diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9a521662024d..3352c4744a3b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -13,13 +13,12 @@ /sdk/core/ @alzimmermsft @jianghaolu @srnagar @hemanttanwar /sdk/cosmos/ @moderakh @christopheranderson @kushagraThapar /sdk/eventhubs/ @conniey @srnagar @mssfang -/sdk/identity/ @jianghaolu @g2vinay +/sdk/identity/ @jianghaolu @g2vinay @hemanttanwar /sdk/keyvault/ @g2vinay @samvaity /sdk/servicebus/ @yvgopal @nemakam /sdk/tracing/ @samvaity @alzimmermsft -# TODO: Once storage libraries are migrated to /sdk folder, fix this line -/storage/ @rickle-msft @jaschrep-msft @alzimmermsft @sima-zhu +/sdk/storage/ @rickle-msft @jaschrep-msft @alzimmermsft @sima-zhu # Management Plane /**/resource-manager/ @yaohaizh @@ -28,5 +27,6 @@ # Eng Sys ########### /eng/ @weshaggard @mitchdenny @danieljurek +/eng/code-quality-reports/ @mssfang @JonathanGiles /**/tests.yml @danieljurek /**/ci.yml @mitchdenny diff --git a/.github/pull.yml b/.github/pull.yml new file mode 100644 index 000000000000..cba38338ca1b --- /dev/null +++ b/.github/pull.yml @@ -0,0 +1,7 @@ +# https://github.com/wei/pull#advanced-setup-with-config +version: "1" +rules: + - base: master + upstream: Azure:master + mergeMethod: rebase +label: "AutoPull" diff --git a/README.md b/README.md index 729c5d70bc3c..3a89fec4d97e 100644 --- a/README.md +++ b/README.md @@ -24,17 +24,17 @@ 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://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). These preview libraries can be easily identified by their folder, package, and namespaces names starting with `azure-`, e.g. `azure-keyvault`. The libraries released in the July 2019 preview: - [App Configuration](sdk/appconfiguration/azure-data-appconfiguration/README.md) -- [Event Hubs](sdk/eventhubs/azure-eventhubs/README.md) +- [Event Hubs](sdk/eventhubs/azure-messaging-eventhubs/README.md) - [Identity](sdk/identity/azure-identity/README.md) - [Key Vault Keys](sdk/keyvault/azure-keyvault-keys/README.md) - [Key Vault Secrets](sdk/keyvault/client/azure-keyvault-secrets/README.md) -- [Storage Blobs](storage/client/README.md) +- [Storage Blobs](sdk/storage/azure-storage-blob/README.md) >NOTE: If you need to ensure your code is ready for production, use one of the stable libraries. diff --git a/apimanagement/resource-manager/v2019_01_01/pom.xml b/apimanagement/resource-manager/v2019_01_01/pom.xml index 1ec4457f1668..374a27beae10 100644 --- a/apimanagement/resource-manager/v2019_01_01/pom.xml +++ b/apimanagement/resource-manager/v2019_01_01/pom.xml @@ -15,7 +15,7 @@ ../../../pom.management.xml azure-mgmt-apimanagement - 1.0.0-beta + 1.0.0-beta-1 jar Microsoft Azure SDK for ApiManagement Management This package contains Microsoft ApiManagement Management SDK. @@ -71,6 +71,8 @@ azure-arm-client-runtime test-jar test + + 1.6.5 diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceBaseProperties.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceBaseProperties.java index 16e591023008..68c85c8b28e9 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceBaseProperties.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceBaseProperties.java @@ -110,14 +110,38 @@ public class ApiManagementServiceBaseProperties { private List additionalLocations; /** - * Custom properties of the API Management service. Setting + * Custom properties of the API Management service.</br>Setting * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, - * 1.1 and 1.2). Setting + * 1.1 and 1.2).</br>Setting * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` - * can be used to disable just TLS 1.1 and setting + * can be used to disable just TLS 1.1.</br>Setting * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` - * can be used to disable TLS 1.0 on an API Management service. + * can be used to disable TLS 1.0 on an API Management + * service.</br>Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` + * can be used to disable just TLS 1.1 for communications with + * backends.</br>Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` + * can be used to disable TLS 1.0 for communications with + * backends.</br>Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` + * can be used to enable HTTP2 protocol on an API Management + * service.</br>Not specifying any of these properties on PATCH + * operation will reset omitted properties' values to their defaults. For + * all the settings except Http2 the default value is `True` if the service + * was created on or before April 1st 2018 and `False` otherwise. Http2 + * setting's default value is `False`.</br></br>You can disable + * any of next ciphers by using settings + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: + * TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, + * TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + * TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + * TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, + * TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, + * TLS_RSA_WITH_AES_128_CBC_SHA. For example, + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. + * The default value is `true` for them. */ @JsonProperty(value = "customProperties") private Map customProperties; @@ -321,7 +345,7 @@ public ApiManagementServiceBaseProperties withAdditionalLocations(List customProperties() { } /** - * Set custom properties of the API Management service. Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2). Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1 and setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service. + * Set custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. * * @param customProperties the customProperties value to set * @return the ApiManagementServiceBaseProperties object itself. diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceUpdateParameters.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceUpdateParameters.java index e7e342d2943f..cd19935cfa23 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceUpdateParameters.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/ApiManagementServiceUpdateParameters.java @@ -112,14 +112,38 @@ public class ApiManagementServiceUpdateParameters extends ApimResource { private List additionalLocations; /** - * Custom properties of the API Management service. Setting + * Custom properties of the API Management service.</br>Setting * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, - * 1.1 and 1.2). Setting + * 1.1 and 1.2).</br>Setting * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` - * can be used to disable just TLS 1.1 and setting + * can be used to disable just TLS 1.1.</br>Setting * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` - * can be used to disable TLS 1.0 on an API Management service. + * can be used to disable TLS 1.0 on an API Management + * service.</br>Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` + * can be used to disable just TLS 1.1 for communications with + * backends.</br>Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` + * can be used to disable TLS 1.0 for communications with + * backends.</br>Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` + * can be used to enable HTTP2 protocol on an API Management + * service.</br>Not specifying any of these properties on PATCH + * operation will reset omitted properties' values to their defaults. For + * all the settings except Http2 the default value is `True` if the service + * was created on or before April 1st 2018 and `False` otherwise. Http2 + * setting's default value is `False`.</br></br>You can disable + * any of next ciphers by using settings + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: + * TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, + * TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + * TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + * TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, + * TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, + * TLS_RSA_WITH_AES_128_CBC_SHA. For example, + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. + * The default value is `true` for them. */ @JsonProperty(value = "properties.customProperties") private Map customProperties; @@ -353,7 +377,7 @@ public ApiManagementServiceUpdateParameters withAdditionalLocations(List customProperties() { } /** - * Set custom properties of the API Management service. Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2). Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1 and setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service. + * Set custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. * * @param customProperties the customProperties value to set * @return the ApiManagementServiceUpdateParameters object itself. diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiDiagnosticsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiDiagnosticsImpl.java index ae6104dd7584..1d13650559b2 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiDiagnosticsImpl.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiDiagnosticsImpl.java @@ -70,10 +70,14 @@ public ApiDiagnosticContract call(DiagnosticContractInner inner) { public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String diagnosticId) { ApiDiagnosticsInner client = this.inner(); return client.getAsync(resourceGroupName, serviceName, apiId, diagnosticId) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public ApiDiagnosticContract call(DiagnosticContractInner inner) { - return wrapModel(inner); + public Observable call(DiagnosticContractInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ApiDiagnosticContract)wrapModel(inner)); + } } }); } diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueAttachmentsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueAttachmentsImpl.java index 18da8471469c..fb156814c5e3 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueAttachmentsImpl.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueAttachmentsImpl.java @@ -70,10 +70,14 @@ public IssueAttachmentContract call(IssueAttachmentContractInner inner) { public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String attachmentId) { ApiIssueAttachmentsInner client = this.inner(); return client.getAsync(resourceGroupName, serviceName, apiId, issueId, attachmentId) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public IssueAttachmentContract call(IssueAttachmentContractInner inner) { - return wrapModel(inner); + public Observable call(IssueAttachmentContractInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((IssueAttachmentContract)wrapModel(inner)); + } } }); } diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueCommentsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueCommentsImpl.java index cdb74dd31973..fb62d496482d 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueCommentsImpl.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssueCommentsImpl.java @@ -70,10 +70,14 @@ public IssueCommentContract call(IssueCommentContractInner inner) { public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String issueId, String commentId) { ApiIssueCommentsInner client = this.inner(); return client.getAsync(resourceGroupName, serviceName, apiId, issueId, commentId) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public IssueCommentContract call(IssueCommentContractInner inner) { - return wrapModel(inner); + public Observable call(IssueCommentContractInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((IssueCommentContract)wrapModel(inner)); + } } }); } diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssuesImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssuesImpl.java index 4fe12eb800da..6871aedace1c 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssuesImpl.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiIssuesImpl.java @@ -70,10 +70,14 @@ public IssueContract call(IssueContractInner inner) { public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String issueId) { ApiIssuesInner client = this.inner(); return client.getAsync(resourceGroupName, serviceName, apiId, issueId) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public IssueContract call(IssueContractInner inner) { - return wrapModel(inner); + public Observable call(IssueContractInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((IssueContract)wrapModel(inner)); + } } }); } diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceResourceInner.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceResourceInner.java index 2b3c40fa2860..c67a8b86db4f 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceResourceInner.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServiceResourceInner.java @@ -120,14 +120,38 @@ public class ApiManagementServiceResourceInner extends ApimResource { private List additionalLocations; /** - * Custom properties of the API Management service. Setting + * Custom properties of the API Management service.</br>Setting * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` * will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, - * 1.1 and 1.2). Setting + * 1.1 and 1.2).</br>Setting * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` - * can be used to disable just TLS 1.1 and setting + * can be used to disable just TLS 1.1.</br>Setting * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` - * can be used to disable TLS 1.0 on an API Management service. + * can be used to disable TLS 1.0 on an API Management + * service.</br>Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` + * can be used to disable just TLS 1.1 for communications with + * backends.</br>Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` + * can be used to disable TLS 1.0 for communications with + * backends.</br>Setting + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` + * can be used to enable HTTP2 protocol on an API Management + * service.</br>Not specifying any of these properties on PATCH + * operation will reset omitted properties' values to their defaults. For + * all the settings except Http2 the default value is `True` if the service + * was created on or before April 1st 2018 and `False` otherwise. Http2 + * setting's default value is `False`.</br></br>You can disable + * any of next ciphers by using settings + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: + * TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, + * TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, + * TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, + * TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, + * TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, + * TLS_RSA_WITH_AES_128_CBC_SHA. For example, + * `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. + * The default value is `true` for them. */ @JsonProperty(value = "properties.customProperties") private Map customProperties; @@ -367,7 +391,7 @@ public ApiManagementServiceResourceInner withAdditionalLocations(List customProperties() { } /** - * Set custom properties of the API Management service. Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2). Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1 and setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service. + * Set custom properties of the API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168` will disable the cipher TLS_RSA_WITH_3DES_EDE_CBC_SHA for all TLS(1.0, 1.1 and 1.2).</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11` can be used to disable just TLS 1.1.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10` can be used to disable TLS 1.0 on an API Management service.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11` can be used to disable just TLS 1.1 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10` can be used to disable TLS 1.0 for communications with backends.</br>Setting `Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2` can be used to enable HTTP2 protocol on an API Management service.</br>Not specifying any of these properties on PATCH operation will reset omitted properties' values to their defaults. For all the settings except Http2 the default value is `True` if the service was created on or before April 1st 2018 and `False` otherwise. Http2 setting's default value is `False`.</br></br>You can disable any of next ciphers by using settings `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.[cipher_name]`: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA. For example, `Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256`:`false`. The default value is `true` for them. * * @param customProperties the customProperties value to set * @return the ApiManagementServiceResourceInner object itself. diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationPolicysImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationPolicysImpl.java index 9e15e93875a1..8867a6e8000d 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationPolicysImpl.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationPolicysImpl.java @@ -64,10 +64,14 @@ public Completable getEntityTagAsync(String resourceGroupName, String serviceNam public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { ApiOperationPolicysInner client = this.inner(); return client.getAsync(resourceGroupName, serviceName, apiId, operationId) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public OperationApiPolicyContract call(PolicyContractInner inner) { - return wrapModel(inner); + public Observable call(PolicyContractInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((OperationApiPolicyContract)wrapModel(inner)); + } } }); } diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationsImpl.java index e80c055cf70f..aec7ed426f8d 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationsImpl.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiOperationsImpl.java @@ -70,10 +70,14 @@ public OperationContract call(OperationContractInner inner) { public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String operationId) { ApiOperationsInner client = this.inner(); return client.getAsync(resourceGroupName, serviceName, apiId, operationId) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public OperationContract call(OperationContractInner inner) { - return wrapModel(inner); + public Observable call(OperationContractInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((OperationContract)wrapModel(inner)); + } } }); } diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiPolicysImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiPolicysImpl.java index 5721e28cb350..fdcfc0c490f0 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiPolicysImpl.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiPolicysImpl.java @@ -64,10 +64,14 @@ public Completable getEntityTagAsync(String resourceGroupName, String serviceNam public Observable getAsync(String resourceGroupName, String serviceName, String apiId) { ApiPolicysInner client = this.inner(); return client.getAsync(resourceGroupName, serviceName, apiId) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public ApiPolicyContract call(PolicyContractInner inner) { - return wrapModel(inner); + public Observable call(PolicyContractInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ApiPolicyContract)wrapModel(inner)); + } } }); } diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleasesImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleasesImpl.java index 882ee3a267a4..4cc8df13df09 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleasesImpl.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiReleasesImpl.java @@ -70,10 +70,14 @@ public ApiReleaseContract call(ApiReleaseContractInner inner) { public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String releaseId) { ApiReleasesInner client = this.inner(); return client.getAsync(resourceGroupName, serviceName, apiId, releaseId) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public ApiReleaseContract call(ApiReleaseContractInner inner) { - return wrapModel(inner); + public Observable call(ApiReleaseContractInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ApiReleaseContract)wrapModel(inner)); + } } }); } diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiSchemasImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiSchemasImpl.java index 07edc6885040..25c5317c2858 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiSchemasImpl.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiSchemasImpl.java @@ -70,10 +70,14 @@ public SchemaContract call(SchemaContractInner inner) { public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String schemaId) { ApiSchemasInner client = this.inner(); return client.getAsync(resourceGroupName, serviceName, apiId, schemaId) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public SchemaContract call(SchemaContractInner inner) { - return wrapModel(inner); + public Observable call(SchemaContractInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SchemaContract)wrapModel(inner)); + } } }); } diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiTagDescriptionsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiTagDescriptionsImpl.java index 54cd58293abb..8868ef08ad14 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiTagDescriptionsImpl.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiTagDescriptionsImpl.java @@ -70,10 +70,14 @@ public TagDescriptionContract call(TagDescriptionContractInner inner) { public Observable getAsync(String resourceGroupName, String serviceName, String apiId, String tagId) { ApiTagDescriptionsInner client = this.inner(); return client.getAsync(resourceGroupName, serviceName, apiId, tagId) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public TagDescriptionContract call(TagDescriptionContractInner inner) { - return wrapModel(inner); + public Observable call(TagDescriptionContractInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((TagDescriptionContract)wrapModel(inner)); + } } }); } diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductPolicysImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductPolicysImpl.java index 771a4164c5ec..c40310da8b6a 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductPolicysImpl.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ProductPolicysImpl.java @@ -64,10 +64,14 @@ public Completable getEntityTagAsync(String resourceGroupName, String serviceNam public Observable getAsync(String resourceGroupName, String serviceName, String productId) { ProductPolicysInner client = this.inner(); return client.getAsync(resourceGroupName, serviceName, productId) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public ProductPolicyContract call(PolicyContractInner inner) { - return wrapModel(inner); + public Observable call(PolicyContractInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((ProductPolicyContract)wrapModel(inner)); + } } }); } diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByPeriodKeysImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByPeriodKeysImpl.java index d0fcfa141921..c76603173c8d 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByPeriodKeysImpl.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/QuotaByPeriodKeysImpl.java @@ -43,10 +43,14 @@ public Completable updateAsync(String resourceGroupName, String serviceName, Str public Observable getAsync(String resourceGroupName, String serviceName, String quotaCounterKey, String quotaPeriodKey) { QuotaByPeriodKeysInner client = this.inner(); return client.getAsync(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public QuotaCounterContract call(QuotaCounterContractInner inner) { - return wrapModel(inner); + public Observable call(QuotaCounterContractInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((QuotaCounterContract)wrapModel(inner)); + } } }); } diff --git a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagsImpl.java b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagsImpl.java index 5ea6d43932a4..ca0ec2c4647e 100644 --- a/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagsImpl.java +++ b/apimanagement/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/TagsImpl.java @@ -238,10 +238,14 @@ public TagContract call(TagContractInner inner) { public Observable getByOperationAsync(String resourceGroupName, String serviceName, String apiId, String operationId, String tagId) { TagsInner client = this.inner(); return client.getByOperationAsync(resourceGroupName, serviceName, apiId, operationId, tagId) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public TagContract call(TagContractInner inner) { - return wrapModel(inner); + public Observable call(TagContractInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((TagContract)wrapModel(inner)); + } } }); } diff --git a/billing/resource-manager/v2017_02_27_preview/pom.xml b/billing/resource-manager/v2017_02_27_preview/pom.xml new file mode 100644 index 000000000000..9db22d20663f --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.billing.v2017_02_27_preview + + com.microsoft.azure + azure-arm-parent + 0.0.3-beta + ../../../pom.xml + + azure-mgmt-billing + 1.0.0-beta + jar + Microsoft Azure SDK for Billing Management + This package contains Microsoft Billing 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 + + + + + + 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/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/DownloadUrl.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/DownloadUrl.java new file mode 100644 index 000000000000..25dd79e95319 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/DownloadUrl.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. + */ + +package com.microsoft.azure.management.billing.v2017_02_27_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A secure URL that can be used to download a PDF invoice until the URL + * expires. + */ +public class DownloadUrl { + /** + * The time in UTC at which this download URL will expire. + */ + @JsonProperty(value = "expiryTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime expiryTime; + + /** + * The URL to the PDF file. + */ + @JsonProperty(value = "url", access = JsonProperty.Access.WRITE_ONLY) + private String url; + + /** + * Get the time in UTC at which this download URL will expire. + * + * @return the expiryTime value + */ + public DateTime expiryTime() { + return this.expiryTime; + } + + /** + * Get the URL to the PDF file. + * + * @return the url value + */ + public String url() { + return this.url; + } + +} diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/ErrorDetails.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/ErrorDetails.java new file mode 100644 index 000000000000..f29943ab0e83 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/ErrorDetails.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.billing.v2017_02_27_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The target of the particular error. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the target of the particular error. + * + * @return the target value + */ + public String target() { + return this.target; + } + +} diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/ErrorResponse.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/ErrorResponse.java new file mode 100644 index 000000000000..2f58153b1991 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/ErrorResponse.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.billing.v2017_02_27_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ErrorResponse { + /** + * The error property. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the error value. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the error value. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/ErrorResponseException.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/ErrorResponseException.java new file mode 100644 index 000000000000..749c77d54031 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/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.billing.v2017_02_27_preview; + +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/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/Invoice.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/Invoice.java new file mode 100644 index 000000000000..5612f9952e53 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/Invoice.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.billing.v2017_02_27_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.billing.v2017_02_27_preview.implementation.InvoiceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2017_02_27_preview.implementation.BillingManager; +import org.joda.time.LocalDate; + +/** + * Type representing Invoice. + */ +public interface Invoice extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the downloadUrl value. + */ + DownloadUrl downloadUrl(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the invoicePeriodEndDate value. + */ + LocalDate invoicePeriodEndDate(); + + /** + * @return the invoicePeriodStartDate value. + */ + LocalDate invoicePeriodStartDate(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/Invoices.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/Invoices.java new file mode 100644 index 000000000000..87ebab77f800 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/Invoices.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.billing.v2017_02_27_preview; + +import com.microsoft.azure.arm.collection.SupportsListing; +import rx.Observable; +import com.microsoft.azure.management.billing.v2017_02_27_preview.implementation.InvoicesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Invoices. + */ +public interface Invoices extends SupportsListing, HasInner { + /** + * Gets a named invoice resource. When getting a single invoice, the downloadUrl property is expanded automatically. + * + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String invoiceName); + + /** + * Gets the most recent invoice. When getting a single invoice, the downloadUrl property is expanded automatically. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getLatestAsync(); + +} diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/Operation.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/Operation.java new file mode 100644 index 000000000000..d50c81d585c9 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/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.billing.v2017_02_27_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.billing.v2017_02_27_preview.implementation.BillingManager; +import com.microsoft.azure.management.billing.v2017_02_27_preview.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/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/OperationDisplay.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/OperationDisplay.java new file mode 100644 index 000000000000..8c583bb7c593 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/OperationDisplay.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.billing.v2017_02_27_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.Billing. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Resource on which the operation is performed: Invoice, etc. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * Get service provider: Microsoft.Billing. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get resource on which the operation is performed: Invoice, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + +} diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/Operations.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/Operations.java new file mode 100644 index 000000000000..4f38907de0e0 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/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.billing.v2017_02_27_preview; + +import rx.Observable; +import com.microsoft.azure.management.billing.v2017_02_27_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available billing REST API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/BillingClientImpl.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/BillingClientImpl.java new file mode 100644 index 000000000000..7a87c5582584 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/BillingClientImpl.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.billing.v2017_02_27_preview.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 BillingClientImpl class. + */ +public class BillingClientImpl 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; + } + + /** Version of the API to be used with the client request. The current version is 2017-02-27-preview. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2017-02-27-preview. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Azure Subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure Subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure Subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public BillingClientImpl 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 BillingClientImpl 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 BillingClientImpl 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 BillingClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The InvoicesInner object to access its operations. + */ + private InvoicesInner invoices; + + /** + * Gets the InvoicesInner object to access its operations. + * @return the InvoicesInner object. + */ + public InvoicesInner invoices() { + return this.invoices; + } + + /** + * 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 BillingClient client. + * + * @param credentials the management credentials for Azure + */ + public BillingClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of BillingClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public BillingClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of BillingClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public BillingClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2017-02-27-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.invoices = new InvoicesInner(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(), "BillingClient", "2017-02-27-preview"); + } +} diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/BillingManager.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/BillingManager.java new file mode 100644 index 000000000000..974c93ed70cd --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/BillingManager.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.billing.v2017_02_27_preview.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.billing.v2017_02_27_preview.Invoices; +import com.microsoft.azure.management.billing.v2017_02_27_preview.Operations; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure Billing resource management. + */ +public final class BillingManager extends ManagerCore { + private Invoices invoices; + private Operations operations; + /** + * Get a Configurable instance that can be used to create BillingManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new BillingManager.ConfigurableImpl(); + } + /** + * Creates an instance of BillingManager that exposes Billing resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the BillingManager + */ + public static BillingManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new BillingManager(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 BillingManager that exposes Billing resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the BillingManager + */ + public static BillingManager authenticate(RestClient restClient, String subscriptionId) { + return new BillingManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of BillingManager that exposes Billing management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing Billing management API entry points that work across subscriptions + */ + BillingManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Invoices. + */ + public Invoices invoices() { + if (this.invoices == null) { + this.invoices = new InvoicesImpl(this); + } + return this.invoices; + } + + /** + * @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 BillingManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return BillingManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private BillingManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new BillingClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/IdParsingUtils.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..815c2fdab6c1 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/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.billing.v2017_02_27_preview.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/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/InvoiceImpl.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/InvoiceImpl.java new file mode 100644 index 000000000000..e0e127dc2a71 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/InvoiceImpl.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.billing.v2017_02_27_preview.implementation; + +import com.microsoft.azure.management.billing.v2017_02_27_preview.Invoice; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.billing.v2017_02_27_preview.DownloadUrl; +import org.joda.time.LocalDate; + +class InvoiceImpl extends IndexableRefreshableWrapperImpl implements Invoice { + private String invoiceName; + private final BillingManager manager; + + InvoiceImpl(InvoiceInner inner, BillingManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.invoiceName = IdParsingUtils.getValueFromIdByName(inner.id(), "invoices"); + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + InvoicesInner client = this.manager().inner().invoices(); + return client.getAsync(this.invoiceName); + } + + + + @Override + public DownloadUrl downloadUrl() { + return this.inner().downloadUrl(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public LocalDate invoicePeriodEndDate() { + return this.inner().invoicePeriodEndDate(); + } + + @Override + public LocalDate invoicePeriodStartDate() { + return this.inner().invoicePeriodStartDate(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/InvoiceInner.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/InvoiceInner.java new file mode 100644 index 000000000000..2b29ddb0f69d --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/InvoiceInner.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2017_02_27_preview.implementation; + +import org.joda.time.LocalDate; +import com.microsoft.azure.management.billing.v2017_02_27_preview.DownloadUrl; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * An invoice resource can be used download a PDF version of an invoice. + */ +@JsonFlatten +public class InvoiceInner extends ProxyResource { + /** + * The start of the date range covered by the invoice. + */ + @JsonProperty(value = "properties.invoicePeriodStartDate", access = JsonProperty.Access.WRITE_ONLY) + private LocalDate invoicePeriodStartDate; + + /** + * The end of the date range covered by the invoice. + */ + @JsonProperty(value = "properties.invoicePeriodEndDate", access = JsonProperty.Access.WRITE_ONLY) + private LocalDate invoicePeriodEndDate; + + /** + * A secure link to download the PDF version of an invoice. The link will + * cease to work after its expiry time is reached. + */ + @JsonProperty(value = "properties.downloadUrl") + private DownloadUrl downloadUrl; + + /** + * Get the start of the date range covered by the invoice. + * + * @return the invoicePeriodStartDate value + */ + public LocalDate invoicePeriodStartDate() { + return this.invoicePeriodStartDate; + } + + /** + * Get the end of the date range covered by the invoice. + * + * @return the invoicePeriodEndDate value + */ + public LocalDate invoicePeriodEndDate() { + return this.invoicePeriodEndDate; + } + + /** + * Get a secure link to download the PDF version of an invoice. The link will cease to work after its expiry time is reached. + * + * @return the downloadUrl value + */ + public DownloadUrl downloadUrl() { + return this.downloadUrl; + } + + /** + * Set a secure link to download the PDF version of an invoice. The link will cease to work after its expiry time is reached. + * + * @param downloadUrl the downloadUrl value to set + * @return the InvoiceInner object itself. + */ + public InvoiceInner withDownloadUrl(DownloadUrl downloadUrl) { + this.downloadUrl = downloadUrl; + return this; + } + +} diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/InvoicesImpl.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/InvoicesImpl.java new file mode 100644 index 000000000000..988869488b2a --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/InvoicesImpl.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. + * jkl + */ + +package com.microsoft.azure.management.billing.v2017_02_27_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2017_02_27_preview.Invoices; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2017_02_27_preview.Invoice; +import com.microsoft.azure.arm.utils.PagedListConverter; + +class InvoicesImpl extends WrapperImpl implements Invoices { + private PagedListConverter converter; + private final BillingManager manager; + + InvoicesImpl(BillingManager manager) { + super(manager.inner().invoices()); + this.manager = manager; + this.converter = new PagedListConverter() { + @Override + public Observable typeConvertAsync(InvoiceInner inner) { + return Observable.just((Invoice) wrapModel(inner)); + } + }; + } + + public BillingManager manager() { + return this.manager; + } + + private InvoiceImpl wrapModel(InvoiceInner inner) { + return new InvoiceImpl(inner, manager()); + } + + @Override + public Observable getAsync(String invoiceName) { + InvoicesInner client = this.inner(); + return client.getAsync(invoiceName) + .map(new Func1() { + @Override + public Invoice call(InvoiceInner inner) { + return new InvoiceImpl(inner, manager()); + } + }); + } + + @Override + public Observable getLatestAsync() { + InvoicesInner client = this.inner(); + return client.getLatestAsync() + .map(new Func1() { + @Override + public Invoice call(InvoiceInner inner) { + return new InvoiceImpl(inner, manager()); + } + }); + } + + @Override + public PagedList list() { + InvoicesInner client = this.inner(); + return converter.convert(client.list()); + } + + @Override + public Observable listAsync() { + InvoicesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Invoice call(InvoiceInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/InvoicesInner.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/InvoicesInner.java new file mode 100644 index 000000000000..d03109e68107 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/InvoicesInner.java @@ -0,0 +1,571 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.billing.v2017_02_27_preview.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.billing.v2017_02_27_preview.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 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 Invoices. + */ +public class InvoicesInner { + /** The Retrofit service to perform REST calls. */ + private InvoicesService service; + /** The service client containing this operation class. */ + private BillingClientImpl client; + + /** + * Initializes an instance of InvoicesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public InvoicesInner(Retrofit retrofit, BillingClientImpl client) { + this.service = retrofit.create(InvoicesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Invoices to be + * used by Retrofit to perform actually REST calls. + */ + interface InvoicesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2017_02_27_preview.Invoices list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("$expand") String expand, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("$top") Integer top, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2017_02_27_preview.Invoices get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/{invoiceName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("invoiceName") String invoiceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.billing.v2017_02_27_preview.Invoices getLatest" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Billing/invoices/latest") + Observable> getLatest(@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.billing.v2017_02_27_preview.Invoices listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + * @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<InvoiceInner> 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 the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + * @param serviceCallback 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 the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> 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 the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String expand = null; + final String filter = null; + final String skiptoken = null; + final Integer top = null; + return service.list(this.client.subscriptionId(), expand, filter, skiptoken, top, 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); + } + } + }); + } + + /** + * Lists the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + * @param expand May be used to expand the downloadUrl property within a list of invoices. This enables download links to be generated for multiple invoices at once. By default, downloadURLs are not included when listing invoices. + * @param filter May be used to filter invoices by invoicePeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not' + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N invoices. + * @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<InvoiceInner> object if successful. + */ + public PagedList list(final String expand, final String filter, final String skiptoken, final Integer top) { + ServiceResponse> response = listSinglePageAsync(expand, filter, skiptoken, top).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + * @param expand May be used to expand the downloadUrl property within a list of invoices. This enables download links to be generated for multiple invoices at once. By default, downloadURLs are not included when listing invoices. + * @param filter May be used to filter invoices by invoicePeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not' + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N invoices. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String expand, final String filter, final String skiptoken, final Integer top, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(expand, filter, skiptoken, top), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + * @param expand May be used to expand the downloadUrl property within a list of invoices. This enables download links to be generated for multiple invoices at once. By default, downloadURLs are not included when listing invoices. + * @param filter May be used to filter invoices by invoicePeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not' + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N invoices. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable> listAsync(final String expand, final String filter, final String skiptoken, final Integer top) { + return listWithServiceResponseAsync(expand, filter, skiptoken, top) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + * @param expand May be used to expand the downloadUrl property within a list of invoices. This enables download links to be generated for multiple invoices at once. By default, downloadURLs are not included when listing invoices. + * @param filter May be used to filter invoices by invoicePeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not' + * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + * @param top May be used to limit the number of results to the most recent N invoices. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<InvoiceInner> object + */ + public Observable>> listWithServiceResponseAsync(final String expand, final String filter, final String skiptoken, final Integer top) { + return listSinglePageAsync(expand, filter, skiptoken, top) + .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 the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + ServiceResponse> * @param expand May be used to expand the downloadUrl property within a list of invoices. This enables download links to be generated for multiple invoices at once. By default, downloadURLs are not included when listing invoices. + ServiceResponse> * @param filter May be used to filter invoices by invoicePeriodEndDate. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and 'and'. It does not currently support 'ne', 'or', or 'not' + ServiceResponse> * @param skiptoken Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element will include a skiptoken parameter that specifies a starting point to use for subsequent calls. + ServiceResponse> * @param top May be used to limit the number of results to the most recent N invoices. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String expand, final String filter, final String skiptoken, final Integer top) { + 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(), expand, filter, skiptoken, top, 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); + } + + /** + * Gets a named invoice resource. When getting a single invoice, the downloadUrl property is expanded automatically. + * + * @param invoiceName The name of an invoice 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 InvoiceInner object if successful. + */ + public InvoiceInner get(String invoiceName) { + return getWithServiceResponseAsync(invoiceName).toBlocking().single().body(); + } + + /** + * Gets a named invoice resource. When getting a single invoice, the downloadUrl property is expanded automatically. + * + * @param invoiceName The name of an invoice 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 getAsync(String invoiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(invoiceName), serviceCallback); + } + + /** + * Gets a named invoice resource. When getting a single invoice, the downloadUrl property is expanded automatically. + * + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable getAsync(String invoiceName) { + return getWithServiceResponseAsync(invoiceName).map(new Func1, InvoiceInner>() { + @Override + public InvoiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a named invoice resource. When getting a single invoice, the downloadUrl property is expanded automatically. + * + * @param invoiceName The name of an invoice resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable> getWithServiceResponseAsync(String invoiceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (invoiceName == null) { + throw new IllegalArgumentException("Parameter invoiceName 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(this.client.subscriptionId(), invoiceName, 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); + } + + /** + * Gets the most recent invoice. When getting a single invoice, the downloadUrl property is expanded automatically. + * + * @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 InvoiceInner object if successful. + */ + public InvoiceInner getLatest() { + return getLatestWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets the most recent invoice. When getting a single invoice, the downloadUrl property is expanded automatically. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getLatestAsync(final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getLatestWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets the most recent invoice. When getting a single invoice, the downloadUrl property is expanded automatically. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable getLatestAsync() { + return getLatestWithServiceResponseAsync().map(new Func1, InvoiceInner>() { + @Override + public InvoiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the most recent invoice. When getting a single invoice, the downloadUrl property is expanded automatically. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the InvoiceInner object + */ + public Observable> getLatestWithServiceResponseAsync() { + 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.getLatest(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 = getLatestDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getLatestDelegate(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); + } + + /** + * Lists the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + * @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<InvoiceInner> 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 the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + * @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 the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + * @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<InvoiceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + * @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<InvoiceInner> 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 the available invoices for a subscription in reverse chronological order beginning with the most recent invoice. In preview, invoices are available via this API only for invoice periods which end December 1, 2016 or later. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<InvoiceInner> 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/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/OperationImpl.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/OperationImpl.java new file mode 100644 index 000000000000..ae62e8d8796d --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/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.billing.v2017_02_27_preview.implementation; + +import com.microsoft.azure.management.billing.v2017_02_27_preview.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2017_02_27_preview.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final BillingManager manager; + OperationImpl(OperationInner inner, BillingManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public BillingManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/OperationInner.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/OperationInner.java new file mode 100644 index 000000000000..0a9010e1cb04 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/OperationInner.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.billing.v2017_02_27_preview.implementation; + +import com.microsoft.azure.management.billing.v2017_02_27_preview.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A Billing REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + 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; + } + + /** + * 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/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/OperationsImpl.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/OperationsImpl.java new file mode 100644 index 000000000000..86e77ad137da --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/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.billing.v2017_02_27_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.billing.v2017_02_27_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.billing.v2017_02_27_preview.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final BillingManager manager; + + OperationsImpl(BillingManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public BillingManager 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/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/OperationsInner.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/OperationsInner.java new file mode 100644 index 000000000000..81ce5ddd79d4 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/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.billing.v2017_02_27_preview.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.billing.v2017_02_27_preview.ErrorResponseException; +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 BillingClientImpl 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, BillingClientImpl 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.billing.v2017_02_27_preview.Operations list" }) + @GET("providers/Microsoft.Billing/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.billing.v2017_02_27_preview.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available billing REST API operations. + * + * @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<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 billing 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 billing 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 billing 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 billing 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists all of the available billing REST API operations. + * + * @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<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 billing 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 billing 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 billing 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 billing 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 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/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/PageImpl.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/PageImpl.java new file mode 100644 index 000000000000..c54a0edb560a --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/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.billing.v2017_02_27_preview.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/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/package-info.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/implementation/package-info.java new file mode 100644 index 000000000000..6d3919af3465 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/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 BillingClient. + * Billing client provides access to billing resources for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + */ +package com.microsoft.azure.management.billing.v2017_02_27_preview.implementation; diff --git a/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/package-info.java b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/package-info.java new file mode 100644 index 000000000000..df517c7f94f1 --- /dev/null +++ b/billing/resource-manager/v2017_02_27_preview/src/main/java/com/microsoft/azure/management/billing/v2017_02_27_preview/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 BillingClient. + * Billing client provides access to billing resources for Azure Web-Direct subscriptions. Other subscription types which were not purchased directly through the Azure web portal are not supported through this preview API. + */ +package com.microsoft.azure.management.billing.v2017_02_27_preview; diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml index 9a97c9831e85..3ae4c9aa409d 100644 --- a/eng/.docsettings.yml +++ b/eng/.docsettings.yml @@ -48,7 +48,7 @@ known_presence_issues: - ['sdk/core/azure-core-management', '#2847'] - ['cosmosdb/data-plane/commons-test-utils', '#2847'] - ['cosmosdb/data-plane/sdk', '#2847'] - - ['sdk/cosmos/sdk', '#2847'] + - ['sdk/cosmos/microsoft-azure-cosmos', '#2847'] - ['cosmosdb/data-plane/gateway', '#2847'] - ['cosmosdb/data-plane/commons', '#2847'] - ['cosmosdb/data-plane/direct-impl', '#2847'] @@ -64,8 +64,8 @@ known_content_issues: - ['sdk/keyvault/README.md', '#3113'] - ['sdk/loganalytics/microsoft-azure-loganalytics/README.md', '#3113'] - ['sdk/servicebus/README.md', '#3113'] - - ['storage/data-plane/README.md', '#3113'] - - ['storage/data-plane/swagger/README.md', '#3113'] + - ['sdk/storage/microsoft-azure-storage-blob/README.md', '#3113'] + - ['sdk/storage/microsoft-azure-storage-blob/swagger/README.md', '#3113'] - ['sdk/core/README.md', '#3113'] - ['cosmosdb/data-plane/README.md', '#3113'] - ['cosmosdb/data-plane/benchmark/README.md', '#3113'] @@ -73,7 +73,7 @@ known_content_issues: - ['cosmosdb/data-plane/faq/README.md', '#3113'] - ['sdk/cosmos/faq/README.md', '#3113'] - ['sdk/cosmos/changelog/README.md', '#3113'] - - ['sdk/cosmos/benchmark/README.md', '#3113'] + - ['sdk/cosmos/microsoft-azure-cosmos-benchmark/README.md', '#3113'] - ['sdk/cosmos/README.md', '#3113'] package_indexing_exclusion_list: - azure-loganalytics-sample 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 b36f28e10be8..44522a4e8597 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,7 @@ * 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 return or method argument 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" ))); @@ -51,6 +49,7 @@ public int[] getAcceptableTokens() { public int[] getRequiredTokens() { return new int[] { TokenTypes.IMPORT, + TokenTypes.CLASS_DEF, TokenTypes.METHOD_DEF }; } @@ -68,7 +67,7 @@ public void visitToken(DetailAST token) { // CLASS_DEF always has MODIFIERS final AccessModifier accessModifier = CheckUtil.getAccessModifierFromModifiersToken( token.findFirstToken(TokenTypes.MODIFIERS)); - isPublicClass = accessModifier.equals(AccessModifier.PUBLIC); + isPublicClass = accessModifier.equals(AccessModifier.PUBLIC) || accessModifier.equals(AccessModifier.PROTECTED); break; case TokenTypes.METHOD_DEF: if (!isPublicClass) { @@ -101,14 +100,14 @@ 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))); + (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, returnTypeName) -> log(token, String.format(EXTERNAL_DEPENDENCY_ERROR, returnTypeName))); + (token, parameterTypeName) -> log(token, String.format(EXTERNAL_DEPENDENCY_ERROR, parameterTypeName, "method argument"))); } } @@ -134,7 +133,7 @@ private Map getInvalidReturnTypes(DetailAST typeToken) { // TYPE_ARGUMENTS, add all invalid external types to the map final DetailAST typeArgumentsToken = typeToken.findFirstToken(TokenTypes.TYPE_ARGUMENTS); if (typeArgumentsToken != null) { - invalidReturnTypeMap.putAll(getInvalidTypeFromTypeArguments(typeArgumentsToken)); + getInvalidParameterType(typeArgumentsToken, invalidReturnTypeMap); } return invalidReturnTypeMap; @@ -150,61 +149,42 @@ private Map getInvalidParameterTypes(DetailAST parametersType final Map invalidParameterTypesMap = new HashMap<>(); for (DetailAST ast = parametersTypeToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { if (ast.getType() == TokenTypes.PARAMETER_DEF) { - invalidParameterTypesMap.putAll(getInvalidTypeFromTypeArguments(ast.findFirstToken(TokenTypes.TYPE))); + getInvalidParameterType(ast.findFirstToken(TokenTypes.TYPE), invalidParameterTypesMap); } } return invalidParameterTypesMap; } /** - * A helper function that checks TYPE AST node. Since both return type and input parameter argument type has - * TYPE AST node under. This function applied to both. + * Get all invalid AST nodes from a given token. DFS tree traversal used to find all invalid nodes. * - * @param typeArgumentsToken TYPE_ARGUMENTS AST node - * @return a map that maps all the invalid TYPE_ARGUMENT node and the type name + * @param token TYPE_ARGUMENT, TYPE_ARGUMENTS or TYPE AST node + * @return a map that maps all the invalid node and the type name */ - private Map getInvalidTypeFromTypeArguments(DetailAST typeArgumentsToken) { - final Map invalidTypesMap = new HashMap<>(); - if (typeArgumentsToken == null) { + private Map getInvalidParameterType(DetailAST token, Map invalidTypesMap) { + if (token == null) { return invalidTypesMap; } - // Checks multiple type arguments - for (DetailAST ast = typeArgumentsToken.getFirstChild(); ast != null; ast = ast.getNextSibling()) { - if (ast.getType() != TokenTypes.TYPE_ARGUMENT) { - continue; - } - final String invalidTypeName = getInvalidTypeNameFromTypeArgument(ast); - if (invalidTypeName != null) { - invalidTypesMap.put(ast, invalidTypeName); + for (DetailAST ast = token.getFirstChild(); ast != null; ast = ast.getNextSibling()) { + final int tokenType = ast.getType(); + if (tokenType == TokenTypes.IDENT) { + final String identName = ast.getText(); + if (!isValidClassDependency(identName)) { + invalidTypesMap.put(ast, identName); + } + } else if (tokenType == TokenTypes.TYPE_ARGUMENT || tokenType == TokenTypes.TYPE_ARGUMENTS) { + getInvalidParameterType(ast, invalidTypesMap); } } return invalidTypesMap; } - /** - * Get invalid type name from TYPE_ARGUMENT - * - * @param typeArgumentToken TYPE_ARGUMENT AST node - * @return an invalid type name if it is an invalid library. Otherwise, returns null. - */ - private String getInvalidTypeNameFromTypeArgument(DetailAST typeArgumentToken) { - final DetailAST identToken = typeArgumentToken.findFirstToken(TokenTypes.IDENT); - // if there is no IDENT token, implies the token is default java types. - if (identToken == null) { - return null; - } - - final String typeName = identToken.getText(); - // if not exist in the classPathMap, that implies the type is java default types, such as int. - return isValidClassDependency(typeName) ? null : typeName; - } - /** * A helper function that checks for whether a class is from a valid internal dependency or is a suppression class * * @param typeName the type name of class - * @return true if the class is a suppression class, otherwise, return false. + * @return true if the class is a suppression class, otherwise, return false. */ private boolean isValidClassDependency(String typeName) { // If the qualified class name does not exist in the map, 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 27d8784c5efd..85cb645b1b71 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 @@ -31,6 +31,9 @@ + + + @@ -94,15 +97,27 @@ - - - - - + + + + + + + + + + + + + + + + + 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 41e4303d4378..a9dda3659410 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml @@ -60,7 +60,12 @@ page at http://checkstyle.sourceforge.net/config.html --> - + + + + + + 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 bf083e11e8bf..6cfdbbd51923 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 @@ -9,7 +9,8 @@ - + @@ -115,8 +116,8 @@ + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/BatchOptions.java#L50 + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/BatchOptions.java#L57 --> @@ -124,16 +125,16 @@ + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/MessageReceiver.java#L247 + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/MessageReceiver.java#L251 + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/MessagingFactory.java#L146 --> + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubRuntimeInformation.java#L62 --> @@ -142,7 +143,7 @@ + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/EventHubRuntimeInformation.java#L27 --> @@ -150,7 +151,7 @@ + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/EventHubClientImpl.java#L41 --> @@ -158,7 +159,7 @@ + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/EventHubClientImpl.java#L47 --> @@ -166,7 +167,7 @@ + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/ReplayableWorkItem.java#L35 --> @@ -174,8 +175,8 @@ + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/FaultTolerantObject.java#L80 + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/FaultTolerantObject.java#L123 --> @@ -183,8 +184,8 @@ + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/EventDataImpl.java#L150 + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/PartitionReceiverImpl.java#L278 --> @@ -192,7 +193,7 @@ + https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/eventhubs/microsoft-azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/ConnectionHandler.java#L88 --> @@ -221,7 +222,8 @@ At InMemoryLeaseManager.java:[line 148,155,209,241,268] https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs-eph/src/main/java/com/microsoft/azure/eventprocessorhost/InMemoryLeaseManager.java#L155 --> - + @@ -229,7 +231,8 @@ At EventProcessorOptions.java:[lines 234-237] https://github.com/Azure/azure-sdk-for-java/blob/master/eventhubs/data-plane/azure-eventhubs-eph/src/main/java/com/microsoft/azure/eventprocessorhost/EventProcessorOptions.java#L234 --> - + @@ -273,7 +276,8 @@ - + @@ -286,7 +290,8 @@ - + @@ -330,14 +335,16 @@ - + - + @@ -347,7 +354,7 @@ - + @@ -445,6 +452,16 @@ + + + + + + + + + @@ -482,11 +499,11 @@ - + - + @@ -494,20 +511,30 @@ - - - + - + + + + + + + + + + + + diff --git a/eng/jacoco-test-coverage/pom.xml b/eng/jacoco-test-coverage/pom.xml index cee087f22d29..7ebdd6ffe1c1 100644 --- a/eng/jacoco-test-coverage/pom.xml +++ b/eng/jacoco-test-coverage/pom.xml @@ -27,12 +27,13 @@ 1.0.0-preview.3 1.0.0-preview.3 1.0.0-preview.3 - 1.0.0-preview.1 + 1.0.0-preview.2 1.0.0-preview.1 4.0.0-preview.1 5.0.0-preview.2 - 12.0.0-preview.1 - 12.0.0-preview.1 + 12.0.0-preview.2 + 12.0.0-preview.2 + 12.0.0-preview.2 @@ -89,11 +90,16 @@ azure-messaging-eventhubs ${azure-messaging-eventhubs.version} - - - - - + + com.azure + azure-storage-blob + ${azure-storage-blob.version} + + + com.azure + azure-storage-file + ${azure-storage-file.version} + com.azure azure-storage-queue diff --git a/eng/pipelines/client.yml b/eng/pipelines/client.yml index 12c08140c139..a3622032f797 100644 --- a/eng/pipelines/client.yml +++ b/eng/pipelines/client.yml @@ -109,7 +109,7 @@ jobs: jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' publishJUnitResults: false - goals: 'spotbugs:spotbugs checkstyle:checkstyle' + goals: 'spotbugs:spotbugs checkstyle:checkstyle-aggregate' # Generate the Maven site report, including SpotBugs, JavaDoc, CheckStyle, Jacoco, etc only when we are not # running as a PR check. diff --git a/eng/pipelines/templates/jobs/archetype-sdk-client.yml b/eng/pipelines/templates/jobs/archetype-sdk-client.yml index 68949203610d..d5a0106cd16e 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-client.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-client.yml @@ -1,3 +1,40 @@ +parameters: + ServiceDirectory: not-specified # Set a default that breaks in obvious ways. + PreTestSteps: [] + TestOptions: '$(DefaultOptions) $(ProfileFlag)' + TestGoals: test + TestMatrix: + Linux - Java 8: + OSName: 'Linux' + OSVmImage: 'ubuntu-16.04' + JavaVersion: '1.8' + ProfileFlag: '' + macOS - Java 8: + OSName: 'macOS' + OSVmImage: 'macOS-10.13' + JavaVersion: '1.8' + ProfileFlag: '' + Windows - Java 8: + OSName: 'Windows' + OSVmImage: 'vs2017-win2016' + JavaVersion: '1.8' + ProfileFlag: '' + Linux - Java LTS: + OSName: 'Linux' + OSVmImage: 'ubuntu-16.04' + JavaVersion: '1.11' + ProfileFlag: '-Djava-lts' + macOS - Java LTS: + OSName: 'macOS' + OSVmImage: 'macOS-10.13' + JavaVersion: '1.11' + ProfileFlag: '-Djava-lts' + Windows - Java LTS: + OSName: 'Windows' + OSVmImage: 'vs2017-win2016' + JavaVersion: '1.11' + ProfileFlag: '-Djava-lts' + jobs: - job: 'Build' @@ -36,10 +73,10 @@ jobs: jdkArchitectureOption: 'x64' publishJUnitResults: false - - task: PublishBuildArtifacts@1 + - publish: $(Build.ArtifactStagingDirectory) displayName: 'Publish Artifacts $(ArtifactName)' - inputs: - artifactName: '$(ArtifactName)' + artifact: '$(ArtifactName)' + - job: 'Analyze' @@ -69,17 +106,11 @@ jobs: # We `install` the code quality reports tooling into our local m2 cache separately from building the Maven project # reports. This means it is available as part of that, but also so that this is not documented in the project report. - - task: Maven@3 - displayName: 'Install reporting tools' - inputs: - mavenPomFile: eng/code-quality-reports/pom.xml - options: '--batch-mode' - mavenOptions: '$(LoggingOptions)' - javaHomeOption: 'JDKVersion' - jdkVersionOption: '1.11' - jdkArchitectureOption: 'x64' - publishJUnitResults: false - goals: 'install' + + - template: ../steps/install-reporting-tools.yml + parameters: + Options: --batch-mode + MavenOptions: $(LoggingOptions) - task: Maven@3 displayName: 'Install all client libraries (for SpotBugs analysis)' @@ -104,7 +135,7 @@ jobs: jdkVersionOption: '1.11' jdkArchitectureOption: 'x64' publishJUnitResults: false - goals: 'spotbugs:spotbugs checkstyle:checkstyle' + goals: 'spotbugs:spotbugs checkstyle:checkstyle-aggregate' # Generate the Maven site report, including SpotBugs, JavaDoc, CheckStyle, Jacoco, etc only when we are not # running as a PR check. @@ -174,12 +205,10 @@ jobs: displayName: 'Copy reports to artifact staging' condition: ne(variables['Build.Reason'], 'PullRequest') - - task: PublishBuildArtifacts@1 + - publish: $(Build.ArtifactStagingDirectory) condition: succeededOrFailed() displayName: 'Publish Report Artifacts' - inputs: - artifactName: reports - + artifact: reports - job: 'Test' @@ -187,53 +216,15 @@ jobs: - template: ../variables/globals.yml strategy: - matrix: - Linux - Java 8: - OSName: 'Linux' - OSVmImage: 'ubuntu-16.04' - JavaVersion: '1.8' - ProfileFlag: '' - macOS - Java 8: - OSName: 'macOS' - OSVmImage: 'macOS-10.13' - JavaVersion: '1.8' - ProfileFlag: '' - Windows - Java 8: - OSName: 'Windows' - OSVmImage: 'vs2017-win2016' - JavaVersion: '1.8' - ProfileFlag: '' - Linux - Java LTS: - OSName: 'Linux' - OSVmImage: 'ubuntu-16.04' - JavaVersion: '1.11' - ProfileFlag: '-Djava-lts' - macOS - Java LTS: - OSName: 'macOS' - OSVmImage: 'macOS-10.13' - JavaVersion: '1.11' - ProfileFlag: '-Djava-lts' - Windows - Java LTS: - OSName: 'Windows' - OSVmImage: 'vs2017-win2016' - JavaVersion: '1.11' - ProfileFlag: '-Djava-lts' + matrix: ${{ parameters.TestMatrix }} pool: vmImage: $(OSVmImage) steps: - - powershell: | - Invoke-WebRequest -Uri "https://github.com/Azure/azure-sdk-tools/releases/download/sdk-tools_14793/sdk-tools.zip" ` - -OutFile "sdk-tools.zip" | Wait-Process; Expand-Archive -Path "sdk-tools.zip" -DestinationPath "./sdk-tools/" - workingDirectory: '$(Build.BinariesDirectory)' - displayName: 'Download Tools Archive From Github Release and Extract it' - - - task: PythonScript@0 - displayName: 'Run VerifyAgentOS script' - inputs: - scriptPath: '$(Build.BinariesDirectory)/sdk-tools/scripts/python/verify_agent_os.py' - arguments: $(OSName) + - template: ../steps/verify-agent-os.yml + parameters: + OSName: $(OSName) - task: Maven@3 displayName: 'Start Jetty' @@ -247,17 +238,19 @@ jobs: publishJUnitResults: false goals: 'jetty:run-forked' + - ${{ parameters.PreTestSteps }} + - task: Maven@3 displayName: 'Run tests' inputs: mavenPomFile: sdk/${{parameters.ServiceDirectory}}/pom.service.xml - options: '$(DefaultOptions) $(ProfileFlag)' + options: ${{ parameters.TestOptions }} mavenOptions: '-Xmx3072m $(LoggingOptions)' javaHomeOption: 'JDKVersion' jdkVersionOption: $(JavaVersion) jdkArchitectureOption: 'x64' publishJUnitResults: false - goals: 'test' + goals: ${{ parameters.TestGoals }} - task: PublishTestResults@2 condition: succeededOrFailed() diff --git a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml index a4e6c32e82aa..e42186eac993 100644 --- a/eng/pipelines/templates/jobs/archetype-sdk-tests.yml +++ b/eng/pipelines/templates/jobs/archetype-sdk-tests.yml @@ -1,28 +1,49 @@ parameters: ServiceDirectory: '' EnvVars: {} + MaxParallel: 0 + Matrix: + Win2016: + OSVmImage: 'vs2017-win2016' + 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' + mavenOptions: '-Xmx3072m -Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.8' + jdkArchitectureOption: 'x64' + publishJUnitResults: false + goals: 'test' + TestResultsFiles: '' jobs: - - job: 'LiveTest' + - job: ${{ parameters.TestName }} + timeoutInMinutes: ${{ parameters.TimeoutInMinutes }} + + strategy: + matrix: ${{ parameters.Matrix }} + maxParallel: ${{ parameters.MaxParallel }} pool: - vmImage: 'vs2017-win2016' + vmImage: $(OSVmImage) steps: + - ${{ parameters.PreRunSteps }} + - task: Maven@3 - displayName: 'Run Live tests' + displayName: $(DisplayName) inputs: mavenPomFile: sdk/${{parameters.ServiceDirectory}}/pom.service.xml - options: '--batch-mode -Dmaven.wagon.http.pool=false -Dsurefire.rerunFailingTestsCount=3' - mavenOptions: '-Xmx3072m -Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' - javaHomeOption: 'JDKVersion' - jdkVersionOption: '1.8' - jdkArchitectureOption: 'x64' - publishJUnitResults: false - goals: 'test' + ${{ insert }}: ${{ parameters.TestStepMavenInputs }} env: ${{ parameters.EnvVars }} + - task: PublishTestResults@2 condition: succeededOrFailed() inputs: mergeTestResults: true - testRunTitle: 'Live tests for ${{ parameters.ServiceDirectory }}' \ No newline at end of file + testRunTitle: 'Live tests for ${{ parameters.ServiceDirectory }} $(DisplayName)' + ${{ if ne(parameters.TestResultsFiles, '') }}: + testResultsFiles: ${{ parameters.TestResultsFiles }} \ No newline at end of file diff --git a/eng/pipelines/templates/stages/archetype-sdk-client.yml b/eng/pipelines/templates/stages/archetype-sdk-client.yml new file mode 100644 index 000000000000..7c0f69c43454 --- /dev/null +++ b/eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -0,0 +1,18 @@ +parameters: + Artifacts: [] + ServiceDirectory: not-specified + +stages: + - stage: Build + jobs: + - template: ../jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: ${{parameters.ServiceDirectory}} + + # 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/install-reporting-tools.yml b/eng/pipelines/templates/steps/install-reporting-tools.yml new file mode 100644 index 000000000000..f050a0d3c061 --- /dev/null +++ b/eng/pipelines/templates/steps/install-reporting-tools.yml @@ -0,0 +1,17 @@ + +parameters: + Options: '--batch-mode -Dmaven.wagon.http.pool=false --settings eng/settings.xml' + MavenOptions: '-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' + +steps: + - task: Maven@3 + displayName: 'Install reporting tools' + inputs: + mavenPomFile: ./eng/code-quality-reports/pom.xml + options: ${{ parameters.Options }} + mavenOptions: ${{ parameters.MavenOptions }} + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.11' + jdkArchitectureOption: 'x64' + publishJUnitResults: false + goals: 'install' diff --git a/eng/pipelines/templates/steps/verify-agent-os.yml b/eng/pipelines/templates/steps/verify-agent-os.yml new file mode 100644 index 000000000000..af8bc10df309 --- /dev/null +++ b/eng/pipelines/templates/steps/verify-agent-os.yml @@ -0,0 +1,15 @@ +parameters: + OSName: $(OSName) + +steps: + - powershell: | + Invoke-WebRequest -Uri "https://github.com/Azure/azure-sdk-tools/releases/download/sdk-tools_14793/sdk-tools.zip" ` + -OutFile "sdk-tools.zip" | Wait-Process; Expand-Archive -Path "sdk-tools.zip" -DestinationPath "./sdk-tools/" + workingDirectory: '$(Build.BinariesDirectory)' + displayName: 'Download Tools Archive From Github Release and Extract it' + + - task: PythonScript@0 + displayName: 'Run VerifyAgentOS script' + inputs: + scriptPath: '$(Build.BinariesDirectory)/sdk-tools/scripts/python/verify_agent_os.py' + arguments: ${{ parameters.OSName }} diff --git a/eng/pipelines/templates/variables/globals.yml b/eng/pipelines/templates/variables/globals.yml index f8fbff4a8c08..df9e146fad01 100644 --- a/eng/pipelines/templates/variables/globals.yml +++ b/eng/pipelines/templates/variables/globals.yml @@ -1,4 +1,4 @@ variables: - DefaultOptions: '--batch-mode -Dmaven.wagon.http.pool=false --settings eng/settings.xml' + DefaultOptions: '--batch-mode -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' skipComponentGovernanceDetection: true \ No newline at end of file diff --git a/eng/spotbugs-aggregate-report/pom.xml b/eng/spotbugs-aggregate-report/pom.xml index 7e86db80baad..0f5b722b2db4 100644 --- a/eng/spotbugs-aggregate-report/pom.xml +++ b/eng/spotbugs-aggregate-report/pom.xml @@ -6,7 +6,7 @@ azure-client-sdk-parent com.azure - 1.1.0 + 1.2.0 ../../pom.client.xml 4.0.0 @@ -23,15 +23,15 @@ 1.0.0-preview.3 - 1.0.0-preview.1 + 1.0.0-preview.2 1.0.0-preview.1 4.0.0-preview.1 - 1.0.0-preview.1 + 1.0.0-preview.2 4.0.0-preview.1 5.0.0-preview.2 - 12.0.0-preview.1 - 12.0.0-preview.1 - 12.0.0-preview.1 + 12.0.0-preview.2 + 12.0.0-preview.2 + 12.0.0-preview.2 @@ -56,24 +56,25 @@ ..\..\sdk\appconfiguration\azure-data-appconfiguration\src\main\java ..\..\sdk\appconfiguration\azure-data-appconfiguration\src\samples\java - ..\..\core\azure-core\src\main\java - ..\..\core\azure-core\src\samples\java - ..\..\core\azure-core-amqp\src\main\java - ..\..\core\azure-core-management\src\main\java - ..\..\core\azure-core-test\src\main\java - ..\..\sdk\eventhubs\azure-eventhubs\src\main\java - ..\..\sdk\eventhubs\azure-eventhubs\src\samples\java + ..\..\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-management\src\main\java + ..\..\sdk\core\azure-core-test\src\main\java + ..\..\sdk\eventhubs\azure-messaging-eventhubs\src\main\java + ..\..\sdk\eventhubs\azure-messaging-eventhubs\src\samples\java ..\..\sdk\identity\azure-identity\src\main\java + ..\..\sdk\identity\azure-identity\src\samples\java - - - - - - + + + + + + @@ -94,12 +95,13 @@ ..\..\sdk\batch\microsoft-azure-batch\src\main\java - ..\..\eventhubs\data-plane\azure-eventhubs\src\main\java - ..\..\eventhubs\data-plane\azure-eventhubs-eph\src\main\java - ..\..\eventhubs\data-plane\azure-eventhubs-extensions\src\main\java + ..\..\sdk\eventhubs\microsoft-azure-eventhubs\src\main\java + ..\..\sdk\eventhubs\microsoft-azure-eventhubs-eph\src\main\java + ..\..\sdk\eventhubs\microsoft-azure-eventhubs-extensions\src\main\java - + dependency in eventhubs code. This issue is under investigation. + Issue Link: https://github.com/Azure/azure-sdk-for-java/issues/3096 --> + ..\..\sdk\keyvault\microsoft-azure-keyvault\src\main\java ..\..\sdk\keyvault\microsoft-azure-keyvault-cryptography\src\main\java ..\..\sdk\keyvault\microsoft-azure-keyvault-core\src\main\java @@ -179,12 +181,11 @@ azure-keyvault-secrets ${azure-keyvault.version} - - - - - - + + com.azure + azure-storage-blob + ${azure-storage-blob.version} + com.azure azure-storage-file diff --git a/hdinsight/resource-manager/v2018_06_01_preview/pom.xml b/hdinsight/resource-manager/v2018_06_01_preview/pom.xml index 5119b5767671..afea210d9bac 100644 --- a/hdinsight/resource-manager/v2018_06_01_preview/pom.xml +++ b/hdinsight/resource-manager/v2018_06_01_preview/pom.xml @@ -15,7 +15,7 @@ ../../../pom.management.xml azure-mgmt-hdinsight - 1.1.0 + 1.1.1 jar Microsoft Azure SDK for HDInsight Management This package contains Microsoft HDInsight Management SDK. @@ -71,36 +71,8 @@ azure-arm-client-runtime test-jar test - - - com.microsoft.azure - azure-mgmt-storage - 1.18.0 - test - - - com.microsoft.azure - azure-mgmt-msi - 1.18.0 - test - - - com.microsoft.azure - azure-mgmt-keyvault - 1.18.0 - test - - - com.microsoft.azure - azure-keyvault - 1.2.0 - test - - - org.assertj - assertj-core - 2.9.1 - test + + 1.6.5 diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ApplicationGetHttpsEndpoint.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ApplicationGetHttpsEndpoint.java index bf7dd2218bd2..7431b6a0079e 100644 --- a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ApplicationGetHttpsEndpoint.java +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ApplicationGetHttpsEndpoint.java @@ -40,7 +40,7 @@ public class ApplicationGetHttpsEndpoint { private Integer publicPort; /** - * The subDomainSuffix of the application. + * The subdomain suffix of the application. */ @JsonProperty(value = "subDomainSuffix") private String subDomainSuffix; @@ -132,7 +132,7 @@ public ApplicationGetHttpsEndpoint withPublicPort(Integer publicPort) { } /** - * Get the subDomainSuffix of the application. + * Get the subdomain suffix of the application. * * @return the subDomainSuffix value */ @@ -141,7 +141,7 @@ public String subDomainSuffix() { } /** - * Set the subDomainSuffix of the application. + * Set the subdomain suffix of the application. * * @param subDomainSuffix the subDomainSuffix value to set * @return the ApplicationGetHttpsEndpoint object itself. diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Autoscale.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Autoscale.java new file mode 100644 index 000000000000..df317ce72ca2 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Autoscale.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.hdinsight.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The autoscale request parameters. + */ +public class Autoscale { + /** + * Parameters for load-based autoscale. + */ + @JsonProperty(value = "capacity") + private AutoscaleCapacity capacity; + + /** + * Parameters for schedule-based autoscale. + */ + @JsonProperty(value = "recurrence") + private AutoscaleRecurrence recurrence; + + /** + * Get parameters for load-based autoscale. + * + * @return the capacity value + */ + public AutoscaleCapacity capacity() { + return this.capacity; + } + + /** + * Set parameters for load-based autoscale. + * + * @param capacity the capacity value to set + * @return the Autoscale object itself. + */ + public Autoscale withCapacity(AutoscaleCapacity capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get parameters for schedule-based autoscale. + * + * @return the recurrence value + */ + public AutoscaleRecurrence recurrence() { + return this.recurrence; + } + + /** + * Set parameters for schedule-based autoscale. + * + * @param recurrence the recurrence value to set + * @return the Autoscale object itself. + */ + public Autoscale withRecurrence(AutoscaleRecurrence recurrence) { + this.recurrence = recurrence; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/AutoscaleCapacity.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/AutoscaleCapacity.java new file mode 100644 index 000000000000..01b5fbcdc2be --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/AutoscaleCapacity.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.hdinsight.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The load-based autoscale request parameters. + */ +public class AutoscaleCapacity { + /** + * The minimum instance count of the cluster. + */ + @JsonProperty(value = "minInstanceCount") + private Integer minInstanceCount; + + /** + * The maximum instance count of the cluster. + */ + @JsonProperty(value = "maxInstanceCount") + private Integer maxInstanceCount; + + /** + * Get the minimum instance count of the cluster. + * + * @return the minInstanceCount value + */ + public Integer minInstanceCount() { + return this.minInstanceCount; + } + + /** + * Set the minimum instance count of the cluster. + * + * @param minInstanceCount the minInstanceCount value to set + * @return the AutoscaleCapacity object itself. + */ + public AutoscaleCapacity withMinInstanceCount(Integer minInstanceCount) { + this.minInstanceCount = minInstanceCount; + return this; + } + + /** + * Get the maximum instance count of the cluster. + * + * @return the maxInstanceCount value + */ + public Integer maxInstanceCount() { + return this.maxInstanceCount; + } + + /** + * Set the maximum instance count of the cluster. + * + * @param maxInstanceCount the maxInstanceCount value to set + * @return the AutoscaleCapacity object itself. + */ + public AutoscaleCapacity withMaxInstanceCount(Integer maxInstanceCount) { + this.maxInstanceCount = maxInstanceCount; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/AutoscaleRecurrence.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/AutoscaleRecurrence.java new file mode 100644 index 000000000000..addbf5debb35 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/AutoscaleRecurrence.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.hdinsight.v2018_06_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Schedule-based autoscale request parameters. + */ +public class AutoscaleRecurrence { + /** + * The time zone for the autoscale schedule times. + */ + @JsonProperty(value = "timeZone") + private String timeZone; + + /** + * Array of schedule-based autoscale rules. + */ + @JsonProperty(value = "schedule") + private List schedule; + + /** + * Get the time zone for the autoscale schedule times. + * + * @return the timeZone value + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the time zone for the autoscale schedule times. + * + * @param timeZone the timeZone value to set + * @return the AutoscaleRecurrence object itself. + */ + public AutoscaleRecurrence withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get array of schedule-based autoscale rules. + * + * @return the schedule value + */ + public List schedule() { + return this.schedule; + } + + /** + * Set array of schedule-based autoscale rules. + * + * @param schedule the schedule value to set + * @return the AutoscaleRecurrence object itself. + */ + public AutoscaleRecurrence withSchedule(List schedule) { + this.schedule = schedule; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/AutoscaleSchedule.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/AutoscaleSchedule.java new file mode 100644 index 000000000000..fdad8b302d0f --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/AutoscaleSchedule.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.hdinsight.v2018_06_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for a schedule-based autoscale rule, consisting of an array of + * days + a time and capacity. + */ +public class AutoscaleSchedule { + /** + * Days of the week for a schedule-based autoscale rule. + */ + @JsonProperty(value = "days") + private List days; + + /** + * Time and capacity for a schedule-based autoscale rule. + */ + @JsonProperty(value = "timeAndCapacity") + private AutoscaleTimeAndCapacity timeAndCapacity; + + /** + * Get days of the week for a schedule-based autoscale rule. + * + * @return the days value + */ + public List days() { + return this.days; + } + + /** + * Set days of the week for a schedule-based autoscale rule. + * + * @param days the days value to set + * @return the AutoscaleSchedule object itself. + */ + public AutoscaleSchedule withDays(List days) { + this.days = days; + return this; + } + + /** + * Get time and capacity for a schedule-based autoscale rule. + * + * @return the timeAndCapacity value + */ + public AutoscaleTimeAndCapacity timeAndCapacity() { + return this.timeAndCapacity; + } + + /** + * Set time and capacity for a schedule-based autoscale rule. + * + * @param timeAndCapacity the timeAndCapacity value to set + * @return the AutoscaleSchedule object itself. + */ + public AutoscaleSchedule withTimeAndCapacity(AutoscaleTimeAndCapacity timeAndCapacity) { + this.timeAndCapacity = timeAndCapacity; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/AutoscaleTimeAndCapacity.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/AutoscaleTimeAndCapacity.java new file mode 100644 index 000000000000..d8bdf29a06c3 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/AutoscaleTimeAndCapacity.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.hdinsight.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Time and capacity request parameters. + */ +public class AutoscaleTimeAndCapacity { + /** + * 24-hour time in the form xx:xx. + */ + @JsonProperty(value = "time") + private String time; + + /** + * The minimum instance count of the cluster. + */ + @JsonProperty(value = "minInstanceCount") + private Integer minInstanceCount; + + /** + * The maximum instance count of the cluster. + */ + @JsonProperty(value = "maxInstanceCount") + private Integer maxInstanceCount; + + /** + * Get 24-hour time in the form xx:xx. + * + * @return the time value + */ + public String time() { + return this.time; + } + + /** + * Set 24-hour time in the form xx:xx. + * + * @param time the time value to set + * @return the AutoscaleTimeAndCapacity object itself. + */ + public AutoscaleTimeAndCapacity withTime(String time) { + this.time = time; + return this; + } + + /** + * Get the minimum instance count of the cluster. + * + * @return the minInstanceCount value + */ + public Integer minInstanceCount() { + return this.minInstanceCount; + } + + /** + * Set the minimum instance count of the cluster. + * + * @param minInstanceCount the minInstanceCount value to set + * @return the AutoscaleTimeAndCapacity object itself. + */ + public AutoscaleTimeAndCapacity withMinInstanceCount(Integer minInstanceCount) { + this.minInstanceCount = minInstanceCount; + return this; + } + + /** + * Get the maximum instance count of the cluster. + * + * @return the maxInstanceCount value + */ + public Integer maxInstanceCount() { + return this.maxInstanceCount; + } + + /** + * Set the maximum instance count of the cluster. + * + * @param maxInstanceCount the maxInstanceCount value to set + * @return the AutoscaleTimeAndCapacity object itself. + */ + public AutoscaleTimeAndCapacity withMaxInstanceCount(Integer maxInstanceCount) { + this.maxInstanceCount = maxInstanceCount; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/BillingMeters.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/BillingMeters.java new file mode 100644 index 000000000000..fb5d9cba8323 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/BillingMeters.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.hdinsight.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The billing meters. + */ +public class BillingMeters { + /** + * The virtual machine sizes. + */ + @JsonProperty(value = "meterParameter") + private String meterParameter; + + /** + * The HDInsight meter guid. + */ + @JsonProperty(value = "meter") + private String meter; + + /** + * The unit of meter, VMHours or CoreHours. + */ + @JsonProperty(value = "unit") + private String unit; + + /** + * Get the virtual machine sizes. + * + * @return the meterParameter value + */ + public String meterParameter() { + return this.meterParameter; + } + + /** + * Set the virtual machine sizes. + * + * @param meterParameter the meterParameter value to set + * @return the BillingMeters object itself. + */ + public BillingMeters withMeterParameter(String meterParameter) { + this.meterParameter = meterParameter; + return this; + } + + /** + * Get the HDInsight meter guid. + * + * @return the meter value + */ + public String meter() { + return this.meter; + } + + /** + * Set the HDInsight meter guid. + * + * @param meter the meter value to set + * @return the BillingMeters object itself. + */ + public BillingMeters withMeter(String meter) { + this.meter = meter; + return this; + } + + /** + * Get the unit of meter, VMHours or CoreHours. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit of meter, VMHours or CoreHours. + * + * @param unit the unit value to set + * @return the BillingMeters object itself. + */ + public BillingMeters withUnit(String unit) { + this.unit = unit; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/BillingResources.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/BillingResources.java new file mode 100644 index 000000000000..4e3cb53f2cf8 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/BillingResources.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.hdinsight.v2018_06_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The billing resources. + */ +public class BillingResources { + /** + * The region or location. + */ + @JsonProperty(value = "region") + private String region; + + /** + * The billing meter information. + */ + @JsonProperty(value = "billingMeters") + private List billingMeters; + + /** + * The managed disk billing information. + */ + @JsonProperty(value = "diskBillingMeters") + private List diskBillingMeters; + + /** + * Get the region or location. + * + * @return the region value + */ + public String region() { + return this.region; + } + + /** + * Set the region or location. + * + * @param region the region value to set + * @return the BillingResources object itself. + */ + public BillingResources withRegion(String region) { + this.region = region; + return this; + } + + /** + * Get the billing meter information. + * + * @return the billingMeters value + */ + public List billingMeters() { + return this.billingMeters; + } + + /** + * Set the billing meter information. + * + * @param billingMeters the billingMeters value to set + * @return the BillingResources object itself. + */ + public BillingResources withBillingMeters(List billingMeters) { + this.billingMeters = billingMeters; + return this; + } + + /** + * Get the managed disk billing information. + * + * @return the diskBillingMeters value + */ + public List diskBillingMeters() { + return this.diskBillingMeters; + } + + /** + * Set the managed disk billing information. + * + * @param diskBillingMeters the diskBillingMeters value to set + * @return the BillingResources object itself. + */ + public BillingResources withDiskBillingMeters(List diskBillingMeters) { + this.diskBillingMeters = diskBillingMeters; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/BillingResponseListResult.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/BillingResponseListResult.java new file mode 100644 index 000000000000..b6c874c0d072 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/BillingResponseListResult.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.hdinsight.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.implementation.HDInsightManager; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.implementation.BillingResponseListResultInner; +import java.util.List; + +/** + * Type representing BillingResponseListResult. + */ +public interface BillingResponseListResult extends HasInner, HasManager { + /** + * @return the billingResources value. + */ + List billingResources(); + + /** + * @return the vmSizeFilters value. + */ + List vmSizeFilters(); + + /** + * @return the vmSizes value. + */ + List vmSizes(); + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/CapabilitiesResult.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/CapabilitiesResult.java new file mode 100644 index 000000000000..eda0cf30f15f --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/CapabilitiesResult.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hdinsight.v2018_06_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.implementation.HDInsightManager; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.implementation.CapabilitiesResultInner; +import java.util.List; +import java.util.Map; + +/** + * Type representing CapabilitiesResult. + */ +public interface CapabilitiesResult extends HasInner, HasManager { + /** + * @return the features value. + */ + List features(); + + /** + * @return the quota value. + */ + QuotaCapability quota(); + + /** + * @return the regions value. + */ + Map regions(); + + /** + * @return the versions value. + */ + Map versions(); + + /** + * @return the vmSizeFilters value. + */ + List vmSizeFilters(); + + /** + * @return the vmSizes value. + */ + Map vmSizes(); + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/DaysOfWeek.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/DaysOfWeek.java new file mode 100644 index 000000000000..85a890ed846f --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/DaysOfWeek.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.hdinsight.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DaysOfWeek. + */ +public enum DaysOfWeek { + /** Enum value Monday. */ + MONDAY("Monday"), + + /** Enum value Tuesday. */ + TUESDAY("Tuesday"), + + /** Enum value Wednesday. */ + WEDNESDAY("Wednesday"), + + /** Enum value Thursday. */ + THURSDAY("Thursday"), + + /** Enum value Friday. */ + FRIDAY("Friday"), + + /** Enum value Saturday. */ + SATURDAY("Saturday"), + + /** Enum value Sunday. */ + SUNDAY("Sunday"); + + /** The actual serialized value for a DaysOfWeek instance. */ + private String value; + + DaysOfWeek(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DaysOfWeek instance. + * + * @param value the serialized value to parse. + * @return the parsed DaysOfWeek object, or null if unable to parse. + */ + @JsonCreator + public static DaysOfWeek fromString(String value) { + DaysOfWeek[] items = DaysOfWeek.values(); + for (DaysOfWeek item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/DiskBillingMeters.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/DiskBillingMeters.java new file mode 100644 index 000000000000..045712dbddc7 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/DiskBillingMeters.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.hdinsight.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The disk billing meters. + */ +public class DiskBillingMeters { + /** + * The managed disk meter guid. + */ + @JsonProperty(value = "diskRpMeter") + private String diskRpMeter; + + /** + * The managed disk billing sku, P30 or S30. + */ + @JsonProperty(value = "sku") + private String sku; + + /** + * The managed disk billing tier, Standard or Premium. Possible values + * include: 'Standard', 'Premium'. + */ + @JsonProperty(value = "tier") + private Tier tier; + + /** + * Get the managed disk meter guid. + * + * @return the diskRpMeter value + */ + public String diskRpMeter() { + return this.diskRpMeter; + } + + /** + * Set the managed disk meter guid. + * + * @param diskRpMeter the diskRpMeter value to set + * @return the DiskBillingMeters object itself. + */ + public DiskBillingMeters withDiskRpMeter(String diskRpMeter) { + this.diskRpMeter = diskRpMeter; + return this; + } + + /** + * Get the managed disk billing sku, P30 or S30. + * + * @return the sku value + */ + public String sku() { + return this.sku; + } + + /** + * Set the managed disk billing sku, P30 or S30. + * + * @param sku the sku value to set + * @return the DiskBillingMeters object itself. + */ + public DiskBillingMeters withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * Get the managed disk billing tier, Standard or Premium. Possible values include: 'Standard', 'Premium'. + * + * @return the tier value + */ + public Tier tier() { + return this.tier; + } + + /** + * Set the managed disk billing tier, Standard or Premium. Possible values include: 'Standard', 'Premium'. + * + * @param tier the tier value to set + * @return the DiskBillingMeters object itself. + */ + public DiskBillingMeters withTier(Tier tier) { + this.tier = tier; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/FilterMode.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/FilterMode.java new file mode 100644 index 000000000000..f416029c5326 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/FilterMode.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.hdinsight.v2018_06_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for FilterMode. + */ +public final class FilterMode extends ExpandableStringEnum { + /** Static value Exclude for FilterMode. */ + public static final FilterMode EXCLUDE = fromString("Exclude"); + + /** Static value Include for FilterMode. */ + public static final FilterMode INCLUDE = fromString("Include"); + + /** + * Creates or finds a FilterMode from its string representation. + * @param name a name to look for + * @return the corresponding FilterMode + */ + @JsonCreator + public static FilterMode fromString(String name) { + return fromString(name, FilterMode.class); + } + + /** + * @return known FilterMode values + */ + public static Collection values() { + return values(FilterMode.class); + } +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Locations.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Locations.java index 9bd76b3ec75c..c93d7ec3cebd 100644 --- a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Locations.java +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Locations.java @@ -14,13 +14,31 @@ * Type representing Locations. */ public interface Locations { + /** + * Gets the capabilities for the specified location. + * + * @param location The Azure location (region) for which to make the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getCapabilitiesAsync(String location); + /** * Lists the usages for the specified location. * - * @param location The location to get capabilities for. + * @param location The Azure location (region) for which to make the request. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ Observable listUsagesAsync(String location); + /** + * Lists the billingSpecs for the specified subscription and location. + * + * @param location The Azure location (region) for which to make the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listBillingSpecsAsync(String location); + } diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/QuotaCapability.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/QuotaCapability.java new file mode 100644 index 000000000000..077067cafa17 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/QuotaCapability.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.hdinsight.v2018_06_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The regional quota capability. + */ +public class QuotaCapability { + /** + * The number of cores used in the subscription. + */ + @JsonProperty(value = "cores_used") + private Long coresUsed; + + /** + * The number of cores that the subscription allowed. + */ + @JsonProperty(value = "max_cores_allowed") + private Long maxCoresAllowed; + + /** + * The list of region quota capabilities. + */ + @JsonProperty(value = "regionalQuotas") + private List regionalQuotas; + + /** + * Get the number of cores used in the subscription. + * + * @return the coresUsed value + */ + public Long coresUsed() { + return this.coresUsed; + } + + /** + * Set the number of cores used in the subscription. + * + * @param coresUsed the coresUsed value to set + * @return the QuotaCapability object itself. + */ + public QuotaCapability withCoresUsed(Long coresUsed) { + this.coresUsed = coresUsed; + return this; + } + + /** + * Get the number of cores that the subscription allowed. + * + * @return the maxCoresAllowed value + */ + public Long maxCoresAllowed() { + return this.maxCoresAllowed; + } + + /** + * Set the number of cores that the subscription allowed. + * + * @param maxCoresAllowed the maxCoresAllowed value to set + * @return the QuotaCapability object itself. + */ + public QuotaCapability withMaxCoresAllowed(Long maxCoresAllowed) { + this.maxCoresAllowed = maxCoresAllowed; + return this; + } + + /** + * Get the list of region quota capabilities. + * + * @return the regionalQuotas value + */ + public List regionalQuotas() { + return this.regionalQuotas; + } + + /** + * Set the list of region quota capabilities. + * + * @param regionalQuotas the regionalQuotas value to set + * @return the QuotaCapability object itself. + */ + public QuotaCapability withRegionalQuotas(List regionalQuotas) { + this.regionalQuotas = regionalQuotas; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/RegionalQuotaCapability.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/RegionalQuotaCapability.java new file mode 100644 index 000000000000..2828f5129635 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/RegionalQuotaCapability.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.hdinsight.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The regional quota capacity. + */ +public class RegionalQuotaCapability { + /** + * The region name. + */ + @JsonProperty(value = "region_name") + private String regionName; + + /** + * The number of cores used in the region. + */ + @JsonProperty(value = "cores_used") + private Long coresUsed; + + /** + * The number of cores available in the region. + */ + @JsonProperty(value = "cores_available") + private Long coresAvailable; + + /** + * Get the region name. + * + * @return the regionName value + */ + public String regionName() { + return this.regionName; + } + + /** + * Set the region name. + * + * @param regionName the regionName value to set + * @return the RegionalQuotaCapability object itself. + */ + public RegionalQuotaCapability withRegionName(String regionName) { + this.regionName = regionName; + return this; + } + + /** + * Get the number of cores used in the region. + * + * @return the coresUsed value + */ + public Long coresUsed() { + return this.coresUsed; + } + + /** + * Set the number of cores used in the region. + * + * @param coresUsed the coresUsed value to set + * @return the RegionalQuotaCapability object itself. + */ + public RegionalQuotaCapability withCoresUsed(Long coresUsed) { + this.coresUsed = coresUsed; + return this; + } + + /** + * Get the number of cores available in the region. + * + * @return the coresAvailable value + */ + public Long coresAvailable() { + return this.coresAvailable; + } + + /** + * Set the number of cores available in the region. + * + * @param coresAvailable the coresAvailable value to set + * @return the RegionalQuotaCapability object itself. + */ + public RegionalQuotaCapability withCoresAvailable(Long coresAvailable) { + this.coresAvailable = coresAvailable; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/RegionsCapability.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/RegionsCapability.java new file mode 100644 index 000000000000..1cbe61192a3e --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/RegionsCapability.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.hdinsight.v2018_06_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The regions capability. + */ +public class RegionsCapability { + /** + * The list of region capabilities. + */ + @JsonProperty(value = "available") + private List available; + + /** + * Get the list of region capabilities. + * + * @return the available value + */ + public List available() { + return this.available; + } + + /** + * Set the list of region capabilities. + * + * @param available the available value to set + * @return the RegionsCapability object itself. + */ + public RegionsCapability withAvailable(List available) { + this.available = available; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Role.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Role.java index 069ad311501d..6a0dc92b3c5a 100644 --- a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Role.java +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Role.java @@ -34,6 +34,12 @@ public class Role { @JsonProperty(value = "targetInstanceCount") private Integer targetInstanceCount; + /** + * The autoscale configurations. + */ + @JsonProperty(value = "autoscale") + private Autoscale autoscaleConfiguration; + /** * The hardware profile. */ @@ -124,6 +130,26 @@ public Role withTargetInstanceCount(Integer targetInstanceCount) { return this; } + /** + * Get the autoscale configurations. + * + * @return the autoscaleConfiguration value + */ + public Autoscale autoscaleConfiguration() { + return this.autoscaleConfiguration; + } + + /** + * Set the autoscale configurations. + * + * @param autoscaleConfiguration the autoscaleConfiguration value to set + * @return the Role object itself. + */ + public Role withAutoscaleConfiguration(Autoscale autoscaleConfiguration) { + this.autoscaleConfiguration = autoscaleConfiguration; + return this; + } + /** * Get the hardware profile. * diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VersionSpec.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VersionSpec.java new file mode 100644 index 000000000000..9502ec2fa88a --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VersionSpec.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.hdinsight.v2018_06_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The version properties. + */ +public class VersionSpec { + /** + * The friendly name. + */ + @JsonProperty(value = "friendlyName") + private String friendlyName; + + /** + * The display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Whether or not the version is the default version. + */ + @JsonProperty(value = "isDefault") + private String isDefault; + + /** + * The component version property. + */ + @JsonProperty(value = "componentVersions") + private Map componentVersions; + + /** + * Get the friendly name. + * + * @return the friendlyName value + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendly name. + * + * @param friendlyName the friendlyName value to set + * @return the VersionSpec object itself. + */ + public VersionSpec withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name. + * + * @param displayName the displayName value to set + * @return the VersionSpec object itself. + */ + public VersionSpec withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get whether or not the version is the default version. + * + * @return the isDefault value + */ + public String isDefault() { + return this.isDefault; + } + + /** + * Set whether or not the version is the default version. + * + * @param isDefault the isDefault value to set + * @return the VersionSpec object itself. + */ + public VersionSpec withIsDefault(String isDefault) { + this.isDefault = isDefault; + return this; + } + + /** + * Get the component version property. + * + * @return the componentVersions value + */ + public Map componentVersions() { + return this.componentVersions; + } + + /** + * Set the component version property. + * + * @param componentVersions the componentVersions value to set + * @return the VersionSpec object itself. + */ + public VersionSpec withComponentVersions(Map componentVersions) { + this.componentVersions = componentVersions; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VersionsCapability.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VersionsCapability.java new file mode 100644 index 000000000000..d60c56864825 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VersionsCapability.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.hdinsight.v2018_06_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The version capability. + */ +public class VersionsCapability { + /** + * The list of version capabilities. + */ + @JsonProperty(value = "available") + private List available; + + /** + * Get the list of version capabilities. + * + * @return the available value + */ + public List available() { + return this.available; + } + + /** + * Set the list of version capabilities. + * + * @param available the available value to set + * @return the VersionsCapability object itself. + */ + public VersionsCapability withAvailable(List available) { + this.available = available; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VmSizeCompatibilityFilter.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VmSizeCompatibilityFilter.java new file mode 100644 index 000000000000..47d62cacd1f3 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VmSizeCompatibilityFilter.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. + */ + +package com.microsoft.azure.management.hdinsight.v2018_06_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The virtual machine type compatibility filter. + */ +public class VmSizeCompatibilityFilter { + /** + * The mode for the filter. + */ + @JsonProperty(value = "FilterMode") + private String filterMode; + + /** + * The list of regions. + */ + @JsonProperty(value = "Regions") + private List regions; + + /** + * The list of cluster types available. + */ + @JsonProperty(value = "ClusterFlavors") + private List clusterFlavors; + + /** + * The list of node types. + */ + @JsonProperty(value = "NodeTypes") + private List nodeTypes; + + /** + * The list of cluster versions. + */ + @JsonProperty(value = "ClusterVersions") + private List clusterVersions; + + /** + * The list of virtual machine sizes. + */ + @JsonProperty(value = "vmsizes") + private List vmsizes; + + /** + * Get the mode for the filter. + * + * @return the filterMode value + */ + public String filterMode() { + return this.filterMode; + } + + /** + * Set the mode for the filter. + * + * @param filterMode the filterMode value to set + * @return the VmSizeCompatibilityFilter object itself. + */ + public VmSizeCompatibilityFilter withFilterMode(String filterMode) { + this.filterMode = filterMode; + return this; + } + + /** + * Get the list of regions. + * + * @return the regions value + */ + public List regions() { + return this.regions; + } + + /** + * Set the list of regions. + * + * @param regions the regions value to set + * @return the VmSizeCompatibilityFilter object itself. + */ + public VmSizeCompatibilityFilter withRegions(List regions) { + this.regions = regions; + return this; + } + + /** + * Get the list of cluster types available. + * + * @return the clusterFlavors value + */ + public List clusterFlavors() { + return this.clusterFlavors; + } + + /** + * Set the list of cluster types available. + * + * @param clusterFlavors the clusterFlavors value to set + * @return the VmSizeCompatibilityFilter object itself. + */ + public VmSizeCompatibilityFilter withClusterFlavors(List clusterFlavors) { + this.clusterFlavors = clusterFlavors; + return this; + } + + /** + * Get the list of node types. + * + * @return the nodeTypes value + */ + public List nodeTypes() { + return this.nodeTypes; + } + + /** + * Set the list of node types. + * + * @param nodeTypes the nodeTypes value to set + * @return the VmSizeCompatibilityFilter object itself. + */ + public VmSizeCompatibilityFilter withNodeTypes(List nodeTypes) { + this.nodeTypes = nodeTypes; + return this; + } + + /** + * Get the list of cluster versions. + * + * @return the clusterVersions value + */ + public List clusterVersions() { + return this.clusterVersions; + } + + /** + * Set the list of cluster versions. + * + * @param clusterVersions the clusterVersions value to set + * @return the VmSizeCompatibilityFilter object itself. + */ + public VmSizeCompatibilityFilter withClusterVersions(List clusterVersions) { + this.clusterVersions = clusterVersions; + return this; + } + + /** + * Get the list of virtual machine sizes. + * + * @return the vmsizes value + */ + public List vmsizes() { + return this.vmsizes; + } + + /** + * Set the list of virtual machine sizes. + * + * @param vmsizes the vmsizes value to set + * @return the VmSizeCompatibilityFilter object itself. + */ + public VmSizeCompatibilityFilter withVmsizes(List vmsizes) { + this.vmsizes = vmsizes; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VmSizeCompatibilityFilterV2.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VmSizeCompatibilityFilterV2.java new file mode 100644 index 000000000000..f7e35ca964c4 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VmSizeCompatibilityFilterV2.java @@ -0,0 +1,207 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hdinsight.v2018_06_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * This class represent a single filter object that defines a multidimensional + * set. The dimensions of this set are Regions, ClusterFlavors, NodeTypes and + * ClusterVersions. The constraint should be defined based on the following: + * FilterMode (Exclude vs Include), VMSizes (the vm sizes in affect of + * exclusion/inclusion) and the ordering of the Filters. Later filters override + * previous settings if conflicted. + */ +public class VmSizeCompatibilityFilterV2 { + /** + * The filtering mode. Effectively this can enabling or disabling the VM + * sizes in a particular set. Possible values include: 'Exclude', + * 'Include'. + */ + @JsonProperty(value = "filterMode") + private FilterMode filterMode; + + /** + * The list of regions under the effect of the filter. + */ + @JsonProperty(value = "regions") + private List regions; + + /** + * The list of cluster flavors under the effect of the filter. + */ + @JsonProperty(value = "clusterFlavors") + private List clusterFlavors; + + /** + * The list of node types affected by the filter. + */ + @JsonProperty(value = "nodeTypes") + private List nodeTypes; + + /** + * The list of cluster versions affected in Major.Minor format. + */ + @JsonProperty(value = "clusterVersions") + private List clusterVersions; + + /** + * The OSType affected, Windows or Linux. + */ + @JsonProperty(value = "osType") + private List osType; + + /** + * The list of virtual machine sizes to include or exclude. + */ + @JsonProperty(value = "vmSizes") + private List vmSizes; + + /** + * Get the filtering mode. Effectively this can enabling or disabling the VM sizes in a particular set. Possible values include: 'Exclude', 'Include'. + * + * @return the filterMode value + */ + public FilterMode filterMode() { + return this.filterMode; + } + + /** + * Set the filtering mode. Effectively this can enabling or disabling the VM sizes in a particular set. Possible values include: 'Exclude', 'Include'. + * + * @param filterMode the filterMode value to set + * @return the VmSizeCompatibilityFilterV2 object itself. + */ + public VmSizeCompatibilityFilterV2 withFilterMode(FilterMode filterMode) { + this.filterMode = filterMode; + return this; + } + + /** + * Get the list of regions under the effect of the filter. + * + * @return the regions value + */ + public List regions() { + return this.regions; + } + + /** + * Set the list of regions under the effect of the filter. + * + * @param regions the regions value to set + * @return the VmSizeCompatibilityFilterV2 object itself. + */ + public VmSizeCompatibilityFilterV2 withRegions(List regions) { + this.regions = regions; + return this; + } + + /** + * Get the list of cluster flavors under the effect of the filter. + * + * @return the clusterFlavors value + */ + public List clusterFlavors() { + return this.clusterFlavors; + } + + /** + * Set the list of cluster flavors under the effect of the filter. + * + * @param clusterFlavors the clusterFlavors value to set + * @return the VmSizeCompatibilityFilterV2 object itself. + */ + public VmSizeCompatibilityFilterV2 withClusterFlavors(List clusterFlavors) { + this.clusterFlavors = clusterFlavors; + return this; + } + + /** + * Get the list of node types affected by the filter. + * + * @return the nodeTypes value + */ + public List nodeTypes() { + return this.nodeTypes; + } + + /** + * Set the list of node types affected by the filter. + * + * @param nodeTypes the nodeTypes value to set + * @return the VmSizeCompatibilityFilterV2 object itself. + */ + public VmSizeCompatibilityFilterV2 withNodeTypes(List nodeTypes) { + this.nodeTypes = nodeTypes; + return this; + } + + /** + * Get the list of cluster versions affected in Major.Minor format. + * + * @return the clusterVersions value + */ + public List clusterVersions() { + return this.clusterVersions; + } + + /** + * Set the list of cluster versions affected in Major.Minor format. + * + * @param clusterVersions the clusterVersions value to set + * @return the VmSizeCompatibilityFilterV2 object itself. + */ + public VmSizeCompatibilityFilterV2 withClusterVersions(List clusterVersions) { + this.clusterVersions = clusterVersions; + return this; + } + + /** + * Get the OSType affected, Windows or Linux. + * + * @return the osType value + */ + public List osType() { + return this.osType; + } + + /** + * Set the OSType affected, Windows or Linux. + * + * @param osType the osType value to set + * @return the VmSizeCompatibilityFilterV2 object itself. + */ + public VmSizeCompatibilityFilterV2 withOsType(List osType) { + this.osType = osType; + return this; + } + + /** + * Get the list of virtual machine sizes to include or exclude. + * + * @return the vmSizes value + */ + public List vmSizes() { + return this.vmSizes; + } + + /** + * Set the list of virtual machine sizes to include or exclude. + * + * @param vmSizes the vmSizes value to set + * @return the VmSizeCompatibilityFilterV2 object itself. + */ + public VmSizeCompatibilityFilterV2 withVmSizes(List vmSizes) { + this.vmSizes = vmSizes; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VmSizesCapability.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VmSizesCapability.java new file mode 100644 index 000000000000..d59e0a36a3ff --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/VmSizesCapability.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.hdinsight.v2018_06_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The virtual machine sizes capability. + */ +public class VmSizesCapability { + /** + * The list of virtual machine size capabilities. + */ + @JsonProperty(value = "available") + private List available; + + /** + * Get the list of virtual machine size capabilities. + * + * @return the available value + */ + public List available() { + return this.available; + } + + /** + * Set the list of virtual machine size capabilities. + * + * @param available the available value to set + * @return the VmSizesCapability object itself. + */ + public VmSizesCapability withAvailable(List available) { + this.available = available; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsImpl.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsImpl.java index 6a1aadd83275..0a968015501f 100644 --- a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsImpl.java +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ApplicationsImpl.java @@ -64,10 +64,14 @@ public Application call(ApplicationInner inner) { public Observable getAsync(String resourceGroupName, String clusterName, String applicationName) { ApplicationsInner client = this.inner(); return client.getAsync(resourceGroupName, clusterName, applicationName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public Application call(ApplicationInner inner) { - return wrapModel(inner); + public Observable call(ApplicationInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Application)wrapModel(inner)); + } } }); } diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/BillingResponseListResultImpl.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/BillingResponseListResultImpl.java new file mode 100644 index 000000000000..d2fd560889c4 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/BillingResponseListResultImpl.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.hdinsight.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.BillingResponseListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.BillingResources; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.VmSizeCompatibilityFilterV2; + +class BillingResponseListResultImpl extends WrapperImpl implements BillingResponseListResult { + private final HDInsightManager manager; + BillingResponseListResultImpl(BillingResponseListResultInner inner, HDInsightManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public HDInsightManager manager() { + return this.manager; + } + + @Override + public List billingResources() { + return this.inner().billingResources(); + } + + @Override + public List vmSizeFilters() { + return this.inner().vmSizeFilters(); + } + + @Override + public List vmSizes() { + return this.inner().vmSizes(); + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/BillingResponseListResultInner.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/BillingResponseListResultInner.java new file mode 100644 index 000000000000..961d83868f09 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/BillingResponseListResultInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hdinsight.v2018_06_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.VmSizeCompatibilityFilterV2; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.BillingResources; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The response for the operation to get regional billingSpecs for a + * subscription. + */ +public class BillingResponseListResultInner { + /** + * The virtual machine sizes to include or exclude. + */ + @JsonProperty(value = "vmSizes") + private List vmSizes; + + /** + * The virtual machine filtering mode. Effectively this can enabling or + * disabling the virtual machine sizes in a particular set. + */ + @JsonProperty(value = "vmSizeFilters") + private List vmSizeFilters; + + /** + * The billing and managed disk billing resources for a region. + */ + @JsonProperty(value = "billingResources") + private List billingResources; + + /** + * Get the virtual machine sizes to include or exclude. + * + * @return the vmSizes value + */ + public List vmSizes() { + return this.vmSizes; + } + + /** + * Set the virtual machine sizes to include or exclude. + * + * @param vmSizes the vmSizes value to set + * @return the BillingResponseListResultInner object itself. + */ + public BillingResponseListResultInner withVmSizes(List vmSizes) { + this.vmSizes = vmSizes; + return this; + } + + /** + * Get the virtual machine filtering mode. Effectively this can enabling or disabling the virtual machine sizes in a particular set. + * + * @return the vmSizeFilters value + */ + public List vmSizeFilters() { + return this.vmSizeFilters; + } + + /** + * Set the virtual machine filtering mode. Effectively this can enabling or disabling the virtual machine sizes in a particular set. + * + * @param vmSizeFilters the vmSizeFilters value to set + * @return the BillingResponseListResultInner object itself. + */ + public BillingResponseListResultInner withVmSizeFilters(List vmSizeFilters) { + this.vmSizeFilters = vmSizeFilters; + return this; + } + + /** + * Get the billing and managed disk billing resources for a region. + * + * @return the billingResources value + */ + public List billingResources() { + return this.billingResources; + } + + /** + * Set the billing and managed disk billing resources for a region. + * + * @param billingResources the billingResources value to set + * @return the BillingResponseListResultInner object itself. + */ + public BillingResponseListResultInner withBillingResources(List billingResources) { + this.billingResources = billingResources; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/CapabilitiesResultImpl.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/CapabilitiesResultImpl.java new file mode 100644 index 000000000000..8f47024d08e4 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/CapabilitiesResultImpl.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.hdinsight.v2018_06_01_preview.implementation; + +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.CapabilitiesResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.QuotaCapability; +import java.util.Map; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.RegionsCapability; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.VersionsCapability; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.VmSizeCompatibilityFilter; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.VmSizesCapability; + +class CapabilitiesResultImpl extends WrapperImpl implements CapabilitiesResult { + private final HDInsightManager manager; + CapabilitiesResultImpl(CapabilitiesResultInner inner, HDInsightManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public HDInsightManager manager() { + return this.manager; + } + + @Override + public List features() { + return this.inner().features(); + } + + @Override + public QuotaCapability quota() { + return this.inner().quota(); + } + + @Override + public Map regions() { + return this.inner().regions(); + } + + @Override + public Map versions() { + return this.inner().versions(); + } + + @Override + public List vmSizeFilters() { + return this.inner().vmSizeFilters(); + } + + @Override + public Map vmSizes() { + return this.inner().vmSizes(); + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/CapabilitiesResultInner.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/CapabilitiesResultInner.java new file mode 100644 index 000000000000..5b4c6f96c5dc --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/CapabilitiesResultInner.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.hdinsight.v2018_06_01_preview.implementation; + +import java.util.Map; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.VersionsCapability; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.RegionsCapability; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.VmSizesCapability; +import java.util.List; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.VmSizeCompatibilityFilter; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.QuotaCapability; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Get Capabilities operation response. + */ +public class CapabilitiesResultInner { + /** + * The version capability. + */ + @JsonProperty(value = "versions") + private Map versions; + + /** + * The virtual machine size compatibility features. + */ + @JsonProperty(value = "regions") + private Map regions; + + /** + * The virtual machine sizes. + */ + @JsonProperty(value = "vmSizes") + private Map vmSizes; + + /** + * The virtual machine size compatibility filters. + */ + @JsonProperty(value = "vmSize_filters") + private List vmSizeFilters; + + /** + * The capability features. + */ + @JsonProperty(value = "features") + private List features; + + /** + * The quota capability. + */ + @JsonProperty(value = "quota") + private QuotaCapability quota; + + /** + * Get the version capability. + * + * @return the versions value + */ + public Map versions() { + return this.versions; + } + + /** + * Set the version capability. + * + * @param versions the versions value to set + * @return the CapabilitiesResultInner object itself. + */ + public CapabilitiesResultInner withVersions(Map versions) { + this.versions = versions; + return this; + } + + /** + * Get the virtual machine size compatibility features. + * + * @return the regions value + */ + public Map regions() { + return this.regions; + } + + /** + * Set the virtual machine size compatibility features. + * + * @param regions the regions value to set + * @return the CapabilitiesResultInner object itself. + */ + public CapabilitiesResultInner withRegions(Map regions) { + this.regions = regions; + return this; + } + + /** + * Get the virtual machine sizes. + * + * @return the vmSizes value + */ + public Map vmSizes() { + return this.vmSizes; + } + + /** + * Set the virtual machine sizes. + * + * @param vmSizes the vmSizes value to set + * @return the CapabilitiesResultInner object itself. + */ + public CapabilitiesResultInner withVmSizes(Map vmSizes) { + this.vmSizes = vmSizes; + return this; + } + + /** + * Get the virtual machine size compatibility filters. + * + * @return the vmSizeFilters value + */ + public List vmSizeFilters() { + return this.vmSizeFilters; + } + + /** + * Set the virtual machine size compatibility filters. + * + * @param vmSizeFilters the vmSizeFilters value to set + * @return the CapabilitiesResultInner object itself. + */ + public CapabilitiesResultInner withVmSizeFilters(List vmSizeFilters) { + this.vmSizeFilters = vmSizeFilters; + return this; + } + + /** + * Get the capability features. + * + * @return the features value + */ + public List features() { + return this.features; + } + + /** + * Set the capability features. + * + * @param features the features value to set + * @return the CapabilitiesResultInner object itself. + */ + public CapabilitiesResultInner withFeatures(List features) { + this.features = features; + return this; + } + + /** + * Get the quota capability. + * + * @return the quota value + */ + public QuotaCapability quota() { + return this.quota; + } + + /** + * Set the quota capability. + * + * @param quota the quota value to set + * @return the CapabilitiesResultInner object itself. + */ + public CapabilitiesResultInner withQuota(QuotaCapability quota) { + this.quota = quota; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsImpl.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsImpl.java index e4a1db3fe5ae..7f5e16109d19 100644 --- a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsImpl.java +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsImpl.java @@ -56,10 +56,14 @@ public Completable disableMonitoringAsync(String resourceGroupName, String clust public Observable getAsync(String resourceGroupName, String clusterName, String extensionName) { ExtensionsInner client = this.inner(); return client.getAsync(resourceGroupName, clusterName, extensionName) - .map(new Func1() { + .flatMap(new Func1>() { @Override - public Extension call(ExtensionInner inner) { - return wrapModel(inner); + public Observable call(ExtensionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Extension)wrapModel(inner)); + } } }); } diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/LocationsImpl.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/LocationsImpl.java index 7dfe32719674..f86af386c853 100644 --- a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/LocationsImpl.java +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/LocationsImpl.java @@ -13,7 +13,9 @@ import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.Locations; import rx.functions.Func1; import rx.Observable; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.CapabilitiesResult; import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.UsagesListResult; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.BillingResponseListResult; class LocationsImpl extends WrapperImpl implements Locations { private final HDInsightManager manager; @@ -27,6 +29,18 @@ public HDInsightManager manager() { return this.manager; } + @Override + public Observable getCapabilitiesAsync(String location) { + LocationsInner client = this.inner(); + return client.getCapabilitiesAsync(location) + .map(new Func1() { + @Override + public CapabilitiesResult call(CapabilitiesResultInner inner) { + return new CapabilitiesResultImpl(inner, manager()); + } + }); + } + @Override public Observable listUsagesAsync(String location) { LocationsInner client = this.inner(); @@ -39,4 +53,16 @@ public UsagesListResult call(UsagesListResultInner inner) { }); } + @Override + public Observable listBillingSpecsAsync(String location) { + LocationsInner client = this.inner(); + return client.listBillingSpecsAsync(location) + .map(new Func1() { + @Override + public BillingResponseListResult call(BillingResponseListResultInner inner) { + return new BillingResponseListResultImpl(inner, manager()); + } + }); + } + } diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/LocationsInner.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/LocationsInner.java index f3ccae61412e..0d13b02b5bc9 100644 --- a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/LocationsInner.java +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/LocationsInner.java @@ -51,16 +51,103 @@ public LocationsInner(Retrofit retrofit, HDInsightManagementClientImpl client) { * used by Retrofit to perform actually REST calls. */ interface LocationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hdinsight.v2018_06_01_preview.Locations getCapabilities" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/capabilities") + Observable> getCapabilities(@Path("subscriptionId") String subscriptionId, @Path("location") String location, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hdinsight.v2018_06_01_preview.Locations listUsages" }) @GET("subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/usages") Observable> listUsages(@Path("subscriptionId") String subscriptionId, @Path("location") String location, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hdinsight.v2018_06_01_preview.Locations listBillingSpecs" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/locations/{location}/billingSpecs") + Observable> listBillingSpecs(@Path("subscriptionId") String subscriptionId, @Path("location") String location, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the capabilities for the specified location. + * + * @param location The Azure location (region) for which to make the request. + * @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 CapabilitiesResultInner object if successful. + */ + public CapabilitiesResultInner getCapabilities(String location) { + return getCapabilitiesWithServiceResponseAsync(location).toBlocking().single().body(); + } + + /** + * Gets the capabilities for the specified location. + * + * @param location The Azure location (region) for which to make the request. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getCapabilitiesAsync(String location, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCapabilitiesWithServiceResponseAsync(location), serviceCallback); + } + + /** + * Gets the capabilities for the specified location. + * + * @param location The Azure location (region) for which to make the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CapabilitiesResultInner object + */ + public Observable getCapabilitiesAsync(String location) { + return getCapabilitiesWithServiceResponseAsync(location).map(new Func1, CapabilitiesResultInner>() { + @Override + public CapabilitiesResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the capabilities for the specified location. + * + * @param location The Azure location (region) for which to make the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CapabilitiesResultInner object + */ + public Observable> getCapabilitiesWithServiceResponseAsync(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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getCapabilities(this.client.subscriptionId(), location, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCapabilitiesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getCapabilitiesDelegate(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); } /** * Lists the usages for the specified location. * - * @param location The location to get capabilities for. + * @param location The Azure location (region) for which to make the request. * @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 @@ -73,7 +160,7 @@ public UsagesListResultInner listUsages(String location) { /** * Lists the usages for the specified location. * - * @param location The location to get capabilities for. + * @param location The Azure location (region) for which to make the request. * @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 +172,7 @@ public ServiceFuture listUsagesAsync(String location, fin /** * Lists the usages for the specified location. * - * @param location The location to get capabilities for. + * @param location The Azure location (region) for which to make the request. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the UsagesListResultInner object */ @@ -101,7 +188,7 @@ public UsagesListResultInner call(ServiceResponse respons /** * Lists the usages for the specified location. * - * @param location The location to get capabilities for. + * @param location The Azure location (region) for which to make the request. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the UsagesListResultInner object */ @@ -136,4 +223,83 @@ private ServiceResponse listUsagesDelegate(Response listBillingSpecsAsync(String location, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listBillingSpecsWithServiceResponseAsync(location), serviceCallback); + } + + /** + * Lists the billingSpecs for the specified subscription and location. + * + * @param location The Azure location (region) for which to make the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingResponseListResultInner object + */ + public Observable listBillingSpecsAsync(String location) { + return listBillingSpecsWithServiceResponseAsync(location).map(new Func1, BillingResponseListResultInner>() { + @Override + public BillingResponseListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the billingSpecs for the specified subscription and location. + * + * @param location The Azure location (region) for which to make the request. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the BillingResponseListResultInner object + */ + public Observable> listBillingSpecsWithServiceResponseAsync(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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listBillingSpecs(this.client.subscriptionId(), location, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listBillingSpecsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listBillingSpecsDelegate(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); + } + } diff --git a/parent/pom.xml b/parent/pom.xml index 15552a2c4a28..29eb19b7c990 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -20,6 +20,7 @@ com.microsoft.maven java-8-parent 8.0.2 + @@ -99,7 +100,7 @@ 2.9.9 - 1.6.10 + 1.6.12 1.10 4.0.0-beta3 3.1.12 @@ -122,6 +123,7 @@ 3.3 1.14.0 0.31 + 6.13 4.0.5 2.2.4 2.5 @@ -133,6 +135,7 @@ 1.6.3 + 0.5.0-preview 1.60 1.11.1 1.3.0 @@ -175,6 +178,7 @@ 3.1.0 8.19 2.28.2 + 1.7.4 0.8.4 1.2.1 2.8 @@ -202,6 +206,12 @@ ${adal4j.version} + + com.microsoft.azure + msal4j + ${msal4j.version} + + com.microsoft.azure azure-annotations @@ -417,6 +427,12 @@ ${commons-net.version} + + com.nimbusds + oauth2-oidc-sdk + ${oauth2-oidc-sdk.version} + + com.microsoft.azure @@ -570,6 +586,20 @@ ${mockito-core.version} test + + + org.powermock + powermock-module-junit4 + 2.0.2 + test + + + + org.powermock + powermock-api-mockito2 + 2.0.2 + test + diff --git a/pom.client.xml b/pom.client.xml index ed51d0abaa3d..f47444c87228 100644 --- a/pom.client.xml +++ b/pom.client.xml @@ -111,6 +111,7 @@ org.apache.maven.plugins maven-checkstyle-plugin + ${maven-checkstyle-plugin.version} com.azure @@ -124,9 +125,9 @@ - checkstyle/checkstyle.xml - checkstyle/checkstyle-suppressions.xml - checkstyle/java.header + eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml + eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml + eng/code-quality-reports/src/main/resources/checkstyle/java.header samedir= UTF-8 true @@ -343,7 +344,6 @@ com.microsoft.azure.template: *.impl*: *.implementation*: - com.azure.tracing*: com.azure.tools.checkstyle* @@ -541,12 +541,13 @@ So, path for aggregate reports have to be defined relative to parent pom --> -maxLineLength 120 -snippetpath ${project.basedir}/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java - -snippetpath ${project.basedir}/core/azure-core/src/samples/java - -snippetpath ${project.basedir}/sdk/eventhubs/azure-eventhubs/src/samples/java + -snippetpath ${project.basedir}/sdk/core/azure-core/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 - - -snippetpath ${project.basedir}/storage/client/queue/src/samples/java + -snippetpath ${project.basedir}/sdk/storage/azure-storage-blob/src/samples/java + -snippetpath ${project.basedir}/sdk/storage/azure-storage-file/src/samples/java + -snippetpath ${project.basedir}/sdk/storage/azure-storage-queue/src/samples/java @@ -610,6 +611,7 @@ -Xlint:all -Xlint:-serial -Xlint:-deprecation + -Xlint:-processing @@ -639,6 +641,7 @@ -Xlint:all -Xlint:-serial -Xlint:-deprecation + -Xlint:-processing @@ -737,15 +740,17 @@ ./sdk/appconfiguration/azure-data-appconfiguration - ./sdk/core - ./sdk/eventhubs/azure-eventhubs + ./sdk/core/azure-core + ./sdk/core/azure-core-amqp + ./sdk/core/azure-core-management + ./sdk/core/azure-core-test + ./sdk/eventhubs/azure-messaging-eventhubs ./sdk/keyvault/azure-keyvault-secrets ./sdk/keyvault/azure-keyvault-keys - - + ./sdk/tracing/tracing-opentelemetry ./sdk/identity/azure-identity - ./storage/client/blob - ./storage/client/file - ./storage/client/queue + ./sdk/storage/azure-storage-blob + ./sdk/storage/azure-storage-file + ./sdk/storage/azure-storage-queue diff --git a/pom.data.xml b/pom.data.xml index 9269fd2c2a0c..2afba64d5be2 100644 --- a/pom.data.xml +++ b/pom.data.xml @@ -546,6 +546,6 @@ ./sdk/eventhubs/pom.data.xml ./sdk/keyvault/pom.data.xml ./sdk/servicebus - ./storage/data-plane + ./sdk/storage/microsoft-azure-storage-blob diff --git a/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md b/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md new file mode 100644 index 000000000000..c89e585b7f4b --- /dev/null +++ b/sdk/appconfiguration/azure-data-appconfiguration/CHANGELOG.md @@ -0,0 +1,27 @@ +# Change Log azure-data-appconfiguration + +## Version 1.0.0-preview.2: + +For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). + +- Merged ConfigurationClientBuilder and ConfigurationAsyncClientBuilder into ConfigurationClientBuilder. Method to build each client were added. +- ConfigurationClientBuilder was made instantiable, static builder method removed from ConfigurationClient and ConfigurationAsyncClient. +- Builder method credentials renamed to credential and serviceEndpoint to endpoint. +- Listing operations return PagedFlux and PagedIterable in their respective clients. +- Non-maximal overloads return response value instead of Response. +- Asynchronous calls check subscriberContext for tracing context. +- Synchronous calls support passing tracing context in maximal overloads. + +## Version 1.0.0-preview.1: + +Version 1.0.0-preview.1 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic +to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide +our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html). + +For details on the Azure SDK for Java (July 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview1-java). + +This package's [documentation](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/appconfiguration/azure-data-appconfiguration/README.md) +and [samples](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration) +demonstrate the new API. + +- Initial release. Please see the README and wiki for information on the new design. diff --git a/sdk/appconfiguration/azure-data-appconfiguration/README.md b/sdk/appconfiguration/azure-data-appconfiguration/README.md index 8740e54e7621..cf9bfa46796e 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/README.md +++ b/sdk/appconfiguration/azure-data-appconfiguration/README.md @@ -5,7 +5,8 @@ Modern programs, especially programs running in a cloud, generally have many com Use the client library for App Configuration to create and manage application configuration settings. -[Source code][source_code] | [Package (Maven)][package] | [API reference documentation][api_documentation] | [Product documentation][azconfig_docs] +[Source code][source_code] | [Package (Maven)][package] | [API reference documentation][api_documentation] +| [Product documentation][azconfig_docs] | [Samples][samples] ## Getting started @@ -21,7 +22,7 @@ Use the client library for App Configuration to create and manage application co com.azure azure-data-appconfiguration - 1.0.0-preview.1 + 1.0.0-preview.2 ``` @@ -106,7 +107,7 @@ An application that has a large set of configurations that it needs to periodica ConfigurationAsyncClient client = new ConfigurationClientBuilder() .credential(new ConfigurationClientCredentials(appConfigConnectionString)) .buildAsyncClient(); - + client.listSettings(new SettingSelection().label(periodicUpdateLabel)) .subscribe(setting -> updateConfiguration(setting)); ``` @@ -172,7 +173,7 @@ When you interact with App Configuration using this Java client library, errors ## Next steps -[Quickstart: Create a Java Spring app with App Configuration](https://docs.microsoft.com/en-us/azure/azure-app-configuration/quickstart-java-spring-app) +[Quickstart: Create a Java Spring app with App Configuration][spring_quickstart] ## Contributing @@ -186,11 +187,13 @@ If you would like to become an active contributor to this project please follow [api_documentation]: https://aka.ms/java-docs -[app_config_store]: https://docs.microsoft.com/en-us/azure/azure-app-configuration/quickstart-dotnet-core-app#create-an-app-configuration-store -[azconfig_docs]: https://docs.microsoft.com/en-us/azure/azure-app-configuration/ +[app_config_store]: https://docs.microsoft.com/azure/azure-app-configuration/quickstart-dotnet-core-app#create-an-app-configuration-store +[azconfig_docs]: https://docs.microsoft.com/azure/azure-app-configuration [azure_cli]: https://docs.microsoft.com/cli/azure -[azure_subscription]: https://azure.microsoft.com/en-us/free/ +[azure_subscription]: https://azure.microsoft.com/free [maven]: https://maven.apache.org/ [package]: https://search.maven.org/artifact/com.azure/azure-data-appconfiguration [rest_api]: https://github.com/Azure/AppConfiguration#rest-api-reference +[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 diff --git a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml index 5f3c743e6a26..e675f1abd993 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/pom.xml +++ b/sdk/appconfiguration/azure-data-appconfiguration/pom.xml @@ -13,7 +13,7 @@ com.azure azure-data-appconfiguration - 1.0.0-preview.1 + 1.0.0-preview.2 Microsoft Azure client library for App Configuration This package contains the Microsoft Azure App Configuration client library. diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/AzureConfiguration.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/AzureConfiguration.java index 13785a52eb77..2b85ed98688b 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/AzureConfiguration.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/AzureConfiguration.java @@ -9,5 +9,5 @@ class AzureConfiguration { //TODO: Eventually remove these hardcoded strings with https://github.com/Azure/azure-sdk-for-java/issues/3141 static final String NAME = "application-configuration"; - static final String VERSION = "1.0.0-SNAPSHOT"; + static final String VERSION = "1.0.0-preview.2"; } 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 8066edbd9b85..7a5c36bb2418 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 @@ -625,27 +625,10 @@ Mono> listSettingRevisionsNextPage(String ne return result; } - Flux listSettingRevisions(SettingSelector selector, Context context) { - Mono> result; - - if (selector != null) { - String fields = ImplUtils.arrayToString(selector.fields(), SettingFields::toStringMapper); - String keys = ImplUtils.arrayToString(selector.keys(), key -> key); - String labels = ImplUtils.arrayToString(selector.labels(), label -> label); - String range = selector.range() != null ? String.format(RANGE_QUERY, selector.range()) : null; - - result = service.listKeyValueRevisions(serviceEndpoint, keys, labels, fields, selector.acceptDateTime(), range, context) - .doOnRequest(ignoredValue -> logger.info("Listing ConfigurationSetting revisions - {}", selector)) - .doOnSuccess(response -> logger.info("Listed ConfigurationSetting revisions - {}", selector)) - .doOnError(error -> logger.warning("Failed to list ConfigurationSetting revisions - {}", selector, error)); - } else { - result = service.listKeyValueRevisions(serviceEndpoint, null, null, null, null, null, context) - .doOnRequest(ignoredValue -> logger.info("Listing ConfigurationSetting revisions")) - .doOnSuccess(response -> logger.info("Listed ConfigurationSetting revisions")) - .doOnError(error -> logger.warning("Failed to list all ConfigurationSetting revisions", error)); - } - - return result.flatMapMany(r -> extractAndFetchConfigurationSettings(r, context)); + PagedFlux listSettingRevisions(SettingSelector selector, Context context) { + return new PagedFlux<>(() -> + listSettingRevisionsFirstPage(selector, context), + continuationToken -> listSettingRevisionsNextPage(continuationToken, context)); } private Flux listSettings(String nextPageLink, Context context) { 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 693bb40e44b6..33337dcb5734 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java @@ -3,6 +3,7 @@ package com.azure.data.appconfiguration; +import com.azure.core.http.rest.PagedIterable; import com.azure.core.implementation.annotation.ReturnType; import com.azure.core.implementation.annotation.ServiceClient; import com.azure.core.implementation.annotation.ServiceMethod; @@ -15,7 +16,6 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; - /** * This class provides a client that contains all the operations for {@link ConfigurationSetting ConfigurationSettings} * in Azure App Configuration Store. Operations allowed by the client are adding, retrieving, updating, and deleting @@ -447,14 +447,14 @@ private Response deleteSetting(ConfigurationSetting settin * *

Retrieve all settings that use the key "prodDBConnection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.listSettings#SettingSelector} + * {@codesnippet com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector} * * @param options Optional. Options to filter configuration setting results from the service. - * @return A List of ConfigurationSettings that matches the {@code options}. If no options were provided, the List + * @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 Iterable listSettings(SettingSelector options) { + public PagedIterable listSettings(SettingSelector options) { return listSettings(options, Context.NONE); } @@ -466,16 +466,16 @@ public Iterable listSettings(SettingSelector options) { * *

Retrieve all settings that use the key "prodDBConnection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.listSettings#SettingSelector-Context} + * {@codesnippet com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector-context} * * @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 List of ConfigurationSettings that matches the {@code options}. If no options were provided, the List + * @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 Iterable listSettings(SettingSelector options, Context context) { - return client.listSettings(options, context).collectList().block(); + public PagedIterable listSettings(SettingSelector options, Context context) { + return new PagedIterable<>(client.listSettings(options, context)); } /** @@ -490,13 +490,13 @@ public Iterable listSettings(SettingSelector options, Cont * *

Retrieve all revisions of the setting that has the key "prodDBConnection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.listSettingRevisions#SettingSelector} + * {@codesnippet com.azure.data.applicationconfig.configurationclient.listSettingRevisions#settingSelector} * * @param selector Optional. Used to filter configuration setting revisions from the service. - * @return Revisions of the ConfigurationSetting + * @return {@link PagedIterable} of {@link ConfigurationSetting} revisions. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public Iterable listSettingRevisions(SettingSelector selector) { + public PagedIterable listSettingRevisions(SettingSelector selector) { return listSettingRevisions(selector, Context.NONE); } @@ -512,14 +512,14 @@ public Iterable listSettingRevisions(SettingSelector selec * *

Retrieve all revisions of the setting that has the key "prodDBConnection".

* - * {@codesnippet com.azure.data.applicationconfig.configurationclient.listSettingRevisions#SettingSelector-Context} + * {@codesnippet com.azure.data.applicationconfig.configurationclient.listSettingRevisions#settingSelector-context} * * @param selector Optional. Used to filter configuration setting revisions from the service. * @param context Additional context that is passed through the Http pipeline during the service call. - * @return Revisions of the ConfigurationSetting + * @return {@link PagedIterable} of {@link ConfigurationSetting} revisions. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public Iterable listSettingRevisions(SettingSelector selector, Context context) { - return client.listSettingRevisions(selector, context).collectList().block(); + public PagedIterable listSettingRevisions(SettingSelector selector, Context context) { + return new PagedIterable<>(client.listSettingRevisions(selector, 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 26840826d978..cdf87bc3aaac 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 @@ -3,6 +3,7 @@ package com.azure.data.appconfiguration; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.implementation.annotation.ServiceClientBuilder; import com.azure.core.util.logging.ClientLogger; import com.azure.data.appconfiguration.credentials.ConfigurationClientCredentials; @@ -33,13 +34,15 @@ import java.util.Objects; /** - * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link ConfigurationAsyncClient} and {@link ConfigurationClient}, - * by calling {@link ConfigurationClientBuilder#buildAsyncClient() buildAsyncClient} and {@link ConfigurationClientBuilder#buildClient() buildClient} respectively - * to construct an instance of the desired client. + * This class provides a fluent builder API to help aid the configuration and instantiation of + * {@link ConfigurationClient ConfigurationClients} and {@link ConfigurationAsyncClient ConfigurationAsyncClients}, + * call {@link #buildClient() buildClient} and {@link #buildAsyncClient() buildAsyncClient} respectively to construct + * an instance of the desired client. * *

The client needs the service endpoint of the Azure App Configuration store and access credential. * {@link ConfigurationClientCredentials} gives the builder the service endpoint and access credential it requires to - * construct a client, set the ConfigurationClientCredentials with {@link ConfigurationClientBuilder#credential(ConfigurationClientCredentials) this}.

+ * construct a client, set the ConfigurationClientCredentials with + * {@link #credential(ConfigurationClientCredentials) this}.

* *

Instantiating an asynchronous Configuration Client

* @@ -49,11 +52,11 @@ * * {@codesnippet com.azure.data.applicationconfig.configurationclient.instantiation} * - *

Another way to construct the client is using a {@link HttpPipeline}. The pipeline gives the client an authenticated - * way to communicate with the service but it doesn't contain the service endpoint. Set the pipeline with - * {@link ConfigurationClientBuilder#pipeline(HttpPipeline) this}, additionally set the service endpoint with - * {@link ConfigurationClientBuilder#endpoint(String) this}. Using a pipeline requires additional setup but - * allows for finer control on how the {@link ConfigurationAsyncClient} and {@link ConfigurationClient} it built.

+ *

Another way to construct the client is using a {@link HttpPipeline}. The pipeline gives the client an + * authenticated way to communicate with the service but it doesn't contain the service endpoint. Set the pipeline with + * {@link #pipeline(HttpPipeline) this} and set the service endpoint with {@link #endpoint(String) this}. Using a + * pipeline requires additional setup but allows for finer control on how the {@link ConfigurationClient} and + * {@link ConfigurationAsyncClient} is built.

* * {@codesnippet com.azure.data.applicationconfig.configurationclient.pipeline.instantiation} * @@ -98,40 +101,38 @@ public ConfigurationClientBuilder() { } /** * Creates a {@link ConfigurationClient} based on options set in the Builder. Every time {@code buildClient()} is - * called, a new instance of {@link ConfigurationClient} is created. + * called a new instance of {@link ConfigurationClient} is created. * *

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

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

* * @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 ConfigurationClientBuilder#credential(ConfigurationClientCredentials) credential} are set through - * the builder. Or can be set explicitly by calling {@link ConfigurationClientBuilder#endpoint(String)}. - * @throws IllegalStateException If {@link ConfigurationClientBuilder#credential(ConfigurationClientCredentials)} - * has not been set. + * {@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() { return new ConfigurationClient(buildAsyncClient()); } /** - * Creates a {@link ConfigurationAsyncClient} based on options set in the Builder. Every time {@code buildAsyncClient()} is - * called, a new instance of {@link ConfigurationAsyncClient} is created. + * Creates a {@link ConfigurationAsyncClient} based on options set in the Builder. Every time + * {@code buildAsyncClient()} is called a new instance of {@link ConfigurationAsyncClient} is created. * *

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

* * @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 ConfigurationClientBuilder#credential(ConfigurationClientCredentials) credential} are set through - * the builder. Or can be set explicitly by calling {@link ConfigurationClientBuilder#endpoint(String)}. - * @throws IllegalStateException If {@link ConfigurationClientBuilder#credential(ConfigurationClientCredentials)} - * has not been set. + * {@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; @@ -165,7 +166,7 @@ public ConfigurationAsyncClient buildAsyncClient() { HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); @@ -192,8 +193,8 @@ public ConfigurationClientBuilder endpoint(String endpoint) { } /** - * Sets the credential to use when authenticating HTTP requests. Also, sets the - * {@link ConfigurationClientBuilder#endpoint(String) endpoint} for this ConfigurationClientBuilder. + * Sets the credential to use when authenticating HTTP requests. Also, sets the {@link #endpoint(String) endpoint} + * for this ConfigurationClientBuilder. * * @param credential The credential to use for authenticating HTTP requests. * @return The updated ConfigurationClientBuilder object. @@ -210,9 +211,10 @@ public ConfigurationClientBuilder credential(ConfigurationClientCredentials cred * * @param logLevel The amount of logging output when sending and receiving HTTP requests/responses. * @return The updated ConfigurationClientBuilder object. + * @throws NullPointerException If {@code logLevel} is {@code null}. */ public ConfigurationClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - httpLogDetailLevel = logLevel; + httpLogDetailLevel = Objects.requireNonNull(logLevel); return this; } @@ -234,10 +236,12 @@ public ConfigurationClientBuilder addPolicy(HttpPipelinePolicy policy) { * * @param client The HTTP client to use for requests. * @return The updated ConfigurationClientBuilder object. - * @throws NullPointerException If {@code client} is {@code null}. */ public ConfigurationClientBuilder httpClient(HttpClient client) { - Objects.requireNonNull(client); + if (this.httpClient != null && client == null) { + logger.info("HttpClient is being set to 'null' when it was previously configured."); + } + this.httpClient = client; return this; } @@ -252,7 +256,10 @@ public ConfigurationClientBuilder httpClient(HttpClient client) { * @return The updated ConfigurationClientBuilder object. */ public ConfigurationClientBuilder pipeline(HttpPipeline pipeline) { - Objects.requireNonNull(pipeline); + if (this.pipeline != null && pipeline == null) { + logger.info("HttpPipeline is being set to 'null' when it was previously configured."); + } + this.pipeline = pipeline; return this; } 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 5759ee76e2f7..6370024bb578 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 @@ -73,6 +73,7 @@ public URL baseUri() { * @param httpMethod the request HTTP method * @param contents the body content of the request * @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) { return contents diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java index 9bd010d7ebe5..3ee39c33eff7 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/ConfigurationSettingPage.java @@ -20,9 +20,9 @@ public final class ConfigurationSettingPage implements Page items; /** - * Gets the link to the next page. Or {@code null} if there are no more resources to fetch. + * Gets the link to the next page. * - * @return The link to the next page. + * @return The link to the next page or {@code null} if there are no more resources to fetch. */ @Override public String nextLink() { @@ -32,7 +32,7 @@ public String nextLink() { /** * Gets the list of {@link ConfigurationSetting ConfigurationSettings} on this page. * - * @return The list of items in {@link List}. + * @return The list of {@link ConfigurationSetting ConfigurationSettings}. */ @Override public List items() { diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/ConfigurationSetting.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/ConfigurationSetting.java index 24bf8709e7e9..27be16892dea 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/ConfigurationSetting.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/ConfigurationSetting.java @@ -11,9 +11,8 @@ import java.util.Objects; /** - * ConfigurationSetting is a resource identified by unique combination of {@link ConfigurationSetting#key() key} and - * {@link ConfigurationSetting#label() label}. By default, the label is {@code null}. To explicitly reference the - * default label use {@link ConfigurationSetting#NO_LABEL}. + * ConfigurationSetting is a resource identified by unique combination of {@link #key() key} and {@link #label() label}. + * By default, the label is {@code null}. To explicitly reference the default label use {@link #NO_LABEL}. */ @Fluent public class ConfigurationSetting { @@ -84,8 +83,8 @@ public String label() { } /** - * Sets the label of this configuration setting. {@link ConfigurationSetting#NO_LABEL} is the default label used - * when this value is not set. + * Sets the label of this configuration setting. {@link #NO_LABEL} is the default label used when this value is + * not set. * * @param label The label of this configuration setting. * @return The updated ConfigurationSetting object. diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/Range.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/Range.java index 07a7214acb94..b5a5e92463a1 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/Range.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/Range.java @@ -5,10 +5,11 @@ import com.azure.core.implementation.annotation.Immutable; import com.azure.data.appconfiguration.ConfigurationAsyncClient; import com.azure.data.appconfiguration.ConfigurationClient; +import com.azure.data.appconfiguration.implementation.ConfigurationSettingPage; /** - * A configuration for selecting a range of revisions when retrieving configuration setting revisions from the - * App Configuration service. + * A configuration for selecting a range of revisions that will be returned in a single + * {@link ConfigurationSettingPage response page} when retrieving revisions from the App Configuration service. * * @see ConfigurationAsyncClient#listSettingRevisions(SettingSelector) * @see ConfigurationClient#listSettingRevisions(SettingSelector) diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SettingSelector.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SettingSelector.java index 90856854f1aa..59c0a33bc028 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SettingSelector.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/SettingSelector.java @@ -14,17 +14,16 @@ * *
    *
  • - * Providing {@link SettingSelector#labels() labels} will filter - * {@link ConfigurationSetting ConfigurationSettings} that match any label name in conjunction with the keys - * that are passed in to the service request. + * Providing {@link #labels() labels} will filter {@link ConfigurationSetting ConfigurationSettings} that match + * any label name in conjunction with the keys that are passed in to the service request. *
  • *
  • - * Providing {@link SettingSelector#acceptDateTime() acceptDateTime} will return the representation of matching + * Providing {@link #acceptDateTime() acceptDateTime} will return the representation of matching * {@link ConfigurationSetting} at that given {@link OffsetDateTime}. *
  • *
  • - * Providing {@link SettingSelector#fields() fields} will populate only those {@link ConfigurationSetting} - * fields in the response. By default, all of the fields are returned. + * Providing {@link #fields() fields} will populate only those {@link ConfigurationSetting} fields in the + * response. By default, all of the fields are returned. *
  • *
* 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 b82ee1727458..379cce877425 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 @@ -4,6 +4,7 @@ package com.azure.data.appconfiguration; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.rest.Response; import com.azure.core.test.models.RecordedData; import com.azure.core.test.policy.RecordNetworkCallPolicy; @@ -34,7 +35,7 @@ public ConfigurationClient createAsyncConfigurationClientWithPipeline() { String connectionString = getConnectionString(); // BEGIN: com.azure.data.applicationconfig.configurationclient.pipeline.instantiation RecordedData networkData = new RecordedData(); - HttpPipeline pipeline = HttpPipeline.builder().policies(new RecordNetworkCallPolicy(networkData)).build(); + HttpPipeline pipeline = new HttpPipelineBuilder().policies(new RecordNetworkCallPolicy(networkData)).build(); ConfigurationClient configurationClient = new ConfigurationClientBuilder() .pipeline(pipeline) @@ -274,45 +275,57 @@ public void deleteSetting() { */ public void listSettings() { ConfigurationClient configurationClient = createSyncConfigurationClient(); - // BEGIN: com.azure.data.applicationconfig.configurationclient.listSettings#SettingSelector - for (ConfigurationSetting setting : configurationClient.listSettings(new SettingSelector() - .keys("prodDBConnection"))) { + // BEGIN: com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector + SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); + configurationClient.listSettings(settingSelector).forEach(setting -> { System.out.printf("Key: %s, Value: %s", setting.key(), setting.value()); - } - // END: com.azure.data.applicationconfig.configurationclient.listSettings#SettingSelector + }); + // END: com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector + } - /** - * Generates code sample for using {@link ConfigurationClient#listSettings(SettingSelector, Context)} - */ - // BEGIN: com.azure.data.applicationconfig.configurationclient.listSettings#SettingSelector-Context - for (ConfigurationSetting setting : configurationClient.listSettings(new SettingSelector() - .keys("prodDBConnection"), new Context(key1, value1))) { + /** + * Generates code sample for using {@link ConfigurationClient#listSettings(SettingSelector, Context)} + */ + public void listSettingsContext() { + ConfigurationClient configurationClient = createSyncConfigurationClient(); + // BEGIN: com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector-context + SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); + Context ctx = new Context(key2, value2); + configurationClient.listSettings(settingSelector, ctx).forEach(setting -> { System.out.printf("Key: %s, Value: %s", setting.key(), setting.value()); - } - // END: com.azure.data.applicationconfig.configurationclient.listSettings#SettingSelector-Context + }); + // END: com.azure.data.applicationconfig.configurationclient.listSettings#settingSelector-context } /** * Generates code sample for using {@link ConfigurationClient#listSettingRevisions(SettingSelector)} */ public void listSettingRevisions() { - ConfigurationClient configurationClient = createSyncConfigurationClient(); - // BEGIN: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#SettingSelector - for (ConfigurationSetting revision : configurationClient.listSettingRevisions(new SettingSelector() - .keys("prodDBConnection"))) { - System.out.printf("Key: %s, Value: %s", revision.key(), revision.value()); - } - // END: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#SettingSelector + ConfigurationClient client = createSyncConfigurationClient(); + // BEGIN: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#settingSelector + SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); + client.listSettingRevisions(settingSelector).streamByPage().forEach(resp -> { + System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.headers(), + resp.request().url(), resp.statusCode()); + resp.items().forEach(value -> { + System.out.printf("Response value is %d %n", value); + }); + }); + // END: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#settingSelector + } - /** - * Generates code sample for using {@link ConfigurationClient#listSettingRevisions(SettingSelector, Context)} - */ - // BEGIN: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#SettingSelector-Context - for (ConfigurationSetting revision : configurationClient.listSettingRevisions(new SettingSelector() - .keys("prodDBConnection"), new Context(key2, value2))) { - System.out.printf("Key: %s, Value: %s", revision.key(), revision.value()); - } - // END: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#SettingSelector-Context + /** + * Generates code sample for using {@link ConfigurationClient#listSettingRevisions(SettingSelector, Context)} + */ + public void listSettingRevisionsContext() { + ConfigurationClient configurationClient = createSyncConfigurationClient(); + // BEGIN: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#settingSelector-context + SettingSelector settingSelector = new SettingSelector().keys("prodDBConnection"); + Context ctx = new Context(key2, value2); + configurationClient.listSettingRevisions(settingSelector, ctx).forEach(setting -> { + System.out.printf("Key: %s, Value: %s", setting.key(), setting.value()); + }); + // END: com.azure.data.applicationconfig.configurationclient.listSettingRevisions#settingSelector-context } /** 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 a8ccda088e76..8b29dc51d313 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 @@ -7,6 +7,7 @@ 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.PagedFlux; import com.azure.core.http.rest.Response; import com.azure.core.util.logging.ClientLogger; import com.azure.data.appconfiguration.models.ConfigurationSetting; @@ -36,18 +37,18 @@ protected void beforeTest() { if (interceptorManager.isPlaybackMode()) { client = clientSetup(credentials -> new ConfigurationClientBuilder() - .credential(credentials) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient()); + .credential(credentials) + .httpClient(interceptorManager.getPlaybackClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .buildAsyncClient()); } else { client = clientSetup(credentials -> new ConfigurationClientBuilder() - .credential(credentials) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .addPolicy(new RetryPolicy()) - .buildAsyncClient()); + .credential(credentials) + .httpClient(HttpClient.createDefault().wiretap(true)) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addPolicy(interceptorManager.getRecordPolicy()) + .addPolicy(new RetryPolicy()) + .buildAsyncClient()); } } @@ -55,11 +56,11 @@ protected void beforeTest() { protected void afterTest() { logger.info("Cleaning up created key values."); client.listSettings(new SettingSelector().keys(keyPrefix + "*")) - .flatMap(configurationSetting -> { - logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.key(), configurationSetting.label(), configurationSetting.isLocked()); - return client.deleteSetting(configurationSetting); - }) - .blockLast(); + .flatMap(configurationSetting -> { + logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.key(), configurationSetting.label(), configurationSetting.isLocked()); + return client.deleteSetting(configurationSetting); + }) + .blockLast(); logger.info("Finished cleaning up values."); } @@ -121,8 +122,8 @@ public void addExistingSetting() { public void setSetting() { setSettingRunner((expected, update) -> StepVerifier.create(client.setSetting(expected)) - .assertNext(response -> assertConfigurationEquals(expected, response)) - .verifyComplete()); + .assertNext(response -> assertConfigurationEquals(expected, response)) + .verifyComplete()); } /** @@ -134,20 +135,20 @@ 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, HttpResponseStatus.PRECONDITION_FAILED.code())); final String etag = client.addSetting(initial).block().etag(); StepVerifier.create(client.setSetting(update.etag(etag))) - .assertNext(response -> assertConfigurationEquals(update, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(update, response)) + .verifyComplete(); StepVerifier.create(client.setSetting(initial)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.PRECONDITION_FAILED.code())); StepVerifier.create(client.getSetting(update)) - .assertNext(response -> assertConfigurationEquals(update, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(update, response)) + .verifyComplete(); }); } @@ -190,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, HttpResponseStatus.PRECONDITION_FAILED.code()))); } /** @@ -200,8 +201,8 @@ public void updateNoExistingSetting() { public void updateSetting() { updateSettingRunner((initial, update) -> StepVerifier.create(client.addSetting(initial)) - .assertNext(response -> assertConfigurationEquals(initial, response)) - .verifyComplete()); + .assertNext(response -> assertConfigurationEquals(initial, response)) + .verifyComplete()); } /** @@ -483,14 +484,14 @@ public void listSettingsAcceptDateTime() { // Create 3 revisions of the same key. StepVerifier.create(client.setSetting(original)) - .assertNext(response -> assertConfigurationEquals(original, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(original, response)) + .verifyComplete(); StepVerifier.create(client.setSetting(updated).delayElement(Duration.ofSeconds(2))) - .assertNext(response -> assertConfigurationEquals(updated, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(updated, response)) + .verifyComplete(); StepVerifier.create(client.setSetting(updated2)) - .assertNext(response -> assertConfigurationEquals(updated2, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(updated2, response)) + .verifyComplete(); // Gets all versions of this value so we can get the one we want at that particular date. List revisions = client.listSettingRevisions(new SettingSelector().keys(keyName)).collectList().block(); @@ -501,8 +502,8 @@ public void listSettingsAcceptDateTime() { // We want to fetch the configuration setting when we first updated its value. SettingSelector options = new SettingSelector().keys(keyName).acceptDatetime(revisions.get(1).lastModified()); StepVerifier.create(client.listSettings(options)) - .assertNext(response -> assertConfigurationEquals(updated, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(updated, response)) + .verifyComplete(); } /** @@ -517,28 +518,28 @@ public void listRevisions() { // Create 3 revisions of the same key. StepVerifier.create(client.setSetting(original)) - .assertNext(response -> assertConfigurationEquals(original, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(original, response)) + .verifyComplete(); StepVerifier.create(client.setSetting(updated)) - .assertNext(response -> assertConfigurationEquals(updated, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(updated, response)) + .verifyComplete(); StepVerifier.create(client.setSetting(updated2)) - .assertNext(response -> assertConfigurationEquals(updated2, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(updated2, response)) + .verifyComplete(); // Get all revisions for a key, they are listed in descending order. StepVerifier.create(client.listSettingRevisions(new SettingSelector().keys(keyName))) - .assertNext(response -> assertConfigurationEquals(updated2, response)) - .assertNext(response -> assertConfigurationEquals(updated, response)) - .assertNext(response -> assertConfigurationEquals(original, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(updated2, response)) + .assertNext(response -> assertConfigurationEquals(updated, response)) + .assertNext(response -> assertConfigurationEquals(original, response)) + .verifyComplete(); // Verifies that we can select specific fields. StepVerifier.create(client.listSettingRevisions(new SettingSelector().keys(keyName).fields(SettingFields.KEY, SettingFields.ETAG))) - .assertNext(response -> validateListRevisions(updated2, response)) - .assertNext(response -> validateListRevisions(updated, response)) - .assertNext(response -> validateListRevisions(original, response)) - .verifyComplete(); + .assertNext(response -> validateListRevisions(updated2, response)) + .assertNext(response -> validateListRevisions(updated, response)) + .assertNext(response -> validateListRevisions(original, response)) + .verifyComplete(); } /** @@ -669,14 +670,14 @@ public void listRevisionsAcceptDateTime() { // Create 3 revisions of the same key. StepVerifier.create(client.setSetting(original)) - .assertNext(response -> assertConfigurationEquals(original, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(original, response)) + .verifyComplete(); StepVerifier.create(client.setSetting(updated).delayElement(Duration.ofSeconds(2))) - .assertNext(response -> assertConfigurationEquals(updated, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(updated, response)) + .verifyComplete(); StepVerifier.create(client.setSetting(updated2)) - .assertNext(response -> assertConfigurationEquals(updated2, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(updated2, response)) + .verifyComplete(); // Gets all versions of this value. List revisions = client.listSettingRevisions(new SettingSelector().keys(keyName)).collectList().block(); @@ -688,9 +689,9 @@ public void listRevisionsAcceptDateTime() { // Revisions are returned in descending order from creation date. SettingSelector options = new SettingSelector().keys(keyName).acceptDatetime(revisions.get(1).lastModified()); StepVerifier.create(client.listSettingRevisions(options)) - .assertNext(response -> assertConfigurationEquals(updated, response)) - .assertNext(response -> assertConfigurationEquals(original, response)) - .verifyComplete(); + .assertNext(response -> assertConfigurationEquals(updated, response)) + .assertNext(response -> assertConfigurationEquals(original, response)) + .verifyComplete(); } /** @@ -717,6 +718,63 @@ public void listRevisionsWithPagination() { .verifyComplete(); } + /** + * Verifies that, given a ton of revisions, we can list the revisions ConfigurationSettings using pagination and stream is invoked multiple times. + * (ie. where 'nextLink' has a URL pointing to the next page of results.) + */ + public void listRevisionsWithPaginationAndRepeatStream() { + final int numberExpected = 50; + List settings = new ArrayList<>(numberExpected); + List>> results = new ArrayList<>(); + for (int value = 0; value < numberExpected; value++) { + ConfigurationSetting setting = new ConfigurationSetting().key(keyPrefix).value("myValue" + value).label(labelPrefix); + settings.add(setting); + results.add(client.setSettingWithResponse(setting)); + } + + SettingSelector filter = new SettingSelector().keys(keyPrefix).labels(labelPrefix); + + Flux.merge(results).blockLast(); + + List configurationSettingList1 = new ArrayList<>(); + List configurationSettingList2 = new ArrayList<>(); + + PagedFlux configurationSettingPagedFlux = client.listSettingRevisions(filter); + configurationSettingPagedFlux.toStream().forEach(configurationSetting -> configurationSettingList1.add(configurationSetting)); + assertEquals(numberExpected, configurationSettingList1.size()); + + configurationSettingPagedFlux.toStream().forEach(configurationSetting -> configurationSettingList2.add(configurationSetting)); + assertEquals(numberExpected, configurationSettingList2.size()); + } + + /** + * Verifies that, given a ton of revisions, we can list the revisions ConfigurationSettings using pagination and stream is invoked multiple times. + * (ie. where 'nextLink' has a URL pointing to the next page of results.) + */ + public void listRevisionsWithPaginationAndRepeatIterator() { + final int numberExpected = 50; + List settings = new ArrayList<>(numberExpected); + List>> results = new ArrayList<>(); + for (int value = 0; value < numberExpected; value++) { + ConfigurationSetting setting = new ConfigurationSetting().key(keyPrefix).value("myValue" + value).label(labelPrefix); + settings.add(setting); + results.add(client.setSettingWithResponse(setting)); + } + + SettingSelector filter = new SettingSelector().keys(keyPrefix).labels(labelPrefix); + + Flux.merge(results).blockLast(); + + List configurationSettingList1 = new ArrayList<>(); + List configurationSettingList2 = new ArrayList<>(); + + PagedFlux configurationSettingPagedFlux = client.listSettingRevisions(filter); + configurationSettingPagedFlux.toIterable().forEach(configurationSetting -> configurationSettingList1.add(configurationSetting)); + assertEquals(numberExpected, configurationSettingList1.size()); + + configurationSettingPagedFlux.toIterable().forEach(configurationSetting -> configurationSettingList2.add(configurationSetting)); + assertEquals(numberExpected, configurationSettingList2.size()); + } /** * Verifies that, given a ton of existing settings, we can list the ConfigurationSettings using pagination * (ie. where 'nextLink' has a URL pointing to the next page of results. 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 e016ed6c1e97..1f243bb73ec2 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,23 +2,28 @@ // Licensed under the MIT License. package com.azure.data.appconfiguration; +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 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 io.netty.handler.codec.http.HttpResponseStatus; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertArrayEquals; public class ConfigurationClientTest extends ConfigurationClientTestBase { private final ClientLogger logger = new ClientLogger(ConfigurationClientTest.class); @@ -49,11 +54,10 @@ protected void beforeTest() { @Override protected void afterTest() { logger.info("Cleaning up created key values."); - - for (ConfigurationSetting configurationSetting : client.listSettings(new SettingSelector().keys(keyPrefix + "*"))) { + client.listSettings(new SettingSelector().keys(keyPrefix + "*")).forEach(configurationSetting -> { logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.key(), configurationSetting.label(), configurationSetting.isLocked()); client.deleteSetting(configurationSetting); - } + }); logger.info("Finished cleaning up values."); } @@ -300,6 +304,7 @@ public void deleteSettingNullKey() { * Verifies that a ConfigurationSetting can be added with a label, and that we can fetch that ConfigurationSetting * from the service when filtering by either its label or just its key. */ + public void listWithKeyAndLabel() { final String value = "myValue"; final String key = getKey(); @@ -323,7 +328,7 @@ public void listWithMultipleKeys() { assertConfigurationEquals(setting, client.addSetting(setting)); assertConfigurationEquals(setting2, client.addSetting(setting2)); - return (List) client.listSettings(new SettingSelector().keys(key, key2)); + return client.listSettings(new SettingSelector().keys(key, key2)); }); } @@ -340,7 +345,7 @@ public void listWithMultipleLabels() { assertConfigurationEquals(setting, client.addSetting(setting)); assertConfigurationEquals(setting2, client.addSetting(setting2)); - return (List) client.listSettings(new SettingSelector().keys(key).labels(label, label2)); + return client.listSettings(new SettingSelector().keys(key).labels(label, label2)); }); } @@ -350,7 +355,7 @@ public void listWithMultipleLabels() { public void listSettingsSelectFields() { listSettingsSelectFieldsRunner((settings, selector) -> { settings.forEach(client::setSetting); - return (List) client.listSettings(selector); + return client.listSettings(selector); }); } @@ -375,14 +380,14 @@ public void listSettingsAcceptDateTime() { } // Gets all versions of this value so we can get the one we want at that particular date. - List revisions = (List) client.listSettingRevisions(new SettingSelector().keys(keyName)); + List revisions = client.listSettingRevisions(new SettingSelector().keys(keyName)).stream().collect(Collectors.toList()); assertNotNull(revisions); assertEquals(3, revisions.size()); // We want to fetch the configuration setting when we first updated its value. SettingSelector options = new SettingSelector().keys(keyName).acceptDatetime(revisions.get(1).lastModified()); - assertConfigurationEquals(updated, ((List) client.listSettings(options)).get(0)); + assertConfigurationEquals(updated, (client.listSettings(options).stream().collect(Collectors.toList())).get(0)); } /** @@ -401,13 +406,13 @@ public void listRevisions() { assertConfigurationEquals(updated2, client.setSetting(updated2)); // Get all revisions for a key, they are listed in descending order. - List revisions = (List) client.listSettingRevisions(new SettingSelector().keys(keyName)); + List revisions = client.listSettingRevisions(new SettingSelector().keys(keyName)).stream().collect(Collectors.toList()); assertConfigurationEquals(updated2, revisions.get(0)); assertConfigurationEquals(updated, revisions.get(1)); assertConfigurationEquals(original, revisions.get(2)); // Verifies that we can select specific fields. - revisions = (List) client.listSettingRevisions(new SettingSelector().keys(keyName).fields(SettingFields.KEY, SettingFields.ETAG)); + revisions = client.listSettingRevisions(new SettingSelector().keys(keyName).fields(SettingFields.KEY, SettingFields.ETAG)).stream().collect(Collectors.toList()); validateListRevisions(updated2, revisions.get(0)); validateListRevisions(updated, revisions.get(1)); validateListRevisions(original, revisions.get(2)); @@ -426,7 +431,7 @@ public void listRevisionsWithMultipleKeys() { assertConfigurationEquals(testInput.get(2), client.addSetting(testInput.get(2))); assertConfigurationEquals(testInput.get(3), client.updateSetting(testInput.get(3))); - return (List) client.listSettingRevisions(new SettingSelector().keys(key, key2)); + return client.listSettingRevisions(new SettingSelector().keys(key, key2)); }); } @@ -444,7 +449,7 @@ public void listRevisionsWithMultipleLabels() { assertConfigurationEquals(testInput.get(2), client.addSetting(testInput.get(2))); assertConfigurationEquals(testInput.get(3), client.updateSetting(testInput.get(3))); - return (List) client.listSettingRevisions(new SettingSelector().keys(key).labels(label, label2)); + return client.listSettingRevisions(new SettingSelector().keys(key).labels(label, label2)); }); } @@ -461,7 +466,7 @@ public void listRevisionsWithRange() { assertConfigurationEquals(updated, client.updateSetting(updated)); assertConfigurationEquals(updated2, client.updateSetting(updated2)); - List revisions = (List) client.listSettingRevisions(new SettingSelector().keys(key).range(new Range(1, 2))); + List revisions = client.listSettingRevisions(new SettingSelector().keys(key).range(new Range(1, 2))).stream().collect(Collectors.toList()); assertConfigurationEquals(updated, revisions.get(0)); assertConfigurationEquals(original, revisions.get(1)); } @@ -474,7 +479,7 @@ public void listRevisionsInvalidRange() { 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))), + assertRestException(() -> client.listSettingRevisions(new SettingSelector().keys(key).range(new Range(0, 10))).forEach(cs -> cs.key()), HttpResponseStatus.REQUESTED_RANGE_NOT_SATISFIABLE.code()); } @@ -499,7 +504,7 @@ public void listRevisionsAcceptDateTime() { } // Gets all versions of this value. - List revisions = (List) client.listSettingRevisions(new SettingSelector().keys(keyName)); + List revisions = client.listSettingRevisions(new SettingSelector().keys(keyName)).stream().collect(Collectors.toList()); assertNotNull(revisions); assertEquals(3, revisions.size()); @@ -507,7 +512,7 @@ public void listRevisionsAcceptDateTime() { // We want to fetch all the revisions that existed up and including when the first revision was created. // Revisions are returned in descending order from creation date. SettingSelector options = new SettingSelector().keys(keyName).acceptDatetime(revisions.get(1).lastModified()); - revisions = (List) client.listSettingRevisions(options); + revisions = client.listSettingRevisions(options).stream().collect(Collectors.toList()); assertConfigurationEquals(updated, revisions.get(0)); assertConfigurationEquals(original, revisions.get(1)); } @@ -523,7 +528,49 @@ public void listRevisionsWithPagination() { } SettingSelector filter = new SettingSelector().keys(keyPrefix).labels(labelPrefix); - assertEquals(numberExpected, ((List) client.listSettingRevisions(filter)).size()); + assertEquals(numberExpected, client.listSettingRevisions(filter).stream().collect(Collectors.toList()).size()); + } + + /** + * Verifies that, given a ton of revisions, we can process {@link java.util.stream.Stream} multiple time and get same result. + * (ie. where 'nextLink' has a URL pointing to the next page of results.) + */ + public void listRevisionsWithPaginationAndRepeatStream() { + final int numberExpected = 50; + for (int value = 0; value < numberExpected; value++) { + client.setSetting(new ConfigurationSetting().key(keyPrefix).value("myValue" + value).label(labelPrefix)); + } + + SettingSelector filter = new SettingSelector().keys(keyPrefix).labels(labelPrefix); + PagedIterable configurationSettingPagedIterable = client.listSettingRevisions(filter); + assertEquals(numberExpected, configurationSettingPagedIterable.stream().collect(Collectors.toList()).size()); + + assertEquals(numberExpected, configurationSettingPagedIterable.stream().collect(Collectors.toList()).size()); + } + + /** + * Verifies that, given a ton of revisions, we can iterate over multiple time and get same result. + * (ie. where 'nextLink' has a URL pointing to the next page of results.) + */ + public void listRevisionsWithPaginationAndRepeatIterator() { + final int numberExpected = 50; + for (int value = 0; value < numberExpected; value++) { + client.setSetting(new ConfigurationSetting().key(keyPrefix).value("myValue" + value).label(labelPrefix)); + } + + SettingSelector filter = new SettingSelector().keys(keyPrefix).labels(labelPrefix); + + PagedIterable configurationSettingPagedIterable = client.listSettingRevisions(filter); + List configurationSettingList1 = new ArrayList<>(); + List configurationSettingList2 = new ArrayList<>(); + + configurationSettingPagedIterable.iterator().forEachRemaining(configurationSetting -> configurationSettingList1.add(configurationSetting)); + assertEquals(numberExpected, configurationSettingList1.size()); + + configurationSettingPagedIterable.iterator().forEachRemaining(configurationSetting -> configurationSettingList2.add(configurationSetting)); + assertEquals(numberExpected, configurationSettingList2.size()); + + assertArrayEquals(configurationSettingList1.toArray(), configurationSettingList2.toArray()); } /** @@ -535,9 +582,9 @@ public void listSettingsWithPagination() { for (int value = 0; value < numberExpected; value++) { client.setSetting(new ConfigurationSetting().key(keyPrefix + "-" + value).value("myValue").label(labelPrefix)); } - SettingSelector filter = new SettingSelector().keys(keyPrefix + "-*").labels(labelPrefix); - assertEquals(numberExpected, ((List) client.listSettings(filter)).size()); + + assertEquals(numberExpected, client.listSettings(filter).stream().count()); } /** @@ -556,9 +603,10 @@ public void getSettingWhenValueNotUpdated() { } public void deleteAllSettings() { - for (ConfigurationSetting configurationSetting : client.listSettings(new SettingSelector().keys("*"))) { + + client.listSettings(new SettingSelector().keys("*")).forEach(configurationSetting -> { logger.info("Deleting key:label [{}:{}]. isLocked? {}", configurationSetting.key(), configurationSetting.label(), configurationSetting.isLocked()); client.deleteSetting(configurationSetting); - } + }); } } diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java b/sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java index 07fc0d897d44..097d604b5be8 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 @@ -2,6 +2,7 @@ // Licensed under the MIT License. package com.azure.data.appconfiguration; + import com.azure.data.appconfiguration.credentials.ConfigurationClientCredentials; import com.azure.data.appconfiguration.models.ConfigurationSetting; import com.azure.data.appconfiguration.models.SettingFields; @@ -307,22 +308,18 @@ void deleteSettingWithETagRunner(BiConsumer> testRunner) { + void listWithMultipleKeysRunner(String key, String key2, BiFunction> testRunner) { final ConfigurationSetting setting = new ConfigurationSetting().key(key).value("value"); final ConfigurationSetting setting2 = new ConfigurationSetting().key(key2).value("value"); final Set expectedSelection = new HashSet<>(Arrays.asList(setting, setting2)); - - for (ConfigurationSetting actual : testRunner.apply(setting, setting2)) { - expectedSelection.removeIf(expected -> expected.equals(cleanResponse(expected, actual))); - } - + testRunner.apply(setting, setting2).forEach(actual -> expectedSelection.removeIf(expected -> expected.equals(cleanResponse(expected, actual)))); assertTrue(expectedSelection.isEmpty()); } @Test public abstract void listWithMultipleLabels(); - void listWithMultipleLabelsRunner(String key, String label, String label2, BiFunction> testRunner) { + void listWithMultipleLabelsRunner(String key, String label, String label2, BiFunction> testRunner) { final ConfigurationSetting setting = new ConfigurationSetting().key(key).value("value").label(label); final ConfigurationSetting setting2 = new ConfigurationSetting().key(key).value("value").label(label2); final Set expectedSelection = new HashSet<>(Arrays.asList(setting, setting2)); @@ -337,7 +334,7 @@ void listWithMultipleLabelsRunner(String key, String label, String label2, BiFun @Test public abstract void listSettingsSelectFields(); - void listSettingsSelectFieldsRunner(BiFunction, SettingSelector, List> testRunner) { + void listSettingsSelectFieldsRunner(BiFunction, SettingSelector, Iterable> testRunner) { final String label = "my-first-mylabel"; final String label2 = "my-second-mylabel"; final int numberToCreate = 8; @@ -386,7 +383,7 @@ static void validateListRevisions(ConfigurationSetting expected, ConfigurationSe @Test public abstract void listRevisionsWithMultipleKeys(); - void listRevisionsWithMultipleKeysRunner(String key, String key2, Function, List> testRunner) { + void listRevisionsWithMultipleKeysRunner(String key, String key2, Function, Iterable> testRunner) { final ConfigurationSetting setting = new ConfigurationSetting().key(key).value("value"); final ConfigurationSetting settingUpdate = new ConfigurationSetting().key(setting.key()).value("updatedValue"); final ConfigurationSetting setting2 = new ConfigurationSetting().key(key2).value("value"); @@ -404,7 +401,7 @@ void listRevisionsWithMultipleKeysRunner(String key, String key2, Function, List> testRunner) { + void listRevisionsWithMultipleLabelsRunner(String key, String label, String label2, Function, Iterable> testRunner) { final ConfigurationSetting setting = new ConfigurationSetting().key(key).value("value").label(label); final ConfigurationSetting settingUpdate = new ConfigurationSetting().key(setting.key()).label(setting.label()).value("updatedValue"); final ConfigurationSetting setting2 = new ConfigurationSetting().key(key).value("value").label(label2); @@ -434,6 +431,12 @@ void listRevisionsWithMultipleLabelsRunner(String key, String label, String labe @Test public abstract void listSettingsWithPagination(); + @Test + public abstract void listRevisionsWithPaginationAndRepeatStream(); + + @Test + public abstract void listRevisionsWithPaginationAndRepeatIterator(); + @Ignore("Getting a configuration setting only when the value has changed is not a common scenario.") @Test public abstract void getSettingWhenValueNotUpdated(); diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/resources/session-records/listRevisionsWithPaginationAndRepeatIterator.json b/sdk/appconfiguration/azure-data-appconfiguration/src/test/resources/session-records/listRevisionsWithPaginationAndRepeatIterator.json new file mode 100644 index 000000000000..5a8b8a78347b --- /dev/null +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/resources/session-records/listRevisionsWithPaginationAndRepeatIterator.json @@ -0,0 +1,1566 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "bceb4088-c3b0-4454-a66a-0c9151fa7e71", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"p0MB3FVqBFZjVNLxsswPOLhAhbw\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4NzQ=;sn=355874", + "x-ms-request-id" : "bceb4088-c3b0-4454-a66a-0c9151fa7e71", + "Body" : "{\"etag\":\"p0MB3FVqBFZjVNLxsswPOLhAhbw\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue0\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"}", + "x-ms-client-request-id" : "d2bdf27e-408f-4b17-b493-d1ffacd6326d", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "4193214e-5f67-4270-ab89-54f42fa54127", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"00dvZCg3Agikg0apkpzWHdwbWg3\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4NzU=;sn=355875", + "x-ms-request-id" : "4193214e-5f67-4270-ab89-54f42fa54127", + "Body" : "{\"etag\":\"00dvZCg3Agikg0apkpzWHdwbWg3\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue1\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"}", + "x-ms-client-request-id" : "3000c086-0f8a-47f1-aeaa-9a69161312d7", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "54658145-c0fb-47fa-b631-1cc420a6b02d", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"Av6PbtuhxNQ1Izr7PKoVfXD1laB\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4NzY=;sn=355876", + "x-ms-request-id" : "54658145-c0fb-47fa-b631-1cc420a6b02d", + "Body" : "{\"etag\":\"Av6PbtuhxNQ1Izr7PKoVfXD1laB\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue2\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"}", + "x-ms-client-request-id" : "07d6814d-ab25-46e1-afa4-655d3b0b6590", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "a7fa2fe0-fe9c-4abb-9271-0e9d6f312b27", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"M1Op5GHGFIhiJ2UGh5oOtUBqLUM\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4Nzc=;sn=355877", + "x-ms-request-id" : "a7fa2fe0-fe9c-4abb-9271-0e9d6f312b27", + "Body" : "{\"etag\":\"M1Op5GHGFIhiJ2UGh5oOtUBqLUM\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue3\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"}", + "x-ms-client-request-id" : "de2ef565-d821-4034-baab-c0c9a40126cc", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "7e383573-4916-4de1-b8d8-fa1f9efdc5d0", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"p9RxmrmZRawSLeckvkXstrivMyo\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4Nzg=;sn=355878", + "x-ms-request-id" : "7e383573-4916-4de1-b8d8-fa1f9efdc5d0", + "Body" : "{\"etag\":\"p9RxmrmZRawSLeckvkXstrivMyo\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue4\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"}", + "x-ms-client-request-id" : "1c7acd25-7b63-4577-acb3-8ad7ea36ae69", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "136b4995-a72d-4904-b6ba-060ad4944288", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"8Devdke7sMPe04s3PwZKw6qfk6z\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4Nzk=;sn=355879", + "x-ms-request-id" : "136b4995-a72d-4904-b6ba-060ad4944288", + "Body" : "{\"etag\":\"8Devdke7sMPe04s3PwZKw6qfk6z\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue5\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"}", + "x-ms-client-request-id" : "c93dfa6f-fd73-42a4-b034-03408215476a", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "be84bf67-fb78-4567-9e94-0048949e6268", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"YhAhxzohYdYHtwflMeYCW9lGmSI\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4ODA=;sn=355880", + "x-ms-request-id" : "be84bf67-fb78-4567-9e94-0048949e6268", + "Body" : "{\"etag\":\"YhAhxzohYdYHtwflMeYCW9lGmSI\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue6\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"}", + "x-ms-client-request-id" : "c1d401aa-3848-4f54-88f6-efb2089d1ea6", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:56 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "bd7e7b5f-2015-4321-a406-7e7803234eac", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"C8shr4IPeLKH9OH389cfhCWnluO\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4ODE=;sn=355881", + "x-ms-request-id" : "bd7e7b5f-2015-4321-a406-7e7803234eac", + "Body" : "{\"etag\":\"C8shr4IPeLKH9OH389cfhCWnluO\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue7\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"}", + "x-ms-client-request-id" : "54bae747-9a00-453a-ae47-6d0156a712c9", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "bd0bfec6-f4c5-41d7-addf-77e69d7fe4a8", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"Up43irEjbjqalUXffHvAAY8IOSK\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4ODI=;sn=355882", + "x-ms-request-id" : "bd0bfec6-f4c5-41d7-addf-77e69d7fe4a8", + "Body" : "{\"etag\":\"Up43irEjbjqalUXffHvAAY8IOSK\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue8\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "a2a7eba3-7293-48cc-9a33-9e9d1d8296cf", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "48cfda9c-8d2b-479d-9f44-0141d7dd1360", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"ZXkcRmcmYybeUZfIoXHjx3h6gHl\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4ODM=;sn=355883", + "x-ms-request-id" : "48cfda9c-8d2b-479d-9f44-0141d7dd1360", + "Body" : "{\"etag\":\"ZXkcRmcmYybeUZfIoXHjx3h6gHl\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue9\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "cb067747-0ce6-4b1f-a11d-f401bf07177f", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "0af69448-1fc5-453e-8ae3-1f29cafdf993", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"udup4cnXm2J1wCkSX6hrEsmp0jS\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4ODQ=;sn=355884", + "x-ms-request-id" : "0af69448-1fc5-453e-8ae3-1f29cafdf993", + "Body" : "{\"etag\":\"udup4cnXm2J1wCkSX6hrEsmp0jS\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue10\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "3af5db32-27a1-489c-b880-78cc41073256", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "b3395e3a-c98f-477d-88ac-14562005d1bc", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"620Rpelck23ILRestB0TMMwA0AX\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4ODU=;sn=355885", + "x-ms-request-id" : "b3395e3a-c98f-477d-88ac-14562005d1bc", + "Body" : "{\"etag\":\"620Rpelck23ILRestB0TMMwA0AX\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue11\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "d1b59f2d-5aa1-42bb-b533-85ae24b89817", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "61e68673-4082-4a35-bda2-8a3942331829", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"q5W7UXp1miYWUjOljt6NqIBxQCL\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4ODY=;sn=355886", + "x-ms-request-id" : "61e68673-4082-4a35-bda2-8a3942331829", + "Body" : "{\"etag\":\"q5W7UXp1miYWUjOljt6NqIBxQCL\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue12\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "7620189b-34a9-4434-a5ff-64a14525b929", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "39140317-21d7-45de-819e-d95abdebf35a", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"Usldr2j3QJbxVgeNv8r9rNpwq05\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4ODc=;sn=355887", + "x-ms-request-id" : "39140317-21d7-45de-819e-d95abdebf35a", + "Body" : "{\"etag\":\"Usldr2j3QJbxVgeNv8r9rNpwq05\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue13\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "65ad371d-3858-4e73-826c-cd9d09320083", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "40ac7bb8-ed66-4ae2-b989-b337df250088", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"vlaOlFXK0JhM5pTaFesWP2IjN4q\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4ODg=;sn=355888", + "x-ms-request-id" : "40ac7bb8-ed66-4ae2-b989-b337df250088", + "Body" : "{\"etag\":\"vlaOlFXK0JhM5pTaFesWP2IjN4q\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue14\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "cdefd95b-8608-4719-b83d-bed12685ca85", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "bf774467-8a53-4f19-81a4-11a02cab034f", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"PuS2hCuYdTOzQMN9DrsXpeAggwm\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4ODk=;sn=355889", + "x-ms-request-id" : "bf774467-8a53-4f19-81a4-11a02cab034f", + "Body" : "{\"etag\":\"PuS2hCuYdTOzQMN9DrsXpeAggwm\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue15\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "006aec97-d3eb-4fca-9a1b-81cdab2c1bf2", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "225f520a-d0ef-425a-80d4-fcc99ef4769e", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"twa1k4YYgm4NxGP9nZHvYamP4CN\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4OTA=;sn=355890", + "x-ms-request-id" : "225f520a-d0ef-425a-80d4-fcc99ef4769e", + "Body" : "{\"etag\":\"twa1k4YYgm4NxGP9nZHvYamP4CN\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue16\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "55b82130-96dd-4dae-9164-c0f895d93dab", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:56 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "f2e7480d-66bf-4ba4-be50-e0185ce45f5f", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"XP7Pbv623eatufHiKTkq5HpFDSa\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4OTE=;sn=355891", + "x-ms-request-id" : "f2e7480d-66bf-4ba4-be50-e0185ce45f5f", + "Body" : "{\"etag\":\"XP7Pbv623eatufHiKTkq5HpFDSa\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue17\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "70f80ed5-cfbb-47a2-8adf-38c8a86442a4", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "85cdb848-4c94-4d5e-951a-aed3241e3b0e", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"wHw9EdHFL2ieEAXdBEPem9KW0A8\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4OTI=;sn=355892", + "x-ms-request-id" : "85cdb848-4c94-4d5e-951a-aed3241e3b0e", + "Body" : "{\"etag\":\"wHw9EdHFL2ieEAXdBEPem9KW0A8\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue18\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "12960f73-ddb1-4851-9111-7360667a7a56", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "9fb59f85-2e10-429d-b81b-30db040b9fb9", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"oZwOhlAepkUSGd1qN7oTZLdKCJV\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4OTM=;sn=355893", + "x-ms-request-id" : "9fb59f85-2e10-429d-b81b-30db040b9fb9", + "Body" : "{\"etag\":\"oZwOhlAepkUSGd1qN7oTZLdKCJV\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue19\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "4130669e-ac5e-4f43-b1bd-43abe585533c", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "3428896b-437d-4fac-abe3-5632d3cbd658", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"7CQJNMuky9Gqq9Qcqsgj22NdG5F\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4OTQ=;sn=355894", + "x-ms-request-id" : "3428896b-437d-4fac-abe3-5632d3cbd658", + "Body" : "{\"etag\":\"7CQJNMuky9Gqq9Qcqsgj22NdG5F\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue20\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "a069cebe-a5b4-48c5-95c5-94c3d7d3eaf9", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "06ec0683-2f72-4744-bb42-ccd9d5c3652a", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"l9X9deLtYeTmwqTucwoYtzP2EQh\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4OTU=;sn=355895", + "x-ms-request-id" : "06ec0683-2f72-4744-bb42-ccd9d5c3652a", + "Body" : "{\"etag\":\"l9X9deLtYeTmwqTucwoYtzP2EQh\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue21\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "f8c13f88-89a7-42b2-a5fc-48b34933a8e5", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "bc39a19e-73f7-4913-b375-ab902891f0d3", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"dSDAldBXJNPHSlUxrB3bVtAlrDr\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4OTY=;sn=355896", + "x-ms-request-id" : "bc39a19e-73f7-4913-b375-ab902891f0d3", + "Body" : "{\"etag\":\"dSDAldBXJNPHSlUxrB3bVtAlrDr\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue22\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "e3a6bc07-2c07-4d50-a0ee-9dafe1f29caf", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "b580fe5c-2f9b-458e-bf93-e332af7e7579", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"bBXCRuTyjV48XDYWCld5T1wsJEK\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4OTc=;sn=355897", + "x-ms-request-id" : "b580fe5c-2f9b-458e-bf93-e332af7e7579", + "Body" : "{\"etag\":\"bBXCRuTyjV48XDYWCld5T1wsJEK\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue23\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "ede36812-3d18-436e-9144-c57351baa827", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "d6939593-32f1-4cbc-b1aa-4006dbe7125f", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"Xb3bwvgDRP2khWPffFH50MHQtCl\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4OTg=;sn=355898", + "x-ms-request-id" : "d6939593-32f1-4cbc-b1aa-4006dbe7125f", + "Body" : "{\"etag\":\"Xb3bwvgDRP2khWPffFH50MHQtCl\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue24\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "dae9c320-abb0-4e6f-afcf-9223b445db24", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "29327c51-8cc6-4834-bf1e-13d4dfeddd40", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"4kukVlmat3kcn834zTAvHSohV30\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU4OTk=;sn=355899", + "x-ms-request-id" : "29327c51-8cc6-4834-bf1e-13d4dfeddd40", + "Body" : "{\"etag\":\"4kukVlmat3kcn834zTAvHSohV30\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue25\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "8839dadb-9412-4702-8742-8aa3be5b6193", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:57 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "d3b5e300-a1dc-4ab7-951b-e8a04942759f", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"8BO9QpmYmpcOOBJj0OyQYcWwz7A\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MDA=;sn=355900", + "x-ms-request-id" : "d3b5e300-a1dc-4ab7-951b-e8a04942759f", + "Body" : "{\"etag\":\"8BO9QpmYmpcOOBJj0OyQYcWwz7A\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue26\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"}", + "x-ms-client-request-id" : "4fb5a3ed-f863-496a-9920-e4836e1db3a5", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "1c113ae9-ac4b-42c9-81e5-8bc97e91aa0f", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"7AQSsfZ2RojgFR1GXdyIsk1taDx\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MDE=;sn=355901", + "x-ms-request-id" : "1c113ae9-ac4b-42c9-81e5-8bc97e91aa0f", + "Body" : "{\"etag\":\"7AQSsfZ2RojgFR1GXdyIsk1taDx\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue27\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "a16b10f0-40e0-429c-afa8-07fab38beb4a", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "1fde4c4b-3980-4161-8769-e87010f8af85", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"eYXq9IaXn6ixTKt0JAOKGZhNJOS\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MDI=;sn=355902", + "x-ms-request-id" : "1fde4c4b-3980-4161-8769-e87010f8af85", + "Body" : "{\"etag\":\"eYXq9IaXn6ixTKt0JAOKGZhNJOS\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue28\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "bb552f2b-e76a-418b-898f-7ba8ca8f4b04", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "13c7f463-a3ab-4881-8539-fab9158cf413", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"MePefJ3j6qhoUpxBrrQVMazWYwF\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MDM=;sn=355903", + "x-ms-request-id" : "13c7f463-a3ab-4881-8539-fab9158cf413", + "Body" : "{\"etag\":\"MePefJ3j6qhoUpxBrrQVMazWYwF\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue29\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "900e6871-c5cc-47f4-a0a7-15897af86e6d", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "d650b894-71f1-42ca-ae70-e14f20e4a6ce", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"kahfNTljWMpvGYGG5ToAldMDbt3\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MDQ=;sn=355904", + "x-ms-request-id" : "d650b894-71f1-42ca-ae70-e14f20e4a6ce", + "Body" : "{\"etag\":\"kahfNTljWMpvGYGG5ToAldMDbt3\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue30\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "ceb5a2bd-a57b-471f-9db2-d894cf07ab46", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "0b7f919f-16fa-495f-8044-7dc8ebe15c6f", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"jipB3VSo7sdhmaUZJuOmAaY9lgn\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MDU=;sn=355905", + "x-ms-request-id" : "0b7f919f-16fa-495f-8044-7dc8ebe15c6f", + "Body" : "{\"etag\":\"jipB3VSo7sdhmaUZJuOmAaY9lgn\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue31\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "3b2a6948-cfe3-46e3-b77c-b915ed145251", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "ffa87632-69ba-4acd-a73b-407caf5b049c", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"9EhSnnaOQOS5Lh2HfxNhrwBS1su\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MDY=;sn=355906", + "x-ms-request-id" : "ffa87632-69ba-4acd-a73b-407caf5b049c", + "Body" : "{\"etag\":\"9EhSnnaOQOS5Lh2HfxNhrwBS1su\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue32\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "db9a426b-f9a3-483c-b905-6a578adc3231", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "24f6641c-ef0d-4f91-8e79-0433aa1c4261", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"m9MW3xrJBfXhHcEkmJaaJF5OPKw\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MDc=;sn=355907", + "x-ms-request-id" : "24f6641c-ef0d-4f91-8e79-0433aa1c4261", + "Body" : "{\"etag\":\"m9MW3xrJBfXhHcEkmJaaJF5OPKw\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue33\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "826d15bc-dd6a-4f03-ab9f-332b631b6639", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "134d2c55-8dd0-47f9-807b-0ae56872ab03", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"7MoKeeNubE0KODpNpfTuGIzBlwd\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MDg=;sn=355908", + "x-ms-request-id" : "134d2c55-8dd0-47f9-807b-0ae56872ab03", + "Body" : "{\"etag\":\"7MoKeeNubE0KODpNpfTuGIzBlwd\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue34\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "fce4b573-e443-4716-ad81-cf2b6af3bf43", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "99d685eb-18ab-4f52-acb1-49ae7c061328", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"7cLVmuRCZycFRHVEORZISnLXw24\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MDk=;sn=355909", + "x-ms-request-id" : "99d685eb-18ab-4f52-acb1-49ae7c061328", + "Body" : "{\"etag\":\"7cLVmuRCZycFRHVEORZISnLXw24\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue35\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "8ac07158-e099-4244-8375-33cf52f22309", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:57 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "939f6381-9adb-42b6-a258-85c5e60b4e9d", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"Eh0OBSjMqf5WJo7XokfdLlegCAt\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MTA=;sn=355910", + "x-ms-request-id" : "939f6381-9adb-42b6-a258-85c5e60b4e9d", + "Body" : "{\"etag\":\"Eh0OBSjMqf5WJo7XokfdLlegCAt\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue36\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "a90719d6-1772-46f4-a8d1-5fdc0ecdfaa6", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "4fe59c3b-f372-4d30-8983-5dcbd9dbcbaa", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"gIdLMmhbXMggBZivNgx67KwqZhm\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MTE=;sn=355911", + "x-ms-request-id" : "4fe59c3b-f372-4d30-8983-5dcbd9dbcbaa", + "Body" : "{\"etag\":\"gIdLMmhbXMggBZivNgx67KwqZhm\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue37\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "400df51a-c26b-4e72-ba96-1750332db3a3", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "3fdf9c2f-c8a3-4fa4-bae1-0d95bfb417f8", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"14PbIi2LwReXsOvpHAbKNjsr0XW\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MTI=;sn=355912", + "x-ms-request-id" : "3fdf9c2f-c8a3-4fa4-bae1-0d95bfb417f8", + "Body" : "{\"etag\":\"14PbIi2LwReXsOvpHAbKNjsr0XW\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue38\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "ce1ec363-1ddb-45dd-93f1-8d4df87c0676", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "902ac7d1-7c3b-4485-b99e-6935b3624ee1", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"UfIowR4bMvwG95aQGEXNbbRehFD\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MTM=;sn=355913", + "x-ms-request-id" : "902ac7d1-7c3b-4485-b99e-6935b3624ee1", + "Body" : "{\"etag\":\"UfIowR4bMvwG95aQGEXNbbRehFD\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue39\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "306a548d-f99b-4017-be6a-be66c47c4146", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "79fcc3a8-4b00-4f42-bc0d-3481c49b0898", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"PLkDXVkfpxYR062op1QXDEIJPeP\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MTQ=;sn=355914", + "x-ms-request-id" : "79fcc3a8-4b00-4f42-bc0d-3481c49b0898", + "Body" : "{\"etag\":\"PLkDXVkfpxYR062op1QXDEIJPeP\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue40\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "04f0efbb-fc25-4519-aa79-329af3c3f11f", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "d150fad7-9754-4f6d-a8c8-40ac74686e7a", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"YBYK7AOZFn8dvB7JQYsbMs4rPCN\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MTU=;sn=355915", + "x-ms-request-id" : "d150fad7-9754-4f6d-a8c8-40ac74686e7a", + "Body" : "{\"etag\":\"YBYK7AOZFn8dvB7JQYsbMs4rPCN\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue41\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "d1d19ec4-e9a5-49a1-9bce-7c95d25d3566", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "af50b9c5-748a-4d30-96f8-82e5dbafb9eb", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"ttkE3tSHjAz5g3JZB2xBUwWcCc5\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MTY=;sn=355916", + "x-ms-request-id" : "af50b9c5-748a-4d30-96f8-82e5dbafb9eb", + "Body" : "{\"etag\":\"ttkE3tSHjAz5g3JZB2xBUwWcCc5\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue42\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "f6efcf61-6a26-4e4e-b203-f57edf2eae44", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "2f45673f-9282-4a15-b872-12b165bc45bb", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"fnDLu9m9abKhRRpj5exGHghyNT2\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MTc=;sn=355917", + "x-ms-request-id" : "2f45673f-9282-4a15-b872-12b165bc45bb", + "Body" : "{\"etag\":\"fnDLu9m9abKhRRpj5exGHghyNT2\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue43\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "3a66dc81-48f5-49d6-8120-cab67ec994ad", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "19b3197a-c6ba-4e22-8bc7-00a7312f426a", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"lZJMSpLWpxr8fDMPv5MTslfH3es\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MTg=;sn=355918", + "x-ms-request-id" : "19b3197a-c6ba-4e22-8bc7-00a7312f426a", + "Body" : "{\"etag\":\"lZJMSpLWpxr8fDMPv5MTslfH3es\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue44\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "7fa7acef-f262-4868-9a82-0b0508f2acad", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "46f02fb7-4cc6-4a65-982a-9de3ded6fbab", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"KbRgqrExC3HwExbGiEURez7MCe7\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MTk=;sn=355919", + "x-ms-request-id" : "46f02fb7-4cc6-4a65-982a-9de3ded6fbab", + "Body" : "{\"etag\":\"KbRgqrExC3HwExbGiEURez7MCe7\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue45\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "d83c2ae0-419f-43e5-bffa-4c924ca11965", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:58 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "cb11df65-b755-4c3a-94bb-c70c343374ec", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"SKQfsxODWRLzlc9W71gm9KlymaQ\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MjA=;sn=355920", + "x-ms-request-id" : "cb11df65-b755-4c3a-94bb-c70c343374ec", + "Body" : "{\"etag\":\"SKQfsxODWRLzlc9W71gm9KlymaQ\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue46\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"}", + "x-ms-client-request-id" : "196078e0-61a2-458f-84df-2bb154b19bfa", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "96d9e214-32a1-4849-98d8-17c4bac4e827", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"mwq67iQg4n3SJNxi2N84nLHVAjp\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MjE=;sn=355921", + "x-ms-request-id" : "96d9e214-32a1-4849-98d8-17c4bac4e827", + "Body" : "{\"etag\":\"mwq67iQg4n3SJNxi2N84nLHVAjp\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue47\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:59+00:00\"}", + "x-ms-client-request-id" : "a6040bee-0015-4422-b9ce-3645b17a0ada", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "91960e5d-948a-4d19-ad07-76a3980416cc", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"TpKeD6knT84Bs1w9jurOrBpdSIV\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MjI=;sn=355922", + "x-ms-request-id" : "91960e5d-948a-4d19-ad07-76a3980416cc", + "Body" : "{\"etag\":\"TpKeD6knT84Bs1w9jurOrBpdSIV\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue48\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:59+00:00\"}", + "x-ms-client-request-id" : "cda1f520-288e-4356-8e65-97fc3b2543d9", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "63b39d90-8ad5-41ae-9417-6505154c8a9a", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"sOK6GPuWPLaVj9h4PWvdIADBa7E\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MjM=;sn=355923", + "x-ms-request-id" : "63b39d90-8ad5-41ae-9417-6505154c8a9a", + "Body" : "{\"etag\":\"sOK6GPuWPLaVj9h4PWvdIADBa7E\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue49\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:59+00:00\"}", + "x-ms-client-request-id" : "28cf2fda-caf5-44e5-b51e-87cbcc710b31", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://hemant-appconfiguration.azconfig.io/revisions?key=key74257&label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "8ac01a41-9074-4714-87b7-56a4ab749e11", + "Accept-Ranges" : "items", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MjM=;sn=355923", + "x-ms-request-id" : "8ac01a41-9074-4714-87b7-56a4ab749e11", + "Body" : "{\"items\":[{\"etag\":\"sOK6GPuWPLaVj9h4PWvdIADBa7E\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue49\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:59+00:00\"},{\"etag\":\"TpKeD6knT84Bs1w9jurOrBpdSIV\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue48\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:59+00:00\"},{\"etag\":\"mwq67iQg4n3SJNxi2N84nLHVAjp\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue47\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:59+00:00\"},{\"etag\":\"SKQfsxODWRLzlc9W71gm9KlymaQ\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue46\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"KbRgqrExC3HwExbGiEURez7MCe7\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue45\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"lZJMSpLWpxr8fDMPv5MTslfH3es\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue44\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"fnDLu9m9abKhRRpj5exGHghyNT2\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue43\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"ttkE3tSHjAz5g3JZB2xBUwWcCc5\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue42\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"YBYK7AOZFn8dvB7JQYsbMs4rPCN\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue41\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"PLkDXVkfpxYR062op1QXDEIJPeP\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue40\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"UfIowR4bMvwG95aQGEXNbbRehFD\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue39\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"14PbIi2LwReXsOvpHAbKNjsr0XW\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue38\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"gIdLMmhbXMggBZivNgx67KwqZhm\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue37\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"Eh0OBSjMqf5WJo7XokfdLlegCAt\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue36\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"7cLVmuRCZycFRHVEORZISnLXw24\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue35\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"7MoKeeNubE0KODpNpfTuGIzBlwd\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue34\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"m9MW3xrJBfXhHcEkmJaaJF5OPKw\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue33\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"9EhSnnaOQOS5Lh2HfxNhrwBS1su\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue32\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"jipB3VSo7sdhmaUZJuOmAaY9lgn\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue31\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"kahfNTljWMpvGYGG5ToAldMDbt3\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue30\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"MePefJ3j6qhoUpxBrrQVMazWYwF\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue29\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"eYXq9IaXn6ixTKt0JAOKGZhNJOS\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue28\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"7AQSsfZ2RojgFR1GXdyIsk1taDx\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue27\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"8BO9QpmYmpcOOBJj0OyQYcWwz7A\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue26\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"4kukVlmat3kcn834zTAvHSohV30\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue25\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"Xb3bwvgDRP2khWPffFH50MHQtCl\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue24\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"bBXCRuTyjV48XDYWCld5T1wsJEK\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue23\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"dSDAldBXJNPHSlUxrB3bVtAlrDr\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue22\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"l9X9deLtYeTmwqTucwoYtzP2EQh\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue21\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"7CQJNMuky9Gqq9Qcqsgj22NdG5F\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue20\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"oZwOhlAepkUSGd1qN7oTZLdKCJV\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue19\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"wHw9EdHFL2ieEAXdBEPem9KW0A8\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue18\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"XP7Pbv623eatufHiKTkq5HpFDSa\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue17\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"twa1k4YYgm4NxGP9nZHvYamP4CN\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue16\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"PuS2hCuYdTOzQMN9DrsXpeAggwm\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue15\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"vlaOlFXK0JhM5pTaFesWP2IjN4q\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue14\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"Usldr2j3QJbxVgeNv8r9rNpwq05\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue13\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"q5W7UXp1miYWUjOljt6NqIBxQCL\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue12\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"620Rpelck23ILRestB0TMMwA0AX\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue11\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"udup4cnXm2J1wCkSX6hrEsmp0jS\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue10\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"ZXkcRmcmYybeUZfIoXHjx3h6gHl\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue9\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"Up43irEjbjqalUXffHvAAY8IOSK\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue8\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"C8shr4IPeLKH9OH389cfhCWnluO\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue7\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"YhAhxzohYdYHtwflMeYCW9lGmSI\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue6\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"8Devdke7sMPe04s3PwZKw6qfk6z\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue5\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"p9RxmrmZRawSLeckvkXstrivMyo\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue4\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"M1Op5GHGFIhiJ2UGh5oOtUBqLUM\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue3\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"Av6PbtuhxNQ1Izr7PKoVfXD1laB\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue2\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"00dvZCg3Agikg0apkpzWHdwbWg3\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue1\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"p0MB3FVqBFZjVNLxsswPOLhAhbw\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue0\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"}]}", + "x-ms-client-request-id" : "8b6367f4-d5d5-44fc-88ba-2373a3ffc68c", + "Content-Type" : "application/vnd.microsoft.appconfig.kvset+json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://hemant-appconfiguration.azconfig.io/revisions?key=key74257&label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0 azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "eea14767-af9a-4d00-80f7-6aff532ebcf6", + "Accept-Ranges" : "items", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MjM=;sn=355923", + "x-ms-request-id" : "eea14767-af9a-4d00-80f7-6aff532ebcf6", + "Body" : "{\"items\":[{\"etag\":\"sOK6GPuWPLaVj9h4PWvdIADBa7E\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue49\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:59+00:00\"},{\"etag\":\"TpKeD6knT84Bs1w9jurOrBpdSIV\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue48\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:59+00:00\"},{\"etag\":\"mwq67iQg4n3SJNxi2N84nLHVAjp\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue47\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:59+00:00\"},{\"etag\":\"SKQfsxODWRLzlc9W71gm9KlymaQ\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue46\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"KbRgqrExC3HwExbGiEURez7MCe7\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue45\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"lZJMSpLWpxr8fDMPv5MTslfH3es\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue44\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"fnDLu9m9abKhRRpj5exGHghyNT2\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue43\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"ttkE3tSHjAz5g3JZB2xBUwWcCc5\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue42\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"YBYK7AOZFn8dvB7JQYsbMs4rPCN\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue41\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"PLkDXVkfpxYR062op1QXDEIJPeP\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue40\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"UfIowR4bMvwG95aQGEXNbbRehFD\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue39\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"14PbIi2LwReXsOvpHAbKNjsr0XW\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue38\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"gIdLMmhbXMggBZivNgx67KwqZhm\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue37\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"Eh0OBSjMqf5WJo7XokfdLlegCAt\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue36\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"7cLVmuRCZycFRHVEORZISnLXw24\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue35\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"7MoKeeNubE0KODpNpfTuGIzBlwd\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue34\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"m9MW3xrJBfXhHcEkmJaaJF5OPKw\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue33\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"9EhSnnaOQOS5Lh2HfxNhrwBS1su\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue32\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"jipB3VSo7sdhmaUZJuOmAaY9lgn\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue31\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"kahfNTljWMpvGYGG5ToAldMDbt3\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue30\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"MePefJ3j6qhoUpxBrrQVMazWYwF\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue29\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"eYXq9IaXn6ixTKt0JAOKGZhNJOS\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue28\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"7AQSsfZ2RojgFR1GXdyIsk1taDx\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue27\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:58+00:00\"},{\"etag\":\"8BO9QpmYmpcOOBJj0OyQYcWwz7A\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue26\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"4kukVlmat3kcn834zTAvHSohV30\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue25\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"Xb3bwvgDRP2khWPffFH50MHQtCl\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue24\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"bBXCRuTyjV48XDYWCld5T1wsJEK\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue23\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"dSDAldBXJNPHSlUxrB3bVtAlrDr\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue22\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"l9X9deLtYeTmwqTucwoYtzP2EQh\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue21\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"7CQJNMuky9Gqq9Qcqsgj22NdG5F\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue20\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"oZwOhlAepkUSGd1qN7oTZLdKCJV\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue19\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"wHw9EdHFL2ieEAXdBEPem9KW0A8\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue18\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"XP7Pbv623eatufHiKTkq5HpFDSa\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue17\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"twa1k4YYgm4NxGP9nZHvYamP4CN\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue16\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"PuS2hCuYdTOzQMN9DrsXpeAggwm\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue15\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"vlaOlFXK0JhM5pTaFesWP2IjN4q\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue14\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"Usldr2j3QJbxVgeNv8r9rNpwq05\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue13\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"q5W7UXp1miYWUjOljt6NqIBxQCL\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue12\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"620Rpelck23ILRestB0TMMwA0AX\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue11\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"udup4cnXm2J1wCkSX6hrEsmp0jS\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue10\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"ZXkcRmcmYybeUZfIoXHjx3h6gHl\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue9\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"Up43irEjbjqalUXffHvAAY8IOSK\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue8\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:57+00:00\"},{\"etag\":\"C8shr4IPeLKH9OH389cfhCWnluO\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue7\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"YhAhxzohYdYHtwflMeYCW9lGmSI\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue6\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"8Devdke7sMPe04s3PwZKw6qfk6z\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue5\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"p9RxmrmZRawSLeckvkXstrivMyo\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue4\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"M1Op5GHGFIhiJ2UGh5oOtUBqLUM\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue3\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"Av6PbtuhxNQ1Izr7PKoVfXD1laB\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue2\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"00dvZCg3Agikg0apkpzWHdwbWg3\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue1\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"},{\"etag\":\"p0MB3FVqBFZjVNLxsswPOLhAhbw\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue0\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:56+00:00\"}]}", + "x-ms-client-request-id" : "8b6367f4-d5d5-44fc-88ba-2373a3ffc68c", + "Content-Type" : "application/vnd.microsoft.appconfig.kvset+json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv?key=key74257%2a", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:58 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "de75e1a4-ae87-4378-b918-9fd96371c419", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MjM=;sn=355923", + "x-ms-request-id" : "de75e1a4-ae87-4378-b918-9fd96371c419", + "Body" : "{\"items\":[{\"etag\":\"sOK6GPuWPLaVj9h4PWvdIADBa7E\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue49\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:59+00:00\"}]}", + "x-ms-client-request-id" : "9a7fbd1e-0aad-46c7-8075-03123c09323a", + "Content-Type" : "application/vnd.microsoft.appconfig.kvset+json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key74257?label=badac284", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:52:59 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:52:59 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "485ac8fa-749a-4197-8572-bac152a72d87", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"sOK6GPuWPLaVj9h4PWvdIADBa7E\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MjQ=;sn=355924", + "x-ms-request-id" : "485ac8fa-749a-4197-8572-bac152a72d87", + "Body" : "{\"etag\":\"sOK6GPuWPLaVj9h4PWvdIADBa7E\",\"key\":\"key74257\",\"label\":\"badac284\",\"content_type\":null,\"value\":\"myValue49\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:52:59+00:00\"}", + "x-ms-client-request-id" : "374e79d5-8a47-4104-9479-014ee085da6b", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + } ], + "variables" : [ "key74257", "badac284" ] +} \ No newline at end of file diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/test/resources/session-records/listRevisionsWithPaginationAndRepeatStream.json b/sdk/appconfiguration/azure-data-appconfiguration/src/test/resources/session-records/listRevisionsWithPaginationAndRepeatStream.json new file mode 100644 index 000000000000..0bb6063c5eac --- /dev/null +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/test/resources/session-records/listRevisionsWithPaginationAndRepeatStream.json @@ -0,0 +1,1566 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:28 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:28 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "a4f034dc-dfa5-4c15-8895-1e8d57755b42", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"jNiyP7Q77USDs4C4RBL5k0z2gc0\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MjU=;sn=355925", + "x-ms-request-id" : "a4f034dc-dfa5-4c15-8895-1e8d57755b42", + "Body" : "{\"etag\":\"jNiyP7Q77USDs4C4RBL5k0z2gc0\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue0\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:28+00:00\"}", + "x-ms-client-request-id" : "6ddf46d2-bfb5-4604-afba-7d1983f04c5a", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:28 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "cdd073c2-6ca5-400d-a176-e7eb3d914d91", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"0fbbfGX81nAx8ohTvfX6qjJsnyJ\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MjY=;sn=355926", + "x-ms-request-id" : "cdd073c2-6ca5-400d-a176-e7eb3d914d91", + "Body" : "{\"etag\":\"0fbbfGX81nAx8ohTvfX6qjJsnyJ\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue1\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "e1778f9c-0570-4916-ac88-90e56221741f", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:28 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "9e679bcd-68bf-4de0-82cc-81bdb2f71eef", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"XCDiu4RIimqAHyMjgaPElT7LAB7\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5Mjc=;sn=355927", + "x-ms-request-id" : "9e679bcd-68bf-4de0-82cc-81bdb2f71eef", + "Body" : "{\"etag\":\"XCDiu4RIimqAHyMjgaPElT7LAB7\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue2\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "380f0144-af69-4bb3-bf65-4cecbc2d14ed", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:28 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "2c70ebc5-4198-4bb3-8bf2-ec8961b1f676", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"I3waB2sqcjR0lolm4oPGGVQf2UN\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5Mjg=;sn=355928", + "x-ms-request-id" : "2c70ebc5-4198-4bb3-8bf2-ec8961b1f676", + "Body" : "{\"etag\":\"I3waB2sqcjR0lolm4oPGGVQf2UN\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue3\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "9bd90a9d-0a84-49f2-8157-dce79d181425", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:28 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "c537ba3c-7a18-493b-a03c-2c7c30be0701", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"k3xWQWwFob9U0iekEexrOsvQNdS\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5Mjk=;sn=355929", + "x-ms-request-id" : "c537ba3c-7a18-493b-a03c-2c7c30be0701", + "Body" : "{\"etag\":\"k3xWQWwFob9U0iekEexrOsvQNdS\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue4\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "b65e35d2-e068-4694-b88b-db3387f3e067", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:28 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "d65b98cf-3204-4ddd-9d75-32d58fffe292", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"noNDOjplAcflJhlW0rxP8C59HxC\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MzA=;sn=355930", + "x-ms-request-id" : "d65b98cf-3204-4ddd-9d75-32d58fffe292", + "Body" : "{\"etag\":\"noNDOjplAcflJhlW0rxP8C59HxC\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue5\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "5b77389e-113f-441d-b642-c2a0a0d00599", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:28 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "e6b714fb-a41b-4923-92a9-d1480c4772bf", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"PvQgsbCoKItfkYjdSehNSGefBCw\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MzE=;sn=355931", + "x-ms-request-id" : "e6b714fb-a41b-4923-92a9-d1480c4772bf", + "Body" : "{\"etag\":\"PvQgsbCoKItfkYjdSehNSGefBCw\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue6\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "a2fadaf5-19d3-45fd-b0a3-4147ad342f0d", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:28 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "112815b4-cced-4d38-b920-3e8b9daa54a2", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"lCr5xrN9rShZSx7NEEwlKU5dEjN\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MzI=;sn=355932", + "x-ms-request-id" : "112815b4-cced-4d38-b920-3e8b9daa54a2", + "Body" : "{\"etag\":\"lCr5xrN9rShZSx7NEEwlKU5dEjN\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue7\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "59e9d54e-51a6-424e-b948-0706d47382dc", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:28 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "a5dafbf5-54bb-4634-86fe-3910cf52b957", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"fUT8brix0evbfPrVlOPegoO1msD\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MzM=;sn=355933", + "x-ms-request-id" : "a5dafbf5-54bb-4634-86fe-3910cf52b957", + "Body" : "{\"etag\":\"fUT8brix0evbfPrVlOPegoO1msD\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue8\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "96292ddc-22fe-4dd1-80a8-833631335ade", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:28 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "334e2859-ae74-493a-8883-d95ab3ea2fcf", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"1CCYXGfgoUU8S7Z22eGpjfVdgCx\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MzQ=;sn=355934", + "x-ms-request-id" : "334e2859-ae74-493a-8883-d95ab3ea2fcf", + "Body" : "{\"etag\":\"1CCYXGfgoUU8S7Z22eGpjfVdgCx\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue9\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "db3d4b2d-4c59-4c63-a8a0-e0a41ecf2c6b", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:28 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "c6da7221-0893-453d-bafd-1ac2fc526dbb", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"rs4ed1mEVqsWPTAQmdwUHpHyAA6\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MzU=;sn=355935", + "x-ms-request-id" : "c6da7221-0893-453d-bafd-1ac2fc526dbb", + "Body" : "{\"etag\":\"rs4ed1mEVqsWPTAQmdwUHpHyAA6\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue10\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "8d3e433c-ad2f-45d4-ba75-21b9987f7797", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "2e886634-4c57-4c2c-8e31-bbf82a77d47b", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"GhklfKlQ6puZhqTH3M2dhfeOf78\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5MzY=;sn=355936", + "x-ms-request-id" : "2e886634-4c57-4c2c-8e31-bbf82a77d47b", + "Body" : "{\"etag\":\"GhklfKlQ6puZhqTH3M2dhfeOf78\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue11\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "9d68d0f7-98ca-4244-9898-2737ec455385", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "c109141a-d9c0-478b-9d08-1026e216275b", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"AQssSuVEmEAOPORA8SNAx56WEA4\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5Mzc=;sn=355937", + "x-ms-request-id" : "c109141a-d9c0-478b-9d08-1026e216275b", + "Body" : "{\"etag\":\"AQssSuVEmEAOPORA8SNAx56WEA4\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue12\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "5d75bc25-b415-402f-a65b-78226278b879", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "c6b711b8-6003-426c-8e29-cfcefc507143", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"Dqo1l1JkizHLTvs7GkjJPChvun9\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5Mzg=;sn=355938", + "x-ms-request-id" : "c6b711b8-6003-426c-8e29-cfcefc507143", + "Body" : "{\"etag\":\"Dqo1l1JkizHLTvs7GkjJPChvun9\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue13\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "272dcb27-b52e-490d-b4e3-eae0b1eacb56", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "353c85d1-3cc2-47c2-ab42-325a27292792", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"YRDxr675Cakmv1WBpdzzpTpQ8BP\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5Mzk=;sn=355939", + "x-ms-request-id" : "353c85d1-3cc2-47c2-ab42-325a27292792", + "Body" : "{\"etag\":\"YRDxr675Cakmv1WBpdzzpTpQ8BP\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue14\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "aba7630e-1111-4578-9e1c-93394eb04798", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "d3e0137b-f409-4789-a038-4496b83e1670", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"uP49wa2rA8KSMoe4ne7z9ozL4bn\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NDA=;sn=355940", + "x-ms-request-id" : "d3e0137b-f409-4789-a038-4496b83e1670", + "Body" : "{\"etag\":\"uP49wa2rA8KSMoe4ne7z9ozL4bn\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue15\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "904405e5-6e42-4066-b5da-7ec7ebf0c74b", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "347ef176-4466-4666-9d72-c1efeea7a8cc", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"tWRhuDeaMMNRKzhXXCid1gJ3lKD\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NDE=;sn=355941", + "x-ms-request-id" : "347ef176-4466-4666-9d72-c1efeea7a8cc", + "Body" : "{\"etag\":\"tWRhuDeaMMNRKzhXXCid1gJ3lKD\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue16\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "65904f6c-bdda-404c-8195-b077116de50b", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "4c602770-0a21-44a3-b24d-2b90e9a96e39", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"cWcHBIcSdVBPrYdqfTC4FNgHBB4\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NDI=;sn=355942", + "x-ms-request-id" : "4c602770-0a21-44a3-b24d-2b90e9a96e39", + "Body" : "{\"etag\":\"cWcHBIcSdVBPrYdqfTC4FNgHBB4\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue17\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "5bfdd0df-4f44-4e53-bb4e-88524884659e", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "141d5539-2848-44d7-bbd6-1985c0d6dd8c", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"upZrsv8iYzydWqYje7jHm9rHcXL\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NDM=;sn=355943", + "x-ms-request-id" : "141d5539-2848-44d7-bbd6-1985c0d6dd8c", + "Body" : "{\"etag\":\"upZrsv8iYzydWqYje7jHm9rHcXL\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue18\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "fb8fa450-4f23-4516-b231-51ec511a3357", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "d0ccbba1-d154-483c-b02b-f092ed1d4fee", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"mwynFY1i5xgbBDjQCoMyG2tJJyn\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NDQ=;sn=355944", + "x-ms-request-id" : "d0ccbba1-d154-483c-b02b-f092ed1d4fee", + "Body" : "{\"etag\":\"mwynFY1i5xgbBDjQCoMyG2tJJyn\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue19\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "64e1f930-5beb-490f-a57d-250d7ec325b8", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:29 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "7fb3486e-2908-4339-b236-e322fc8fc07c", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"5ZHNlkJlMtNALJHYTMEFf8GfgWE\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NDU=;sn=355945", + "x-ms-request-id" : "7fb3486e-2908-4339-b236-e322fc8fc07c", + "Body" : "{\"etag\":\"5ZHNlkJlMtNALJHYTMEFf8GfgWE\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue20\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"}", + "x-ms-client-request-id" : "9cbe13b0-be74-43e9-af15-407a930daa02", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "7f4ccbcf-0a07-44fb-b676-8324cc554587", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"VQ34jz49f5kzGyRuhogVrUpwN7O\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NDY=;sn=355946", + "x-ms-request-id" : "7f4ccbcf-0a07-44fb-b676-8324cc554587", + "Body" : "{\"etag\":\"VQ34jz49f5kzGyRuhogVrUpwN7O\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue21\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "a1774869-a4ff-4eb8-8e9a-37947d62c12f", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "5a3a1a0f-1d2a-4fa9-907d-fcd5c8af8c29", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"nUG3aATwp4xd69HMBcX11TvIb22\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NDc=;sn=355947", + "x-ms-request-id" : "5a3a1a0f-1d2a-4fa9-907d-fcd5c8af8c29", + "Body" : "{\"etag\":\"nUG3aATwp4xd69HMBcX11TvIb22\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue22\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "9f0652c4-50ad-43b9-8dd2-8ed3fb772d8b", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "aa1d6058-20d5-4e61-a11a-5a466a5ec37e", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"YxmRHNz0UUBT99nEvq9R3xWMi41\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NDg=;sn=355948", + "x-ms-request-id" : "aa1d6058-20d5-4e61-a11a-5a466a5ec37e", + "Body" : "{\"etag\":\"YxmRHNz0UUBT99nEvq9R3xWMi41\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue23\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "5798ec0b-7d8b-4352-8205-9ccdbb2ca8a4", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "22bae82c-3efe-4c16-9aba-b9b504c23efe", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"U2X8ROJcTNIzRaMAuKzLI2b0EU1\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NDk=;sn=355949", + "x-ms-request-id" : "22bae82c-3efe-4c16-9aba-b9b504c23efe", + "Body" : "{\"etag\":\"U2X8ROJcTNIzRaMAuKzLI2b0EU1\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue24\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "e30e13da-5d80-4582-a9d6-54298bc58005", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "2c544de8-f45f-4afd-bd6f-9e0bdf2eadc1", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"gnLsef4Juk3ekuG1L9Y5kayR4KE\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NTA=;sn=355950", + "x-ms-request-id" : "2c544de8-f45f-4afd-bd6f-9e0bdf2eadc1", + "Body" : "{\"etag\":\"gnLsef4Juk3ekuG1L9Y5kayR4KE\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue25\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "601cbb5e-db9f-4081-9f3f-75c84d425d71", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "904aa2b0-3769-4b20-af59-cebe47c2d719", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"jqHhLOJHxJO2vhjNCGzE11wGD3j\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NTE=;sn=355951", + "x-ms-request-id" : "904aa2b0-3769-4b20-af59-cebe47c2d719", + "Body" : "{\"etag\":\"jqHhLOJHxJO2vhjNCGzE11wGD3j\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue26\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "2c61bfb1-ca29-489a-857e-571b06809d67", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "6bf45028-72fc-4091-8e15-7d9a793cc04d", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"ggbKmyOxgmIg5fPkUJLYo617rkU\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NTI=;sn=355952", + "x-ms-request-id" : "6bf45028-72fc-4091-8e15-7d9a793cc04d", + "Body" : "{\"etag\":\"ggbKmyOxgmIg5fPkUJLYo617rkU\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue27\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "fb959c4e-a161-4518-a49e-be1aaa2c4bdd", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "e1cf23aa-2017-4f7f-a334-00554d91beb7", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"ymDGKm1NX2h4Gfpio9RSTKJ7rr9\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NTM=;sn=355953", + "x-ms-request-id" : "e1cf23aa-2017-4f7f-a334-00554d91beb7", + "Body" : "{\"etag\":\"ymDGKm1NX2h4Gfpio9RSTKJ7rr9\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue28\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "6d6a15aa-2a8e-413e-90ba-d4ee74dac32d", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "52d580a4-3bc2-4021-8763-1d1bdf7a3c21", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"ectYS6odE2dFHrJVKvZd2XsCsNk\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NTQ=;sn=355954", + "x-ms-request-id" : "52d580a4-3bc2-4021-8763-1d1bdf7a3c21", + "Body" : "{\"etag\":\"ectYS6odE2dFHrJVKvZd2XsCsNk\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue29\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "5425dd3a-3905-4c3d-98d5-05b5b8d54b1b", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:29 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "62f3ebdb-a438-43d6-bd0c-5dcf4385b164", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"a3qDyWPJlP8UuySqljnkRZcWbSx\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NTU=;sn=355955", + "x-ms-request-id" : "62f3ebdb-a438-43d6-bd0c-5dcf4385b164", + "Body" : "{\"etag\":\"a3qDyWPJlP8UuySqljnkRZcWbSx\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue30\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "ce0e3ce0-a328-4b44-bee2-8aed4960cfce", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "c4b76ac5-0fb0-47d5-9db1-96532e50eee9", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"uvj2Gh9v4124k57JYXwYEZOntqp\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NTY=;sn=355956", + "x-ms-request-id" : "c4b76ac5-0fb0-47d5-9db1-96532e50eee9", + "Body" : "{\"etag\":\"uvj2Gh9v4124k57JYXwYEZOntqp\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue31\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "955b1254-fb2f-4cf0-9f04-2cc27542beba", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "c3ff3750-cb51-46c8-8b3a-d1eccc4549d8", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"MrM1BDpqECFyW8CdCiEfPPzz0gy\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NTc=;sn=355957", + "x-ms-request-id" : "c3ff3750-cb51-46c8-8b3a-d1eccc4549d8", + "Body" : "{\"etag\":\"MrM1BDpqECFyW8CdCiEfPPzz0gy\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue32\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "b603c55c-17f8-4ebf-b97b-12630fd29ff3", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "04d06d36-ea0f-4622-af53-119cc09a5018", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"D2zHtjpFr4FC9a1bCjsc6QNiZ0W\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NTg=;sn=355958", + "x-ms-request-id" : "04d06d36-ea0f-4622-af53-119cc09a5018", + "Body" : "{\"etag\":\"D2zHtjpFr4FC9a1bCjsc6QNiZ0W\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue33\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "b0334f7e-0dc7-46f1-b799-8679603b91fe", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "7a9b2cc9-1467-4304-a402-0e3a3c0cc7a8", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"P3dG0y5T3k4M1TMULVKsAuxnPNF\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NTk=;sn=355959", + "x-ms-request-id" : "7a9b2cc9-1467-4304-a402-0e3a3c0cc7a8", + "Body" : "{\"etag\":\"P3dG0y5T3k4M1TMULVKsAuxnPNF\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue34\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "f37f4b13-38fa-4e03-9274-cd67d71d0a5c", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "12222853-c32d-4a0c-9f47-3fc1dc017482", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"83zr6N5go4zKpPvlwKTf2uoaoxK\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NjA=;sn=355960", + "x-ms-request-id" : "12222853-c32d-4a0c-9f47-3fc1dc017482", + "Body" : "{\"etag\":\"83zr6N5go4zKpPvlwKTf2uoaoxK\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue35\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "2aed2ac7-d50e-4f24-8d2c-8a24098c375f", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "89ec33ac-966e-4517-8bac-ece0fe12164a", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"XTsdMpFVDVeJkevXl8UlwspMKqW\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NjE=;sn=355961", + "x-ms-request-id" : "89ec33ac-966e-4517-8bac-ece0fe12164a", + "Body" : "{\"etag\":\"XTsdMpFVDVeJkevXl8UlwspMKqW\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue36\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "6bee6ee8-ce77-4b59-afd8-882161125b65", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "f17a1dde-e7ea-44a3-af2c-fc7cfd37cd76", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"SKL0U2WRmokCHZjXoAqdegKpVZH\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NjI=;sn=355962", + "x-ms-request-id" : "f17a1dde-e7ea-44a3-af2c-fc7cfd37cd76", + "Body" : "{\"etag\":\"SKL0U2WRmokCHZjXoAqdegKpVZH\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue37\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "a5cc28d1-9d79-4807-93e9-a969b26b5d11", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "ff36bac5-7acc-42c5-90ad-04b6579317cd", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"bmWEhDNsBrV1uzqbP5UgleufkJu\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NjM=;sn=355963", + "x-ms-request-id" : "ff36bac5-7acc-42c5-90ad-04b6579317cd", + "Body" : "{\"etag\":\"bmWEhDNsBrV1uzqbP5UgleufkJu\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue38\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "03127d09-72b4-4914-bd20-261f965de54b", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "d4ab9aa0-a037-4525-b5cb-41b9b0bea1f3", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"QKgNZ00wWrfvkedoInI4IS7sTGB\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NjQ=;sn=355964", + "x-ms-request-id" : "d4ab9aa0-a037-4525-b5cb-41b9b0bea1f3", + "Body" : "{\"etag\":\"QKgNZ00wWrfvkedoInI4IS7sTGB\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue39\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "8b7aae12-7678-4299-9b84-f7d154bc9f6b", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:30 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "f1edb443-44c7-4182-a2ca-888139d8b56c", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"TP4kXbH9tqphIfWOg7t4aaUP9V9\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NjU=;sn=355965", + "x-ms-request-id" : "f1edb443-44c7-4182-a2ca-888139d8b56c", + "Body" : "{\"etag\":\"TP4kXbH9tqphIfWOg7t4aaUP9V9\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue40\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"}", + "x-ms-client-request-id" : "7a867d3d-5940-40b6-94e8-32e6a30c2c69", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "d6813be1-a182-4fd1-8818-5c09850cdc2b", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"WtmJ27m8hLTawG2q6nsSwIM6i1n\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NjY=;sn=355966", + "x-ms-request-id" : "d6813be1-a182-4fd1-8818-5c09850cdc2b", + "Body" : "{\"etag\":\"WtmJ27m8hLTawG2q6nsSwIM6i1n\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue41\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"}", + "x-ms-client-request-id" : "22e293fb-2798-4d74-b808-1aa877b72f54", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "ab6edd7f-8418-4579-ab6a-5665c58b8c75", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"qXRaj0Fh6afaaQW92k4h6JvVhD2\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5Njc=;sn=355967", + "x-ms-request-id" : "ab6edd7f-8418-4579-ab6a-5665c58b8c75", + "Body" : "{\"etag\":\"qXRaj0Fh6afaaQW92k4h6JvVhD2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue42\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"}", + "x-ms-client-request-id" : "894afe6c-a03e-4703-8ab0-135b7368fe73", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "9372cb31-72d6-4674-9698-fde1e31d0960", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"FDGQuEodmlMSNuCjIp37tZOpVnB\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5Njg=;sn=355968", + "x-ms-request-id" : "9372cb31-72d6-4674-9698-fde1e31d0960", + "Body" : "{\"etag\":\"FDGQuEodmlMSNuCjIp37tZOpVnB\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue43\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"}", + "x-ms-client-request-id" : "7fb38d4e-c223-47c3-95de-a1c5f413621f", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "c5d93d76-79ae-45ba-a146-d3a2dffef727", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"2N6LZ5MrGaiTH5gBFnELLhqA8N2\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5Njk=;sn=355969", + "x-ms-request-id" : "c5d93d76-79ae-45ba-a146-d3a2dffef727", + "Body" : "{\"etag\":\"2N6LZ5MrGaiTH5gBFnELLhqA8N2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue44\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"}", + "x-ms-client-request-id" : "3e23af68-030b-476d-854e-833d2762f9d0", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "31640901-581a-4349-bfe0-c7dd034e08eb", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"BtQypwuQfOImh4BpxoH9jpnNXj2\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NzA=;sn=355970", + "x-ms-request-id" : "31640901-581a-4349-bfe0-c7dd034e08eb", + "Body" : "{\"etag\":\"BtQypwuQfOImh4BpxoH9jpnNXj2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue45\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"}", + "x-ms-client-request-id" : "ce349f1e-8db3-4801-a0e6-cb58d17bf091", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "ab01f83e-8bc7-4dcc-9e5f-78529205ee91", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"kTKoMIe2RfsIyQcFeSbcyIxu9gT\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NzE=;sn=355971", + "x-ms-request-id" : "ab01f83e-8bc7-4dcc-9e5f-78529205ee91", + "Body" : "{\"etag\":\"kTKoMIe2RfsIyQcFeSbcyIxu9gT\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue46\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"}", + "x-ms-client-request-id" : "56054950-fb97-4326-940a-108c1ce65e1f", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "2ce38b31-7808-44e4-8df0-da57c0630b27", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"2mc5z3RxNs2a0MqR5sgJXmaBjnE\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NzI=;sn=355972", + "x-ms-request-id" : "2ce38b31-7808-44e4-8df0-da57c0630b27", + "Body" : "{\"etag\":\"2mc5z3RxNs2a0MqR5sgJXmaBjnE\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue47\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"}", + "x-ms-client-request-id" : "e342bd50-c602-4200-ac33-54095fcec6bc", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "c8e815a3-d41b-485c-8aed-840105a9dd2e", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"79gGNL9vs3vTEgaSWqAn1kUV9xz\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NzM=;sn=355973", + "x-ms-request-id" : "c8e815a3-d41b-485c-8aed-840105a9dd2e", + "Body" : "{\"etag\":\"79gGNL9vs3vTEgaSWqAn1kUV9xz\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue48\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"}", + "x-ms-client-request-id" : "25026f6c-1593-4466-b2a2-31795dc32ac4", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:30 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "e397bc6d-bf8e-4eed-9f63-acb576ac39c7", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"IPjAXqJXU1C8rF1kydehHCU1Uq2\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NzQ=;sn=355974", + "x-ms-request-id" : "e397bc6d-bf8e-4eed-9f63-acb576ac39c7", + "Body" : "{\"etag\":\"IPjAXqJXU1C8rF1kydehHCU1Uq2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue49\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"}", + "x-ms-client-request-id" : "3c545fb1-2ed7-4d87-8662-6544ee3f04a1", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://hemant-appconfiguration.azconfig.io/revisions?key=key94007&label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:31 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "649ac81e-77da-4288-9fc7-7723b467c82a", + "Accept-Ranges" : "items", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NzQ=;sn=355974", + "x-ms-request-id" : "649ac81e-77da-4288-9fc7-7723b467c82a", + "Body" : "{\"items\":[{\"etag\":\"IPjAXqJXU1C8rF1kydehHCU1Uq2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue49\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"79gGNL9vs3vTEgaSWqAn1kUV9xz\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue48\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"2mc5z3RxNs2a0MqR5sgJXmaBjnE\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue47\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"kTKoMIe2RfsIyQcFeSbcyIxu9gT\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue46\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"BtQypwuQfOImh4BpxoH9jpnNXj2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue45\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"2N6LZ5MrGaiTH5gBFnELLhqA8N2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue44\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"FDGQuEodmlMSNuCjIp37tZOpVnB\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue43\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"qXRaj0Fh6afaaQW92k4h6JvVhD2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue42\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"WtmJ27m8hLTawG2q6nsSwIM6i1n\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue41\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"TP4kXbH9tqphIfWOg7t4aaUP9V9\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue40\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"QKgNZ00wWrfvkedoInI4IS7sTGB\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue39\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"bmWEhDNsBrV1uzqbP5UgleufkJu\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue38\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"SKL0U2WRmokCHZjXoAqdegKpVZH\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue37\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"XTsdMpFVDVeJkevXl8UlwspMKqW\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue36\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"83zr6N5go4zKpPvlwKTf2uoaoxK\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue35\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"P3dG0y5T3k4M1TMULVKsAuxnPNF\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue34\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"D2zHtjpFr4FC9a1bCjsc6QNiZ0W\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue33\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"MrM1BDpqECFyW8CdCiEfPPzz0gy\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue32\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"uvj2Gh9v4124k57JYXwYEZOntqp\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue31\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"a3qDyWPJlP8UuySqljnkRZcWbSx\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue30\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"ectYS6odE2dFHrJVKvZd2XsCsNk\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue29\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"ymDGKm1NX2h4Gfpio9RSTKJ7rr9\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue28\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"ggbKmyOxgmIg5fPkUJLYo617rkU\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue27\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"jqHhLOJHxJO2vhjNCGzE11wGD3j\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue26\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"gnLsef4Juk3ekuG1L9Y5kayR4KE\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue25\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"U2X8ROJcTNIzRaMAuKzLI2b0EU1\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue24\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"YxmRHNz0UUBT99nEvq9R3xWMi41\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue23\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"nUG3aATwp4xd69HMBcX11TvIb22\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue22\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"VQ34jz49f5kzGyRuhogVrUpwN7O\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue21\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"5ZHNlkJlMtNALJHYTMEFf8GfgWE\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue20\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"mwynFY1i5xgbBDjQCoMyG2tJJyn\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue19\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"upZrsv8iYzydWqYje7jHm9rHcXL\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue18\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"cWcHBIcSdVBPrYdqfTC4FNgHBB4\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue17\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"tWRhuDeaMMNRKzhXXCid1gJ3lKD\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue16\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"uP49wa2rA8KSMoe4ne7z9ozL4bn\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue15\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"YRDxr675Cakmv1WBpdzzpTpQ8BP\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue14\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"Dqo1l1JkizHLTvs7GkjJPChvun9\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue13\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"AQssSuVEmEAOPORA8SNAx56WEA4\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue12\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"GhklfKlQ6puZhqTH3M2dhfeOf78\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue11\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"rs4ed1mEVqsWPTAQmdwUHpHyAA6\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue10\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"1CCYXGfgoUU8S7Z22eGpjfVdgCx\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue9\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"fUT8brix0evbfPrVlOPegoO1msD\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue8\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"lCr5xrN9rShZSx7NEEwlKU5dEjN\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue7\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"PvQgsbCoKItfkYjdSehNSGefBCw\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue6\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"noNDOjplAcflJhlW0rxP8C59HxC\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue5\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"k3xWQWwFob9U0iekEexrOsvQNdS\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue4\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"I3waB2sqcjR0lolm4oPGGVQf2UN\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue3\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"XCDiu4RIimqAHyMjgaPElT7LAB7\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue2\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"0fbbfGX81nAx8ohTvfX6qjJsnyJ\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue1\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"jNiyP7Q77USDs4C4RBL5k0z2gc0\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue0\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:28+00:00\"}]}", + "x-ms-client-request-id" : "76d39dd5-b3b0-4ca6-b203-43c42a4942f1", + "Content-Type" : "application/vnd.microsoft.appconfig.kvset+json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://hemant-appconfiguration.azconfig.io/revisions?key=key94007&label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0 azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:31 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "1c1d9bea-76fa-4db6-92e5-f3f6417d7939", + "Accept-Ranges" : "items", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NzQ=;sn=355974", + "x-ms-request-id" : "1c1d9bea-76fa-4db6-92e5-f3f6417d7939", + "Body" : "{\"items\":[{\"etag\":\"IPjAXqJXU1C8rF1kydehHCU1Uq2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue49\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"79gGNL9vs3vTEgaSWqAn1kUV9xz\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue48\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"2mc5z3RxNs2a0MqR5sgJXmaBjnE\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue47\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"kTKoMIe2RfsIyQcFeSbcyIxu9gT\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue46\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"BtQypwuQfOImh4BpxoH9jpnNXj2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue45\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"2N6LZ5MrGaiTH5gBFnELLhqA8N2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue44\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"FDGQuEodmlMSNuCjIp37tZOpVnB\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue43\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"qXRaj0Fh6afaaQW92k4h6JvVhD2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue42\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"WtmJ27m8hLTawG2q6nsSwIM6i1n\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue41\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"},{\"etag\":\"TP4kXbH9tqphIfWOg7t4aaUP9V9\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue40\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"QKgNZ00wWrfvkedoInI4IS7sTGB\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue39\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"bmWEhDNsBrV1uzqbP5UgleufkJu\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue38\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"SKL0U2WRmokCHZjXoAqdegKpVZH\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue37\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"XTsdMpFVDVeJkevXl8UlwspMKqW\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue36\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"83zr6N5go4zKpPvlwKTf2uoaoxK\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue35\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"P3dG0y5T3k4M1TMULVKsAuxnPNF\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue34\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"D2zHtjpFr4FC9a1bCjsc6QNiZ0W\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue33\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"MrM1BDpqECFyW8CdCiEfPPzz0gy\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue32\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"uvj2Gh9v4124k57JYXwYEZOntqp\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue31\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"a3qDyWPJlP8UuySqljnkRZcWbSx\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue30\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"ectYS6odE2dFHrJVKvZd2XsCsNk\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue29\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"ymDGKm1NX2h4Gfpio9RSTKJ7rr9\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue28\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"ggbKmyOxgmIg5fPkUJLYo617rkU\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue27\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"jqHhLOJHxJO2vhjNCGzE11wGD3j\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue26\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"gnLsef4Juk3ekuG1L9Y5kayR4KE\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue25\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"U2X8ROJcTNIzRaMAuKzLI2b0EU1\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue24\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"YxmRHNz0UUBT99nEvq9R3xWMi41\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue23\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"nUG3aATwp4xd69HMBcX11TvIb22\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue22\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"VQ34jz49f5kzGyRuhogVrUpwN7O\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue21\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:30+00:00\"},{\"etag\":\"5ZHNlkJlMtNALJHYTMEFf8GfgWE\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue20\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"mwynFY1i5xgbBDjQCoMyG2tJJyn\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue19\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"upZrsv8iYzydWqYje7jHm9rHcXL\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue18\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"cWcHBIcSdVBPrYdqfTC4FNgHBB4\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue17\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"tWRhuDeaMMNRKzhXXCid1gJ3lKD\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue16\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"uP49wa2rA8KSMoe4ne7z9ozL4bn\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue15\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"YRDxr675Cakmv1WBpdzzpTpQ8BP\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue14\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"Dqo1l1JkizHLTvs7GkjJPChvun9\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue13\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"AQssSuVEmEAOPORA8SNAx56WEA4\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue12\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"GhklfKlQ6puZhqTH3M2dhfeOf78\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue11\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"rs4ed1mEVqsWPTAQmdwUHpHyAA6\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue10\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"1CCYXGfgoUU8S7Z22eGpjfVdgCx\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue9\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"fUT8brix0evbfPrVlOPegoO1msD\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue8\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"lCr5xrN9rShZSx7NEEwlKU5dEjN\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue7\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"PvQgsbCoKItfkYjdSehNSGefBCw\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue6\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"noNDOjplAcflJhlW0rxP8C59HxC\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue5\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"k3xWQWwFob9U0iekEexrOsvQNdS\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue4\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"I3waB2sqcjR0lolm4oPGGVQf2UN\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue3\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"XCDiu4RIimqAHyMjgaPElT7LAB7\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue2\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"0fbbfGX81nAx8ohTvfX6qjJsnyJ\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue1\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:29+00:00\"},{\"etag\":\"jNiyP7Q77USDs4C4RBL5k0z2gc0\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue0\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:28+00:00\"}]}", + "x-ms-client-request-id" : "76d39dd5-b3b0-4ca6-b203-43c42a4942f1", + "Content-Type" : "application/vnd.microsoft.appconfig.kvset+json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv?key=key94007%2a", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:31 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "d2ac8670-2990-467c-aa04-7c0903f51950", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NzQ=;sn=355974", + "x-ms-request-id" : "d2ac8670-2990-467c-aa04-7c0903f51950", + "Body" : "{\"items\":[{\"etag\":\"IPjAXqJXU1C8rF1kydehHCU1Uq2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue49\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"}]}", + "x-ms-client-request-id" : "b1f5f800-2e70-4e2e-b108-ff61a50398aa", + "Content-Type" : "application/vnd.microsoft.appconfig.kvset+json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://hemant-appconfiguration.azconfig.io/kv/key94007?label=4f568078", + "Headers" : { + "User-Agent" : "azsdk-java-application-configuration/1.0.0-SNAPSHOT 1.8.0_212; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "Server" : "nginx/1.13.12", + "Access-Control-Allow-Origin" : "*", + "Access-Control-Allow-Methods" : "GET, PUT, POST, DELETE, PATCH, OPTIONS", + "Connection" : "keep-alive", + "Last-Modified" : "Thu, 25 Jul 2019 23:53:31 GMT", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Thu, 25 Jul 2019 23:53:31 GMT", + "Access-Control-Allow-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "x-ms-correlation-request-id" : "45ed019e-9367-4a83-8a68-06076dd73562", + "Strict-Transport-Security" : "max-age=15724800; includeSubDomains", + "Access-Control-Expose-Headers" : "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate", + "ETag" : "\"IPjAXqJXU1C8rF1kydehHCU1Uq2\"", + "Access-Control-Allow-Credentials" : "true", + "Sync-Token" : "zAJw6V16=NDotMSMzNTU5NzU=;sn=355975", + "x-ms-request-id" : "45ed019e-9367-4a83-8a68-06076dd73562", + "Body" : "{\"etag\":\"IPjAXqJXU1C8rF1kydehHCU1Uq2\",\"key\":\"key94007\",\"label\":\"4f568078\",\"content_type\":null,\"value\":\"myValue49\",\"tags\":{},\"locked\":false,\"last_modified\":\"2019-07-25T23:53:31+00:00\"}", + "x-ms-client-request-id" : "4a59737c-309a-4050-8aa5-20d687a44380", + "Content-Type" : "application/vnd.microsoft.appconfig.kv+json; charset=utf-8" + } + } ], + "variables" : [ "key94007", "4f568078" ] +} \ No newline at end of file diff --git a/sdk/appconfiguration/ci.yml b/sdk/appconfiguration/ci.yml index d4b965f3ea0b..75985c51833a 100644 --- a/sdk/appconfiguration/ci.yml +++ b/sdk/appconfiguration/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/appconfiguration/ @@ -13,11 +22,17 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/appconfiguration/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: ServiceDirectory: appconfiguration + Artifacts: + - name: azure-data-appconfiguration + safeName: azuredataappconfiguration \ No newline at end of file diff --git a/sdk/appconfiguration/pom.service.xml b/sdk/appconfiguration/pom.service.xml index 5e032d27570c..1dcb85086aea 100644 --- a/sdk/appconfiguration/pom.service.xml +++ b/sdk/appconfiguration/pom.service.xml @@ -9,7 +9,8 @@ pom 1.0.0 - ../core + ../core/azure-core + ../core/azure-core-test azure-data-appconfiguration diff --git a/sdk/core/azure-core-amqp/README.md b/sdk/core/azure-core-amqp/README.md index baf975788a87..38e2442aabd5 100644 --- a/sdk/core/azure-core-amqp/README.md +++ b/sdk/core/azure-core-amqp/README.md @@ -15,7 +15,7 @@ own AMQP client library that abstracts from the underlying transport library's i com.azure azure-core-amqp - 1.0.0-SNAPSHOT + 1.0.0-preview.3 ``` diff --git a/sdk/core/azure-core-amqp/pom.xml b/sdk/core/azure-core-amqp/pom.xml index acdcb042d4c2..2eb988e793eb 100644 --- a/sdk/core/azure-core-amqp/pom.xml +++ b/sdk/core/azure-core-amqp/pom.xml @@ -6,9 +6,9 @@ 4.0.0 com.azure - azure-core-parent - 1.0.0-preview.3 - ../pom.xml + azure-client-sdk-parent + 1.1.0 + ../../../pom.client.xml com.azure diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpSession.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpSession.java index 2ee596fd0390..68653566b24e 100644 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpSession.java +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/AmqpSession.java @@ -32,10 +32,10 @@ public interface AmqpSession extends EndpointStateNotifier, Closeable { * @param linkName Name of the link. * @param entityPath The entity path this link connects to when producing events. * @param timeout Timeout required for creating and opening AMQP link. - * @param retry The retry policy to use when sending messages. + * @param retryPolicy The retry policy to use when sending messages. * @return A newly created AMQP link. */ - Mono createProducer(String linkName, String entityPath, Duration timeout, Retry retry); + Mono createProducer(String linkName, String entityPath, Duration timeout, RetryPolicy retryPolicy); /** * Creates a new AMQP link that consumes events from the message broker. @@ -43,10 +43,10 @@ public interface AmqpSession extends EndpointStateNotifier, Closeable { * @param linkName Name of the link. * @param entityPath The entity path this link connects to, so that it may read events from the message broker. * @param timeout Timeout required for creating and opening an AMQP link. - * @param retry The retry policy to use when consuming messages. + * @param retryPolicy The retry policy to use when consuming messages. * @return A newly created AMQP link. */ - Mono createConsumer(String linkName, String entityPath, Duration timeout, Retry retry); + Mono createConsumer(String linkName, String entityPath, Duration timeout, RetryPolicy retryPolicy); /** * Removes an {@link AmqpLink} with the given {@code linkName}. diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/ExponentialRetry.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/ExponentialRetry.java deleted file mode 100644 index 87e136690bc0..000000000000 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/ExponentialRetry.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.amqp; - -import java.time.Duration; -import java.util.Objects; - -/** - * A policy to govern retrying of messaging operations in which the delay between retries will grow in an exponential - * manner, allowing more time to recover as the number of retries increases. - */ -public final class ExponentialRetry extends Retry { - private static final Duration TIMER_TOLERANCE = Duration.ofSeconds(1); - - private final Duration minBackoff; - private final Duration maxBackoff; - private final double retryFactor; - - /** - * Creates a new instance with a minimum and maximum retry period in addition to maximum number of retry attempts. - * - * @param minBackoff The minimum time period permissible for backing off between retries. - * @param maxBackoff The maximum time period permissible for backing off between retries. - * @param maxRetryCount The maximum number of retries allowed. - * @throws NullPointerException if {@code minBackoff} or {@code maxBackoff} is {@code null}. - */ - public ExponentialRetry(Duration minBackoff, Duration maxBackoff, int maxRetryCount) { - super(maxRetryCount); - Objects.requireNonNull(minBackoff); - Objects.requireNonNull(maxBackoff); - - this.minBackoff = minBackoff; - this.maxBackoff = maxBackoff; - - this.retryFactor = computeRetryFactor(); - } - - /** - * {@inheritDoc} - */ - @Override - protected Duration calculateNextRetryInterval(final Exception lastException, - final Duration remainingTime, - final int baseWaitSeconds, - final int retryCount) { - final double nextRetryInterval = Math.pow(retryFactor, (double) retryCount); - final long nextRetryIntervalSeconds = (long) nextRetryInterval; - final long nextRetryIntervalNano = (long) ((nextRetryInterval - (double) nextRetryIntervalSeconds) * 1000000000); - - if (remainingTime.getSeconds() < Math.max(nextRetryInterval, TIMER_TOLERANCE.getSeconds())) { - return null; - } - - final Duration retryAfter = minBackoff.plus(Duration.ofSeconds(nextRetryIntervalSeconds, nextRetryIntervalNano)); - return retryAfter.plus(Duration.ofSeconds(baseWaitSeconds)); - } - - private double computeRetryFactor() { - final long deltaBackoff = maxBackoff.minus(minBackoff).getSeconds(); - if (deltaBackoff <= 0 || super.getMaxRetryCount() <= 0) { - return 0; - } - return Math.log(deltaBackoff) / Math.log(super.getMaxRetryCount()); - } - - @Override - public int hashCode() { - return Objects.hash(maxBackoff, minBackoff, getMaxRetryCount(), getRetryCount()); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - - if (!(obj instanceof ExponentialRetry)) { - return false; - } - - ExponentialRetry other = (ExponentialRetry) obj; - - return this.maxBackoff.equals(other.maxBackoff) - && this.minBackoff.equals(other.minBackoff) - && this.getMaxRetryCount() == other.getMaxRetryCount() - && this.getRetryCount() == other.getRetryCount(); - } - - /** - * Creates a clone of this instance. - * - * The {@code minBackoff}, {@code maxBackoff}, and {@code maxRetryCount} are not cloned, but these objects are - * immutable and not subject to change. - * - * @return A clone of the {@link ExponentialRetry} instance. - */ - @SuppressWarnings("CloneDoesntCallSuperClone") - @Override - public Object clone() { - return new ExponentialRetry(minBackoff, maxBackoff, getMaxRetryCount()); - } -} diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/ExponentialRetryPolicy.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/ExponentialRetryPolicy.java new file mode 100644 index 000000000000..bfbdcfabed5b --- /dev/null +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/ExponentialRetryPolicy.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.amqp; + +import java.time.Duration; +import java.util.concurrent.ThreadLocalRandom; + +/** + * A policy to govern retrying of messaging operations in which the delay between retries will grow in an exponential + * manner, allowing more time to recover as the number of retries increases. + */ +public final class ExponentialRetryPolicy extends RetryPolicy { + private final double retryFactor; + + /** + * Creates a new instance with a minimum and maximum retry period in addition to maximum number of retry attempts. + * + * @param retryOptions The options to apply to this retry policy. + * @throws NullPointerException if {@code retryOptions} is {@code null}. + */ + public ExponentialRetryPolicy(RetryOptions retryOptions) { + super(retryOptions); + + this.retryFactor = computeRetryFactor(); + } + + /** + * Calculates the retry delay using exponential backoff. + * + * @param retryCount The number of attempts that have been made, including the initial attempt before any + * retries. + * @param baseDelay The delay to use for the basis of the exponential 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) { + final double jitterSeconds = random.nextDouble() * baseJitter.getSeconds(); + final double nextRetrySeconds = Math.pow(retryFactor, (double) retryCount); + final Double nextRetryNanos = (jitterSeconds + nextRetrySeconds) * NANOS_PER_SECOND; + + return baseDelay.plus(Duration.ofNanos(nextRetryNanos.longValue())); + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() { + return super.hashCode(); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + return obj instanceof ExponentialRetryPolicy + && super.equals(obj); + } + + /** + * Creates a clone of this instance. + * + * @return A clone of the {@link ExponentialRetryPolicy} instance. + */ + @Override + public RetryPolicy clone() { + final RetryOptions cloned = getRetryOptions().clone(); + return new ExponentialRetryPolicy(cloned); + } + + private double computeRetryFactor() { + final RetryOptions options = getRetryOptions(); + final Duration maxBackoff = options.maxDelay(); + final Duration minBackoff = options.delay(); + final int maximumRetries = options.maxRetries(); + final long deltaBackoff = maxBackoff.minus(minBackoff).getSeconds(); + + if (deltaBackoff <= 0 || maximumRetries <= 0) { + return 0; + } + + return Math.log(deltaBackoff) / Math.log(maximumRetries); + } +} 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 new file mode 100644 index 000000000000..56e84b7ea43d --- /dev/null +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/FixedRetryPolicy.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.amqp; + +import java.time.Duration; +import java.util.concurrent.ThreadLocalRandom; + +/** + * A policy to govern retrying of messaging operations in which the base delay between retries remains the same. + */ +public final class FixedRetryPolicy extends RetryPolicy { + /** + * Creates an instance with the given retry options. + * + * @param retryOptions The options to set on this retry policy. + */ + public FixedRetryPolicy(RetryOptions retryOptions) { + super(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. + * @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) { + final Double jitterNanos = random.nextDouble() * baseJitter.getSeconds() * RetryPolicy.NANOS_PER_SECOND; + final Duration jitter = Duration.ofNanos(jitterNanos.longValue()); + + return baseDelay.plus(jitter); + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() { + return super.hashCode(); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + return obj instanceof FixedRetryPolicy + && super.equals(obj); + } + + /** + * Creates a clone of this instance. + * + * @return A clone of the {@link FixedRetryPolicy} instance. + */ + @Override + public RetryPolicy clone() { + final RetryOptions cloned = getRetryOptions().clone(); + return new FixedRetryPolicy(cloned); + } +} diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/Retry.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/Retry.java deleted file mode 100644 index f88968c8341f..000000000000 --- a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/Retry.java +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.amqp; - -import com.azure.core.amqp.exception.AmqpException; -import com.azure.core.amqp.exception.ErrorCondition; - -import java.time.Duration; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * An abstract representation of a policy to govern retrying of messaging operations. - */ -public abstract class Retry implements Cloneable { - /** - * Default for the minimum time between retry attempts. - */ - public static final Duration DEFAULT_RETRY_MIN_BACKOFF = Duration.ofSeconds(0); - /** - * Default for the maximum time between retry attempts. - */ - public static final Duration DEFAULT_RETRY_MAX_BACKOFF = Duration.ofSeconds(30); - /** - * Default for the maximum number of retry attempts. - */ - public static final int DEFAULT_MAX_RETRY_COUNT = 10; - - /** - * Base sleep wait time. - */ - private static final int SERVER_BUSY_BASE_SLEEP_TIME_IN_SECS = 4; - - private final AtomicInteger retryCount = new AtomicInteger(); - private final int maxRetryCount; - - /** - * Creates a new instance of Retry with the maximum retry count of {@code maxRetryCount} - * - * @param maxRetryCount The maximum number of retries allowed. - */ - public Retry(int maxRetryCount) { - this.maxRetryCount = maxRetryCount; - } - - /** - * Check if the existing exception is a retriable exception. - * - * @param exception An exception that was observed for the operation to be retried. - * @return true if the exception is a retriable exception, otherwise false. - */ - public static boolean isRetriableException(Exception exception) { - return (exception instanceof AmqpException) && ((AmqpException) exception).isTransient(); - } - - /** - * Creates a Retry policy that does not retry failed requests. - * - * @return A new Retry policy that does not retry failed requests. - */ - public static Retry getNoRetry() { - return new ExponentialRetry(Duration.ZERO, Duration.ZERO, 0); - } - - /** - * Creates a Retry policy that retries failed requests up to {@link #DEFAULT_MAX_RETRY_COUNT 10} times. As the - * number of retry attempts increase, the period between retry attempts increases. - * - * @return A new instance with the default Retry values configured. - */ - public static Retry getDefaultRetry() { - return new ExponentialRetry(DEFAULT_RETRY_MIN_BACKOFF, DEFAULT_RETRY_MAX_BACKOFF, DEFAULT_MAX_RETRY_COUNT); - } - - /** - * Increments the number of retry attempts and returns the previous number of retry counts. - * - * @return The number of retry attempts before it was incremented. - */ - public int incrementRetryCount() { - return retryCount.getAndIncrement(); - } - - /** - * Gets the current number of retry attempts for this instance. - * - * @return The current number of retry attempts. - */ - public int getRetryCount() { - return retryCount.get(); - } - - /** - * Resets the number of retry attempts for this instance. - */ - public void resetRetryInterval() { - retryCount.set(0); - } - - /** - * Gets the maximum number of retry attempts that are allowed. - * - * @return The maximum number of retry attempts. - */ - public int getMaxRetryCount() { - return maxRetryCount; - } - - /** - * Calculates the amount of time to delay before the next retry attempt. - * - * @param lastException The last exception that was observed for the operation to be retried. - * @param remainingTime The amount of time remaining for the cumulative timeout across retry attempts. - * @return The amount of time to delay before retrying the associated operation; if {@code null}, - * then the operation is no longer eligible to be retried. - */ - public Duration getNextRetryInterval(Exception lastException, Duration remainingTime) { - int baseWaitTime = 0; - - if (!isRetriableException(lastException) || retryCount.get() >= maxRetryCount) { - return null; - } - - if (!(lastException instanceof AmqpException)) { - return null; - } - - if (((AmqpException) lastException).getErrorCondition() == ErrorCondition.SERVER_BUSY_ERROR) { - baseWaitTime += SERVER_BUSY_BASE_SLEEP_TIME_IN_SECS; - } - - return this.calculateNextRetryInterval(lastException, remainingTime, baseWaitTime, this.getRetryCount()); - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } - - /** - * Allows a concrete retry policy implementation to offer a base retry interval to be used in - * the calculations performed by 'Retry.GetNextRetryInterval'. - * - * @param lastException The last exception that was observed for the operation to be retried. - * @param remainingTime The amount of time remaining for the cumulative timeout across retry attempts. - * @param baseWaitSeconds The number of seconds to base the suggested retry interval on; - * this should be used as the minimum interval returned under normal circumstances. - * @param retryCount The number of retries that have already been attempted. - * @return The amount of time to delay before retrying the associated operation; if {@code null}, - * then the operation is no longer eligible to be retried. - */ - protected abstract Duration calculateNextRetryInterval(Exception lastException, Duration remainingTime, - int baseWaitSeconds, int retryCount); -} diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryMode.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryMode.java new file mode 100644 index 000000000000..dac126fe64d1 --- /dev/null +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryMode.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.amqp; + +/** + * The type of approach to apply when calculating the delay between retry attempts. + */ +public enum RetryMode { + /** + * Retry attempts happen at fixed intervals; each delay is a consistent duration. + */ + FIXED, + /** + * Retry attempts will delay based on a backoff strategy, where each attempt will increase the duration that it + * waits before retrying. + */ + EXPONENTIAL, +} diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryOptions.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryOptions.java new file mode 100644 index 000000000000..58a426ecc3e5 --- /dev/null +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryOptions.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.amqp; + +import java.time.Duration; +import java.util.Objects; + +/** + * A set of options that can be specified to influence how retry attempts are made. + */ +public class RetryOptions implements Cloneable { + private int maxRetries; + private Duration delay; + private Duration maxDelay; + private Duration tryTimeout; + private RetryMode retryMode; + + /** + * Creates an instance with the default retry options set. + */ + public RetryOptions() { + maxRetries = 3; + delay = Duration.ofMillis(800); + maxDelay = Duration.ofMinutes(1); + tryTimeout = Duration.ofMinutes(1); + retryMode = RetryMode.EXPONENTIAL; + } + + /** + * Sets the approach to use for calculating retry delays. + * + * @param retryMode The retry approach to use for calculating delays. + * @return The updated {@link RetryOptions} object. + */ + public RetryOptions retryMode(RetryMode retryMode) { + this.retryMode = retryMode; + return this; + } + + /** + * Sets the maximum number of retry attempts before considering the associated operation to have failed. + * + * @param numberOfRetries The maximum number of retry attempts. + * @return The updated {@link RetryOptions} object. + */ + public RetryOptions maxRetries(int numberOfRetries) { + this.maxRetries = numberOfRetries; + return this; + } + + /** + * Gets the delay between retry attempts for a fixed approach or the delay on which to base calculations for a + * backoff-approach. + * + * @param delay The delay between retry attempts. + * @return The updated {@link RetryOptions} object. + */ + public RetryOptions delay(Duration delay) { + this.delay = delay; + return this; + } + + /** + * Sets the maximum permissible delay between retry attempts. + * + * @param maximumDelay The maximum permissible delay between retry attempts. + * @return The updated {@link RetryOptions} object. + */ + public RetryOptions maxDelay(Duration maximumDelay) { + this.maxDelay = maximumDelay; + return this; + } + + /** + * Sets the maximum duration to wait for completion of a single attempt, whether the initial attempt or a retry. + * + * @param tryTimeout The maximum duration to wait for completion. + * @return The updated {@link RetryOptions} object. + */ + public RetryOptions tryTimeout(Duration tryTimeout) { + this.tryTimeout = tryTimeout; + return this; + } + + /** + * Gets the approach to use for calculating retry delays. + * + * @return The approach to use for calculating retry delays. + */ + public RetryMode retryMode() { + return retryMode; + } + + /** + * The maximum number of retry attempts before considering the associated operation to have failed. + * + * @return The maximum number of retry attempts before considering the associated operation to have failed. + */ + public int maxRetries() { + return maxRetries; + } + + /** + * Gets the delay between retry attempts for a fixed approach or the delay on which to base calculations for a + * backoff-approach. + * + * @return The delay between retry attempts. + */ + public Duration delay() { + return delay; + } + + /** + * Gets the maximum permissible delay between retry attempts. + * + * @return The maximum permissible delay between retry attempts. + */ + public Duration maxDelay() { + return maxDelay; + } + + /** + * Gets the maximum duration to wait for completion of a single attempt, whether the initial attempt or a retry. + * + * @return The maximum duration to wait for completion of a single attempt, whether the initial attempt or a retry. + */ + public Duration tryTimeout() { + return tryTimeout; + } + + /** + * Creates a new copy of the current instance, cloning its attributes into a new instance. + * + * @return A new copy of {@link RetryOptions}. + */ + @Override + public RetryOptions clone() { + + RetryOptions clone; + try { + clone = (RetryOptions) super.clone(); + } catch (CloneNotSupportedException e) { + clone = new RetryOptions(); + } + + return clone.delay(delay) + .maxDelay(maxDelay) + .maxRetries(maxRetries) + .tryTimeout(tryTimeout) + .retryMode(retryMode); + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (!(obj instanceof RetryOptions)) { + return false; + } + + final RetryOptions other = (RetryOptions) obj; + + return this.maxRetries() == other.maxRetries() + && this.retryMode() == other.retryMode() + && Objects.equals(this.maxDelay(), other.maxDelay()) + && Objects.equals(this.delay(), other.delay()) + && Objects.equals(this.tryTimeout(), other.tryTimeout()); + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() { + return Objects.hash(maxRetries, retryMode, maxDelay, delay, tryTimeout); + } +} 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 new file mode 100644 index 000000000000..5424f705ff1f --- /dev/null +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/RetryPolicy.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.amqp; + +import com.azure.core.amqp.exception.AmqpException; + +import java.time.Duration; +import java.util.Objects; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeoutException; + +import static com.azure.core.amqp.exception.ErrorCondition.SERVER_BUSY_ERROR; + +/** + * An abstract representation of a policy to govern retrying of messaging operations. + */ +public abstract class RetryPolicy implements Cloneable { + static final long NANOS_PER_SECOND = 1000_000_000L; + + private static final double JITTER_FACTOR = 0.08; + // Base sleep wait time. + private static final Duration SERVER_BUSY_WAIT_TIME = Duration.ofSeconds(4); + + private final RetryOptions retryOptions; + private final Duration baseJitter; + + /** + * Creates an instance with the given retry options. If {@link RetryOptions#maxDelay()}, {@link + * RetryOptions#delay()}, or {@link RetryOptions#maxRetries()} is equal to {@link Duration#ZERO} or zero, requests + * failing with a retriable exception will not be retried. + * + * @param retryOptions The options to set on this retry policy. + * @throws NullPointerException if {@code retryOptions} is {@code null}. + */ + protected RetryPolicy(RetryOptions retryOptions) { + Objects.requireNonNull(retryOptions); + + this.retryOptions = retryOptions; + + // 1 second = 1.0 * 10^9 nanoseconds. + final Double jitterInNanos = retryOptions.delay().getSeconds() * JITTER_FACTOR * NANOS_PER_SECOND; + baseJitter = Duration.ofNanos(jitterInNanos.longValue()); + } + + /** + * Gets the set of options used to configure this retry policy. + * + * @return The set of options used to configure this retry policy. + */ + protected RetryOptions getRetryOptions() { + return retryOptions; + } + + /** + * Gets the maximum number of retry attempts. + * + * @return The maximum number of retry attempts. + */ + public int getMaxRetries() { + return retryOptions.maxRetries(); + } + + /** + * Calculates the amount of time to delay before the next retry attempt. + * + * @param lastException The last exception that was observed for the operation to be retried. + * @param retryCount The number of attempts that have been made, including the initial attempt before any + * retries. + * @return The amount of time to delay before retrying the associated operation; if {@code null}, then the operation + * is no longer eligible to be retried. + */ + public Duration calculateRetryDelay(Exception lastException, int retryCount) { + if (retryOptions.delay() == Duration.ZERO + || retryOptions.maxDelay() == Duration.ZERO + || retryCount > retryOptions.maxRetries()) { + return null; + } + + final Duration baseDelay; + if (lastException instanceof AmqpException && isRetriableException(lastException)) { + baseDelay = ((AmqpException) lastException).getErrorCondition() == SERVER_BUSY_ERROR + ? retryOptions.delay().plus(SERVER_BUSY_WAIT_TIME) + : retryOptions.delay(); + } else if (lastException instanceof TimeoutException) { + baseDelay = retryOptions.delay(); + } else { + baseDelay = null; + } + + if (baseDelay == null) { + return null; + } + + final Duration delay = calculateRetryDelay(retryCount, baseDelay, baseJitter, ThreadLocalRandom.current()); + + // If delay is smaller or equal to the maximum delay, return the maximum delay. + return delay.compareTo(retryOptions.maxDelay()) <= 0 + ? delay + : retryOptions.maxDelay(); + } + + /** + * 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. + * @param baseDelay The base delay for a retry attempt. + * @param baseJitter The base jitter delay. + * @param random The random number generator. Can be utilised to calculate a random jitter value for the + * retry. + * @return The amount of time to delay before retrying to associated operation; or {@code null} if the it cannot be + * retried. + */ + protected abstract Duration calculateRetryDelay(int retryCount, Duration baseDelay, Duration baseJitter, + ThreadLocalRandom random); + + /** + * Creates a clone of the retry policy. + * + * @return A new clone of the retry policy. + */ + @Override + public RetryPolicy clone() throws CloneNotSupportedException { + return (RetryPolicy) super.clone(); + } + + @Override + public int hashCode() { + return Objects.hash(retryOptions); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + + if (!(obj instanceof RetryPolicy)) { + return false; + } + + final RetryPolicy other = (RetryPolicy) obj; + return retryOptions.equals(other.retryOptions); + } + + /** + * Check if the existing exception is a retriable exception. + * + * @param exception An exception that was observed for the operation to be retried. + * @return true if the exception is a retriable exception, otherwise false. + */ + private static boolean isRetriableException(Exception exception) { + return (exception instanceof AmqpException) && ((AmqpException) exception).isTransient(); + } +} diff --git a/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/RetryUtil.java b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/RetryUtil.java new file mode 100644 index 000000000000..bbf800bcf402 --- /dev/null +++ b/sdk/core/azure-core-amqp/src/main/java/com/azure/core/amqp/implementation/RetryUtil.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.amqp.implementation; + +import com.azure.core.amqp.ExponentialRetryPolicy; +import com.azure.core.amqp.FixedRetryPolicy; +import com.azure.core.amqp.RetryOptions; +import com.azure.core.amqp.RetryPolicy; +import reactor.core.Exceptions; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.time.Duration; +import java.util.Locale; +import java.util.concurrent.TimeoutException; + +/** + * Helper class to help with retry policies. + */ +public class RetryUtil { + // So this class can't be instantiated. + private RetryUtil() { + } + + /** + * Given a set of {@link RetryOptions options}, creates the appropriate retry policy. + * + * @param options A set of options used to configure the retry policy. + * @return A new retry policy configured with the given {@code options}. + * @throws IllegalArgumentException If {@link RetryOptions#retryMode()} is not a supported mode. + */ + public static RetryPolicy getRetryPolicy(RetryOptions options) { + switch (options.retryMode()) { + case FIXED: + return new FixedRetryPolicy(options); + case EXPONENTIAL: + return new ExponentialRetryPolicy(options); + default: + throw new IllegalArgumentException( + String.format(Locale.ROOT, "Mode is not supported: %s", options.retryMode())); + } + } + + /** + * Given a {@link Flux} will apply the retry policy to it when the operation times out. + * + * @param source The publisher to apply the retry policy to. + * @return A publisher that returns the results of the {@link Flux} if any of the retry attempts are successful. + * Otherwise, propagates a {@link TimeoutException}. + */ + public static Flux withRetry(Flux source, Duration operationTimeout, RetryPolicy retryPolicy) { + return Flux.defer(() -> source.timeout(operationTimeout)) + .retryWhen(errors -> retry(errors, retryPolicy)); + } + + /** + * Given a {@link Mono} will apply the retry policy to it when the operation times out. + * + * @param source The publisher to apply the retry policy to. + * @return A publisher that returns the results of the {@link Flux} if any of the retry attempts are successful. + * Otherwise, propagates a {@link TimeoutException}. + */ + public static Mono withRetry(Mono source, Duration operationTimeout, RetryPolicy retryPolicy) { + return Mono.defer(() -> source.timeout(operationTimeout)) + .retryWhen(errors -> retry(errors, retryPolicy)); + } + + private static Flux retry(Flux source, RetryPolicy retryPolicy) { + return source.zipWith(Flux.range(1, retryPolicy.getMaxRetries() + 1), + (error, attempt) -> { + if (!(error instanceof TimeoutException) || attempt > retryPolicy.getMaxRetries()) { + throw Exceptions.propagate(error); + } + + //TODO (conniey): is it possible to add a logger here even though it is static? :/ + return retryPolicy.calculateRetryDelay((TimeoutException) error, attempt); + }) + .flatMap(Mono::delay); + } +} diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/ExponentialRetryPolicyTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/ExponentialRetryPolicyTest.java new file mode 100644 index 000000000000..fa6049ad6e28 --- /dev/null +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/ExponentialRetryPolicyTest.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.amqp; + +import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.amqp.exception.ErrorCondition; +import com.azure.core.amqp.exception.ErrorContext; +import org.junit.Assert; +import org.junit.Test; + +import java.time.Duration; + +public class ExponentialRetryPolicyTest { + private final ErrorContext errorContext = new ErrorContext("test-namespace"); + private final AmqpException exception = new AmqpException(true, ErrorCondition.SERVER_BUSY_ERROR, "error message", errorContext); + private final Duration minBackoff = Duration.ofSeconds(15); + private final Duration maxBackoff = Duration.ofSeconds(60); + private final Duration tolerance = Duration.ofSeconds(1); + private final int retryAttempts = 5; + private final RetryOptions options = new RetryOptions() + .delay(minBackoff) + .maxDelay(maxBackoff) + .maxRetries(retryAttempts) + .retryMode(RetryMode.EXPONENTIAL); + + /** + * Verifies that when the service is busy and we retry an exception multiple times, the retry duration gets longer. + */ + @Test + public void retryDurationIncreases() { + // Arrange + + final ExponentialRetryPolicy retry = new ExponentialRetryPolicy(options); + + // Act + final Duration firstRetryInterval = retry.calculateRetryDelay(exception, 1); + final Duration secondRetryInterval = retry.calculateRetryDelay(exception, 2); + + // Assert + Assert.assertNotNull(firstRetryInterval); + Assert.assertNotNull(secondRetryInterval); + Assert.assertTrue(secondRetryInterval.toNanos() > firstRetryInterval.toNanos()); + } + + /** + * Verifies that we can clone the retry instance and it behaves the same as its original. + */ + @Test + public void retryCloneBehavesSame() { + // Arrange + final ExponentialRetryPolicy retry = new ExponentialRetryPolicy(options); + final ExponentialRetryPolicy clone = (ExponentialRetryPolicy) retry.clone(); + + final Duration retryInterval = retry.calculateRetryDelay(exception, 1); + final Duration cloneRetryInterval = clone.calculateRetryDelay(exception, 4); + + // Assert + Assert.assertNotNull(retryInterval); + Assert.assertNotNull(cloneRetryInterval); + + // The retry interval for the clone will be larger because we've incremented the retry count, so it should + // calculate a longer waiting period. + Assert.assertTrue(cloneRetryInterval.compareTo(retryInterval) > 0); + } + + /** + * Verify that two instances created with the same set of RetryOptions are equal. + */ + @Test + public void isEquals() { + // Arrange + final ExponentialRetryPolicy policy = new ExponentialRetryPolicy(options); + + final RetryOptions otherOptions = new RetryOptions() + .delay(minBackoff) + .maxDelay(maxBackoff) + .maxRetries(retryAttempts) + .retryMode(RetryMode.EXPONENTIAL); + final ExponentialRetryPolicy otherPolicy = new ExponentialRetryPolicy(otherOptions); + + // Assert + Assert.assertEquals(policy, otherPolicy); + Assert.assertEquals(policy.hashCode(), otherPolicy.hashCode()); + } + + @Test + public void retryClone() { + // Arrange + final ExponentialRetryPolicy retry = new ExponentialRetryPolicy(options); + final ExponentialRetryPolicy clone = (ExponentialRetryPolicy) retry.clone(); + final int retryCount = 1; + + // Act + final Duration retryInterval = retry.calculateRetryDelay(exception, retryCount); + final Duration cloneRetryInterval = clone.calculateRetryDelay(exception, retryCount); + + // Assert + Assert.assertNotSame(retry, clone); + Assert.assertEquals(retry, clone); + Assert.assertEquals(retry.hashCode(), clone.hashCode()); + + Assert.assertNotNull(retryInterval); + Assert.assertNotNull(cloneRetryInterval); + + // Assert that the cloned interval is within our jitter threshold. + final Duration minValue = retryInterval.minus(tolerance); + final Duration maxValue = retryInterval.plus(tolerance); + Assert.assertTrue(minValue.compareTo(cloneRetryInterval) < 0 + && maxValue.compareTo(cloneRetryInterval) > 0); + } +} diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/ExponentialRetryTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/ExponentialRetryTest.java deleted file mode 100644 index 1bf45032e090..000000000000 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/ExponentialRetryTest.java +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.amqp; - -import com.azure.core.amqp.exception.AmqpException; -import com.azure.core.amqp.exception.ErrorCondition; -import com.azure.core.amqp.exception.ErrorContext; -import org.junit.Assert; -import org.junit.Test; - -import java.time.Duration; - -public class ExponentialRetryTest { - private final ErrorContext errorContext = new ErrorContext("test-namespace"); - private final AmqpException exception = new AmqpException(true, ErrorCondition.SERVER_BUSY_ERROR, "error message", errorContext); - private final Duration minBackoff = Duration.ofSeconds(15); - private final Duration maxBackoff = Duration.ofSeconds(45); - private final int retryAttempts = 4; - - /** - * Verifies that when the service is busy and we retry an exception multiple times, the retry duration gets longer. - */ - @Test - public void retryDurationIncreases() { - // Arrange - final ExponentialRetry retry = new ExponentialRetry(minBackoff, maxBackoff, retryAttempts); - final Duration remainingTime = Duration.ofSeconds(60); - - // Act - retry.incrementRetryCount(); - final Duration firstRetryInterval = retry.getNextRetryInterval(exception, remainingTime); - Assert.assertNotNull(firstRetryInterval); - - retry.incrementRetryCount(); - final Duration leftoverTime = remainingTime.minus(firstRetryInterval); - final Duration secondRetryInterval = retry.getNextRetryInterval(exception, leftoverTime); - - // Assert - Assert.assertNotNull(secondRetryInterval); - Assert.assertTrue(secondRetryInterval.toNanos() > firstRetryInterval.toNanos()); - } - - /** - * Verifies that we can clone the retry instance and it behaves the same as its original. - */ - @Test - public void retryCloneBehavesSame() { - // Arrange - final ExponentialRetry retry = new ExponentialRetry(minBackoff, maxBackoff, retryAttempts); - final ExponentialRetry clone = (ExponentialRetry) retry.clone(); - - final Duration remainingTime = Duration.ofSeconds(60); - - retry.incrementRetryCount(); - final Duration retryInterval = retry.getNextRetryInterval(exception, remainingTime); - - clone.incrementRetryCount(); - clone.incrementRetryCount(); - clone.incrementRetryCount(); - final Duration cloneRetryInterval = clone.getNextRetryInterval(exception, remainingTime); - - // Assert - Assert.assertNotNull(retryInterval); - Assert.assertNotNull(cloneRetryInterval); - - // The retry interval for the clone will be larger because we've incremented the retry count, so it should - // calculate a longer waiting period. - Assert.assertTrue(cloneRetryInterval.toNanos() > retryInterval.toNanos()); - } - - @Test - public void retryClone() { - // Arrange - final ExponentialRetry retry = new ExponentialRetry(minBackoff, maxBackoff, retryAttempts); - final ExponentialRetry clone = (ExponentialRetry) retry.clone(); - - final Duration remainingTime = Duration.ofSeconds(60); - - retry.incrementRetryCount(); - final Duration retryInterval = retry.getNextRetryInterval(exception, remainingTime); - - clone.incrementRetryCount(); - final Duration cloneRetryInterval = clone.getNextRetryInterval(exception, remainingTime); - - // Assert - Assert.assertNotSame(retry, clone); - Assert.assertEquals(retry, clone); - Assert.assertEquals(retry.hashCode(), clone.hashCode()); - - Assert.assertNotNull(retryInterval); - Assert.assertNotNull(cloneRetryInterval); - Assert.assertEquals(retryInterval, cloneRetryInterval); - } -} diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/FixedRetryPolicyTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/FixedRetryPolicyTest.java new file mode 100644 index 000000000000..1ed9c257ed08 --- /dev/null +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/FixedRetryPolicyTest.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.amqp; + +import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.amqp.exception.ErrorCondition; +import com.azure.core.amqp.exception.ErrorContext; +import org.junit.Assert; +import org.junit.Test; + +import java.time.Duration; + +public class FixedRetryPolicyTest { + private final ErrorContext errorContext = new ErrorContext("test-namespace"); + private final AmqpException exception = new AmqpException(true, ErrorCondition.SERVER_BUSY_ERROR, "error message", errorContext); + private final Duration minBackoff = Duration.ofSeconds(15); + private final Duration maxBackoff = Duration.ofSeconds(60); + private final Duration tolerance = Duration.ofSeconds(1); + private final int retryAttempts = 5; + private final RetryOptions options = new RetryOptions() + .delay(minBackoff) + .maxDelay(maxBackoff) + .maxRetries(retryAttempts) + .retryMode(RetryMode.FIXED); + + /** + * Verifies that when the service is busy and we retry an exception multiple times, the retry duration gets longer. + */ + @Test + public void retryDurationIsTheSame() { + // Arrange + final FixedRetryPolicy retry = new FixedRetryPolicy(options); + + // Act + final Duration firstRetryInterval = retry.calculateRetryDelay(exception, 1); + final Duration secondRetryInterval = retry.calculateRetryDelay(exception, 2); + + // Assert + Assert.assertNotNull(firstRetryInterval); + Assert.assertNotNull(secondRetryInterval); + + // Assert that the second retry interval is within our jitter threshold. + final Duration minValue = firstRetryInterval.minus(tolerance); + final Duration maxValue = firstRetryInterval.plus(tolerance); + Assert.assertTrue(minValue.compareTo(secondRetryInterval) < 0 + && maxValue.compareTo(secondRetryInterval) > 0); + } + + /** + * Verifies that we can clone the retry instance and it behaves the same as its original. + */ + @Test + public void retryCloneBehavesSame() { + // Arrange + final FixedRetryPolicy retry = new FixedRetryPolicy(options); + final FixedRetryPolicy clone = (FixedRetryPolicy) retry.clone(); + + final Duration retryInterval = retry.calculateRetryDelay(exception, 1); + final Duration cloneRetryInterval = clone.calculateRetryDelay(exception, 4); + + // Assert + Assert.assertNotNull(retryInterval); + Assert.assertNotNull(cloneRetryInterval); + + // Assert that the cloned retry interval is within our jitter threshold. + final Duration minValue = retryInterval.minus(tolerance); + final Duration maxValue = retryInterval.plus(tolerance); + Assert.assertTrue(minValue.compareTo(cloneRetryInterval) < 0 + && maxValue.compareTo(cloneRetryInterval) > 0); + } + + /** + * Verify that two instances created with the same set of RetryOptions are equal. + */ + @Test + public void isEquals() { + // Arrange + final FixedRetryPolicy policy = new FixedRetryPolicy(options); + + final RetryOptions otherOptions = new RetryOptions() + .delay(minBackoff) + .maxDelay(maxBackoff) + .maxRetries(retryAttempts) + .retryMode(RetryMode.FIXED); + final FixedRetryPolicy otherPolicy = new FixedRetryPolicy(otherOptions); + + // Assert + Assert.assertEquals(policy, otherPolicy); + Assert.assertEquals(policy.hashCode(), otherPolicy.hashCode()); + } + + @Test + public void retryClone() { + // Arrange + final FixedRetryPolicy retry = new FixedRetryPolicy(options); + final FixedRetryPolicy clone = (FixedRetryPolicy) retry.clone(); + final int retryCount = 1; + + // Act + final Duration retryInterval = retry.calculateRetryDelay(exception, retryCount); + final Duration cloneRetryInterval = clone.calculateRetryDelay(exception, retryCount); + + // Assert + Assert.assertNotSame(retry, clone); + Assert.assertEquals(retry, clone); + Assert.assertEquals(retry.hashCode(), clone.hashCode()); + + Assert.assertNotNull(retryInterval); + Assert.assertNotNull(cloneRetryInterval); + + // Assert that the cloned interval is within our jitter threshold. + final Duration minValue = retryInterval.minus(tolerance); + final Duration maxValue = retryInterval.plus(tolerance); + Assert.assertTrue(minValue.compareTo(cloneRetryInterval) < 0 + && maxValue.compareTo(cloneRetryInterval) > 0); + } +} diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryOptionsTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryOptionsTest.java new file mode 100644 index 000000000000..e2af9cd90239 --- /dev/null +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryOptionsTest.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.amqp; + +import org.junit.Assert; +import org.junit.Test; + +import java.time.Duration; + +public class RetryOptionsTest { + /** + * Test there are defaults set when creating RetryOptions + */ + @Test + public void constructor() { + // Arrange + final Duration defaultTimeout = Duration.ofMinutes(1); + final int maxRetries = 3; + + // Act + final RetryOptions options = new RetryOptions(); + + // Assert + Assert.assertEquals(maxRetries, options.maxRetries()); + Assert.assertEquals(RetryMode.EXPONENTIAL, options.retryMode()); + Assert.assertEquals(defaultTimeout, options.maxDelay()); + Assert.assertEquals(defaultTimeout, options.tryTimeout()); + } + + /** + * Verifies we can set new properties. + */ + @Test + public void canSetProperties() { + // Arrange + final Duration delay = Duration.ofMillis(1000); + final Duration maxDelay = Duration.ofMinutes(10); + final Duration tryTimeout = Duration.ofMinutes(2); + final int retries = 10; + final RetryMode retryMode = RetryMode.FIXED; + final RetryOptions options = new RetryOptions(); + + // Act + final RetryOptions actual = options.retryMode(retryMode) + .maxDelay(maxDelay) + .delay(delay) + .maxRetries(retries) + .tryTimeout(tryTimeout); + + // Assert + Assert.assertEquals(delay, actual.delay()); + Assert.assertEquals(maxDelay, actual.maxDelay()); + Assert.assertEquals(tryTimeout, actual.tryTimeout()); + Assert.assertEquals(retries, actual.maxRetries()); + Assert.assertEquals(retryMode, actual.retryMode()); + } + + /** + * Verifies that we can clone the RetryOptions object, and its fields change independent of the original. + */ + @Test + public void canClone() { + // Arrange + final Duration delay = Duration.ofMillis(1000); + final Duration maxDelay = Duration.ofMinutes(10); + final Duration tryTimeout = Duration.ofMinutes(2); + final int retries = 10; + final RetryMode retryMode = RetryMode.FIXED; + + final Duration newDelay = Duration.ofMillis(700); + final Duration newMaxDelay = Duration.ofSeconds(90); + final Duration newTryTimeout = Duration.ofMinutes(2); + final int newRetries = 5; + final RetryMode newRetryMode = RetryMode.EXPONENTIAL; + + final RetryOptions original = new RetryOptions().retryMode(retryMode) + .maxDelay(maxDelay) + .delay(delay) + .maxRetries(retries) + .tryTimeout(tryTimeout); + + // Act + final RetryOptions clone = original.clone(); + Assert.assertNotNull(clone); + Assert.assertEquals(original, clone); + + final RetryOptions actual = clone + .retryMode(newRetryMode) + .maxDelay(newMaxDelay) + .delay(newDelay) + .maxRetries(newRetries) + .tryTimeout(newTryTimeout); + + // Assert + Assert.assertNotSame(original, actual); + Assert.assertEquals(delay, original.delay()); + Assert.assertEquals(maxDelay, original.maxDelay()); + Assert.assertEquals(tryTimeout, original.tryTimeout()); + Assert.assertEquals(retries, original.maxRetries()); + Assert.assertEquals(retryMode, original.retryMode()); + + Assert.assertEquals(newDelay, actual.delay()); + Assert.assertEquals(newMaxDelay, actual.maxDelay()); + Assert.assertEquals(newTryTimeout, actual.tryTimeout()); + Assert.assertEquals(newRetries, actual.maxRetries()); + Assert.assertEquals(newRetryMode, actual.retryMode()); + } + + @Test + public void isEqual() { + // Arrange + final RetryOptions first = new RetryOptions() + .retryMode(RetryMode.FIXED) + .maxDelay(Duration.ofMinutes(10)) + .delay(Duration.ofMillis(1000)) + .maxRetries(10) + .tryTimeout(Duration.ofMinutes(2)); + + final RetryOptions second = new RetryOptions() + .retryMode(RetryMode.FIXED) + .maxDelay(Duration.ofMinutes(10)) + .delay(Duration.ofMillis(1000)) + .maxRetries(10) + .tryTimeout(Duration.ofMinutes(2)); + + Assert.assertEquals(first, second); + Assert.assertEquals(first.hashCode(), second.hashCode()); + } +} diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryPolicyTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryPolicyTest.java new file mode 100644 index 000000000000..420d5c273ad0 --- /dev/null +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryPolicyTest.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.amqp; + +import com.azure.core.amqp.exception.AmqpException; +import com.azure.core.amqp.exception.ErrorContext; +import org.junit.Assert; +import org.junit.Test; + +import java.time.Duration; +import java.util.concurrent.ThreadLocalRandom; +import java.util.concurrent.TimeoutException; + +public class RetryPolicyTest { + private final ErrorContext errorContext = new ErrorContext("test-namespace"); + private final int maxRetries = 10; + private final Duration maxDelay = Duration.ofSeconds(120); + private final Duration delay = Duration.ofSeconds(20); + private final RetryOptions options = new RetryOptions() + .maxRetries(maxRetries) + .maxDelay(maxDelay) + .delay(delay); + + /** + * Verifies we retry on a retriable AmqpException. + */ + @Test + public void isRetriableException() { + // Arrange + final Exception exception = new AmqpException(true, "error message", errorContext); + final Duration expected = Duration.ofSeconds(40); + final int count = 2; + final RetryPolicy policy = new MockRetryPolicy(options, expected); + + // Act + final Duration actual = policy.calculateRetryDelay(exception, count); + + // Assert + Assert.assertEquals(expected, actual); + Assert.assertEquals(maxRetries, policy.getMaxRetries()); + } + + /** + * Verifies that a timeout exception will allow for retries. + */ + @Test + public void isTimeoutException() { + // Arrange + final Exception exception = new TimeoutException("test-message-timeout"); + final Duration expected = Duration.ofSeconds(40); + final int count = 2; + final RetryPolicy policy = new MockRetryPolicy(options, expected); + + // Act + final Duration actual = policy.calculateRetryDelay(exception, count); + + // Assert + Assert.assertEquals(expected, actual); + } + + /** + * Verifies that null is returned if the exception is not an AmqpException. + */ + @Test + public void notRetriableException() { + // Arrange + final Exception invalidException = new RuntimeException("invalid exception"); + final Duration expected = Duration.ofSeconds(40); + final int count = 2; + final RetryPolicy policy = new MockRetryPolicy(options, expected); + + // Act + final Duration actual = policy.calculateRetryDelay(invalidException, count); + + // Assert + Assert.assertNull(actual); + } + + /** + * Verifies that null is returned if the AmqpException is not transient. + */ + @Test + public void notRetriableExceptionNotTransient() { + // Arrange + final Exception invalidException = new AmqpException(false, "Some test exception", errorContext); + final Duration expected = Duration.ofSeconds(40); + final int count = 2; + final RetryPolicy policy = new MockRetryPolicy(options, expected); + + // Act + final Duration actual = policy.calculateRetryDelay(invalidException, count); + + // Assert + Assert.assertNull(actual); + } + + /** + * Verifies that we return {@link RetryOptions#maxDelay()} if the returned delay is larger than the maximum. + */ + @Test + public void returnsMaxDelayIfDelayLarger() { + // Arrange + final Exception exception = new AmqpException(true, "error message", errorContext); + final Duration returnedDelay = maxDelay.plus(Duration.ofMillis(50)); + final int count = 2; + final RetryPolicy policy = new MockRetryPolicy(options, returnedDelay); + + // Act + final Duration actual = policy.calculateRetryDelay(exception, count); + + // Assert + Assert.assertEquals(maxDelay, actual); + Assert.assertEquals(maxRetries, policy.getMaxRetries()); + } + + private class MockRetryPolicy extends RetryPolicy { + private final Duration expectedDuration; + + /** + * Creates an instance with the given retry options. + * + * @param retryOptions The options to set on this retry policy. + */ + MockRetryPolicy(RetryOptions retryOptions, Duration expectedDuration) { + super(retryOptions); + this.expectedDuration = expectedDuration; + } + + @Override + protected Duration calculateRetryDelay(int retryCount, Duration baseDelay, Duration baseJitter, ThreadLocalRandom random) { + return expectedDuration; + } + + @Override + public RetryPolicy clone() { + return new MockRetryPolicy(getRetryOptions(), expectedDuration); + } + } +} diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryTest.java deleted file mode 100644 index fa30f6d5cce2..000000000000 --- a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/RetryTest.java +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.core.amqp; - -import com.azure.core.amqp.exception.AmqpException; -import com.azure.core.amqp.exception.ErrorCondition; -import com.azure.core.amqp.exception.ErrorContext; -import org.junit.Assert; -import org.junit.Test; - -import java.time.Duration; - -public class RetryTest { - private final ErrorContext errorContext = new ErrorContext("test-namespace"); - - /** - * Verifies that when the service is busy and we retry an exception multiple times, the retry duration gets longer. - */ - @Test - public void defaultRetryPolicy() { - // Arrange - final Retry retry = Retry.getDefaultRetry(); - final AmqpException exception = new AmqpException(true, ErrorCondition.SERVER_BUSY_ERROR, "error message", errorContext); - final Duration remainingTime = Duration.ofSeconds(60); - - // Act - retry.incrementRetryCount(); - final Duration firstRetryInterval = retry.getNextRetryInterval(exception, remainingTime); - Assert.assertNotNull(firstRetryInterval); - - retry.incrementRetryCount(); - final Duration leftoverTime = remainingTime.minus(firstRetryInterval); - final Duration secondRetryInterval = retry.getNextRetryInterval(exception, leftoverTime); - - // Assert - Assert.assertNotNull(secondRetryInterval); - Assert.assertTrue(secondRetryInterval.toNanos() > firstRetryInterval.toNanos()); - } - - /** - * Verifies we can increment the retry count. - */ - @Test - public void canIncrementRetryCount() { - Retry retry = Retry.getDefaultRetry(); - Assert.assertEquals(0, retry.getRetryCount()); - Assert.assertEquals(0, retry.incrementRetryCount()); - - Assert.assertEquals(1, retry.getRetryCount()); - Assert.assertEquals(1, retry.incrementRetryCount()); - - Assert.assertEquals(2, retry.getRetryCount()); - Assert.assertEquals(2, retry.incrementRetryCount()); - - retry.resetRetryInterval(); - - Assert.assertEquals(0, retry.getRetryCount()); - Assert.assertEquals(0, retry.incrementRetryCount()); - - Assert.assertEquals(1, retry.getRetryCount()); - } - - @Test - public void isRetriableException() { - final Exception exception = new AmqpException(true, "error message", errorContext); - Assert.assertTrue(Retry.isRetriableException(exception)); - } - - @Test - public void notRetriableException() { - final Exception invalidException = new RuntimeException("invalid exception"); - Assert.assertFalse(Retry.isRetriableException(invalidException)); - } - - @Test - public void notRetriableExceptionNotTransient() { - final Exception invalidException = new AmqpException(false, "Some test exception", errorContext); - Assert.assertFalse(Retry.isRetriableException(invalidException)); - } - - /** - * Verifies that using no retry policy does not allow us to retry a failed request. - */ - @Test - public void noRetryPolicy() { - // Arrange - final Retry noRetry = Retry.getNoRetry(); - final Exception exception = new AmqpException(true, "error message", errorContext); - final Duration remainingTime = Duration.ofSeconds(60); - - // Act - final Duration nextRetryInterval = noRetry.getNextRetryInterval(exception, remainingTime); - int retryCount = noRetry.incrementRetryCount(); - - // Assert - Assert.assertEquals(0, retryCount); - Assert.assertNull(nextRetryInterval); - } - - /** - * Verifies that if we exceed the number of allowed retry attempts, the next retry interval, even if there is time - * remaining, is null. - */ - @Test - public void excessMaxRetry() { - // Arrange - final Retry retry = Retry.getDefaultRetry(); - final Exception exception = new AmqpException(true, "error message", errorContext); - final Duration sixtySec = Duration.ofSeconds(60); - - // Simulates that we've tried to retry the max number of requests this allows. - for (int i = 0; i < retry.getMaxRetryCount(); i++) { - retry.incrementRetryCount(); - } - - // Act - final Duration nextRetryInterval = retry.getNextRetryInterval(exception, sixtySec); - - // Assert - Assert.assertEquals(Retry.DEFAULT_MAX_RETRY_COUNT, retry.getRetryCount()); - Assert.assertNull(nextRetryInterval); - } -} diff --git a/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/RetryUtilTest.java b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/RetryUtilTest.java new file mode 100644 index 000000000000..0da0ac848499 --- /dev/null +++ b/sdk/core/azure-core-amqp/src/test/java/com/azure/core/amqp/implementation/RetryUtilTest.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.amqp.implementation; + +import com.azure.core.amqp.ExponentialRetryPolicy; +import com.azure.core.amqp.FixedRetryPolicy; +import com.azure.core.amqp.RetryMode; +import com.azure.core.amqp.RetryOptions; +import com.azure.core.amqp.RetryPolicy; +import com.azure.core.amqp.TransportType; +import org.junit.Assert; +import org.junit.Test; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; + +import java.time.Duration; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.atomic.AtomicInteger; + +public class RetryUtilTest { + @Test + public void getCorrectModeFixed() { + // Act + final RetryOptions retryOptions = new RetryOptions() + .retryMode(RetryMode.FIXED); + final RetryPolicy retryPolicy = RetryUtil.getRetryPolicy(retryOptions); + + // Assert + Assert.assertNotNull(retryPolicy); + Assert.assertEquals(FixedRetryPolicy.class, retryPolicy.getClass()); + } + + @Test + public void getCorrectModeExponential() { + // Act + final RetryOptions retryOptions = new RetryOptions() + .retryMode(RetryMode.EXPONENTIAL); + final RetryPolicy retryPolicy = RetryUtil.getRetryPolicy(retryOptions); + + // Assert + Assert.assertNotNull(retryPolicy); + Assert.assertEquals(ExponentialRetryPolicy.class, retryPolicy.getClass()); + } + + @Test + public void withRetryFlux() { + // Arrange + final RetryOptions options = new RetryOptions() + .delay(Duration.ofSeconds(1)) + .maxRetries(2); + final Duration totalWaitTime = Duration.ofSeconds(options.maxRetries() * options.delay().getSeconds()); + final Duration timeout = Duration.ofMillis(500); + + final AtomicInteger resubscribe = new AtomicInteger(); + final RetryPolicy retryPolicy = new FixedRetryPolicy(options); + final Flux neverFlux = Flux.never() + .doOnSubscribe(s -> resubscribe.incrementAndGet()); + + // Act & Assert + StepVerifier.create(RetryUtil.withRetry(neverFlux, timeout, retryPolicy)) + .expectSubscription() + .thenAwait(totalWaitTime) + .expectError(TimeoutException.class) + .verify(); + + Assert.assertEquals(options.maxRetries() + 1, resubscribe.get()); + } + + @Test + public void withRetryMono() { + // Arrange + final RetryOptions options = new RetryOptions() + .delay(Duration.ofSeconds(1)) + .maxRetries(2); + final Duration totalWaitTime = Duration.ofSeconds(options.maxRetries() * options.delay().getSeconds()); + final Duration timeout = Duration.ofMillis(500); + + final AtomicInteger resubscribe = new AtomicInteger(); + final RetryPolicy retryPolicy = new FixedRetryPolicy(options); + final Mono neverFlux = Mono.never() + .doOnSubscribe(s -> resubscribe.incrementAndGet()); + + // Act & Assert + StepVerifier.create(RetryUtil.withRetry(neverFlux, timeout, retryPolicy)) + .expectSubscription() + .thenAwait(totalWaitTime) + .expectError(TimeoutException.class) + .verify(); + + Assert.assertEquals(options.maxRetries() + 1, resubscribe.get()); + } +} diff --git a/sdk/core/azure-core-management/pom.xml b/sdk/core/azure-core-management/pom.xml index 19accb8aaa85..974cad20d1b6 100644 --- a/sdk/core/azure-core-management/pom.xml +++ b/sdk/core/azure-core-management/pom.xml @@ -6,9 +6,9 @@ 4.0.0 com.azure - azure-core-parent - 1.0.0-preview.3 - ../pom.xml + azure-client-sdk-parent + 1.1.0 + ../../../pom.client.xml com.azure 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 a60817b69fdd..d892d00ce718 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 @@ -8,6 +8,7 @@ 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.policy.CookiePolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -189,7 +190,7 @@ public static HttpPipeline createDefaultPipeline(Class swaggerInterface, Http policies.add(credentialsPolicy); } - return HttpPipeline.builder() + return new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .build(); } diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyTests.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyTests.java index 8e6e63c015b6..c61f36a953b2 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyTests.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyTests.java @@ -3,6 +3,7 @@ package com.azure.core.management; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.implementation.annotation.BodyParam; import com.azure.core.implementation.annotation.Delete; import com.azure.core.implementation.annotation.ExpectedResponses; @@ -764,7 +765,7 @@ public void service18GetStatus500WithExpectedResponse500() { } private T createService(Class serviceClass) { - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(createHttpClient()) .build(); // diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/AzureProxyTests.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/AzureProxyTests.java index 7f1de50865f5..05adb15d5994 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/AzureProxyTests.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/AzureProxyTests.java @@ -3,6 +3,7 @@ package com.azure.core.management.implementation; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.implementation.annotation.Delete; import com.azure.core.implementation.annotation.ExpectedResponses; import com.azure.core.implementation.annotation.Get; @@ -851,7 +852,7 @@ public Mono send(HttpRequest request) { } private static T createMockService(Class serviceClass, MockAzureHttpClient httpClient) { - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(httpClient) .build(); diff --git a/sdk/core/azure-core-test/README.md b/sdk/core/azure-core-test/README.md index 9fbc3c45c3f6..6bd321f2e250 100644 --- a/sdk/core/azure-core-test/README.md +++ b/sdk/core/azure-core-test/README.md @@ -16,7 +16,7 @@ To use this package, add the following to your _pom.xml_. com.azure azure-core-test - 1.0.0-preview.1 + 1.0.0-preview.3 ``` diff --git a/sdk/core/azure-core-test/pom.xml b/sdk/core/azure-core-test/pom.xml index 7dd327ef2b29..16a132e6c89a 100644 --- a/sdk/core/azure-core-test/pom.xml +++ b/sdk/core/azure-core-test/pom.xml @@ -5,9 +5,9 @@ 4.0.0 com.azure - azure-core-parent - 1.0.0-preview.3 - ../pom.xml + azure-client-sdk-parent + 1.1.0 + ../../../pom.client.xml com.azure diff --git a/sdk/core/azure-core/README.md b/sdk/core/azure-core/README.md index 5323106dd8d0..1cb9a0ffe9c6 100644 --- a/sdk/core/azure-core/README.md +++ b/sdk/core/azure-core/README.md @@ -14,7 +14,7 @@ Typically, you will not need to install or specifically depend on Azure Core, in com.azure azure-core - 1.0.0-preview.2 + 1.0.0-preview.3 ``` diff --git a/sdk/core/azure-core/pom.xml b/sdk/core/azure-core/pom.xml index 33deba0573e1..3cda1c5ee1ea 100644 --- a/sdk/core/azure-core/pom.xml +++ b/sdk/core/azure-core/pom.xml @@ -6,9 +6,9 @@ 4.0.0 com.azure - azure-core-parent - 1.0.0-preview.3 - ../pom.xml + azure-client-sdk-parent + 1.1.0 + ../../../pom.client.xml com.azure diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java index e39bdd33b248..ee0ad8cfdb57 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java @@ -3,12 +3,6 @@ package com.azure.core.http; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializable; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.jsontype.TypeSerializer; - -import java.io.IOException; import java.util.HashMap; import java.util.Iterator; import java.util.Locale; @@ -17,7 +11,7 @@ /** * A collection of headers on an HTTP request or response. */ -public class HttpHeaders implements Iterable, JsonSerializable { +public class HttpHeaders implements Iterable { private final Map headers = new HashMap<>(); /** @@ -128,14 +122,4 @@ public Map toMap() { public Iterator iterator() { return headers.values().iterator(); } - - @Override - public void serialize(JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { - jsonGenerator.writeObject(toMap()); - } - - @Override - public void serializeWithType(JsonGenerator jsonGenerator, SerializerProvider serializerProvider, TypeSerializer typeSerializer) throws IOException { - serialize(jsonGenerator, serializerProvider); - } } 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 7ee93824740a..c0ae2db65d2e 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 @@ -18,15 +18,6 @@ public final class HttpPipeline { private final HttpPipelinePolicy[] pipelinePolicies; - /** - * Creates a builder that can configure options for the HttpPipeline before creating an instance of it. - * - * @return A new {@link HttpPipelineBuilder} to create a HttpPipeline from. - */ - public static HttpPipelineBuilder builder() { - return new HttpPipelineBuilder(); - } - /** * Creates a HttpPipeline holding array of policies that gets applied to all request initiated through * {@link HttpPipeline#send(HttpPipelineCallContext)} and it's response. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineBuilder.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineBuilder.java index 14f7f6ab53e5..4df299958bf7 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineBuilder.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineBuilder.java @@ -21,14 +21,14 @@ *

Create a pipeline without configuration

* *
- * HttpPipeline.builder()
+ * new HttpPipelineBuilder()
  *     .build();
  * 
* *

Create a pipeline using the default HTTP client and a retry policy

* *
- * HttpPipeline.builder()
+ * new HttpPipelineBuilder()
  *     .httpClient(HttpClient.createDefault())
  *     .policies(new RetryPolicy())
  *     .build();
@@ -41,7 +41,11 @@ public class HttpPipelineBuilder {
     private List pipelinePolicies;
 
 
-    HttpPipelineBuilder() {
+    /**
+     *  Creates a new instance of HttpPipelineBuilder that can configure options for the {@link HttpPipeline} before
+     *  creating an instance of it.
+     */
+    public HttpPipelineBuilder() {
     }
 
     /**
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/UserAgentPolicy.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/UserAgentPolicy.java
index bb2aad90f6be..a4540edf5e9a 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/UserAgentPolicy.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/UserAgentPolicy.java
@@ -73,10 +73,17 @@ public UserAgentPolicy(String sdkName, String sdkVersion, Configuration configur
         }
     }
 
+    /**
+     * Updates the User-Agent header with the value supplied in the policy.
+     *
+     * When the User-Agent header already has a value and it differs from the value used to create this policy the
+     * User-Agent header is updated by prepending the value in this policy.
+     * {@inheritDoc}
+     */
     @Override
     public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) {
         String header = context.httpRequest().headers().value("User-Agent");
-        if (header == null || DEFAULT_USER_AGENT_HEADER.equals(header)) {
+        if (header == null || header.startsWith(DEFAULT_USER_AGENT_HEADER)) {
             header = userAgent;
         } else {
             header = userAgent + " " + header;
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
new file mode 100644
index 000000000000..abdb328a556c
--- /dev/null
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/IterableResponse.java
@@ -0,0 +1,59 @@
+// 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 6ea3bb3bb8aa..0ddf3a89cd82 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 @@ -133,6 +133,10 @@ private Publisher extractAndFetchT(PagedResponse page) { * @return A {@link Flux} of {@link PagedResponse} */ private Publisher> extractAndFetchPage(PagedResponse 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 new file mode 100644 index 000000000000..cac6c353efae --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/rest/PagedIterable.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.rest; + +import java.util.stream.Stream; + +/** + * This class provides utility to iterate over {@link PagedResponse} using {@link Stream} and {@link Iterable} interfaces. + * + *

Code sample using {@link Stream} by page

+ * + * {@codesnippet com.azure.core.http.rest.pagedIterable.streamByPage} + * + *

Code sample using {@link Iterable} by page

+ * + * {@codesnippet com.azure.core.http.rest.pagedIterable.iterableByPage} + * + *

Code sample using {@link Iterable} by page and while loop

+ * + * {@codesnippet com.azure.core.http.rest.pagedIterable.iterableByPage.while} + * + * @param The type of value contained in this {@link IterableResponse}. + * @see PagedResponse + * @see IterableResponse + */ +public class PagedIterable extends IterableResponse { + private final PagedFlux pagedFlux; + + /** + * Creates instance given {@link PagedFlux}. + * @param pagedFlux to use as iterable + */ + public PagedIterable(PagedFlux pagedFlux) { + super(pagedFlux); + this.pagedFlux = pagedFlux; + } + + /** + * Retrieve the {@link Stream}, one page at a time. + * It will provide same {@link Stream} of T values from starting if called multiple times. + * @return {@link Stream} of {@link PagedResponse} + */ + public Stream> streamByPage() { + return pagedFlux.byPage().toStream(); + } + + /** + * Provides {@link Iterable} API for{ @link PagedResponse} + * It will provide same collection of T values from starting if called multiple times. + * @return {@link Iterable} interface + */ + public Iterable> iterableByPage() { + return pagedFlux.byPage().toIterable(); + } + +} 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 d61885ce272b..107a3c410b24 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 @@ -11,6 +11,7 @@ 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.policy.CookiePolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -624,7 +625,7 @@ public static HttpPipeline createDefaultPipeline(HttpPipelinePolicy credentialsP policies.add(credentialsPolicy); } - return HttpPipeline.builder() + return new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .build(); } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/HttpHeadersSerializer.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/HttpHeadersSerializer.java new file mode 100644 index 000000000000..352a9dd4251d --- /dev/null +++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/HttpHeadersSerializer.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.implementation.serializer.jackson; + +import com.azure.core.http.HttpHeaders; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.module.SimpleModule; + +import java.io.IOException; + +/** + * Custom serializer for serializing {@code HttpHeaders} objects into Base64 strings. + */ +final class HttpHeadersSerializer extends JsonSerializer { + /** + * Gets a module wrapping this serializer as an adapter for the Jackson + * ObjectMapper. + * + * @return a simple module to be plugged onto Jackson ObjectMapper. + */ + public static SimpleModule getModule() { + SimpleModule module = new SimpleModule(); + module.addSerializer(HttpHeaders.class, new HttpHeadersSerializer()); + return module; + } + + @Override + public void serialize(HttpHeaders value, JsonGenerator jgen, SerializerProvider provider) throws IOException { + jgen.writeObject(value.toMap()); + } +} 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 c5a0a8c8fd38..c8fa542aa34e 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 @@ -170,7 +170,8 @@ private static T initializeObjectMapper(T mapper) { .registerModule(Base64UrlSerializer.getModule()) .registerModule(DateTimeSerializer.getModule()) .registerModule(DateTimeRfc1123Serializer.getModule()) - .registerModule(DurationSerializer.getModule()); + .registerModule(DurationSerializer.getModule()) + .registerModule(HttpHeadersSerializer.getModule()); mapper.setVisibility(mapper.getSerializationConfig().getDefaultVisibilityChecker() .withFieldVisibility(JsonAutoDetect.Visibility.ANY) .withSetterVisibility(JsonAutoDetect.Visibility.NONE) 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 c13d5b9bee02..032fed01998b 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 @@ -3,6 +3,7 @@ package com.azure.core.implementation.util; +import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; @@ -199,6 +200,16 @@ public static Mono withContext(Function> serviceCall) { .flatMap(serviceCall); } + /** + * Converts the incoming content to Mono. + * + * @param response whose {@link Response#value() value} is to be converted + * @return The converted {@link Mono} + */ + public static Mono toMono(Response response) { + return Mono.justOrEmpty(response.value()); + } + /** * 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 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 ab68188df243..f4f4365af3c0 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 @@ -220,13 +220,19 @@ private T convertOrDefault(String value, T defaultValue) { */ private boolean loadFrom(String name, Function loader, String logMessage) { String value = loader.apply(name); - if (!ImplUtils.isNullOrEmpty(value) && !value.equals(configurations.get(name))) { + + if (value == null) { + // Nothing was loaded + return false; + } else if (value.equals(configurations.get(name))) { + // Value loaded is the same, no need to log anything. + return true; + } else { + // Value changed, log it! configurations.put(name, value); logger.info(logMessage, name, value); return true; } - - return false; } /* 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 new file mode 100644 index 000000000000..9ccdd4157ed4 --- /dev/null +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/IterableResponseJavaDocCodeSnippets.java @@ -0,0 +1,120 @@ +// 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/PagedIterableJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedIterableJavaDocCodeSnippets.java new file mode 100644 index 000000000000..23e2b4be8a61 --- /dev/null +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/http/rest/PagedIterableJavaDocCodeSnippets.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.rest; + +import reactor.core.publisher.Mono; + +import java.util.Iterator; +import java.util.function.Function; +import java.util.function.Supplier; + +/** + * Code snippets for {@link PagedIterable} + */ +public class PagedIterableJavaDocCodeSnippets { + + /**Provides an example for iterate over each response using streamByPage function.**/ + public void streamByPageSnippet() { + + PagedFlux pagedFlux = createAnInstance(); + PagedIterable pagedIterableResponse = new PagedIterable<>(pagedFlux); + + // BEGIN: com.azure.core.http.rest.pagedIterable.streamByPage + // process the streamByPage + pagedIterableResponse.streamByPage().forEach(resp -> { + System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.headers(), + resp.request().url(), resp.statusCode()); + resp.items().forEach(value -> { + System.out.printf("Response value is %d %n", value); + }); + }); + // END: com.azure.core.http.rest.pagedIterable.streamByPage + } + + /**Provides an example for iterate over each response using iterableByPage function.**/ + public void iterateByPageSnippet() { + + PagedFlux pagedFlux = createAnInstance(); + PagedIterable pagedIterableResponse = new PagedIterable<>(pagedFlux); + + // BEGIN: com.azure.core.http.rest.pagedIterable.iterableByPage + // process the iterableByPage + pagedIterableResponse.iterableByPage().forEach(resp -> { + System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.headers(), + resp.request().url(), resp.statusCode()); + resp.items().forEach(value -> { + System.out.printf("Response value is %d %n", value); + }); + }); + // END: com.azure.core.http.rest.pagedIterable.iterableByPage + } + + /**Provides an example for iterate over each response using iterableByPage function and while loop.**/ + public void iterableByPageWhileSnippet() { + + PagedFlux pagedFlux = createAnInstance(); + PagedIterable pagedIterableResponse = new PagedIterable<>(pagedFlux); + + // BEGIN: com.azure.core.http.rest.pagedIterable.iterableByPage.while + // iterate over each page + Iterator> ite = pagedIterableResponse.iterableByPage().iterator(); + while (ite.hasNext()) { + PagedResponse resp = ite.next(); + System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.headers(), + resp.request().url(), resp.statusCode()); + resp.items().forEach(value -> { + System.out.printf("Response value is %d %n", value); + }); + } + // END: com.azure.core.http.rest.pagedIterable.iterableByPage.while + } + + /** + * Code snippets for creating an instance of {@link PagedFlux} + * @return An instance of {@link PagedFlux} + */ + public PagedFlux createAnInstance() { + + // BEGIN: com.azure.core.http.rest.pagedflux.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); + + PagedFlux pagedFlux = new PagedFlux<>(firstPageRetriever, + nextPageRetriever); + // END: com.azure.core.http.rest.pagedflux.instantiation + return pagedFlux; + } + + /** + * 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/implementation/util/FluxUtilJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/implementation/util/FluxUtilJavaDocCodeSnippets.java index d09272ddb377..e61e9a3434fd 100644 --- a/sdk/core/azure-core/src/samples/java/com/azure/core/implementation/util/FluxUtilJavaDocCodeSnippets.java +++ b/sdk/core/azure-core/src/samples/java/com/azure/core/implementation/util/FluxUtilJavaDocCodeSnippets.java @@ -53,5 +53,4 @@ private Flux serviceCallReturnsCollection(String prefix, Context context private Mono serviceCallReturnsSingle(String prefix, Context context) { return Mono.empty(); } - } diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/ConfigurationTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/ConfigurationTests.java index 3ac2eca6bd20..441c23ff5d1f 100644 --- a/sdk/core/azure-core/src/test/java/com/azure/core/ConfigurationTests.java +++ b/sdk/core/azure-core/src/test/java/com/azure/core/ConfigurationTests.java @@ -8,9 +8,9 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; /** * Tests the configuration API. @@ -94,13 +94,24 @@ public void notFoundConfigurationIsConvertedToNull() { } @Test - public void logLevelAndTracingDisabledUpdateInstantly() { - assertNull(ConfigurationManager.getConfiguration().get(BaseConfigurations.AZURE_LOG_LEVEL)); - System.setProperty(BaseConfigurations.AZURE_LOG_LEVEL, "2"); - assertEquals(2, (int) ConfigurationManager.getConfiguration().get(BaseConfigurations.AZURE_LOG_LEVEL, 5)); - - assertNull(ConfigurationManager.getConfiguration().get(BaseConfigurations.AZURE_TELEMETRY_DISABLED)); - System.setProperty(BaseConfigurations.AZURE_TELEMETRY_DISABLED, Boolean.toString(true)); - assertTrue(ConfigurationManager.getConfiguration().get(BaseConfigurations.AZURE_TELEMETRY_DISABLED, false)); + public void logLevelUpdatesInstantly() { + String initialLogLevel = ConfigurationManager.getConfiguration().get(BaseConfigurations.AZURE_LOG_LEVEL); + System.setProperty(BaseConfigurations.AZURE_LOG_LEVEL, "123456789"); + assertNotEquals(initialLogLevel, ConfigurationManager.getConfiguration().get(BaseConfigurations.AZURE_LOG_LEVEL)); + + // Cleanup the test + if (initialLogLevel != null) { + System.setProperty(BaseConfigurations.AZURE_LOG_LEVEL, initialLogLevel); + } + } + + @Test + public void tracingDisabledUpdatesInstantly() { + boolean initialTracingDisabled = Boolean.parseBoolean(ConfigurationManager.getConfiguration().get(BaseConfigurations.AZURE_TRACING_DISABLED)); + System.setProperty(BaseConfigurations.AZURE_TRACING_DISABLED, Boolean.toString(!initialTracingDisabled)); + assertNotEquals(initialTracingDisabled, ConfigurationManager.getConfiguration().get(BaseConfigurations.AZURE_TRACING_DISABLED)); + + // Cleanup the test + System.setProperty(BaseConfigurations.AZURE_TRACING_DISABLED, Boolean.toString(initialTracingDisabled)); } } 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 404631e808c4..c97baf2b59ad 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 @@ -6,6 +6,7 @@ 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.MockHttpClient; import com.azure.core.http.MockHttpResponse; @@ -19,7 +20,7 @@ public class UserAgentTests { @Test public void defaultUserAgentTests() throws Exception { - final HttpPipeline pipeline = HttpPipeline.builder() + final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new MockHttpClient() { @Override public Mono send(HttpRequest request) { @@ -40,7 +41,7 @@ public Mono send(HttpRequest request) { @Test public void customUserAgentTests() throws Exception { - final HttpPipeline pipeline = HttpPipeline.builder() + final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new MockHttpClient() { @Override public Mono send(HttpRequest request) { 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 2362bf9d5b99..581042362bc4 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 @@ -5,6 +5,7 @@ import com.azure.core.http.HttpMethod; 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.policy.BearerTokenAuthenticationPolicy; @@ -28,7 +29,7 @@ public void basicCredentialsTest() throws Exception { return next.process(); }; // - final HttpPipeline pipeline = HttpPipeline.builder() + final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new MockHttpClient()) .policies((context, next) -> credentials.getToken("scope./default") .flatMap(token -> { @@ -56,7 +57,7 @@ public Mono getToken(String... scopes) { return next.process(); }; - final HttpPipeline pipeline = HttpPipeline.builder() + final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new MockHttpClient()) .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 07f2e164317e..fc4d59e79685 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 @@ -23,7 +23,7 @@ public class HttpPipelineTests { @Test public void constructorWithNoArguments() { - HttpPipeline pipeline = HttpPipeline.builder().build(); + HttpPipeline pipeline = new HttpPipelineBuilder().build(); assertEquals(0, pipeline.getPolicyCount()); assertNotNull(pipeline.httpClient()); assertTrue(pipeline.httpClient() instanceof ReactorNettyClient); @@ -31,7 +31,7 @@ public void constructorWithNoArguments() { @Test public void withRequestPolicy() { - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(new PortPolicy(80, true), new ProtocolPolicy("ftp", true), new RetryPolicy()) @@ -47,7 +47,7 @@ public void withRequestPolicy() { @Test public void withRequestOptions() throws MalformedURLException { - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(new PortPolicy(80, true), new ProtocolPolicy("ftp", true), new RetryPolicy()) @@ -63,7 +63,7 @@ public void withRequestOptions() throws MalformedURLException { public void withNoRequestPolicies() throws MalformedURLException { final HttpMethod expectedHttpMethod = HttpMethod.GET; final URL expectedUrl = new URL("http://my.site.com"); - final HttpPipeline httpPipeline = HttpPipeline.builder() + final HttpPipeline httpPipeline = new HttpPipelineBuilder() .httpClient(new MockHttpClient() { @Override public Mono send(HttpRequest request) { @@ -96,7 +96,7 @@ public Mono send(HttpRequest request) { } }; - final HttpPipeline httpPipeline = HttpPipeline.builder() + final HttpPipeline httpPipeline = new HttpPipelineBuilder() .httpClient(httpClient) .policies(new UserAgentPolicy(expectedUserAgent)) .build(); @@ -110,7 +110,7 @@ public Mono send(HttpRequest request) { public void withRequestIdRequestPolicy() throws MalformedURLException { final HttpMethod expectedHttpMethod = HttpMethod.GET; final URL expectedUrl = new URL("http://my.site.com/1"); - final HttpPipeline httpPipeline = HttpPipeline.builder() + final HttpPipeline httpPipeline = new HttpPipelineBuilder() .httpClient(new MockHttpClient() { @Override public Mono send(HttpRequest request) { 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 8c209c4817c1..beb4a130ad97 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 @@ -7,6 +7,7 @@ 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 org.junit.Test; @@ -32,7 +33,7 @@ public void withPort() throws MalformedURLException { } private static HttpPipeline createPipeline(String host, String expectedUrl) { - return HttpPipeline.builder() + return new HttpPipelineBuilder() .httpClient(new MockHttpClient()) .policies(new HostPolicy(host), (context, next) -> { 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 c581c598b71a..3701b984d40d 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 @@ -7,6 +7,7 @@ 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 org.junit.Test; @@ -32,7 +33,7 @@ public void withNoOverwrite() throws MalformedURLException { pipeline.send(createHttpRequest("https://www.bing.com")); } private static HttpPipeline createPipeline(String protocol, String expectedUrl) { - return HttpPipeline.builder() + return new HttpPipelineBuilder() .httpClient(new MockHttpClient()) .policies(new ProtocolPolicy(protocol, true), (context, next) -> { @@ -43,7 +44,7 @@ private static HttpPipeline createPipeline(String protocol, String expectedUrl) } private static HttpPipeline createPipeline(String protocol, boolean overwrite, String expectedUrl) { - return HttpPipeline.builder() + return new HttpPipelineBuilder() .httpClient(new MockHttpClient()) .policies(new ProtocolPolicy(protocol, overwrite), (context, next) -> { 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 2832ab41e820..7c0331086ae0 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 @@ -5,6 +5,7 @@ import com.azure.core.http.HttpMethod; 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 org.junit.Test; @@ -23,7 +24,7 @@ public void test() throws MalformedURLException { final String username = "testuser"; final String password = "testpass"; // - final HttpPipeline pipeline = HttpPipeline.builder() + final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new MockHttpClient()) .policies(new ProxyAuthenticationPolicy(username, password), (context, next) -> { 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 e044f7d1ea5b..035a0ded64c8 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 @@ -7,6 +7,7 @@ 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.MockHttpClient; import io.netty.buffer.ByteBuf; @@ -62,7 +63,7 @@ public Mono bodyAsString(Charset charset) { @Test public void newRequestIdForEachCall() throws Exception { - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new MockHttpClient() { String firstRequestId = null; @Override @@ -89,7 +90,7 @@ public Mono send(HttpRequest request) { @Test public void sameRequestIdForRetry() throws Exception { - final HttpPipeline pipeline = HttpPipeline.builder() + final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new MockHttpClient() { String firstRequestId = null; 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 7a20532fa07c..03eb57f79fb6 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 @@ -6,6 +6,7 @@ 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.MockHttpClient; import com.azure.core.http.MockHttpResponse; @@ -20,7 +21,7 @@ public class RetryPolicyTests { @Test public void exponentialRetryEndOn501() throws Exception { - final HttpPipeline pipeline = HttpPipeline.builder() + final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new MockHttpClient() { // Send 408, 500, 502, all retried, with a 501 ending private final int[] codes = new int[]{408, 500, 502, 501}; @@ -43,7 +44,7 @@ public Mono send(HttpRequest request) { @Test public void exponentialRetryMax() throws Exception { final int maxRetries = 5; - final HttpPipeline pipeline = HttpPipeline.builder() + final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new MockHttpClient() { int count = -1; 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 new file mode 100644 index 000000000000..e74104f1a6b6 --- /dev/null +++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/rest/IterableResponseTest.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.core.http.rest; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +import reactor.core.publisher.Flux; + + +public class IterableResponseTest { + + @Rule + public TestName testName = new TestName(); + + @Before + public void setup() { + System.out.println("-------------- Running " + testName.getMethodName() + " -----------------------------"); + } + + /*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); + Assert.assertEquals(iterableResponse.stream().collect(Collectors.toList()).size(), iterableResponse.stream().collect(Collectors.toList()).size()); + + // ensure original list of values are same after calling iterator() + List originalIntegerList = Arrays.asList(2, 3, 4, 5, 6); + iterableResponse.stream().forEach(number -> Assert.assertTrue(originalIntegerList.contains(number))); + } + + /*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); + List actualNumberValues1 = new ArrayList<>(); + List actualNumberValues2 = new ArrayList<>(); + iterableResponse.iterator().forEachRemaining(number -> actualNumberValues1.add(number)); + iterableResponse.iterator().forEachRemaining(number -> actualNumberValues2.add(number)); + Assert.assertArrayEquals(actualNumberValues1.toArray(), actualNumberValues2.toArray()); + + // ensure original list of values are same after calling iterator() + List originalIntegerList = Arrays.asList(2, 3, 4, 5, 6); + iterableResponse.iterator().forEachRemaining(number -> Assert.assertTrue(originalIntegerList.contains(number))); + } + + private IterableResponse getIntegerIterableResponse(int startNumber, int noOfValues) { + Flux integerFlux = Flux.range(startNumber, noOfValues); + return new IterableResponse<>(integerFlux); + } +} 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 c5aea3ac2a0f..a8a7258c419f 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 @@ -14,7 +14,7 @@ import com.azure.core.implementation.annotation.PathParam; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpPipelineCallContext; import com.azure.core.http.HttpPipelineNextPolicy; import com.azure.core.http.HttpResponse; @@ -108,7 +108,7 @@ public static void beforeClass() throws IOException { polices.add(new HttpLoggingPolicy(HttpLogDetailLevel.BASIC, false)); // service = RestProxy.create(IOService.class, - HttpPipeline.builder() + new HttpPipelineBuilder() .policies(polices.toArray(new HttpPipelinePolicy[0])) .build()); @@ -506,7 +506,7 @@ public void testHighParallelism() { } final IOService innerService = RestProxy.create(IOService.class, - HttpPipeline.builder() + new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .build()); 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 2afd1cdd5768..36137bf7e205 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 @@ -4,6 +4,7 @@ package com.azure.core.implementation; import com.azure.core.MyRestException; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.implementation.annotation.BodyParam; import com.azure.core.implementation.annotation.Delete; import com.azure.core.implementation.annotation.ExpectedResponses; @@ -1526,7 +1527,7 @@ public void flowableUploadTest() throws Exception { // // Order in which policies applied will be the order in which they added to builder // - final HttpPipeline httpPipeline = HttpPipeline.builder() + final HttpPipeline httpPipeline = new HttpPipelineBuilder() .httpClient(httpClient) .policies(new HttpLoggingPolicy(HttpLogDetailLevel.BODY_AND_HEADERS, true)) .build(); @@ -1611,14 +1612,14 @@ interface Service25 { @Test(expected = HttpResponseException.class) @Ignore("Decoding is not a policy anymore") public void testMissingDecodingPolicyCausesException() { - Service25 service = RestProxy.create(Service25.class, HttpPipeline.builder().build()); + Service25 service = RestProxy.create(Service25.class, new HttpPipelineBuilder().build()); service.get(); } @Test(expected = HttpResponseException.class) @Ignore("Decoding is not a policy anymore") public void testSingleMissingDecodingPolicyCausesException() { - Service25 service = RestProxy.create(Service25.class, HttpPipeline.builder().build()); + Service25 service = RestProxy.create(Service25.class, new HttpPipelineBuilder().build()); service.getAsync().block(); service.getBodyResponseAsync().block(); } @@ -1626,7 +1627,7 @@ public void testSingleMissingDecodingPolicyCausesException() { @Test(expected = HttpResponseException.class) @Ignore("Decoding is not a policy anymore") public void testSingleBodyResponseMissingDecodingPolicyCausesException() { - Service25 service = RestProxy.create(Service25.class, HttpPipeline.builder().build()); + Service25 service = RestProxy.create(Service25.class, new HttpPipelineBuilder().build()); service.getBodyResponseAsync().block(); } @@ -1639,7 +1640,7 @@ interface Service26 { @Test public void postUrlFormEncoded() { - Service26 service = RestProxy.create(Service26.class, HttpPipeline.builder().build()); + Service26 service = RestProxy.create(Service26.class, new HttpPipelineBuilder().build()); HttpBinFormDataJSON response = service.postForm("Foo", "123", "foo@bar.com", PizzaSize.LARGE, Arrays.asList("Bacon", "Onion")); assertNotNull(response); assertNotNull(response.form()); @@ -1660,7 +1661,7 @@ protected T createService(Class serviceClass) { } protected T createService(Class serviceClass, HttpClient httpClient) { - final HttpPipeline httpPipeline = HttpPipeline.builder() + final HttpPipeline httpPipeline = new HttpPipelineBuilder() .httpClient(httpClient) .build(); 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 ccbdace92608..32ae6b6789fb 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 @@ -15,7 +15,7 @@ import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; import com.azure.core.http.MockHttpClient; @@ -179,7 +179,7 @@ interface ServiceErrorWithCharsetService { public void serviceErrorWithResponseContentType() { ServiceErrorWithCharsetService service = RestProxy.create( ServiceErrorWithCharsetService.class, - HttpPipeline.builder().httpClient(new SimpleMockHttpClient() { + new HttpPipelineBuilder().httpClient(new SimpleMockHttpClient() { @Override public Mono send(HttpRequest request) { HttpHeaders headers = new HttpHeaders().put("Content-Type", "application/json"); @@ -202,7 +202,7 @@ public Mono send(HttpRequest request) { public void serviceErrorWithResponseContentTypeBadJSON() { ServiceErrorWithCharsetService service = RestProxy.create( ServiceErrorWithCharsetService.class, - HttpPipeline.builder().httpClient(new SimpleMockHttpClient() { + new HttpPipelineBuilder().httpClient(new SimpleMockHttpClient() { @Override public Mono send(HttpRequest request) { HttpHeaders headers = new HttpHeaders().put("Content-Type", "application/json"); @@ -225,7 +225,7 @@ public Mono send(HttpRequest request) { public void serviceErrorWithResponseContentTypeCharset() { ServiceErrorWithCharsetService service = RestProxy.create( ServiceErrorWithCharsetService.class, - HttpPipeline.builder().httpClient(new SimpleMockHttpClient() { + new HttpPipelineBuilder().httpClient(new SimpleMockHttpClient() { @Override public Mono send(HttpRequest request) { HttpHeaders headers = new HttpHeaders().put("Content-Type", "application/json; charset=UTF-8"); @@ -248,7 +248,7 @@ public Mono send(HttpRequest request) { public void serviceErrorWithResponseContentTypeCharsetBadJSON() { ServiceErrorWithCharsetService service = RestProxy.create( ServiceErrorWithCharsetService.class, - HttpPipeline.builder().httpClient(new SimpleMockHttpClient() { + new HttpPipelineBuilder().httpClient(new SimpleMockHttpClient() { @Override public Mono send(HttpRequest request) { HttpHeaders headers = new HttpHeaders().put("Content-Type", "application/json; charset=UTF-8"); 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 7ea7c05e50ed..b533a6ff9103 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 @@ -16,6 +16,7 @@ import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpRequest; import com.azure.core.http.HttpResponse; import com.azure.core.http.MockHttpResponse; @@ -96,7 +97,7 @@ interface MyXMLService { @Test public void canReadXMLResponse() throws Exception { // - final HttpPipeline pipeline = HttpPipeline.builder() + final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new MockXMLHTTPClient()) .build(); @@ -162,7 +163,7 @@ public void canWriteXMLRequest() throws Exception { JacksonAdapter serializer = new JacksonAdapter(); MockXMLReceiverClient httpClient = new MockXMLReceiverClient(); // - final HttpPipeline pipeline = HttpPipeline.builder() + final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(httpClient) .build(); // @@ -199,7 +200,7 @@ public interface MyXMLServiceWithAttributes { public void canDeserializeXMLWithAttributes() throws Exception { JacksonAdapter serializer = new JacksonAdapter(); // - final HttpPipeline pipeline = HttpPipeline.builder() + final HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(new MockXMLHTTPClient()) .build(); 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 index 50a427fc25b5..3ebeb7544b14 100644 --- 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 @@ -12,6 +12,7 @@ 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; @@ -278,6 +279,13 @@ public void testCollectByteBufStream() { 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, ") @@ -401,4 +409,29 @@ private File createFileIfNotExist(String fileName) throws IOException { 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 a4eb3bc813cf..1f44374c8d28 100644 --- a/sdk/core/ci.yml +++ b/sdk/core/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/core/ @@ -13,11 +22,23 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/core/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: core \ No newline at end of file + ServiceDirectory: core + Artifacts: + - name: azure-core + safeName: azurecore + - name: azure-core-amqp + safeName: azurecoreamqp + - name: azure-core-management + safeName: azurecoremanagement + - name: azure-core-test + safeName: azurecoretest \ No newline at end of file diff --git a/sdk/core/pom.xml b/sdk/core/pom.xml deleted file mode 100644 index 033b53558098..000000000000 --- a/sdk/core/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - 4.0.0 - - - com.azure - azure-client-sdk-parent - 1.1.0 - ../../pom.client.xml - - - com.azure - azure-core-parent - 1.0.0-preview.3 - pom - - Microsoft Azure Core Libraries for Java - This package contains the core libraries for Java clients. - 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:https://github.com/Azure/azure-sdk-for-java.git - scm:git:https://github.com/Azure/azure-sdk-for-java.git - - - - UTF-8 - - - - - - - microsoft - Microsoft - - - - - - azure-java-build-docs - ${site.url}/site/${project.artifactId} - - - - - azure-core - azure-core-amqp - azure-core-management - azure-core-test - - diff --git a/sdk/cosmos/README.md b/sdk/cosmos/README.md index e32aaddb8603..f7854c9ae68e 100644 --- a/sdk/cosmos/README.md +++ b/sdk/cosmos/README.md @@ -1,6 +1,6 @@ # 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/3.0.0/jar) +[![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) public static String MASTER_KEY = - System.getProperty("ACCOUNT_KEY", + System.getProperty("ACCOUNT_KEY", StringUtils.defaultString(Strings.emptyToNull( System.getenv().get("ACCOUNT_KEY")), "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==")); + public static String SECONDARY_MASTER_KEY = + System.getProperty("SECONDARY_ACCOUNT_KEY", + StringUtils.defaultString(Strings.emptyToNull( + System.getenv().get("SECONDARY_ACCOUNT_KEY")), + "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==")); + public static String HOST = System.getProperty("ACCOUNT_HOST", StringUtils.defaultString(Strings.emptyToNull( diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/Trigger.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Trigger.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/Trigger.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Trigger.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/Undefined.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Undefined.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/Undefined.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Undefined.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/User.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/User.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/User.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/User.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/UserAgentContainer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/UserAgentContainer.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/UserAgentContainer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/UserAgentContainer.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/UserDefinedFunction.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/UserDefinedFunction.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/UserDefinedFunction.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/UserDefinedFunction.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/Utils.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Utils.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/Utils.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/Utils.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/VectorSessionToken.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/VectorSessionToken.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/VectorSessionToken.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/VectorSessionToken.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/WebExceptionRetryPolicy.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/WebExceptionRetryPolicy.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/WebExceptionRetryPolicy.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/WebExceptionRetryPolicy.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/AsyncCache.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/AsyncCache.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/AsyncCache.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/AsyncCache.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/AsyncLazy.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/AsyncLazy.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/AsyncLazy.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/AsyncLazy.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/IEqualityComparer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/IEqualityComparer.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/IEqualityComparer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/IEqualityComparer.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/IPartitionKeyRangeCache.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/IPartitionKeyRangeCache.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/IPartitionKeyRangeCache.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/IPartitionKeyRangeCache.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/RxClientCollectionCache.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/RxClientCollectionCache.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/RxClientCollectionCache.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/RxClientCollectionCache.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/RxCollectionCache.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/RxCollectionCache.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/RxCollectionCache.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/RxCollectionCache.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/RxPartitionKeyRangeCache.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/RxPartitionKeyRangeCache.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/caches/RxPartitionKeyRangeCache.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/caches/RxPartitionKeyRangeCache.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/Bootstrapper.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/Bootstrapper.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/Bootstrapper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/Bootstrapper.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/CancellationToken.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/CancellationToken.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/CancellationToken.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/CancellationToken.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/CancellationTokenSource.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/CancellationTokenSource.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/CancellationTokenSource.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/CancellationTokenSource.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedContextClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedContextClient.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedContextClient.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedContextClient.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserver.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserver.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserverCloseReason.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserverCloseReason.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserverCloseReason.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserverCloseReason.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserverContext.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserverContext.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserverContext.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserverContext.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserverFactory.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserverFactory.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserverFactory.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ChangeFeedObserverFactory.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/CheckpointFrequency.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/CheckpointFrequency.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/CheckpointFrequency.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/CheckpointFrequency.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/HealthMonitor.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/HealthMonitor.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/HealthMonitor.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/HealthMonitor.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/HealthMonitoringRecord.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/HealthMonitoringRecord.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/HealthMonitoringRecord.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/HealthMonitoringRecord.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/Lease.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/Lease.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/Lease.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/Lease.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseCheckpointer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseCheckpointer.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseCheckpointer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseCheckpointer.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseContainer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseContainer.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseContainer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseContainer.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseManager.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseManager.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseManager.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseManager.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseRenewer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseRenewer.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseRenewer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseRenewer.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseStore.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseStore.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseStore.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseStore.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseStoreManager.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseStoreManager.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseStoreManager.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseStoreManager.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseStoreManagerSettings.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseStoreManagerSettings.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseStoreManagerSettings.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/LeaseStoreManagerSettings.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionCheckpointer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionCheckpointer.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionCheckpointer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionCheckpointer.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionController.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionController.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionController.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionController.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionLoadBalancer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionLoadBalancer.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionLoadBalancingStrategy.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionLoadBalancingStrategy.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionLoadBalancingStrategy.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionLoadBalancingStrategy.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionManager.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionManager.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionProcessor.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionProcessor.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionProcessor.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionProcessor.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionProcessorFactory.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionProcessorFactory.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionProcessorFactory.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionProcessorFactory.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionSupervisor.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionSupervisor.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionSupervisor.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionSupervisor.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionSupervisorFactory.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionSupervisorFactory.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionSupervisorFactory.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionSupervisorFactory.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionSynchronizer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionSynchronizer.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionSynchronizer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/PartitionSynchronizer.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ProcessorSettings.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ProcessorSettings.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ProcessorSettings.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ProcessorSettings.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/RemainingPartitionWork.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/RemainingPartitionWork.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/RemainingPartitionWork.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/RemainingPartitionWork.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/RemainingWorkEstimator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/RemainingWorkEstimator.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/RemainingWorkEstimator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/RemainingWorkEstimator.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/RequestOptionsFactory.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/RequestOptionsFactory.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/RequestOptionsFactory.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/RequestOptionsFactory.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ServiceItemLease.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ServiceItemLease.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ServiceItemLeaseUpdater.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ServiceItemLeaseUpdater.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/ServiceItemLeaseUpdater.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/ServiceItemLeaseUpdater.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/LeaseLostException.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/LeaseLostException.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/LeaseLostException.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/LeaseLostException.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/ObserverException.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/ObserverException.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/PartitionException.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/PartitionException.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/PartitionException.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/PartitionException.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/PartitionNotFoundException.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/PartitionNotFoundException.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/PartitionNotFoundException.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/PartitionNotFoundException.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/PartitionSplitException.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/PartitionSplitException.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/PartitionSplitException.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/PartitionSplitException.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/TaskCancelledException.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/TaskCancelledException.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/TaskCancelledException.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/exceptions/TaskCancelledException.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/AutoCheckpointer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/AutoCheckpointer.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/BootstrapperImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/BootstrapperImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedContextClientImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedContextClientImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedHelper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedHelper.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverContextImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverContextImpl.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverFactoryImpl.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverFactoryImpl.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverFactoryImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedObserverFactoryImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedProcessorBuilderImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ChangeFeedProcessorBuilderImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/CheckpointerObserverFactory.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/CheckpointerObserverFactory.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/Constants.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/Constants.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/Constants.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/Constants.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserver.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserver.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserverFactory.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserverFactory.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserverFactory.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DefaultObserverFactory.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseStore.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseStore.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseUpdaterImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/DocumentServiceLeaseUpdaterImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/EqualPartitionsBalancingStrategy.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/EqualPartitionsBalancingStrategy.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ExceptionClassifier.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ExceptionClassifier.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/HealthMonitoringPartitionControllerDecorator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/HealthMonitoringPartitionControllerDecorator.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseRenewerImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseRenewerImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseStoreManagerImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/LeaseStoreManagerImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ObserverExceptionWrappingChangeFeedObserverDecorator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/ObserverExceptionWrappingChangeFeedObserverDecorator.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionCheckpointerImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionCheckpointerImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionControllerImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionControllerImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionLoadBalancerImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionManagerImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionManagerImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorFactoryImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorFactoryImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionProcessorImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorFactoryImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorFactoryImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSupervisorImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSynchronizerImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionSynchronizerImpl.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionedByIdCollectionRequestOptionsFactory.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionedByIdCollectionRequestOptionsFactory.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionedByIdCollectionRequestOptionsFactory.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/PartitionedByIdCollectionRequestOptionsFactory.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingPartitionWorkImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingPartitionWorkImpl.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingWorkEstimatorImpl.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/RemainingWorkEstimatorImpl.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/StatusCodeErrorType.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/StatusCodeErrorType.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/StatusCodeErrorType.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/StatusCodeErrorType.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/TraceHealthMonitor.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/TraceHealthMonitor.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/WorkerTask.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/WorkerTask.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/WorkerTask.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/changefeed/implementation/WorkerTask.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/Address.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/Address.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/Address.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/Address.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/AddressInformation.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/AddressInformation.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/AddressInformation.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/AddressInformation.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/AddressResolver.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/AddressResolver.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/AddressResolver.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/AddressResolver.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/AddressSelector.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/AddressSelector.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/AddressSelector.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/AddressSelector.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/BarrierRequestHelper.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/BarrierRequestHelper.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/BarrierRequestHelper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/BarrierRequestHelper.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyReader.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyReader.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyReader.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyReader.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyWriter.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyWriter.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyWriter.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyWriter.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/CustomHeaders.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/CustomHeaders.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/CustomHeaders.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/CustomHeaders.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ErrorUtils.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ErrorUtils.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ErrorUtils.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ErrorUtils.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayAddressCache.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayAddressCache.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayAddressCache.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayAddressCache.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReader.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReader.java similarity index 98% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReader.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReader.java index 25fab9dce714..a281231933b6 100644 --- a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReader.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReader.java @@ -107,13 +107,15 @@ private Mono getDatabaseAccountAsync(URI serviceEndpoint) { httpHeaders.set(HttpConstants.HttpHeaders.USER_AGENT, userAgentContainer.getUserAgent()); httpHeaders.set(HttpConstants.HttpHeaders.API_TYPE, Constants.Properties.SQL_API_TYPE); + + String xDate = Utils.nowAsRFC1123(); + httpHeaders.set(HttpConstants.HttpHeaders.X_DATE, xDate); + String authorizationToken; if (this.hasAuthKeyResourceToken || baseAuthorizationTokenProvider == null) { authorizationToken = HttpUtils.urlEncode(this.authKeyResourceToken); } else { // Retrieve the document service properties. - String xDate = Utils.nowAsRFC1123(); - httpHeaders.set(HttpConstants.HttpHeaders.X_DATE, xDate); Map header = new HashMap<>(); header.put(HttpConstants.HttpHeaders.X_DATE, xDate); authorizationToken = baseAuthorizationTokenProvider diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GlobalAddressResolver.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GlobalAddressResolver.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GlobalAddressResolver.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GlobalAddressResolver.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GoneAndRetryWithRetryPolicy.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GoneAndRetryWithRetryPolicy.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GoneAndRetryWithRetryPolicy.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/GoneAndRetryWithRetryPolicy.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/HttpClientUtils.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/HttpClientUtils.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/HttpClientUtils.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/HttpClientUtils.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/HttpTransportClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/HttpTransportClient.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/HttpTransportClient.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/HttpTransportClient.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/HttpUtils.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/HttpUtils.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/HttpUtils.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/HttpUtils.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/IAddressCache.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/IAddressCache.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/IAddressCache.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/IAddressCache.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/IAddressResolver.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/IAddressResolver.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/IAddressResolver.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/IAddressResolver.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/IStoreClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/IStoreClient.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/IStoreClient.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/IStoreClient.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/Protocol.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/Protocol.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/Protocol.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/Protocol.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/QueryRequestPerformanceActivity.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/QueryRequestPerformanceActivity.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/QueryRequestPerformanceActivity.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/QueryRequestPerformanceActivity.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/QuorumReader.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/QuorumReader.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/QuorumReader.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/QuorumReader.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ReadMode.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ReadMode.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ReadMode.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ReadMode.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ReplicatedResourceClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ReplicatedResourceClient.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ReplicatedResourceClient.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ReplicatedResourceClient.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RequestHelper.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RequestHelper.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RequestHelper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RequestHelper.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ResourceOperation.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ResourceOperation.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ResourceOperation.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ResourceOperation.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ResponseUtils.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ResponseUtils.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ResponseUtils.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ResponseUtils.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClient.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ServerProperties.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ServerProperties.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ServerProperties.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ServerProperties.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ServerStoreModel.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ServerStoreModel.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ServerStoreModel.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ServerStoreModel.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ServiceConfig.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ServiceConfig.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ServiceConfig.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/ServiceConfig.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreClient.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreClient.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreClient.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreClientFactory.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreClientFactory.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreClientFactory.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreClientFactory.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreReader.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreReader.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreReader.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreReader.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreResponse.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreResponse.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreResponse.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreResponse.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreResult.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreResult.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreResult.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/StoreResult.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/TimeoutHelper.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/TimeoutHelper.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/TimeoutHelper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/TimeoutHelper.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/TransportClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/TransportClient.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/TransportClient.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/TransportClient.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/TransportException.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/TransportException.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/TransportException.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/TransportException.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/WFConstants.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/WFConstants.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/WFConstants.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/WFConstants.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/WebExceptionUtility.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/WebExceptionUtility.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/WebExceptionUtility.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/WebExceptionUtility.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelHandler.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelPool.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdClientChannelPool.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdConstants.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdConstants.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContext.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContext.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextDecoder.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextDecoder.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextDecoder.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextDecoder.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextException.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextException.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextException.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextException.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextNegotiator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextNegotiator.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequest.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequestDecoder.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequestDecoder.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequestDecoder.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequestDecoder.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequestEncoder.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequestEncoder.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequestEncoder.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdContextRequestEncoder.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdEndpoint.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdEndpoint.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdEndpoint.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdEndpoint.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdFramer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdFramer.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdMetrics.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdMetrics.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdObjectMapper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdObjectMapper.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdReporter.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdReporter.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdReporter.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdReporter.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequest.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequest.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequest.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestArgs.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestArgs.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestArgs.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestArgs.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestDecoder.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestDecoder.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestDecoder.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestDecoder.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestEncoder.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestEncoder.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestEncoder.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestEncoder.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFrame.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFrame.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFramer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFramer.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFramer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestFramer.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestHeaders.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestHeaders.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestManager.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestManager.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestRecord.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestTimer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestTimer.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestTimer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdRequestTimer.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponse.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponse.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseDecoder.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseDecoder.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseHeaders.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseHeaders.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseStatus.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdResponseStatus.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdServiceEndpoint.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdToken.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdToken.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenStream.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenStream.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenType.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdTokenType.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdUUID.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/directconnectivity/rntbd/RntbdUUID.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/BufferedHttpResponse.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/BufferedHttpResponse.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/BufferedHttpResponse.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/BufferedHttpResponse.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/HttpClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/HttpClient.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/HttpClient.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/HttpClient.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/HttpClientConfig.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/HttpClientConfig.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/HttpClientConfig.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/HttpClientConfig.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/HttpHeader.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/HttpHeader.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/HttpHeader.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/HttpHeader.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/HttpHeaders.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/HttpHeaders.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/HttpHeaders.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/HttpHeaders.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/HttpRequest.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/HttpRequest.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/HttpRequest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/HttpRequest.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/HttpResponse.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/HttpResponse.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/HttpResponse.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/HttpResponse.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/ReactorNettyClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/ReactorNettyClient.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/http/ReactorNettyClient.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/http/ReactorNettyClient.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/AggregateDocumentQueryExecutionContext.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/AggregateDocumentQueryExecutionContext.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/AggregateDocumentQueryExecutionContext.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/AggregateDocumentQueryExecutionContext.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/CompositeContinuationToken.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/CompositeContinuationToken.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/CompositeContinuationToken.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/CompositeContinuationToken.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/DefaultDocumentQueryExecutionContext.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/DefaultDocumentQueryExecutionContext.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/DefaultDocumentQueryExecutionContext.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/DefaultDocumentQueryExecutionContext.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/DocumentProducer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/DocumentProducer.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/DocumentProducer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/DocumentProducer.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/DocumentQueryExecutionContextBase.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/DocumentQueryExecutionContextBase.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/DocumentQueryExecutionContextBase.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/DocumentQueryExecutionContextBase.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/DocumentQueryExecutionContextFactory.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/DocumentQueryExecutionContextFactory.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/DocumentQueryExecutionContextFactory.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/DocumentQueryExecutionContextFactory.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ExceptionHelper.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ExceptionHelper.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ExceptionHelper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ExceptionHelper.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/Fetcher.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/Fetcher.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/Fetcher.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/Fetcher.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/IDocumentQueryClient.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/IDocumentQueryClient.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/IDocumentQueryClient.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/IDocumentQueryClient.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/IDocumentQueryExecutionComponent.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/IDocumentQueryExecutionComponent.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/IDocumentQueryExecutionComponent.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/IDocumentQueryExecutionComponent.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/IDocumentQueryExecutionContext.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/IDocumentQueryExecutionContext.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/IDocumentQueryExecutionContext.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/IDocumentQueryExecutionContext.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ItemComparator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ItemComparator.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ItemComparator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ItemComparator.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ItemType.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ItemType.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ItemType.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ItemType.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ItemTypeHelper.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ItemTypeHelper.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ItemTypeHelper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ItemTypeHelper.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/OrderByContinuationToken.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/OrderByContinuationToken.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/OrderByContinuationToken.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/OrderByContinuationToken.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/OrderByDocumentProducer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/OrderByDocumentProducer.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/OrderByDocumentProducer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/OrderByDocumentProducer.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/OrderByDocumentQueryExecutionContext.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/OrderByDocumentQueryExecutionContext.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/OrderByDocumentQueryExecutionContext.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/OrderByDocumentQueryExecutionContext.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/OrderByUtils.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/OrderByUtils.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/OrderByUtils.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/OrderByUtils.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/Paginator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/Paginator.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/Paginator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/Paginator.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ParallelDocumentQueryExecutionContext.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ParallelDocumentQueryExecutionContext.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ParallelDocumentQueryExecutionContext.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ParallelDocumentQueryExecutionContext.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ParallelDocumentQueryExecutionContextBase.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ParallelDocumentQueryExecutionContextBase.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ParallelDocumentQueryExecutionContextBase.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ParallelDocumentQueryExecutionContextBase.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ParallelQueryConfig.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ParallelQueryConfig.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ParallelQueryConfig.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ParallelQueryConfig.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/PartitionedQueryExecutionInfo.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/PartitionedQueryExecutionInfo.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/PartitionedQueryExecutionInfo.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/PartitionedQueryExecutionInfo.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/PartitionedQueryExecutionInfoInternal.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/PartitionedQueryExecutionInfoInternal.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/PartitionedQueryExecutionInfoInternal.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/PartitionedQueryExecutionInfoInternal.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/PipelinedDocumentQueryExecutionContext.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/PipelinedDocumentQueryExecutionContext.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/PipelinedDocumentQueryExecutionContext.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/PipelinedDocumentQueryExecutionContext.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ProxyDocumentQueryExecutionContext.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ProxyDocumentQueryExecutionContext.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/ProxyDocumentQueryExecutionContext.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/ProxyDocumentQueryExecutionContext.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/QueryInfo.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/QueryInfo.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/QueryInfo.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/QueryInfo.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/QueryItem.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/QueryItem.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/QueryItem.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/QueryItem.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/SortOrder.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/SortOrder.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/SortOrder.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/SortOrder.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/TakeContinuationToken.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/TakeContinuationToken.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/TakeContinuationToken.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/TakeContinuationToken.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/TopDocumentQueryExecutionContext.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/TopDocumentQueryExecutionContext.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/TopDocumentQueryExecutionContext.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/TopDocumentQueryExecutionContext.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/TriFunction.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/TriFunction.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/TriFunction.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/TriFunction.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/AggregateOperator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/AggregateOperator.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/AggregateOperator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/AggregateOperator.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/Aggregator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/Aggregator.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/Aggregator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/Aggregator.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/AverageAggregator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/AverageAggregator.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/AverageAggregator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/AverageAggregator.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/CountAggregator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/CountAggregator.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/CountAggregator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/CountAggregator.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/MaxAggregator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/MaxAggregator.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/MaxAggregator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/MaxAggregator.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/MinAggregator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/MinAggregator.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/MinAggregator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/MinAggregator.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/SumAggregator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/SumAggregator.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/aggregation/SumAggregator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/aggregation/SumAggregator.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/ClientSideMetrics.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/ClientSideMetrics.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/ClientSideMetrics.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/ClientSideMetrics.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/FetchExecutionRange.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/FetchExecutionRange.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/FetchExecutionRange.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/FetchExecutionRange.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/FetchExecutionRangeAccumulator.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/FetchExecutionRangeAccumulator.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/FetchExecutionRangeAccumulator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/FetchExecutionRangeAccumulator.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/QueryMetricsTextWriter.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/QueryMetricsTextWriter.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/QueryMetricsTextWriter.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/QueryMetricsTextWriter.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/QueryMetricsWriter.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/QueryMetricsWriter.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/QueryMetricsWriter.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/QueryMetricsWriter.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/SchedulingStopwatch.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/SchedulingStopwatch.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/SchedulingStopwatch.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/SchedulingStopwatch.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/SchedulingTimeSpan.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/SchedulingTimeSpan.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/SchedulingTimeSpan.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/SchedulingTimeSpan.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/TextTable.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/TextTable.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/metrics/TextTable.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/metrics/TextTable.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/orderbyquery/OrderByRowResult.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/orderbyquery/OrderByRowResult.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/orderbyquery/OrderByRowResult.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/orderbyquery/OrderByRowResult.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/orderbyquery/OrderbyRowComparer.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/orderbyquery/OrderbyRowComparer.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/query/orderbyquery/OrderbyRowComparer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/query/orderbyquery/OrderbyRowComparer.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/BoolPartitionKeyComponent.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/BoolPartitionKeyComponent.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/BoolPartitionKeyComponent.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/BoolPartitionKeyComponent.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/CaseInsensitiveHashMap.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/CaseInsensitiveHashMap.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/CaseInsensitiveHashMap.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/CaseInsensitiveHashMap.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/CollectionRoutingMap.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/CollectionRoutingMap.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/CollectionRoutingMap.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/CollectionRoutingMap.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/IPartitionKeyComponent.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/IPartitionKeyComponent.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/IPartitionKeyComponent.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/IPartitionKeyComponent.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/IServerIdentity.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/IServerIdentity.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/IServerIdentity.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/IServerIdentity.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/InMemoryCollectionRoutingMap.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/InMemoryCollectionRoutingMap.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/InMemoryCollectionRoutingMap.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/InMemoryCollectionRoutingMap.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/InfinityPartitionKeyComponent.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/InfinityPartitionKeyComponent.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/InfinityPartitionKeyComponent.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/InfinityPartitionKeyComponent.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/Int128.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/Int128.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/Int128.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/Int128.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/LocationCache.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/LocationCache.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/LocationCache.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/LocationCache.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/LocationHelper.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/LocationHelper.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/LocationHelper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/LocationHelper.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/MaxNumberPartitionKeyComponent.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/MaxNumberPartitionKeyComponent.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/MaxNumberPartitionKeyComponent.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/MaxNumberPartitionKeyComponent.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/MaxStringPartitionKeyComponent.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/MaxStringPartitionKeyComponent.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/MaxStringPartitionKeyComponent.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/MaxStringPartitionKeyComponent.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/MinNumberPartitionKeyComponent.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/MinNumberPartitionKeyComponent.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/MinNumberPartitionKeyComponent.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/MinNumberPartitionKeyComponent.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/MinStringPartitionKeyComponent.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/MinStringPartitionKeyComponent.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/MinStringPartitionKeyComponent.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/MinStringPartitionKeyComponent.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/MurmurHash3_128.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/MurmurHash3_128.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/MurmurHash3_128.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/MurmurHash3_128.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/MurmurHash3_32.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/MurmurHash3_32.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/MurmurHash3_32.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/MurmurHash3_32.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/NullPartitionKeyComponent.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/NullPartitionKeyComponent.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/NullPartitionKeyComponent.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/NullPartitionKeyComponent.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/NumberPartitionKeyComponent.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/NumberPartitionKeyComponent.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/NumberPartitionKeyComponent.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/NumberPartitionKeyComponent.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyAndResourceTokenPair.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyAndResourceTokenPair.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyAndResourceTokenPair.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyAndResourceTokenPair.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyComponentType.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyComponentType.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyComponentType.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyComponentType.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyInternal.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyInternal.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyInternal.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyInternal.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyInternalHelper.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyInternalHelper.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyInternalHelper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyInternalHelper.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyRangeIdentity.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyRangeIdentity.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyRangeIdentity.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/PartitionKeyRangeIdentity.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/Range.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/Range.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/Range.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/Range.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/RoutingMapProvider.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/RoutingMapProvider.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/RoutingMapProvider.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/RoutingMapProvider.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/RoutingMapProviderHelper.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/RoutingMapProviderHelper.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/RoutingMapProviderHelper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/RoutingMapProviderHelper.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/StringPartitionKeyComponent.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/StringPartitionKeyComponent.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/StringPartitionKeyComponent.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/StringPartitionKeyComponent.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/UInt128.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/UInt128.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/UInt128.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/UInt128.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/UndefinedPartitionKeyComponent.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/UndefinedPartitionKeyComponent.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/internal/routing/UndefinedPartitionKeyComponent.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/internal/routing/UndefinedPartitionKeyComponent.java diff --git a/sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/package-info.java b/sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/package-info.java similarity index 100% rename from sdk/cosmos/sdk/src/main/java/com/azure/data/cosmos/package-info.java rename to sdk/cosmos/microsoft-azure-cosmos/src/main/java/com/azure/data/cosmos/package-info.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/BridgeUtils.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/BridgeUtils.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/BridgeUtils.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/BridgeUtils.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/ClientUnderTestBuilder.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/ClientUnderTestBuilder.java similarity index 90% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/ClientUnderTestBuilder.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/ClientUnderTestBuilder.java index 2a3e50958715..ae651447b7ef 100644 --- a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/ClientUnderTestBuilder.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/ClientUnderTestBuilder.java @@ -16,6 +16,7 @@ public ClientUnderTestBuilder(CosmosClientBuilder builder) { this.consistencyLevel(builder.consistencyLevel()); this.key(builder.key()); this.endpoint(builder.endpoint()); + this.cosmosKeyCredential(builder.cosmosKeyCredential()); } @Override @@ -27,7 +28,8 @@ public CosmosClient build() { this.key(), this.connectionPolicy(), this.consistencyLevel(), - this.configs()); + this.configs(), + this.cosmosKeyCredential()); } catch (URISyntaxException e) { throw new IllegalArgumentException(e.getMessage()); } diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/ConflictTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/ConflictTests.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/ConflictTests.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/ConflictTests.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/ConnectionPolicyTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/ConnectionPolicyTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/ConnectionPolicyTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/ConnectionPolicyTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/CosmosClientExceptionTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosClientExceptionTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/CosmosClientExceptionTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosClientExceptionTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/CosmosClientTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosClientTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/CosmosClientTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosClientTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/CosmosDatabaseForTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosDatabaseForTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/CosmosDatabaseForTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosDatabaseForTest.java diff --git a/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosKeyCredentialTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosKeyCredentialTest.java new file mode 100644 index 000000000000..ab9d4957f5a6 --- /dev/null +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosKeyCredentialTest.java @@ -0,0 +1,344 @@ +package com.azure.data.cosmos; + +import com.azure.data.cosmos.internal.FailureValidator; +import com.azure.data.cosmos.internal.TestConfigurations; +import com.azure.data.cosmos.rx.TestSuiteBase; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Factory; +import org.testng.annotations.Test; +import reactor.core.publisher.Mono; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; + +public class CosmosKeyCredentialTest extends TestSuiteBase { + + private static final int TIMEOUT = 50000; + private static final int SETUP_TIMEOUT = 20000; + private static final int SHUTDOWN_TIMEOUT = 20000; + + private final List databases = new ArrayList<>(); + private final String databaseId = CosmosDatabaseForTest.generateId(); + + private CosmosClient client; + private CosmosDatabase database; + private CosmosContainer container; + + @Factory(dataProvider = "clientBuildersWithDirect") + public CosmosKeyCredentialTest(CosmosClientBuilder clientBuilder) { + super(clientBuilder); + this.subscriberValidationTimeout = TIMEOUT; + } + + @DataProvider(name = "crudArgProvider") + public Object[][] crudArgProvider() { + return new Object[][] { + // collection name, is name base + { UUID.randomUUID().toString()} , + + // with special characters in the name. + {"+ -_,:.|~" + UUID.randomUUID().toString() + " +-_,:.|~"} , + }; + } + + private CosmosContainerProperties getCollectionDefinition(String collectionName) { + PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition(); + ArrayList paths = new ArrayList<>(); + paths.add("/mypk"); + partitionKeyDef.paths(paths); + + return new CosmosContainerProperties( + collectionName, + partitionKeyDef); + } + + private CosmosItemProperties getDocumentDefinition(String documentId) { + final String uuid = UUID.randomUUID().toString(); + return new CosmosItemProperties(String.format("{ " + + "\"id\": \"%s\", " + + "\"mypk\": \"%s\", " + + "\"sgmts\": [[6519456, 1471916863], [2498434, 1455671440]]" + + "}" + , documentId, uuid)); + } + + @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "crudArgProvider") + public void createCollectionWithSecondaryKey(String collectionName) throws InterruptedException { + CosmosContainerProperties collectionDefinition = getCollectionDefinition(collectionName); + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.MASTER_KEY); + + cosmosKeyCredential.key(TestConfigurations.SECONDARY_MASTER_KEY); + Mono createObservable = database + .createContainer(collectionDefinition); + + CosmosResponseValidator validator = new CosmosResponseValidator.Builder() + .withId(collectionDefinition.id()).build(); + + validateSuccess(createObservable, validator); + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.SECONDARY_MASTER_KEY); + safeDeleteAllCollections(database); + } + + @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "crudArgProvider") + public void readCollectionWithSecondaryKey(String collectionName) throws InterruptedException { + CosmosContainerProperties collectionDefinition = getCollectionDefinition(collectionName); + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.MASTER_KEY); + + Mono createObservable = database.createContainer(collectionDefinition); + CosmosContainer collection = createObservable.block().container(); + + cosmosKeyCredential.key(TestConfigurations.SECONDARY_MASTER_KEY); + Mono readObservable = collection.read(); + + CosmosResponseValidator validator = + new CosmosResponseValidator.Builder() + .withId(collection.id()).build(); + validateSuccess(readObservable, validator); + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.SECONDARY_MASTER_KEY); + safeDeleteAllCollections(database); + } + + @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "crudArgProvider") + public void deleteCollectionWithSecondaryKey(String collectionName) throws InterruptedException { + CosmosContainerProperties collectionDefinition = getCollectionDefinition(collectionName); + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.MASTER_KEY); + + Mono createObservable = database.createContainer(collectionDefinition); + CosmosContainer collection = createObservable.block().container(); + + cosmosKeyCredential.key(TestConfigurations.SECONDARY_MASTER_KEY); + Mono deleteObservable = collection.delete(); + + CosmosResponseValidator validator = new CosmosResponseValidator.Builder() + .nullResource().build(); + validateSuccess(deleteObservable, validator); + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.SECONDARY_MASTER_KEY); + } + + @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "crudArgProvider") + public void replaceCollectionWithSecondaryKey(String collectionName) throws InterruptedException { + // create a collection + CosmosContainerProperties collectionDefinition = getCollectionDefinition(collectionName); + Mono createObservable = database.createContainer(collectionDefinition); + CosmosContainer collection = createObservable.block().container(); + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.MASTER_KEY); + + CosmosContainerProperties collectionSettings = collection.read().block().properties(); + // sanity check + assertThat(collectionSettings.indexingPolicy().indexingMode()).isEqualTo(IndexingMode.CONSISTENT); + + cosmosKeyCredential.key(TestConfigurations.SECONDARY_MASTER_KEY); + + // replace indexing mode + IndexingPolicy indexingMode = new IndexingPolicy(); + indexingMode.indexingMode(IndexingMode.LAZY); + collectionSettings.indexingPolicy(indexingMode); + Mono readObservable = collection.replace(collectionSettings, new CosmosContainerRequestOptions()); + + // validate + CosmosResponseValidator validator = new CosmosResponseValidator.Builder() + .indexingMode(IndexingMode.LAZY).build(); + validateSuccess(readObservable, validator); + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.SECONDARY_MASTER_KEY); + safeDeleteAllCollections(database); + } + + @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "crudArgProvider") + public void createDocumentWithSecondaryKey(String documentId) throws InterruptedException { + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.MASTER_KEY); + + cosmosKeyCredential.key(TestConfigurations.SECONDARY_MASTER_KEY); + + CosmosItemProperties properties = getDocumentDefinition(documentId); + Mono createObservable = container.createItem(properties, new CosmosItemRequestOptions()); + + CosmosResponseValidator validator = new CosmosResponseValidator.Builder() + .withId(properties.id()) + .build(); + + validateSuccess(createObservable, validator); + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.SECONDARY_MASTER_KEY); + } + + @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "crudArgProvider") + public void readDocumentWithSecondaryKey(String documentId) throws InterruptedException { + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.MASTER_KEY); + + cosmosKeyCredential.key(TestConfigurations.SECONDARY_MASTER_KEY); + + CosmosItemProperties docDefinition = getDocumentDefinition(documentId); + CosmosItem document = container.createItem(docDefinition, new CosmosItemRequestOptions()).block().item(); + + waitIfNeededForReplicasToCatchUp(clientBuilder()); + + CosmosItemRequestOptions options = new CosmosItemRequestOptions(); + options.partitionKey(new PartitionKey(docDefinition.get("mypk"))); + Mono readObservable = document.read(options); + + CosmosResponseValidator validator = new CosmosResponseValidator.Builder() + .withId(document.id()) + .build(); + + validateSuccess(readObservable, validator); + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.SECONDARY_MASTER_KEY); + } + + @Test(groups = { "simple" }, timeOut = TIMEOUT, dataProvider = "crudArgProvider") + public void deleteDocumentWithSecondaryKey(String documentId) throws InterruptedException { + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.MASTER_KEY); + + cosmosKeyCredential.key(TestConfigurations.SECONDARY_MASTER_KEY); + + CosmosItemProperties docDefinition = getDocumentDefinition(documentId); + + CosmosItem document = container.createItem(docDefinition, new CosmosItemRequestOptions()).block().item(); + + CosmosItemRequestOptions options = new CosmosItemRequestOptions(); + options.partitionKey(new PartitionKey(docDefinition.get("mypk"))); + Mono deleteObservable = document.delete(options); + + + CosmosResponseValidator validator = new CosmosResponseValidator.Builder() + .nullResource().build(); + validateSuccess(deleteObservable, validator); + + // attempt to read document which was deleted + waitIfNeededForReplicasToCatchUp(clientBuilder()); + + Mono readObservable = document.read(options); + FailureValidator notFoundValidator = new FailureValidator.Builder().resourceNotFound().build(); + validateFailure(readObservable, notFoundValidator); + + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.SECONDARY_MASTER_KEY); + } + + @Test(groups = { "simple" }, timeOut = TIMEOUT) + public void createDatabaseWithSecondaryKey() throws Exception { + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.MASTER_KEY); + + cosmosKeyCredential.key(TestConfigurations.SECONDARY_MASTER_KEY); + + CosmosDatabaseProperties databaseDefinition = new CosmosDatabaseProperties(CosmosDatabaseForTest.generateId()); + databases.add(databaseDefinition.id()); + // create the database + Mono createObservable = client.createDatabase(databaseDefinition, new CosmosDatabaseRequestOptions()); + + // validate + CosmosResponseValidator validator = new CosmosResponseValidator.Builder() + .withId(databaseDefinition.id()).build(); + validateSuccess(createObservable, validator); + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.SECONDARY_MASTER_KEY); + } + + @Test(groups = { "simple" }, timeOut = TIMEOUT) + public void readDatabaseWithSecondaryKey() throws Exception { + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.MASTER_KEY); + + cosmosKeyCredential.key(TestConfigurations.SECONDARY_MASTER_KEY); + + // read database + Mono readObservable = client.getDatabase(databaseId).read(); + + // validate + CosmosResponseValidator validator = new CosmosResponseValidator.Builder() + .withId(databaseId).build(); + validateSuccess(readObservable, validator); + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.SECONDARY_MASTER_KEY); + } + + @Test(groups = { "simple" }, timeOut = TIMEOUT) + public void deleteDatabaseWithSecondaryKey() throws Exception { + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.MASTER_KEY); + + cosmosKeyCredential.key(TestConfigurations.SECONDARY_MASTER_KEY); + + // create the database + CosmosDatabaseProperties databaseDefinition = new CosmosDatabaseProperties(CosmosDatabaseForTest.generateId()); + databases.add(databaseDefinition.id()); + + CosmosDatabase database = client.createDatabase(databaseDefinition, new CosmosDatabaseRequestOptions()).block().database(); + // delete the database + Mono deleteObservable = database.delete(); + + // validate + CosmosResponseValidator validator = new CosmosResponseValidator.Builder() + .nullResource().build(); + validateSuccess(deleteObservable, validator); + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.SECONDARY_MASTER_KEY); + } + + @Test(groups = { "simple" }, timeOut = TIMEOUT, + expectedExceptions = IllegalArgumentException.class, + expectedExceptionsMessageRegExp = "Illegal base64 character .*") + public void invalidSecondaryKey() throws Exception { + // sanity check + assertThat(client.cosmosKeyCredential().key()).isEqualTo(TestConfigurations.MASTER_KEY); + + cosmosKeyCredential.key("Invalid Secondary Key"); + + // create the database, and this should throw Illegal Argument Exception for secondary key + CosmosDatabaseProperties databaseDefinition = new CosmosDatabaseProperties(CosmosDatabaseForTest.generateId()); + client.createDatabase(databaseDefinition, new CosmosDatabaseRequestOptions()).block().database(); + } + + @AfterMethod(groups = { "simple" }, timeOut = SETUP_TIMEOUT) + public void afterMethod() { + // Set back master key before every test + cosmosKeyCredential.key(TestConfigurations.MASTER_KEY); + } + + @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT) + public void beforeClass() { + client = clientBuilder().build(); + database = createDatabase(client, databaseId); + container = getSharedMultiPartitionCosmosContainer(client); + } + + @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true) + public void afterClass() { + safeDeleteDatabase(database); + for(String dbId: databases) { + safeDeleteDatabase(client.getDatabase(dbId)); + } + safeClose(client); + } +} diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/CosmosPartitionKeyTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosPartitionKeyTests.java similarity index 99% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/CosmosPartitionKeyTests.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosPartitionKeyTests.java index ddf79725aab8..137816d3096b 100644 --- a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/CosmosPartitionKeyTests.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosPartitionKeyTests.java @@ -62,17 +62,17 @@ private void createContainerWithoutPk() throws URISyntaxException, IOException { .withRequestTimeoutInMillis(connectionPolicy.requestTimeoutInMillis()); HttpClient httpClient = HttpClient.createFixed(httpClientConfig); - + // CREATE a non partitioned collection using the rest API and older version String resourceId = Paths.DATABASES_PATH_SEGMENT + "/" + createdDatabase.id(); String path = Paths.DATABASES_PATH_SEGMENT + "/" + createdDatabase.id() + "/" + Paths.COLLECTIONS_PATH_SEGMENT + "/"; DocumentCollection collection = new DocumentCollection(); collection.id(NON_PARTITIONED_CONTAINER_ID); - + HashMap headers = new HashMap(); headers.put(HttpConstants.HttpHeaders.X_DATE, Utils.nowAsRFC1123()); headers.put(HttpConstants.HttpHeaders.VERSION, "2018-09-17"); - BaseAuthorizationTokenProvider base = new BaseAuthorizationTokenProvider(TestConfigurations.MASTER_KEY); + BaseAuthorizationTokenProvider base = new BaseAuthorizationTokenProvider(new CosmosKeyCredential(TestConfigurations.MASTER_KEY)); String authorization = base.generateKeyAuthorizationSignature(HttpConstants.HttpMethods.POST, resourceId, Paths.COLLECTIONS_PATH_SEGMENT, headers); headers.put(HttpConstants.HttpHeaders.AUTHORIZATION, URLEncoder.encode(authorization, "UTF-8")); RxDocumentServiceRequest request = RxDocumentServiceRequest.create(OperationType.Create, @@ -87,7 +87,7 @@ private void createContainerWithoutPk() throws URISyntaxException, IOException { httpRequest.withBody(request.getContent()); String body = httpClient.send(httpRequest).block().bodyAsString().block(); assertThat(body).contains("\"id\":\"" + NON_PARTITIONED_CONTAINER_ID + "\""); - + // CREATE a document in the non partitioned collection using the rest API and older version resourceId = Paths.DATABASES_PATH_SEGMENT + "/" + createdDatabase.id() + "/" + Paths.COLLECTIONS_PATH_SEGMENT + "/" + collection.id(); path = Paths.DATABASES_PATH_SEGMENT + "/" + createdDatabase.id() + "/" + Paths.COLLECTIONS_PATH_SEGMENT diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/CosmosResponseValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosResponseValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/CosmosResponseValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/CosmosResponseValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/DocumentClientTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/DocumentClientTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/DocumentClientTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/DocumentClientTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/DocumentCollectionTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/DocumentCollectionTests.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/DocumentCollectionTests.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/DocumentCollectionTests.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/DocumentTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/DocumentTests.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/DocumentTests.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/DocumentTests.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/GatewayTestUtils.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/GatewayTestUtils.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/GatewayTestUtils.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/GatewayTestUtils.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/IncludedPathTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/IncludedPathTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/IncludedPathTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/IncludedPathTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/JsonSerializableTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/JsonSerializableTests.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/JsonSerializableTests.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/JsonSerializableTests.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/PartitionKeyHashingTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/PartitionKeyHashingTests.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/PartitionKeyHashingTests.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/PartitionKeyHashingTests.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/PermissionTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/PermissionTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/PermissionTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/PermissionTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/ResourceIdTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/ResourceIdTests.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/ResourceIdTests.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/ResourceIdTests.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ClientRetryPolicyTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ClientRetryPolicyTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ClientRetryPolicyTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ClientRetryPolicyTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ConfigsBuilder.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConfigsBuilder.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ConfigsBuilder.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConfigsBuilder.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ConfigsTests.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConfigsTests.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ConsistencyTests1.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConsistencyTests1.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ConsistencyTests1.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConsistencyTests1.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ConsistencyTests2.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConsistencyTests2.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ConsistencyTests2.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConsistencyTests2.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ConsistencyTestsBase.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConsistencyTestsBase.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ConsistencyTestsBase.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ConsistencyTestsBase.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/DocumentQuerySpyWireContentTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/DocumentQuerySpyWireContentTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/DocumentQuerySpyWireContentTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/DocumentQuerySpyWireContentTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/DocumentServiceRequestContextValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/DocumentServiceRequestContextValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/DocumentServiceRequestContextValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/DocumentServiceRequestContextValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/DocumentServiceRequestValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/DocumentServiceRequestValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/DocumentServiceRequestValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/DocumentServiceRequestValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/FailureValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/FailureValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/FailureValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/FailureValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/FeedResponseListValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/FeedResponseListValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/FeedResponseListValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/FeedResponseListValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/FeedResponseValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/FeedResponseValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/FeedResponseValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/FeedResponseValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/HttpClientUnderTestWrapper.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/HttpClientUnderTestWrapper.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/HttpClientUnderTestWrapper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/HttpClientUnderTestWrapper.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/LocationHelperTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/LocationHelperTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/LocationHelperTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/LocationHelperTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/NetworkFailureTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/NetworkFailureTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/NetworkFailureTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/NetworkFailureTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ParallelAsync.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ParallelAsync.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ParallelAsync.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ParallelAsync.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/PathsHelperTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/PathsHelperTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/PathsHelperTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/PathsHelperTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RenameCollectionAwareClientRetryPolicyTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RenameCollectionAwareClientRetryPolicyTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RenameCollectionAwareClientRetryPolicyTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RenameCollectionAwareClientRetryPolicyTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ResourceResponseValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ResourceResponseValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ResourceResponseValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ResourceResponseValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ResourceValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ResourceValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ResourceValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ResourceValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RetryAnalyzer.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RetryAnalyzer.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RetryAnalyzer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RetryAnalyzer.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RetryCreateDocumentTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RetryCreateDocumentTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RetryCreateDocumentTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RetryCreateDocumentTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RetryThrottleTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RetryThrottleTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RetryThrottleTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RetryThrottleTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RetryUtilsTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RetryUtilsTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RetryUtilsTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RetryUtilsTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RxDocumentClientUnderTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RxDocumentClientUnderTest.java similarity index 91% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RxDocumentClientUnderTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RxDocumentClientUnderTest.java index 1818f37cb834..300aab9bbfd9 100644 --- a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RxDocumentClientUnderTest.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RxDocumentClientUnderTest.java @@ -5,6 +5,7 @@ import com.azure.data.cosmos.ClientUnderTestBuilder; import com.azure.data.cosmos.ConnectionPolicy; import com.azure.data.cosmos.ConsistencyLevel; +import com.azure.data.cosmos.CosmosKeyCredential; import com.azure.data.cosmos.internal.http.HttpClient; import com.azure.data.cosmos.internal.http.HttpRequest; import com.azure.data.cosmos.internal.http.HttpResponse; @@ -34,8 +35,9 @@ public RxDocumentClientUnderTest(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, - Configs configs) { - super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs); + Configs configs, + CosmosKeyCredential cosmosKeyCredential) { + super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs, cosmosKeyCredential); init(); } diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RxDocumentServiceRequestTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RxDocumentServiceRequestTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RxDocumentServiceRequestTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RxDocumentServiceRequestTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RxGatewayStoreModelTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RxGatewayStoreModelTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/RxGatewayStoreModelTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/RxGatewayStoreModelTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/SessionContainerTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/SessionContainerTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/SessionContainerTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/SessionContainerTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/SessionTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/SessionTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/SessionTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/SessionTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/SessionTokenTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/SessionTokenTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/SessionTokenTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/SessionTokenTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ShouldRetryValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ShouldRetryValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/ShouldRetryValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/ShouldRetryValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/SpyClientBuilder.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/SpyClientBuilder.java similarity index 86% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/SpyClientBuilder.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/SpyClientBuilder.java index 3a6a49f46238..bc8e93eea0cf 100644 --- a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/SpyClientBuilder.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/SpyClientBuilder.java @@ -11,6 +11,7 @@ public SpyClientBuilder(AsyncDocumentClient.Builder builder) { super.desiredConsistencyLevel = builder.desiredConsistencyLevel; super.masterKeyOrResourceToken = builder.masterKeyOrResourceToken; super.serviceEndpoint = builder.serviceEndpoint; + super.cosmosKeyCredential = builder.cosmosKeyCredential; } public SpyClientUnderTestFactory.ClientUnderTest build() { @@ -19,7 +20,7 @@ public SpyClientUnderTestFactory.ClientUnderTest build() { masterKeyOrResourceToken, connectionPolicy, desiredConsistencyLevel, - configs); + configs, cosmosKeyCredential); } public SpyClientUnderTestFactory.ClientWithGatewaySpy buildWithGatewaySpy() { @@ -28,7 +29,7 @@ public SpyClientUnderTestFactory.ClientWithGatewaySpy buildWithGatewaySpy() { masterKeyOrResourceToken, connectionPolicy, desiredConsistencyLevel, - configs); + configs, cosmosKeyCredential); } public SpyClientUnderTestFactory.DirectHttpsClientUnderTest buildWithDirectHttps() { @@ -36,6 +37,6 @@ public SpyClientUnderTestFactory.DirectHttpsClientUnderTest buildWithDirectHttps serviceEndpoint, masterKeyOrResourceToken, connectionPolicy, - desiredConsistencyLevel); + desiredConsistencyLevel, cosmosKeyCredential); } } diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/SpyClientUnderTestFactory.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/SpyClientUnderTestFactory.java similarity index 91% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/SpyClientUnderTestFactory.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/SpyClientUnderTestFactory.java index 5fbcb8e50882..faeac5af3da2 100644 --- a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/SpyClientUnderTestFactory.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/SpyClientUnderTestFactory.java @@ -5,6 +5,7 @@ import com.azure.data.cosmos.ConnectionMode; import com.azure.data.cosmos.ConnectionPolicy; import com.azure.data.cosmos.ConsistencyLevel; +import com.azure.data.cosmos.CosmosKeyCredential; import com.azure.data.cosmos.internal.directconnectivity.Protocol; import com.azure.data.cosmos.internal.directconnectivity.ReflectionUtils; import com.azure.data.cosmos.internal.http.HttpClient; @@ -31,12 +32,12 @@ 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 SpyBaseClass(URI serviceEndpoint, String masterKeyOrResourceToken, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, Configs configs, CosmosKeyCredential cosmosKeyCredential) { + super(serviceEndpoint, masterKeyOrResourceToken, connectionPolicy, consistencyLevel, configs, cosmosKeyCredential); } - + public abstract List getCapturedRequests(); - + public abstract void clearCapturedRequests(); protected static Configs createConfigsSpy(final Protocol protocol) { @@ -45,7 +46,7 @@ protected static Configs createConfigsSpy(final Protocol protocol) { return configs; } } - + public static class ClientWithGatewaySpy extends SpyBaseClass { private RxGatewayStoreModel origRxGatewayStoreModel; @@ -54,8 +55,8 @@ public static class ClientWithGatewaySpy extends SpyBaseClass requests; - ClientWithGatewaySpy(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, Configs configs) { - super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs); + ClientWithGatewaySpy(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, Configs configs, CosmosKeyCredential cosmosKeyCredential) { + super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs, cosmosKeyCredential); init(); } @@ -116,8 +117,8 @@ public static class ClientUnderTest extends SpyBaseClass { List>> requestsResponsePairs = Collections.synchronizedList(new ArrayList<>()); - ClientUnderTest(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, Configs configs) { - super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs); + ClientUnderTest(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, Configs configs, CosmosKeyCredential cosmosKeyCredential) { + super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs, cosmosKeyCredential); init(); } @@ -168,8 +169,8 @@ public static class DirectHttpsClientUnderTest extends SpyBaseClass List>> requestsResponsePairs = Collections.synchronizedList(new ArrayList<>()); - DirectHttpsClientUnderTest(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel) { - super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, createConfigsSpy(Protocol.HTTPS)); + DirectHttpsClientUnderTest(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, CosmosKeyCredential cosmosKeyCredential) { + super(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, createConfigsSpy(Protocol.HTTPS), cosmosKeyCredential); assert connectionPolicy.connectionMode() == ConnectionMode.DIRECT; init(); @@ -219,7 +220,7 @@ public HttpClient getSpyHttpClient() { return spyHttpClient; } } - + public static ClientWithGatewaySpy createClientWithGatewaySpy(AsyncDocumentClient.Builder builder) { return new SpyClientBuilder(builder).buildWithGatewaySpy(); } @@ -228,14 +229,15 @@ public static ClientWithGatewaySpy createClientWithGatewaySpy(URI serviceEndpoin String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, - Configs configs) { - return new ClientWithGatewaySpy(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs); + Configs configs, + CosmosKeyCredential cosmosKeyCredential) { + return new ClientWithGatewaySpy(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs, cosmosKeyCredential); } public static ClientUnderTest createClientUnderTest(AsyncDocumentClient.Builder builder) { return new SpyClientBuilder(builder).build(); } - + public static DirectHttpsClientUnderTest createDirectHttpsClientUnderTest(AsyncDocumentClient.Builder builder) { return new SpyClientBuilder(builder).buildWithDirectHttps(); } @@ -244,8 +246,9 @@ public static ClientUnderTest createClientUnderTest(URI serviceEndpoint, String masterKey, ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, - Configs configs) { - return new ClientUnderTest(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs) { + Configs configs, + CosmosKeyCredential cosmosKeyCredential) { + return new ClientUnderTest(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, configs, cosmosKeyCredential) { @Override RxGatewayStoreModel createRxGatewayProxy(ISessionContainer sessionContainer, @@ -274,7 +277,7 @@ RxGatewayStoreModel createRxGatewayProxy(ISessionContainer sessionContainer, } public static DirectHttpsClientUnderTest createDirectHttpsClientUnderTest(URI serviceEndpoint, String masterKey, - ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel) { - return new DirectHttpsClientUnderTest(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel); + ConnectionPolicy connectionPolicy, ConsistencyLevel consistencyLevel, CosmosKeyCredential cosmosKeyCredential) { + return new DirectHttpsClientUnderTest(serviceEndpoint, masterKey, connectionPolicy, consistencyLevel, cosmosKeyCredential); } } diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/StoreHeaderTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/StoreHeaderTests.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/StoreHeaderTests.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/StoreHeaderTests.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/StoreResponseBuilder.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/StoreResponseBuilder.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/StoreResponseBuilder.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/StoreResponseBuilder.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/TestSuiteBase.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/TestSuiteBase.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/TestSuiteBase.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/TestSuiteBase.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/TestUtils.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/TestUtils.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/TestUtils.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/TestUtils.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/TimeTokenTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/TimeTokenTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/TimeTokenTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/TimeTokenTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/caches/AsyncCacheTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/caches/AsyncCacheTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/caches/AsyncCacheTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/caches/AsyncCacheTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressResolverTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressResolverTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressResolverTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressResolverTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressSelectorTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressSelectorTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressSelectorTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressSelectorTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressSelectorWrapper.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressSelectorWrapper.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressSelectorWrapper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressSelectorWrapper.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/AddressValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/BarrierRequestHelperTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/BarrierRequestHelperTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/BarrierRequestHelperTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/BarrierRequestHelperTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyReaderTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyReaderTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyReaderTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyReaderTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyReaderUnderTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyReaderUnderTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyReaderUnderTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyReaderUnderTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyWriterTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyWriterTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyWriterTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ConsistencyWriterTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/DCDocumentCrudTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/DCDocumentCrudTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/DCDocumentCrudTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/DCDocumentCrudTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/EndpointMock.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/EndpointMock.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/EndpointMock.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/EndpointMock.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ExceptionBuilder.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ExceptionBuilder.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ExceptionBuilder.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ExceptionBuilder.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/Function1WithCheckedException.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/Function1WithCheckedException.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/Function1WithCheckedException.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/Function1WithCheckedException.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/Function2WithCheckedException.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/Function2WithCheckedException.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/Function2WithCheckedException.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/Function2WithCheckedException.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayAddressCacheTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayAddressCacheTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayAddressCacheTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayAddressCacheTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java similarity index 98% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java index da14e7fb5153..0401d60021aa 100644 --- a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfigurationReaderTest.java @@ -3,6 +3,7 @@ package com.azure.data.cosmos.internal.directconnectivity; +import com.azure.data.cosmos.CosmosKeyCredential; import com.azure.data.cosmos.internal.AsyncDocumentClient; import com.azure.data.cosmos.internal.AsyncDocumentClient.Builder; import com.azure.data.cosmos.BridgeInternal; @@ -56,7 +57,7 @@ public void setup() throws Exception { client = clientBuilder().build(); SpyClientUnderTestFactory.ClientUnderTest clientUnderTest = SpyClientUnderTestFactory.createClientUnderTest(this.clientBuilder()); HttpClient httpClient = clientUnderTest.getSpyHttpClient(); - baseAuthorizationTokenProvider = new BaseAuthorizationTokenProvider(TestConfigurations.MASTER_KEY); + baseAuthorizationTokenProvider = new BaseAuthorizationTokenProvider(new CosmosKeyCredential(TestConfigurations.MASTER_KEY)); connectionPolicy = ConnectionPolicy.defaultPolicy(); mockHttpClient = Mockito.mock(HttpClient.class); mockGatewayServiceConfigurationReader = new GatewayServiceConfigurationReader(new URI(TestConfigurations.HOST), @@ -151,4 +152,4 @@ private HttpResponse getMockResponse(String databaseAccountJson) { Mockito.doReturn(new HttpHeaders()).when(httpResponse).headers(); return httpResponse; } -} \ No newline at end of file +} diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GatewayServiceConfiguratorReaderMock.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GlobalAddressResolverTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GlobalAddressResolverTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GlobalAddressResolverTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GlobalAddressResolverTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GoneAndRetryWithRetryPolicyTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GoneAndRetryWithRetryPolicyTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GoneAndRetryWithRetryPolicyTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/GoneAndRetryWithRetryPolicyTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/HttpClientMockWrapper.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/HttpClientMockWrapper.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/HttpClientMockWrapper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/HttpClientMockWrapper.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/HttpTransportClientTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/HttpTransportClientTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/HttpTransportClientTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/HttpTransportClientTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/HttpUtilsTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/HttpUtilsTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/HttpUtilsTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/HttpUtilsTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/MultiStoreResultValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/MultiStoreResultValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/MultiStoreResultValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/MultiStoreResultValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/MurmurHash3_32Test.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/MurmurHash3_32Test.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/MurmurHash3_32Test.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/MurmurHash3_32Test.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/PartitionKeyInternalTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/PartitionKeyInternalTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/PartitionKeyInternalTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/PartitionKeyInternalTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/PartitionKeyTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/PartitionKeyTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/PartitionKeyTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/PartitionKeyTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/PartitionReplicasAddressesValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/PartitionReplicasAddressesValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/PartitionReplicasAddressesValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/PartitionReplicasAddressesValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/QuorumReaderTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/QuorumReaderTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/QuorumReaderTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/QuorumReaderTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReflectionUtils.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReflectionUtils.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReflectionUtils.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReflectionUtils.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReplicaAddressFactory.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReplicaAddressFactory.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReplicaAddressFactory.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReplicaAddressFactory.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReplicatedResourceClientPartitionSplitTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReplicatedResourceClientPartitionSplitTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReplicatedResourceClientPartitionSplitTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReplicatedResourceClientPartitionSplitTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReplicatedResourceClientTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReplicatedResourceClientTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReplicatedResourceClientTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/ReplicatedResourceClientTest.java diff --git a/sdk/cosmos/sdk/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 similarity index 99% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/RntbdTransportClientTest.java index 9a095f948940..607d78fe57cb 100644 --- a/sdk/cosmos/sdk/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 @@ -5,6 +5,7 @@ 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.LockedException; @@ -17,10 +18,6 @@ import com.azure.data.cosmos.RetryWithException; import com.azure.data.cosmos.ServiceUnavailableException; import com.azure.data.cosmos.UnauthorizedException; -import com.azure.data.cosmos.internal.directconnectivity.RntbdTransportClient; -import com.azure.data.cosmos.internal.directconnectivity.ServerProperties; -import com.azure.data.cosmos.internal.directconnectivity.RntbdTransportClient; -import com.azure.data.cosmos.internal.directconnectivity.ServerProperties; 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; @@ -611,7 +608,7 @@ public void verifyGoneResponseMapsToGoneException() throws Exception { try (final RntbdTransportClient transportClient = new RntbdTransportClient(options, sslContext)) { final BaseAuthorizationTokenProvider authorizationTokenProvider = new BaseAuthorizationTokenProvider( - RntbdTestConfiguration.AccountKey + new CosmosKeyCredential(RntbdTestConfiguration.AccountKey) ); final URI physicalAddress = new URI("rntbd://" diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreReaderDotNetTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreReaderDotNetTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreReaderDotNetTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreReaderDotNetTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreReaderTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreReaderTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreReaderTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreReaderTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreReaderUnderTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreReaderUnderTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreReaderUnderTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreReaderUnderTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreResponseTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreResponseTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreResponseTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreResponseTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreResponseValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreResponseValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreResponseValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreResponseValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreResultValidator.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreResultValidator.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreResultValidator.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/StoreResultValidator.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/TimeoutHelperTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/TimeoutHelperTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/TimeoutHelperTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/TimeoutHelperTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/TransportClientWrapper.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/TransportClientWrapper.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/TransportClientWrapper.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/TransportClientWrapper.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/WebExceptionUtilityTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/WebExceptionUtilityTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/directconnectivity/WebExceptionUtilityTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/directconnectivity/WebExceptionUtilityTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/query/DocumentProducerTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/query/DocumentProducerTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/query/DocumentProducerTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/query/DocumentProducerTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/query/FeedResponseBuilder.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/query/FeedResponseBuilder.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/query/FeedResponseBuilder.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/query/FeedResponseBuilder.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/query/FetcherTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/query/FetcherTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/query/FetcherTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/query/FetcherTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/routing/InMemoryCollectionRoutingMapTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/InMemoryCollectionRoutingMapTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/routing/InMemoryCollectionRoutingMapTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/InMemoryCollectionRoutingMapTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/routing/LocationCacheTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/LocationCacheTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/routing/LocationCacheTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/LocationCacheTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/routing/PartitionKeyInternalUtils.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/PartitionKeyInternalUtils.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/routing/PartitionKeyInternalUtils.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/PartitionKeyInternalUtils.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/routing/RoutingMapProviderHelperTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/RoutingMapProviderHelperTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/routing/RoutingMapProviderHelperTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/RoutingMapProviderHelperTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/routing/StringPartitionKeyComponentTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/StringPartitionKeyComponentTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/internal/routing/StringPartitionKeyComponentTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/internal/routing/StringPartitionKeyComponentTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/AggregateQueryTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/AggregateQueryTests.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/AggregateQueryTests.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/AggregateQueryTests.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/BackPressureCrossPartitionTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/BackPressureCrossPartitionTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/BackPressureCrossPartitionTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/BackPressureCrossPartitionTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/BackPressureTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/BackPressureTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/BackPressureTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/BackPressureTest.java diff --git a/sdk/cosmos/sdk/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 similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ChangeFeedProcessorTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ChangeFeedProcessorTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ChangeFeedTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ChangeFeedTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ChangeFeedTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ChangeFeedTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/CollectionCrudTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/CollectionCrudTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/CollectionCrudTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/CollectionCrudTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/CollectionQueryTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/CollectionQueryTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/CollectionQueryTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/CollectionQueryTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/CosmosConflictTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/CosmosConflictTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/CosmosConflictTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/CosmosConflictTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/DatabaseCrudTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/DatabaseCrudTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/DatabaseCrudTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/DatabaseCrudTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/DatabaseQueryTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/DatabaseQueryTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/DatabaseQueryTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/DatabaseQueryTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/DocumentClientResourceLeakTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/DocumentClientResourceLeakTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/DocumentClientResourceLeakTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/DocumentClientResourceLeakTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/DocumentCrudTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/DocumentCrudTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/DocumentCrudTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/DocumentCrudTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/LogLevelTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/LogLevelTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/LogLevelTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/LogLevelTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/MultiMasterConflictResolutionTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/MultiMasterConflictResolutionTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/MultiMasterConflictResolutionTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/MultiMasterConflictResolutionTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/MultiOrderByQueryTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/MultiOrderByQueryTests.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/MultiOrderByQueryTests.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/MultiOrderByQueryTests.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/OfferQueryTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/OfferQueryTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/OfferQueryTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/OfferQueryTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/OfferReadReplaceTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/OfferReadReplaceTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/OfferReadReplaceTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/OfferReadReplaceTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/OrderbyDocumentQueryTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/OrderbyDocumentQueryTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/OrderbyDocumentQueryTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/OrderbyDocumentQueryTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ParallelDocumentQueryTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ParallelDocumentQueryTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ParallelDocumentQueryTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ParallelDocumentQueryTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ParsingEnvTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ParsingEnvTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ParsingEnvTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ParsingEnvTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/PermissionCrudTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/PermissionCrudTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/PermissionCrudTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/PermissionCrudTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/PermissionQueryTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/PermissionQueryTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/PermissionQueryTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/PermissionQueryTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ProxyHostTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ProxyHostTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ProxyHostTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ProxyHostTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedCollectionsTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedCollectionsTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedCollectionsTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedCollectionsTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedDatabasesTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedDatabasesTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedDatabasesTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedDatabasesTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedDocumentsTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedDocumentsTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedDocumentsTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedDocumentsTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedExceptionHandlingTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedExceptionHandlingTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedExceptionHandlingTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedExceptionHandlingTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedOffersTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedOffersTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedOffersTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedOffersTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedPermissionsTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedPermissionsTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedPermissionsTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedPermissionsTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedPkrTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedPkrTests.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedPkrTests.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedPkrTests.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedStoredProceduresTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedStoredProceduresTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedStoredProceduresTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedStoredProceduresTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedTriggersTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedTriggersTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedTriggersTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedTriggersTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedUdfsTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedUdfsTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedUdfsTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedUdfsTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedUsersTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedUsersTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ReadFeedUsersTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ReadFeedUsersTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ResourceTokenTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ResourceTokenTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/ResourceTokenTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/ResourceTokenTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/SimpleSerializationTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/SimpleSerializationTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/SimpleSerializationTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/SimpleSerializationTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/SinglePartitionDocumentQueryTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/SinglePartitionDocumentQueryTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/SinglePartitionDocumentQueryTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/SinglePartitionDocumentQueryTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/SinglePartitionReadFeedDocumentsTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/SinglePartitionReadFeedDocumentsTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/SinglePartitionReadFeedDocumentsTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/SinglePartitionReadFeedDocumentsTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/StoredProcedureCrudTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/StoredProcedureCrudTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/StoredProcedureCrudTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/StoredProcedureCrudTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/StoredProcedureQueryTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/StoredProcedureQueryTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/StoredProcedureQueryTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/StoredProcedureQueryTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/StoredProcedureUpsertReplaceTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/StoredProcedureUpsertReplaceTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/StoredProcedureUpsertReplaceTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/StoredProcedureUpsertReplaceTest.java diff --git a/sdk/cosmos/sdk/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 similarity index 99% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/TestSuiteBase.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TestSuiteBase.java index f20082c85c41..cd83f3d4fb7d 100644 --- a/sdk/cosmos/sdk/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 @@ -23,6 +23,7 @@ import com.azure.data.cosmos.CosmosItem; import com.azure.data.cosmos.CosmosItemProperties; import com.azure.data.cosmos.CosmosItemResponse; +import com.azure.data.cosmos.CosmosKeyCredential; import com.azure.data.cosmos.CosmosResponse; import com.azure.data.cosmos.CosmosResponseValidator; import com.azure.data.cosmos.CosmosStoredProcedureRequestOptions; @@ -99,6 +100,8 @@ public class TestSuiteBase extends CosmosClientTest { private static final ImmutableList desiredConsistencies; private static final ImmutableList protocols; + protected static final CosmosKeyCredential cosmosKeyCredential; + protected int subscriberValidationTimeout = TIMEOUT; private static CosmosDatabase SHARED_DATABASE; @@ -113,7 +116,7 @@ public TestSuiteBase(CosmosClientBuilder clientBuilder) { protected static CosmosDatabase getSharedCosmosDatabase(CosmosClient client) { return CosmosBridgeInternal.getCosmosDatabaseWithNewClient(SHARED_DATABASE, client); } - + protected static CosmosContainer getSharedMultiPartitionCosmosContainer(CosmosClient client) { return CosmosBridgeInternal.getCosmosContainerWithNewClient(SHARED_MULTI_PARTITION_COLLECTION, SHARED_DATABASE, client); } @@ -140,6 +143,8 @@ protected static CosmosContainer getSharedSinglePartitionCosmosContainer(CosmosC objectMapper.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true); objectMapper.configure(JsonParser.Feature.ALLOW_TRAILING_COMMA, true); objectMapper.configure(JsonParser.Feature.STRICT_DUPLICATE_DETECTION, true); + + cosmosKeyCredential = new CosmosKeyCredential(TestConfigurations.MASTER_KEY); } protected TestSuiteBase() { @@ -519,7 +524,7 @@ public static void deleteCollectionIfExists(CosmosClient client, String database .flatMap(page -> Flux.fromIterable(page.results())) .collectList() .block(); - + if (!res.isEmpty()) { deleteCollection(database, collectionId); } @@ -803,7 +808,7 @@ public static Object[][] simpleClientBuildersWithDirectHttps() { private static Object[][] simpleClientBuildersWithDirect(Protocol... protocols) { logger.info("Max test consistency to use is [{}]", accountConsistency); List testConsistencies = ImmutableList.of(ConsistencyLevel.EVENTUAL); - + boolean isMultiMasterEnabled = preferredLocations != null && accountConsistency == ConsistencyLevel.SESSION; List cosmosConfigurations = new ArrayList<>(); @@ -876,7 +881,7 @@ static List parseDesiredConsistencies(String consistencies) { static List allEqualOrLowerConsistencies(ConsistencyLevel accountConsistency) { List testConsistencies = new ArrayList<>(); switch (accountConsistency) { - + case STRONG: testConsistencies.add(ConsistencyLevel.STRONG); case BOUNDED_STALENESS: @@ -924,7 +929,7 @@ static protected CosmosClientBuilder createGatewayHouseKeepingDocumentClient() { options.maxRetryWaitTimeInSeconds(SUITE_SETUP_TIMEOUT); connectionPolicy.retryOptions(options); return CosmosClient.builder().endpoint(TestConfigurations.HOST) - .key(TestConfigurations.MASTER_KEY) + .cosmosKeyCredential(cosmosKeyCredential) .connectionPolicy(connectionPolicy) .consistencyLevel(ConsistencyLevel.SESSION); } @@ -935,7 +940,7 @@ static protected CosmosClientBuilder createGatewayRxDocumentClient(ConsistencyLe connectionPolicy.usingMultipleWriteLocations(multiMasterEnabled); connectionPolicy.preferredLocations(preferredLocations); return CosmosClient.builder().endpoint(TestConfigurations.HOST) - .key(TestConfigurations.MASTER_KEY) + .cosmosKeyCredential(cosmosKeyCredential) .connectionPolicy(connectionPolicy) .consistencyLevel(consistencyLevel); } @@ -963,7 +968,7 @@ static protected CosmosClientBuilder createDirectRxDocumentClient(ConsistencyLev doAnswer((Answer)invocation -> protocol).when(configs).getProtocol(); CosmosClientBuilder builder = CosmosClient.builder().endpoint(TestConfigurations.HOST) - .key(TestConfigurations.MASTER_KEY) + .cosmosKeyCredential(cosmosKeyCredential) .connectionPolicy(connectionPolicy) .consistencyLevel(consistencyLevel); diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/TokenResolverTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TokenResolverTest.java similarity index 99% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/TokenResolverTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TokenResolverTest.java index 1425f65fae46..94d8e958a9e2 100644 --- a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/TokenResolverTest.java +++ b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TokenResolverTest.java @@ -44,13 +44,13 @@ 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; @@ -296,12 +296,12 @@ public void createAndExecuteSprocWithWritePermission(ConnectionMode connectionMo " }" + " }'" + "}"); - + Flux> createObservable = asyncClientWithTokenResolver.createStoredProcedure(createdCollection.selfLink(), 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.id() + "/colls/" + createdCollection.id() + "/sprocs/" + sprocId; @@ -317,7 +317,7 @@ 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.selfLink(), new Document("{'id': '" + id1 + "'}"), null, false) @@ -330,7 +330,7 @@ public void readDocumentsWithAllPermission(ConnectionMode connectionMode) { expectedIds.add(rid1); expectedIds.add(rid2); String query = "SELECT * FROM r WHERE r._rid=\"" + rid1 + "\" or r._rid=\"" + rid2 + "\""; - + FeedOptions options = new FeedOptions(); options.enableCrossPartitionQuery(true); Flux> queryObservable = asyncClientWithTokenResolver.queryDocuments(createdCollection.selfLink(), query, options); @@ -365,7 +365,7 @@ public void readChangeFeedWithAllPermission(ConnectionMode connectionMode) throw try { asyncClientWithTokenResolver = buildClient(connectionMode, PermissionMode.ALL); OffsetDateTime befTime = OffsetDateTime.now(); - Thread.sleep(1000); + Thread.sleep(1500); document1 = asyncClientWithTokenResolver .createDocument(createdCollection.selfLink(), document1, null, false).single().block() @@ -397,7 +397,7 @@ public void readChangeFeedWithAllPermission(ConnectionMode connectionMode) throw @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) public void verifyRuntimeExceptionWhenUserModifiesProperties(ConnectionMode connectionMode) { AsyncDocumentClient asyncClientWithTokenResolver = null; - + try { ConnectionPolicy connectionPolicy = new ConnectionPolicy(); connectionPolicy.connectionMode(connectionMode); @@ -412,12 +412,12 @@ public void verifyRuntimeExceptionWhenUserModifiesProperties(ConnectionMode conn options.setProperties(new HashMap()); Flux> readObservable = asyncClientWithTokenResolver.readCollection(createdCollection.selfLink(), options); FailureValidator validator = new FailureValidator.Builder().withRuntimeExceptionClass(UnsupportedOperationException.class).build(); - validateFailure(readObservable, validator); + validateFailure(readObservable, validator); } finally { safeClose(asyncClientWithTokenResolver); } } - + @Test(groups = {"simple"}, dataProvider = "connectionMode", timeOut = TIMEOUT) public void verifyBlockListedUserThrows(ConnectionMode connectionMode) { String field = "user"; @@ -434,7 +434,7 @@ public void verifyBlockListedUserThrows(ConnectionMode connectionMode) { .withConsistencyLevel(ConsistencyLevel.SESSION) .withTokenResolver(getTokenResolverWithBlockList(PermissionMode.READ, field, blockListedUser, errorMessage)) .build(); - + RequestOptions options = new RequestOptions(); HashMap properties = new HashMap(); properties.put(field, blockListedUser); @@ -518,14 +518,14 @@ private TokenResolver getBadTokenResolver() { 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 && @@ -541,4 +541,4 @@ private TokenResolver getTokenResolverWithBlockList(PermissionMode permissionMod } }; } -} \ No newline at end of file +} diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/TopQueryTests.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TopQueryTests.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/TopQueryTests.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TopQueryTests.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/TriggerCrudTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TriggerCrudTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/TriggerCrudTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TriggerCrudTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/TriggerQueryTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TriggerQueryTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/TriggerQueryTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TriggerQueryTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/TriggerUpsertReplaceTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TriggerUpsertReplaceTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/TriggerUpsertReplaceTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/TriggerUpsertReplaceTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/UniqueIndexTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/UniqueIndexTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/UniqueIndexTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/UniqueIndexTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/UserCrudTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/UserCrudTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/UserCrudTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/UserCrudTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/UserDefinedFunctionCrudTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/UserDefinedFunctionCrudTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/UserDefinedFunctionCrudTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/UserDefinedFunctionCrudTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/UserDefinedFunctionQueryTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/UserDefinedFunctionQueryTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/UserDefinedFunctionQueryTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/UserDefinedFunctionQueryTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/UserDefinedFunctionUpsertReplaceTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/UserDefinedFunctionUpsertReplaceTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/UserDefinedFunctionUpsertReplaceTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/UserDefinedFunctionUpsertReplaceTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/UserQueryTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/UserQueryTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/UserQueryTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/UserQueryTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/VeryLargeDocumentQueryTest.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/VeryLargeDocumentQueryTest.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/VeryLargeDocumentQueryTest.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/VeryLargeDocumentQueryTest.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyChannelInitializer.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyChannelInitializer.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyChannelInitializer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyChannelInitializer.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyClientHandler.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyClientHandler.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyClientHandler.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyClientHandler.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyClientHeader.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyClientHeader.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyClientHeader.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyClientHeader.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyRemoteHandler.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyRemoteHandler.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyRemoteHandler.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyRemoteHandler.java diff --git a/sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyServer.java b/sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyServer.java similarity index 100% rename from sdk/cosmos/sdk/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyServer.java rename to sdk/cosmos/microsoft-azure-cosmos/src/test/java/com/azure/data/cosmos/rx/proxy/HttpProxyServer.java diff --git a/sdk/cosmos/sdk/src/test/resources/Microsoft.jpg b/sdk/cosmos/microsoft-azure-cosmos/src/test/resources/Microsoft.jpg similarity index 100% rename from sdk/cosmos/sdk/src/test/resources/Microsoft.jpg rename to sdk/cosmos/microsoft-azure-cosmos/src/test/resources/Microsoft.jpg diff --git a/sdk/cosmos/sdk/src/test/resources/cosmosdb-1.png b/sdk/cosmos/microsoft-azure-cosmos/src/test/resources/cosmosdb-1.png similarity index 100% rename from sdk/cosmos/sdk/src/test/resources/cosmosdb-1.png rename to sdk/cosmos/microsoft-azure-cosmos/src/test/resources/cosmosdb-1.png diff --git a/sdk/cosmos/sdk/src/test/resources/databaseAccount.json b/sdk/cosmos/microsoft-azure-cosmos/src/test/resources/databaseAccount.json similarity index 100% rename from sdk/cosmos/sdk/src/test/resources/databaseAccount.json rename to sdk/cosmos/microsoft-azure-cosmos/src/test/resources/databaseAccount.json diff --git a/sdk/cosmos/sdk/src/test/resources/emulator-testng.xml b/sdk/cosmos/microsoft-azure-cosmos/src/test/resources/emulator-testng.xml similarity index 100% rename from sdk/cosmos/sdk/src/test/resources/emulator-testng.xml rename to sdk/cosmos/microsoft-azure-cosmos/src/test/resources/emulator-testng.xml diff --git a/sdk/cosmos/sdk/src/test/resources/fast-testng.xml b/sdk/cosmos/microsoft-azure-cosmos/src/test/resources/fast-testng.xml similarity index 100% rename from sdk/cosmos/sdk/src/test/resources/fast-testng.xml rename to sdk/cosmos/microsoft-azure-cosmos/src/test/resources/fast-testng.xml diff --git a/sdk/cosmos/sdk/src/test/resources/log4j.properties b/sdk/cosmos/microsoft-azure-cosmos/src/test/resources/log4j.properties similarity index 100% rename from sdk/cosmos/sdk/src/test/resources/log4j.properties rename to sdk/cosmos/microsoft-azure-cosmos/src/test/resources/log4j.properties diff --git a/sdk/cosmos/sdk/src/test/resources/long-testng.xml b/sdk/cosmos/microsoft-azure-cosmos/src/test/resources/long-testng.xml similarity index 100% rename from sdk/cosmos/sdk/src/test/resources/long-testng.xml rename to sdk/cosmos/microsoft-azure-cosmos/src/test/resources/long-testng.xml diff --git a/sdk/cosmos/sdk/src/test/resources/sampleConflict.json b/sdk/cosmos/microsoft-azure-cosmos/src/test/resources/sampleConflict.json similarity index 100% rename from sdk/cosmos/sdk/src/test/resources/sampleConflict.json rename to sdk/cosmos/microsoft-azure-cosmos/src/test/resources/sampleConflict.json diff --git a/sdk/cosmos/pom.service.xml b/sdk/cosmos/pom.service.xml new file mode 100644 index 000000000000..ed71b263af04 --- /dev/null +++ b/sdk/cosmos/pom.service.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + com.azure + azure-cosomos-service + pom + 1.0.0 + + microsoft-azure-cosmos + microsoft-azure-cosmos-benchmark + microsoft-azure-cosmos-examples + + + \ No newline at end of file diff --git a/sdk/cosmos/pom.xml b/sdk/cosmos/pom.xml index 80fb223a1ac7..be5969442abd 100644 --- a/sdk/cosmos/pom.xml +++ b/sdk/cosmos/pom.xml @@ -13,11 +13,11 @@ Licensed under the MIT License. com.microsoft.azure azure-cosmos-parent - 3.0.0 + 3.1.0 pom Microsoft Azure Cosmos DB SQL API - This package contains Mircosoft Azure SDK for Azure Cosmos DB SQL API (with Reactive Extension RX support) + This package contains Microsoft Azure SDK for Azure Cosmos DB SQL API (with Reactive Extension RX support) https://github.com/Azure/azure-sdk-for-java @@ -34,11 +34,11 @@ Licensed under the MIT License. UTF-8 UTF-8 - 3.0.0 - 3.0.0 + 3.1.0 + 3.1.0 1.10.19 4.1.36.Final - 3.0.0 + 3.1.0 27.0.1-jre 3.2.9.RELEASE 2.0.25.Final @@ -389,9 +389,9 @@ Licensed under the MIT License. - sdk - benchmark - examples + microsoft-azure-cosmos + microsoft-azure-cosmos-benchmark + microsoft-azure-cosmos-examples diff --git a/sdk/cosmos/sdk/CosmosConflict b/sdk/cosmos/sdk/CosmosConflict deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/sdk/cosmos/tests.yml b/sdk/cosmos/tests.yml index d5c7a662960a..771b32bcbb58 100644 --- a/sdk/cosmos/tests.yml +++ b/sdk/cosmos/tests.yml @@ -1,429 +1,339 @@ -trigger: - branches: - include: - - master - paths: - include: - - sdk/cosmos +trigger: none variables: - pomFile: './sdk/cosmos/pom.xml' - DefaultOptions: '--batch-mode -Dmaven.wagon.http.pool=false' - LoggingOptions: '-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn' + - template: ../../eng/pipelines/templates/variables/globals.yml + - name: AdditionalArgs + value: '' jobs: - - job: 'Build' - - pool: - vmImage: 'vs2017-win2016' - - steps: - - task: Maven@3 - displayName: 'Install reporting tools' - inputs: - mavenPomFile: ./eng/code-quality-reports/pom.xml - options: '$(DefaultOptions) -DskipTests -Dgpg.skip' - mavenOptions: '$(LoggingOptions)' - javaHomeOption: 'JDKVersion' - jdkVersionOption: '1.11' - jdkArchitectureOption: 'x64' - publishJUnitResults: false - goals: 'install' - - - task: Maven@1 - displayName: Build - inputs: - mavenPomFile: $(pomFile) - goals: 'package package' - options: '-DskipTests -Dgpg.skip' - publishJUnitResults: false - checkStyleRunAnalysis: true - pmdRunAnalysis: true - findBugsRunAnalysis: true - condition: succeededOrFailed() - - - job: 'Test' - - timeoutInMinutes: 240 - - strategy: - maxParallel: 1 - matrix: - Session_Single_Region_ReadMyWrites: + - template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml + parameters: + TestName: Single_Region_Session + ServiceDirectory: cosmos + TimeoutInMinutes: 240 + EnvVars: + ACCOUNT_HOST: $(java-cosmos-session-singleregion-host) + ACCOUNT_KEY: $(java-cosmos-session-singleregion-key) + SECONDARY_ACCOUNT_KEY: $(java-cosmos-session-singleregion-secondary-key) + MaxParallel: 1 + Matrix: + # 59m 59s, timed out + Http_E2E: + DisplayName: ReadMyWrites Integration Tests OSVmImage: 'vs2017-win2016' - CosmosAccountHost: $(java-cosmos-session-singleregion-host) - CosmosAccountKey: $(java-cosmos-session-singleregion-key) - Consistency: 'Session' - TestDisplayName: 'ReadMyWrites Integration Tests' ProfileFlag: '-Pe2e' - cosmos.directModeProtocol: 'Https' - - - Strong_Single_Region_ReadMyWrites: + AdditionalArgs: '-DargLine="-Dcosmos.directModeProtocol=Https"' + DESIRED_CONSISTENCY: 'Session' + # 09m 23s, expect passed + Single_Region_Fast: + DisplayName: Single Region Fast + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pfast' + PROTOCOLS: '["Https"]' + DESIRED_CONSISTENCIES: '["Session"]' + # 09m 0s, expect passed + Single_Region_Direct: + DisplayName: Single Region Direct + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pdirect' + PROTOCOLS: '["Https"]' + DESIRED_CONSISTENCIES: '["Session"]' + # 7m 44s, expect passed + Single_Region_Examples: + DisplayName: Single Region Examples + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pexamples' + PROTOCOLS: '["Https"]' + DESIRED_CONSISTENCIES: '["Session"]' + + PreRunSteps: + - template: ../steps/install-reporting-tools.yml + + TestStepMavenInputs: + goals: verify + options: '$(ProfileFlag) -Dgpg.skip $(AdditionalArgs)' + + TestResultsFiles: '**/junitreports/TEST-*.xml' + + + # This template parllelizes tests that could be run on Single_Region_Session + # by running them against a different cosmosdb instance + - template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml + parameters: + TestName: Single_Region_Session_2 + ServiceDirectory: cosmos + TimeoutInMinutes: 240 + EnvVars: + ACCOUNT_HOST: $(java-cosmos-session-singleregion-one-host) + ACCOUNT_KEY: $(java-cosmos-session-singleregion-one-key) + SECONDARY_ACCOUNT_KEY: $(java-cosmos-session-singleregion-one-secondary-key) + DESIRED_CONSISTENCIES: '["Session"]' + PROTOCOLS: '["Tcp"]' + MaxParallel: 1 + Matrix: + # 09m 07s, expect passed + Fast: + DisplayName: Multimaster Single Region Fast + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pfast' + AdditionalArgs: '-DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong"' + # 09m 14s, expect passed + Direct: + DisplayName: Multimaster Single Region Direct + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pdirect' + AdditionalArgs: '-DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong"' + # 07m 42s, expect passed + Examples: + DisplayName: Multimaster Single Region Examples + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pexamples' + AdditionalArgs: '-DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong"' + # 07m 05s, expect passed + NonEmulator: + DisplayName: Multimaster Single Region NonEmulator + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pnon-emulator' + AdditionalArgs: '-DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong"' + # 28m 42s, expect passed (rebalanced) + Single_Region_Long: + DisplayName: Long Integration Tests + OSVmImage: 'vs2017-win2016' + ProfileFlag: '-e -Plong' + DESIRED_CONSISTENCIES: '["Session"]' + PREFERRED_LOCATIONS: null + PROTOCOLS: '' + # 6m 58s, expect passed (rebalanced) + Single_Region_NonEmulator: + DisplayName: Single Region Examples + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pnon-emulator' + PROTOCOLS: '["Https"]' + DESIRED_CONSISTENCIES: '["Session"]' + + PreRunSteps: + - template: ../steps/install-reporting-tools.yml + + TestStepMavenInputs: + goals: verify + options: '$(ProfileFlag) -Dgpg.skip $(AdditionalArgs)' + + TestResultsFiles: '**/junitreports/TEST-*.xml' + + - template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml + parameters: + TestName: Single_Region_Strong_Tcp + ServiceDirectory: cosmos + TimeoutInMinutes: 240 + EnvVars: + ACCOUNT_HOST: $(java-cosmos-strong-singleregion-host) + ACCOUNT_KEY: $(java-cosmos-strong-singleregion-key) + SECONDARY_ACCOUNT_KEY: $(java-cosmos-strong-singleregion-secondary-key) + MaxParallel: 1 + Matrix: + # 09m 32s, expect passed + Strong_Tcp_Fast: + DisplayName: Strong TCP Fast + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pfast' + AdditionalArgs: '-DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong"' + PROTOCOLS: '["Tcp"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + # 08m 53s, expect passed + Strong_Tcp_Direct: + DisplayName: Strong TCP Direct + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pdirect' + AdditionalArgs: '-DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong"' + PROTOCOLS: '["Tcp"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + # 07m 36s, expect passed + Strong_Tcp_Examples: + DisplayName: Strong TCP Examples + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pexamples' + AdditionalArgs: '-DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong"' + PROTOCOLS: '["Tcp"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + # 06m 59s, expect passed + Strong_Tcp_NonEmulator: + DisplayName: Strong TCP NonEmulator + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pnon-emulator' + AdditionalArgs: '-DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong"' + PROTOCOLS: '["Tcp"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + + PreRunSteps: + - template: ../steps/install-reporting-tools.yml + + TestStepMavenInputs: + goals: verify + options: '$(ProfileFlag) -Dgpg.skip $(AdditionalArgs)' + + TestResultsFiles: '**/junitreports/TEST-*.xml' + + # Same host as above, parallelizing the e2e tests saves time overall + - template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml + parameters: + TestName: Single_Region_Strong_Https + ServiceDirectory: cosmos + TimeoutInMinutes: 240 + EnvVars: + ACCOUNT_HOST: $(java-cosmos-strong-singleregion-host) + ACCOUNT_KEY: $(java-cosmos-strong-singleregion-key) + SECONDARY_ACCOUNT_KEY: $(java-cosmos-strong-singleregion-secondary-key) + MaxParallel: 1 + Matrix: + # 59m 58s, timed out + Https_E2E: + DisplayName: Single Region ReadMyWrites OSVmImage: 'vs2017-win2016' - CosmosAccountHost: $(java-cosmos-strong-singleregion-host) - CosmosAccountKey: $(java-cosmos-strong-singleregion-key) - Consistency: 'Strong' - TestDisplayName: 'ReadMyWrites Integration Tests' ProfileFlag: '-Pe2e' - cosmos.directModeProtocol: 'Https' - - # Temporarily Disabled as V3 code lacks the support to run this pipeline. Will be enabled later by cosmos team. - # Strong_Multi_Region_ReadMyWrites: - # OSVmImage: 'macOS-10.13' - # CosmosAccountHost: $(MULTI_STRONG_ACCOUNT_HOST) - # CosmosAccountKey: $(MULTI_STRONG_ACCOUNT_KEY) - # Consistency: 'Strong' - # TestDisplayName: 'ReadMyWrites Integration Tests' - # ProfileFlag: '-Pe2e' - # cosmos.directModeProtocol: 'Https' - - pool: - vmImage: $(OSVmImage) - - #Your build pipeline references a secret variable named ‘ACCOUNT_HOST’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972 - #Your build pipeline references a secret variable named ‘ACCOUNT_KEY’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972 - steps: - - task: Maven@3 - displayName: 'Install reporting tools' - inputs: - mavenPomFile: ./eng/code-quality-reports/pom.xml - options: '$(DefaultOptions) -DskipTests -Dgpg.skip' - mavenOptions: '$(LoggingOptions)' - javaHomeOption: 'JDKVersion' - jdkVersionOption: '1.11' - jdkArchitectureOption: 'x64' - publishJUnitResults: false - goals: 'install' - - - task: Maven@1 - displayName: $(TestDisplayName) - inputs: - mavenPomFile: $(pomFile) - goals: verify - options: '$(ProfileFlag) -Dgpg.skip -DargLine="-Dcosmos.directModeProtocol=$(cosmos.directModeProtocol)" -DACCOUNT_HOST=$(CosmosAccountHost) -DACCOUNT_KEY=$(CosmosAccountKey)' - testResultsFiles: '**/junitreports/TEST-*.xml' - env: - DESIRED_CONSISTENCY: $(Consistency) - condition: succeededOrFailed() - - - task: CopyFiles@2 - displayName: 'Copy Files to: $(build.artifactstagingdirectory)' - inputs: - SourceFolder: '$(build.sourcesdirectory)' - Contents: | - **/target/** - **/collectedArtifactsForRelease/** - TargetFolder: '$(build.artifactstagingdirectory)' - continueOnError: true - condition: succeededOrFailed() - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: drop' - inputs: - PathtoPublish: '$(build.artifactstagingdirectory)' - continueOnError: true - condition: succeededOrFailed() - - - - job: 'Long_Tests' - - timeoutInMinutes: 240 - - strategy: - maxParallel: 1 - matrix: - MultiMaster_Multi_Region_Long: - OSVmImage: 'vs2017-win2016' - CosmosAccountHost: $(java-cosmos-multimaster-multiregion-host) - CosmosAccountKey: $(java-cosmos-multimaster-multiregion-key) - Consistency: '["Session"]' - TestDisplayName: 'Long Integration Tests' - ProfileFlag: '-e -Plong' - PreferredLocations: '["East US 2"]' - - Session_Single_Region_Long: - OSVmImage: 'vs2017-win2016' - CosmosAccountHost: $(java-cosmos-session-singleregion-host) - CosmosAccountKey: $(java-cosmos-session-singleregion-key) - Consistency: '["Session"]' - TestDisplayName: 'Long Integration Tests' - ProfileFlag: '-e -Plong' - PreferredLocations: null - - pool: - vmImage: $(OSVmImage) - - #Your build pipeline references a secret variable named ‘ACCOUNT_HOST’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972 - #Your build pipeline references a secret variable named ‘ACCOUNT_KEY’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab, and then select the option to make it secret. See https://go.microsoft.com/fwlink/?linkid=865972 - steps: - - task: Maven@3 - displayName: 'Install reporting tools' - inputs: - mavenPomFile: ./eng/code-quality-reports/pom.xml - options: '$(DefaultOptions) -DskipTests -Dgpg.skip' - mavenOptions: '$(LoggingOptions)' - javaHomeOption: 'JDKVersion' - jdkVersionOption: '1.11' - jdkArchitectureOption: 'x64' - publishJUnitResults: false - goals: 'install' - - - task: Maven@1 - displayName: 'Long Integration Tests' - inputs: - mavenPomFile: $(pomFile) - goals: verify - options: '$(ProfileFlag) -Dgpg.skip -DACCOUNT_HOST=$(CosmosAccountHost) -DACCOUNT_KEY=$(CosmosAccountKey)' - testResultsFiles: '**/junitreports/TEST-*.xml' - env: - DESIRED_CONSISTENCIES: $(Consistency) - PREFERRED_LOCATIONS: $(PreferredLocations) - condition: succeededOrFailed() - - - task: CopyFiles@2 - displayName: 'Copy Files to: $(build.artifactstagingdirectory)' - inputs: - SourceFolder: '$(build.sourcesdirectory)' - Contents: | - **/target/** - **/collectedArtifactsForRelease/** - TargetFolder: '$(build.artifactstagingdirectory)' - continueOnError: true - condition: succeededOrFailed() - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: drop' - inputs: - PathtoPublish: '$(build.artifactstagingdirectory)' - continueOnError: true - condition: succeededOrFailed() - - - job: 'MultiMaster' - - timeoutInMinutes: 240 - - strategy: - maxParallel: 1 - matrix: - Single_Region: - OSVmImage: 'macOS-10.13' - CosmosAccountHost: $(java-cosmos-multimaster-singleregion-host) - CosmosAccountKey: $(java-cosmos-multimaster-singleregion-key) - PreferredLocations: null - - Multi_Region: + AdditionalArgs: '-DargLine="-Dcosmos.directModeProtocol=Https"' + DESIRED_CONSISTENCY: 'Strong' + # 08m 50s, expect passed + Strong_Https_Fast: + DisplayName: Strong HTTP Fast OSVmImage: 'macOS-10.13' - CosmosAccountHost: $(java-cosmos-multimaster-multiregion-host) - CosmosAccountKey: $(java-cosmos-multimaster-multiregion-key) - PreferredLocations: '["East US 2"]' - - pool: - vmImage: $(OSVmImage) - - steps: - - task: Maven@3 - displayName: 'Install reporting tools' - inputs: - mavenPomFile: ./eng/code-quality-reports/pom.xml - options: '$(DefaultOptions) -DskipTests -Dgpg.skip' - mavenOptions: '$(LoggingOptions)' - javaHomeOption: 'JDKVersion' - jdkVersionOption: '1.11' - jdkArchitectureOption: 'x64' - publishJUnitResults: false - goals: 'install' - - - task: Maven@1 - displayName: 'Multi-Master Integration Tests' - inputs: - mavenPomFile: $(pomFile) - goals: verify - options: '-Pmulti-master -Dgpg.skip -DACCOUNT_HOST=$(CosmosAccountHost) -DACCOUNT_KEY=$(CosmosAccountKey)' - testResultsFiles: '**/junitreports/TEST-*.xml' - env: - DESIRED_CONSISTENCIES: '["Session"]' - PREFERRED_LOCATIONS: $(PreferredLocations) - condition: succeededOrFailed() - - - task: Maven@1 - displayName: 'Fast Integration Tests' - inputs: - mavenPomFile: $(pomFile) - goals: verify - options: '-Pfast -Dgpg.skip -DACCOUNT_HOST=$(CosmosAccountHost) -DACCOUNT_KEY=$(CosmosAccountKey)' - testResultsFiles: '**/junitreports/TEST-*.xml' - env: - DESIRED_CONSISTENCIES: '["Session"]' - PREFERRED_LOCATION: $(PreferredLocations) - condition: succeededOrFailed() - - - task: Maven@1 - displayName: 'DirectHttps Integration Tests' - inputs: - mavenPomFile: $(pomFile) - goals: verify - options: '-Pdirect -Dgpg.skip -DACCOUNT_HOST=$(CosmosAccountHost) -DACCOUNT_KEY=$(CosmosAccountKey)' - testResultsFiles: '**/junitreports/TEST-*.xml' - env: - DESIRED_CONSISTENCIES: '["Session"]' - PREFERRED_LOCATION: $(PreferredLocations) - condition: succeededOrFailed() - - - task: Maven@1 - displayName: 'Examples Integration Tests' - inputs: - mavenPomFile: $(pomFile) - goals: verify - options: '-Pexamples -Dgpg.skip -DACCOUNT_HOST=$(CosmosAccountHost) -DACCOUNT_KEY=$(CosmosAccountKey)' - testResultsFiles: '**/junitreports/TEST-*.xml' - env: - DESIRED_CONSISTENCIES: '["Session"]' - PREFERRED_LOCATION: $(PreferredLocations) - condition: succeededOrFailed() - - - task: Maven@1 - displayName: 'Non Emulator Tests' - inputs: - mavenPomFile: $(pomFile) - goals: verify - options: '-Pnon-emulator -Dgpg.skip -DACCOUNT_HOST=$(CosmosAccountHost) -DACCOUNT_KEY=$(CosmosAccountKey)' - testResultsFiles: '**/junitreports/TEST-*.xml' - env: + ProfileFlag: '-Pfast' + AdditionalArgs: '-DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong"' + PROTOCOLS: '["Https"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + # 08m 50s, expect passed + Strong_Https_Direct: + DisplayName: Strong HTTP Direct + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pdirect' + AdditionalArgs: '-DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong"' + PROTOCOLS: '["Https"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + # 07m 36s, expect passed + Strong_Https_Examples: + DisplayName: Strong HTTP Examples + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pexamples' + AdditionalArgs: '-DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong"' + PROTOCOLS: '["Https"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + # 06m 59s, expect passed + Strong_Https_NonEmulator: + DisplayName: Strong HTTP NonEmulator + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pnon-emulator' + AdditionalArgs: '-DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong"' + PROTOCOLS: '["Https"]' + DESIRED_CONSISTENCIES: '["Strong", "Session"]' + + PreRunSteps: + - template: ../steps/install-reporting-tools.yml + + TestStepMavenInputs: + goals: verify + options: '$(ProfileFlag) -Dgpg.skip $(AdditionalArgs)' + + TestResultsFiles: '**/junitreports/TEST-*.xml' + + + - template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml + parameters: + TestName: MultiMaster_Multi_Region + ServiceDirectory: cosmos + TimeoutInMinutes: 240 + EnvVars: + ACCOUNT_HOST: $(java-cosmos-multimaster-multiregion-host) + ACCOUNT_KEY: $(java-cosmos-multimaster-multiregion-key) + SECONDARY_ACCOUNT_KEY: $(java-cosmos-multimaster-multiregion-secondary-key) DESIRED_CONSISTENCIES: '["Session"]' - PREFERRED_LOCATION: $(PreferredLocations) - condition: succeededOrFailed() - - - task: CopyFiles@2 - displayName: 'Copy Files to: $(build.artifactstagingdirectory)' - inputs: - SourceFolder: '$(build.sourcesdirectory)' - Contents: | - **/target/** - **/collectedArtifactsForRelease/** - TargetFolder: '$(build.artifactstagingdirectory)' - continueOnError: true - condition: succeededOrFailed() - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: drop' - inputs: - PathtoPublish: '$(build.artifactstagingdirectory)' - continueOnError: true - condition: succeededOrFailed() - - - job: 'Single_Region' - - timeoutInMinutes: 120 - - strategy: - maxParallel: 2 - matrix: - Strong_Tcp: + PREFERRED_LOCATIONS: '["East US 2"]' + MaxParallel: 1 + Matrix: + # 29m 23s, expect passed + Long: + DisplayName: Multimaster Multi Region Long + OSVmImage: 'vs2017-win2016' + ProfileFlag: '-e -Plong' + AdditionalArgs: '-DargLine="-Dcosmos.directModeProtocol=Https"' + # 06m 34s, previously failing + MultiMaster: + DisplayName: Multimaster Multi Region Multi-Master OSVmImage: 'macOS-10.13' - CosmosAccountHost: $(java-cosmos-strong-singleregion-host) - CosmosAccountKey: $(java-cosmos-strong-singleregion-key) - ProtocolFlag: '["Tcp"]' - Consistency: '["Strong", "Session"]' - - Session_Tcp: + ProfileFlag: '-Pmulti-master' + # 09m 43s, expect passed + Fast: + DisplayName: Multimaster Multi Region Fast + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pfast' + # 09m 10s, expect passed + Direct: + DisplayName: Multimaster Multi Region Direct OSVmImage: 'macOS-10.13' - CosmosAccountHost: $(java-cosmos-session-singleregion-one-host) - CosmosAccountKey: $(java-cosmos-session-singleregion-one-key) - ProtocolFlag: '["Tcp"]' - Consistency: '["Session"]' + ProfileFlag: '-Pdirect' + # 07m 49s, expect passed + Examples: + DisplayName: Multimaster Multi Region Examples + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pexamples' + # 08m 0s, expect passed + NonEmulator: + DisplayName: Multimaster Multi Region NonEmulator + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pnon-emulator' - Strong_Https: - OSVmImage: 'macOS-10.13' - CosmosAccountHost: $(java-cosmos-strong-singleregion-host) - CosmosAccountKey: $(java-cosmos-strong-singleregion-key) - ProtocolFlag: '["Https"]' - Consistency: '["Strong", "Session"]' + PreRunSteps: + - template: ../steps/install-reporting-tools.yml - Session_Https: - OSVmImage: 'macOS-10.13' - CosmosAccountHost: $(java-cosmos-session-singleregion-host) - CosmosAccountKey: $(java-cosmos-session-singleregion-key) - ProtocolFlag: '["Https"]' - Consistency: '["Session"]' - pool: - vmImage: $(OSVmImage) + TestStepMavenInputs: + goals: verify + options: '$(ProfileFlag) -Dgpg.skip $(AdditionalArgs)' - steps: - - task: Maven@3 - displayName: 'Install reporting tools' - inputs: - mavenPomFile: ./eng/code-quality-reports/pom.xml - options: '$(DefaultOptions) -DskipTests -Dgpg.skip' - mavenOptions: '$(LoggingOptions)' - javaHomeOption: 'JDKVersion' - jdkVersionOption: '1.11' - jdkArchitectureOption: 'x64' - publishJUnitResults: false - goals: 'install' + TestResultsFiles: '**/junitreports/TEST-*.xml' - - task: Maven@1 - displayName: 'Fast Integration Tests' - inputs: - mavenPomFile: $(pomFile) - goals: verify - options: '-Pfast -Dgpg.skip -DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong" -DACCOUNT_HOST=$(CosmosAccountHost) -DACCOUNT_KEY=$(CosmosAccountKey)' - testResultsFiles: '**/junitreports/TEST-*.xml' - env: - DESIRED_CONSISTENCIES: $(Consistency) - PROTOCOLS: $(ProtocolFlag) - condition: succeededOrFailed() - - - task: Maven@1 - displayName: 'DirectHttps Integration Tests' - inputs: - mavenPomFile: $(pomFile) - goals: verify - options: '-Pdirect -Dgpg.skip -DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong" -DACCOUNT_HOST=$(CosmosAccountHost) -DACCOUNT_KEY=$(CosmosAccountKey)' - testResultsFiles: '**/junitreports/TEST-*.xml' - env: - DESIRED_CONSISTENCIES: $(Consistency) - PROTOCOLS: $(ProtocolFlag) - condition: succeededOrFailed() - - task: Maven@1 - displayName: 'Examples Integration Tests' - inputs: - mavenPomFile: $(pomFile) - goals: verify - options: '-Pexamples -Dgpg.skip -DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong" -DACCOUNT_HOST=$(CosmosAccountHost) -DACCOUNT_KEY=$(CosmosAccountKey)' - testResultsFiles: '**/junitreports/TEST-*.xml' - env: - DESIRED_CONSISTENCIES: $(Consistency) - PROTOCOLS: $(ProtocolFlag) - condition: succeededOrFailed() + - template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml + parameters: + TestName: MultiMaster_Single_Region + ServiceDirectory: cosmos + TimeoutInMinutes: 240 + EnvVars: + ACCOUNT_HOST: $(java-cosmos-multimaster-singleregion-host) + ACCOUNT_KEY: $(java-cosmos-multimaster-singleregion-key) + SECONDARY_ACCOUNT_KEY: $(java-cosmos-multimaster-singleregion-secondary-key) + DESIRED_CONSISTENCIES: '["Session"]' + PREFERRED_LOCATIONS: null + MaxParallel: 1 + Matrix: + # 05m 21s, previously failing + MultiMaster: + DisplayName: MultiMaster Single Region Multi-Master + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pmulti-master' + # 09m 34s, expect passed + Fast: + DisplayName: Multimaster Single Region Fast + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pfast' + # 09m 05s, expect passed + Direct: + DisplayName: Multimaster Single Region Direct + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pdirect' + # 07m 52s, expect passed + Examples: + DisplayName: Multimaster Single Region Examples + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pexamples' + # 07m 10s, expect passed + NonEmulator: + DisplayName: Multimaster Single Region NonEmulator + OSVmImage: 'macOS-10.13' + ProfileFlag: '-Pnon-emulator' - - task: Maven@1 - displayName: 'Non Emulator Tests' - inputs: - mavenPomFile: $(pomFile) - goals: verify - options: '-Pnon-emulator -Dgpg.skip -DargLine="-DACCOUNT_DEFAULT_CONSISTENCY=Strong" -DACCOUNT_HOST=$(CosmosAccountHost) -DACCOUNT_KEY=$(CosmosAccountKey)' - testResultsFiles: '**/junitreports/TEST-*.xml' - env: - DESIRED_CONSISTENCIES: $(Consistency) - PROTOCOLS: $(ProtocolFlag) - condition: succeededOrFailed() + PreRunSteps: + - template: ../steps/install-reporting-tools.yml - - task: CopyFiles@2 - displayName: 'Copy Files to: $(build.artifactstagingdirectory)' - inputs: - SourceFolder: '$(build.sourcesdirectory)' - Contents: | - **/target/** - **/collectedArtifactsForRelease/** - TargetFolder: '$(build.artifactstagingdirectory)' - continueOnError: true - condition: succeededOrFailed() + TestStepMavenInputs: + goals: verify + options: '$(ProfileFlag) -Dgpg.skip $(AdditionalArgs)' - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: drop' - inputs: - PathtoPublish: '$(build.artifactstagingdirectory)' - continueOnError: true - condition: succeededOrFailed() + TestResultsFiles: '**/junitreports/TEST-*.xml' diff --git a/sdk/eventhubs/azure-eventhubs/CHANGELOG.md b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md similarity index 50% rename from sdk/eventhubs/azure-eventhubs/CHANGELOG.md rename to sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md index 331c6ad6b447..6b39d40249b1 100644 --- a/sdk/eventhubs/azure-eventhubs/CHANGELOG.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/CHANGELOG.md @@ -1,6 +1,29 @@ # Release History +## 5.0.0-preview.2 (2019-08-06) + +- Added support for AMQP protocol using web sockets to connect to Azure Event Hubs. +- Added support for publishing events using `EventDataBatch`. +- Added support for processing events from all Event Hub partitions through `EventProcessor`. This early preview is + intended to allow consumers to test the new design using a single instance that does not persist checkpoints to any + durable store. +- Added a fixed retry policy implementation. +- Removed operation timeouts from `EventHubClientBuilder`, `EventHubProducerOptions`, and `EventHubConsumerOptions` and + moved to `RetryOptions` as `tryTimeout(Duration)`. +- Removed exposed retry policies in favor of setting `RetryOptions`. +- Renamed all instances of `EventHubPath` to `EventHubName` to align with the usage context and unify on the chosen + semantics across the client library for different languages. +- Fixed various bugs for notifying users of link shutdown and errors. + +### Known issues + +- Proxy support is not implemented. +- `EventHubClient` does not clean up its `EventHubPublishers` and `EventHubConsumers`. These need to be closed manually +by calling `EventHubPublisher.close()` or `EventHubConsumer.close()`. +- On transient AMQP connection/session/link failures, the corresponding transports are not recreated. + ## 5.0.0-preview.1 (2019-07-01) + Version 5.0.0-preview.1 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide our efforts can be found in the [Azure SDK Design Guidelines for @@ -25,4 +48,4 @@ For release notes and more information please visit https://aka.ms/azure-sdk-pre - `EventHubClient` does not clean up its `EventHubPublishers` and `EventHubConsumers`. These need to be closed manually by calling `EventHubPublisher.close()` or `EventHubConsumer.close()`. - Creating more than two concurrent `EventHubClients` or `EventHubConsumers` does not work. Limit usage of concurrent - clients and consumers to two to avoid failures. \ No newline at end of file + clients and consumers to two to avoid failures. diff --git a/sdk/eventhubs/azure-eventhubs/CONTRIBUTING.md b/sdk/eventhubs/azure-messaging-eventhubs/CONTRIBUTING.md similarity index 100% rename from sdk/eventhubs/azure-eventhubs/CONTRIBUTING.md rename to sdk/eventhubs/azure-messaging-eventhubs/CONTRIBUTING.md diff --git a/sdk/eventhubs/azure-eventhubs/README.md b/sdk/eventhubs/azure-messaging-eventhubs/README.md similarity index 61% rename from sdk/eventhubs/azure-eventhubs/README.md rename to sdk/eventhubs/azure-messaging-eventhubs/README.md index 727273ba1680..3c185370c177 100644 --- a/sdk/eventhubs/azure-eventhubs/README.md +++ b/sdk/eventhubs/azure-messaging-eventhubs/README.md @@ -4,7 +4,7 @@ Azure Event Hubs is a highly scalable publish-subscribe service that can ingest them to multiple consumers. This lets you process and analyze the massive amounts of data produced by your connected devices and applications. Once Event Hubs has collected the data, you can retrieve, transform, and store it by using any real-time analytics provider or with batching/storage adapters. If you would like to know more about Azure Event Hubs, -you may wish to review: [What is Event Hubs](https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-about)? +you may wish to review: [What is Event Hubs](https://docs.microsoft.com/azure/event-hubs/event-hubs-about)? The Azure Event Hubs client library allows for publishing and consuming of Azure Event Hubs events and may be used to: @@ -36,7 +36,7 @@ documentation][event_hubs_product_docs] | [Samples][sample_examples] com.azure azure-messaging-eventhubs - 5.0.0-preview.1 + 5.0.0-preview.2 ``` @@ -47,17 +47,17 @@ with it. ### Create an Event Hub client using a connection string -The easiest means for doing so is to use a connection string, which is created automatically when creating an -Event Hubs namespace. If you aren't familiar with shared access policies in Azure, you may wish to follow the -step-by-step guide to [get an Event Hubs connection string][event_hubs_connection_string]. +The easiest means for doing so is to use a connection string, which is created automatically when creating an Event Hubs +namespace. If you aren't familiar with shared access policies in Azure, you may wish to follow the step-by-step guide to +[get an Event Hubs connection string][event_hubs_connection_string]. Once the connection string is obtained, create an `EventHubAsyncClient` using the `EventHubClientBuilder`: ```java String connectionString = "<< CONNECTION STRING FOR THE EVENT HUBS NAMESPACE >>"; -String eventHubPath = "<< NAME OF THE EVENT HUB >>"; +String eventHubName = "<< NAME OF THE EVENT HUB >>"; EventHubAsyncClient client = new EventHubClientBuilder() - .connectionString(connectionString, eventHubPath) + .connectionString(connectionString, eventHubName) .buildAsyncClient(); ``` @@ -70,16 +70,18 @@ platform. First, add the package: com.azure azure-identity - 1.0.0-preview.1 + 1.0.0-preview.3 ``` -All the implemented ways to request a credential can be found under the `com.azure.identity.credential` package. The sample below shows how to use an Azure Active Directory (AAD) application client secret to authorize with Azure Event Hubs. +All the implemented ways to request a credential can be found under the `com.azure.identity.credential` package. The +sample below shows how to use an Azure Active Directory (AAD) application client secret to authorize with Azure Event +Hubs. #### Authorizing with AAD application client secret Follow the instructions in [Creating a service principal using Azure Portal][application_client_secret] to create a -service principal and a client secret. The corresponding `clientId` and `tenantId` for the service principale can be +service principal and a client secret. The corresponding `clientId` and `tenantId` for the service principal can be obtained from the [App registration page][app_registration_page]. ```java @@ -90,9 +92,9 @@ ClientSecretCredential credential = new ClientSecretCredential() // The fully qualified host name for the Event Hubs namespace. This is likely to be similar to: // {your-namespace}.servicebus.windows.net String host = "<< EVENT HUBS HOST >>" -String eventHubPath = "<< NAME OF THE EVENT HUB >>"; +String eventHubName = "<< NAME OF THE EVENT HUB >>"; EventHubAsyncClient client = new EventHubClientBuilder() - .credential(host, eventHubPath, credential) + .credential(host, eventHubName, credential) .buildAsyncClient(); ``` @@ -130,21 +132,23 @@ are well documented in [OASIS Advanced Messaging Queuing Protocol (AMQP) Version - [Inspect Event Hub and partition properties][sample_get_event_hubs_metadata] - [Publish an event to an Event Hub][sample_publish_event] +- [Publish an EventDataBatch to an Event Hub][sample_publish_eventdatabatch] - [Consume events from an Event Hub partition][sample_consume_event] +- [Consume events from all Event Hub partitions][sample_event_processor] ### Publish events to an Event Hub -In order to publish events, you'll need to create an [EventHubProducer][eventhubconsumer]. Producers may be dedicated to -a specific partition, or allow the Event Hubs service to decide which partition events should be published to. It is -recommended to use automatic routing when the publishing of events needs to be highly available or when event data -should be distributed evenly among the partitions. In the our example, we will take advantage of automatic routing. +In order to publish events, you'll need to create an [`EventHubProducer`][source_eventhubconsumer]. Producers may be +dedicated to a specific partition, or allow the Event Hubs service to decide which partition events should be published +to. It is recommended to use automatic routing when the publishing of events needs to be highly available or when event +data should be distributed evenly among the partitions. In the our example, we will take advantage of automatic routing. you can also use the send method to send multiple events using a single call. #### Producer creation -With an existing [EventHubAsyncClient][eventhubasyncclient], developers can create a producer by calling `createProducer()` or -`createProducer(EventHubProducerOptions)`. +With an existing [EventHubAsyncClient][source_eventhubasyncclient], developers can create a producer by calling +`createProducer()` or `createProducer(EventHubProducerOptions)`. Creates a producer sends events to any partition, allowing Event Hubs service to route the event to an available partition. @@ -154,9 +158,9 @@ EventHubProducer producer = client.createProducer(); ``` To send events to a particular partition, set the optional parameter `partitionId` on -[EventHubProducerOptions][eventhubproduceroptions] when creating an event producer. +[`EventHubProducerOptions`][source_eventhubproduceroptions] when creating an event producer. -#### Partition Identifier +#### Partition identifier Many Event Hub operations take place within the scope of a specific partition. Because partitions are owned by the Event Hub, their names are assigned at the time of creation. To understand what partitions are available, You can use the @@ -166,11 +170,11 @@ Hub, their names are assigned at the time of creation. To understand what partit Flux firstPartition = client.getPartitionIds(); ``` -#### Partition Key +#### Partition key When an Event Hub producer is not associated with any specific partition, it may be desirable to request that the Event - Hubs service keep different events or batches of events together on the same partition. This can be accomplished by - setting a `partition key` when publishing the events. +Hubs service keep different events or batches of events together on the same partition. This can be accomplished by +setting a `partition key` when publishing the events. ```java SendOptions sendOptions = new SendOptions().partitionKey("grouping-key"); @@ -179,31 +183,84 @@ producer.send(dataList, sendOptions).subscribe( ); ``` -### Consume events from an Event Hub +### Consume events from an Event Hub partition -In order to consume events, you'll need to create an EventHubConsumer for a specific partition and consumer group +In order to consume events, you'll need to create an `EventHubConsumer` for a specific partition and consumer group combination. When an Event Hub is created, it starts with a default consumer group that can be used to get started. A consumer also needs to specify where in the event stream to begin receiving events; in our example, we will focus on reading new events as they are published. -#### Consumer creation - -We are creating a consumer that receives events from `partitionID` and only listens to newest events that get pushed to -the partition. +In the snippet below, we are creating a consumer that receives events from `partitionId` and only listens to newest +events that get pushed to the partition. Developers can begin receiving events by calling `.receive()` and subscribing +to the stream. ```java -EventHubConsumer consumer = client.createConsumer(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, partitionID, +String partitionId = "<< EVENT HUB PARTITION ID >>" +EventHubConsumer consumer = client.createConsumer(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, partitionId, EventPosition.latest()); + +consumer.receive().subscribe(event -> { + // Process each event as it arrives. +}); ``` -#### Consume events +### Consume events using an Event Processor + +To consume events for all partitions of an Event Hub, you'll create an [`EventProcessor`][source_eventprocessor] for a +specific consumer group. When an Event Hub is created, it provides a default consumer group that can be used to get +started. + +The [`EventProcessor`][source_eventprocessor] will delegate processing of events to a +[`PartitionProcessor`][source_partition_processor] implementation that you provide, allowing your logic to focus on the +logic needed to provide value while the processor holds responsibility for managing the underlying consumer operations. -Developers can begin receiving events by calling `.receive()` and subscribing to the stream. +In our example, we will focus on building the [`EventProcessor`][source_eventprocessor], use the built-in +[`InMemoryPartitionManager`][source_inmemorypartitionmanager], and a `PartitionProcessor` implementation that logs +events received and errors to console. ```java -consumer.receive().subscribe(event -> { - // do stuff. -}); +class Program { + public static void main(String[] args) { + EventProcessor eventProcessor = new EventHubClientBuilder() + .connectionString("<< CONNECTION STRING FOR THE EVENT HUB INSTANCE >>") + .consumerGroupName("<< CONSUMER GROUP NAME>>") + .partitionProcessorFactory(SimplePartitionProcessor::new) + .partitionManager(new InMemoryPartitionManager()) + .buildEventProcessor(); + + // This will start the processor. It will start processing events from all partitions. + eventProcessor.start(); + + // When the user wishes to stop processing events, they can call `stop()`. + eventProcessor.stop(); + } +} + +class SimplePartitionProcessor implements PartitionProcessor { + SimplePartitionProcessor(PartitionContext partitionContext, CheckpointManager checkpointManager) { + } + + @Override + Mono initialize() { + return Mono.empty(); + } + + @Override + Mono processEvent(EventData eventData) { + System.out.printf("Event received. Sequence number: %s%n.", eventData.sequenceNumber()); + return Mono.empty(); + } + + @Override + void processError(Throwable throwable) { + System.err.println("Error received." + throwable.toString()); + } + + @Override + Mono close(CloseReason closeReason) { + return Mono.empty(); + } +} ``` ## Troubleshooting @@ -212,7 +269,7 @@ consumer.receive().subscribe(event -> { You can set the `AZURE_LOG_LEVEL` environment variable to view logging statements made in the client library. For example, setting `AZURE_LOG_LEVEL=2` would show all informational, warning, and error log messages. The log levels can -be found here: [log levels][log_levels]. +be found here: [log levels][source_loglevels]. ### Enable AMQP transport logging @@ -244,14 +301,14 @@ This is a general exception for AMQP related failures, which includes the AMQP e that caused this exception as ErrorContext. 'isTransient' is a boolean indicating if the exception is a transient error or not. If true, then the request can be retried; otherwise not. -The [ErrorCondition][error_condition] contains error conditions common to the AMQP protocol and used by Azure services. -When an AMQP exception is thrown, examining the error condition field can inform developers as to why the AMQP exception -occurred and if possible, how to mitigate this exception. A list of all the AMQP exceptions can be found in [OASIS AMQP -Version 1.0 Transport Errors][oasis_amqp_v1_error]. +The [ErrorCondition][source_errorcondition] contains error conditions common to the AMQP protocol and used by Azure +services. When an AMQP exception is thrown, examining the error condition field can inform developers as to why the AMQP +exception occurred and if possible, how to mitigate this exception. A list of all the AMQP exceptions can be found in +[OASIS AMQP Version 1.0 Transport Errors][oasis_amqp_v1_error]. -The [ErrorContext][error_context] in the [AmqpException][amqp_exception] provides information about the AMQP session, -link, or connection that the exception occurred in. This is useful to diagnose which level in the transport this -exception occurred at and whether it was an issue in one of the producers or consumers. +The [ErrorContext][source_errorcontext] in the [AmqpException][source_amqpexception] provides information about the AMQP +session, link, or connection that the exception occurred in. This is useful to diagnose which level in the transport +this exception occurred at and whether it was an issue in one of the producers or consumers. The recommended way to solve the specific exception the AMQP exception represents is to follow the [Event Hubs Messaging Exceptions][event_hubs_messaging_exceptions] guidance. @@ -278,11 +335,12 @@ Exceptions][event_hubs_messaging_exceptions]. Beyond those discussed, the Azure Event Hubs client library offers support for many additional scenarios to help take advantage of the full feature set of the Azure Event Hubs service. In order to help explore some of the these scenarios, the following set of sample is available: + - [Inspect Event Hub and partition properties][sample_get_event_hubs_metadata] - [Publish an event to an Event Hub][sample_publish_event] -- [Publish events to a specific Event Hub partition with partition identifier][sample_publish_partition_ID] -- [Publish events to a specific Event Hub partition with partition key][sample_publish_partition_key] -- [Publish events with custom metadata][sample_publish_custom_meta_data] +- [Publish events to a specific Event Hub partition with partition identifier][sample_publish_partitionId] +- [Publish events to a specific Event Hub partition with partition key][sample_publish_partitionKey] +- [Publish events with custom metadata][sample_publish_custom_metadata] - [Consume events from an Event Hub partition][sample_consume_event] - [Save the last read event and resume from that point][sample_sequence_number] @@ -292,34 +350,39 @@ If you would like to become an active contributor to this project please refer t Guidelines](./CONTRIBUTING.md) for more information. -[amqp_exception]: ../../core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpException.java [amqp_transport_error]: https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#type-amqp-error [api_documentation]: https://aka.ms/java-docs -[app_registration_page]: https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal#get-values-for-signing-in -[application_client_secret]: https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal#create-a-new-application-secret -[error_condition]: ../../core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ErrorCondition.java -[error_context]: ../../core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ErrorContext.java -[event_hubs_connection_string]: https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-get-connection-string -[event_hubs_create]: https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-create -[event_hubs_features]: https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-features -[event_hubs_messaging_exceptions]: https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-messaging-exceptions -[event_hubs_product_docs]: https://docs.microsoft.com/en-us/azure/event-hubs/ -[event_hubs_quotas]: https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-quotas -[eventhubasyncclient]: ./src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java -[eventhubconsumer]: ./src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java -[eventhubproduceroptions]: ./src/main/java/com/azure/messaging/eventhubs/models/EventHubProducerOptions.java +[app_registration_page]: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal#get-values-for-signing-in +[application_client_secret]: https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal#create-a-new-application-secret +[event_hubs_connection_string]: https://docs.microsoft.com/azure/event-hubs/event-hubs-get-connection-string +[event_hubs_create]: https://docs.microsoft.com/azure/event-hubs/event-hubs-create +[event_hubs_features]: https://docs.microsoft.com/azure/event-hubs/event-hubs-features +[event_hubs_messaging_exceptions]: https://docs.microsoft.com/azure/event-hubs/event-hubs-messaging-exceptions +[event_hubs_product_docs]: https://docs.microsoft.com/azure/event-hubs/ +[event_hubs_quotas]: https://docs.microsoft.com/azure/event-hubs/event-hubs-quotas [java_8_sdk_javadocs]: https://docs.oracle.com/javase/8/docs/api/java/util/logging/package-summary.html -[log_levels]: ../../core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java [maven]: https://maven.apache.org/ [oasis_amqp_v1_error]: http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-transport-v1.0-os.html#type-error [oasis_amqp_v1]: http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-overview-v1.0-os.html [qpid_proton_j_apache]: http://qpid.apache.org/proton/ -[sample_examples]: ./src/samples/java/com/azure/messaging/eventhubs/ [sample_consume_event]: ./src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java +[sample_event_processor]: ./src/samples/java/com/azure/messaging/eventhubs/EventProcessorSample.java +[sample_examples]: ./src/samples/java/com/azure/messaging/eventhubs/ [sample_get_event_hubs_metadata]: ./src/samples/java/com/azure/messaging/eventhubs/GetEventHubMetadata.java -[sample_publish_custom_meta_data]: ./src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java +[sample_publish_custom_metadata]: ./src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java [sample_publish_event]: ./src/samples/java/com/azure/messaging/eventhubs/PublishEvent.java -[sample_publish_partition_ID]: ./src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java -[sample_publish_partition_key]: ./src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java +[sample_publish_eventdatabatch]: ./src/samples/java/com/azure/messaging/eventhubs/PublishEventDataBatch.java +[sample_publish_partitionId]: ./src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java +[sample_publish_partitionKey]: ./src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java [sample_sequence_number]: ./src/samples/java/com/azure/messaging/eventhubs/ConsumeEventsFromKnownSequenceNumberPosition.java +[source_amqpexception]: ../../core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/AmqpException.java [source_code]: ./ +[source_errorcondition]: ../../core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ErrorCondition.java +[source_errorcontext]: ../../core/azure-core-amqp/src/main/java/com/azure/core/amqp/exception/ErrorContext.java +[source_eventhubasyncclient]: ./src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java +[source_eventhubconsumer]: ./src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java +[source_eventhubproduceroptions]: ./src/main/java/com/azure/messaging/eventhubs/models/EventHubProducerOptions.java +[source_eventprocessor]: ./src/main/java/com/azure/messaging/eventhubs/EventProcessor.java +[source_inmemorypartitionmanager]: ./src/main/java/com/azure/messaging/eventhubs/InMemoryPartitionManager.java +[source_loglevels]: ../../core/azure-core/src/main/java/com/azure/core/util/logging/ClientLogger.java +[source_partition_processor]: ./src/main/java/com/azure/messaging/eventhubs/PartitionProcessor.java diff --git a/sdk/eventhubs/azure-eventhubs/pom.xml b/sdk/eventhubs/azure-messaging-eventhubs/pom.xml similarity index 100% rename from sdk/eventhubs/azure-eventhubs/pom.xml rename to sdk/eventhubs/azure-messaging-eventhubs/pom.xml 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 new file mode 100644 index 000000000000..3cfbb85f9597 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/CheckpointManager.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.messaging.eventhubs.models.Checkpoint; +import com.azure.messaging.eventhubs.models.PartitionContext; + +import java.util.concurrent.atomic.AtomicReference; +import reactor.core.publisher.Mono; + +/** + * The checkpoint manager that clients should use to update checkpoints to track progress of events processed. Each + * instance of a {@link PartitionProcessor} will be provided with it's own instance of a CheckpointManager. + */ +public class CheckpointManager { + + private final PartitionContext partitionContext; + private final PartitionManager partitionManager; + private final AtomicReference eTag; + private final String ownerId; + + /** + * Creates a new checkpoint manager which {@link PartitionProcessor} can use to update checkpoints. + * + * @param ownerId The event processor identifier that is responsible for updating checkpoints. + * @param partitionContext The partition context providing necessary partition and event hub information for updating + * checkpoints. + * @param partitionManager The {@link PartitionManager} implementation that will be store the checkpoint information. + * @param eTag The last known ETag stored in {@link PartitionManager} for this partition. When the update checkpoint + * is called from this CheckpointManager, this ETag will be used to provide optimistic + * concurrency. + */ + CheckpointManager(String ownerId, PartitionContext partitionContext, PartitionManager partitionManager, + String eTag) { + this.ownerId = ownerId; + this.partitionContext = partitionContext; + this.partitionManager = partitionManager; + this.eTag = new AtomicReference<>(eTag); + } + + /** + * Updates the checkpoint for this partition using the event data. This will serve as the last known successfully + * processed event in this partition if the update is successful. + * + * @param eventData The event data to use for updating the checkpoint. + * @return a representation of deferred execution of this call. + */ + public Mono updateCheckpoint(EventData eventData) { + String previousETag = this.eTag.get(); + Checkpoint checkpoint = new Checkpoint() + .consumerGroupName(partitionContext.consumerGroupName()) + .eventHubName(partitionContext.eventHubName()) + .ownerId(ownerId) + .partitionId(partitionContext.partitionId()) + .sequenceNumber(eventData.sequenceNumber()) + .offset(eventData.offset()) + .eTag(previousETag); + return this.partitionManager.updateCheckpoint(checkpoint) + .map(eTag -> this.eTag.compareAndSet(previousETag, eTag)) + .then(); + } + + /** + * Updates a checkpoint using the given offset and sequence number. This will serve as the last known successfully + * processed event in this partition if the update is successful. + * + * @param sequenceNumber The sequence number to update the checkpoint. + * @param offset The offset to update the checkpoint. + * @return a representation of deferred execution of this call. + */ + public Mono updateCheckpoint(long sequenceNumber, String offset) { + String previousETag = this.eTag.get(); + Checkpoint checkpoint = new Checkpoint() + .consumerGroupName(partitionContext.consumerGroupName()) + .eventHubName(partitionContext.eventHubName()) + .ownerId(ownerId) + .partitionId(partitionContext.partitionId()) + .sequenceNumber(sequenceNumber) + .offset(offset) + .eTag(previousETag); + + return this.partitionManager.updateCheckpoint(checkpoint) + .map(eTag -> this.eTag.compareAndSet(previousETag, eTag)) + .then(); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/CloseReason.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/CloseReason.java new file mode 100644 index 000000000000..6d942dfb9d51 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/CloseReason.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +/** + * 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)}. + */ + 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. + */ + 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. + */ + EVENT_HUB_EXCEPTION +} diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventData.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventData.java diff --git a/sdk/eventhubs/azure-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 similarity index 99% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventDataBatch.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventDataBatch.java index 06cc9902c901..94d22d31b068 100644 --- a/sdk/eventhubs/azure-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,6 +9,7 @@ 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; diff --git a/sdk/eventhubs/azure-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 similarity index 90% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubAsyncClient.java index 58dab86dc69d..ada13c64576b 100644 --- a/sdk/eventhubs/azure-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 @@ -4,8 +4,10 @@ package com.azure.messaging.eventhubs; import com.azure.core.amqp.AmqpConnection; +import com.azure.core.amqp.RetryPolicy; 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.implementation.annotation.ReturnType; import com.azure.core.implementation.annotation.ServiceClient; import com.azure.core.implementation.annotation.ServiceMethod; @@ -73,7 +75,7 @@ public class EventHubAsyncClient implements Closeable { private final Mono connectionMono; private final AtomicBoolean hasConnection = new AtomicBoolean(false); private final ConnectionOptions connectionOptions; - private final String eventHubPath; + private final String eventHubName; private final EventHubProducerOptions defaultProducerOptions; private final EventHubConsumerOptions defaultConsumerOptions; @@ -83,18 +85,18 @@ public class EventHubAsyncClient implements Closeable { Objects.requireNonNull(handlerProvider); this.connectionOptions = connectionOptions; - this.eventHubPath = connectionOptions.eventHubPath(); + this.eventHubName = connectionOptions.eventHubName(); this.connectionId = StringUtil.getRandomString("MF"); this.connectionMono = Mono.fromCallable(() -> { - return (EventHubConnection) new ReactorConnection(connectionId, connectionOptions, provider, handlerProvider, new ResponseMapper()); + return (EventHubConnection) new ReactorConnection(connectionId, connectionOptions, provider, + handlerProvider, new ResponseMapper()); }).doOnSubscribe(c -> hasConnection.set(true)) .cache(); this.defaultProducerOptions = new EventHubProducerOptions() - .retry(connectionOptions.retryPolicy()) - .timeout(connectionOptions.timeout()); + .retry(connectionOptions.retry()); this.defaultConsumerOptions = new EventHubConsumerOptions() - .retry(connectionOptions.retryPolicy()) + .retry(connectionOptions.retry()) .scheduler(connectionOptions.scheduler()); } @@ -156,29 +158,30 @@ public EventHubProducer createProducer() { public EventHubProducer createProducer(EventHubProducerOptions options) { Objects.requireNonNull(options); - final EventHubProducerOptions clonedOptions = (EventHubProducerOptions) options.clone(); - if (clonedOptions.timeout() == null) { - clonedOptions.timeout(connectionOptions.timeout()); - } + final EventHubProducerOptions clonedOptions = options.clone(); + if (clonedOptions.retry() == null) { - clonedOptions.retry(connectionOptions.retryPolicy()); + clonedOptions.retry(connectionOptions.retry()); } final String entityPath; final String linkName; if (ImplUtils.isNullOrEmpty(options.partitionId())) { - entityPath = eventHubPath; + entityPath = eventHubName; linkName = StringUtil.getRandomString("EC"); } else { - entityPath = String.format(Locale.US, SENDER_ENTITY_PATH_FORMAT, eventHubPath, options.partitionId()); + entityPath = String.format(Locale.US, SENDER_ENTITY_PATH_FORMAT, eventHubName, options.partitionId()); linkName = StringUtil.getRandomString("PS"); } - final Mono amqpLinkMono = connectionMono.flatMap(connection -> connection.createSession(entityPath)) + final Mono amqpLinkMono = connectionMono + .flatMap(connection -> connection.createSession(entityPath)) .flatMap(session -> { - logger.info("Creating producer."); - return session.createProducer(linkName, entityPath, clonedOptions.timeout(), clonedOptions.retry()) + logger.verbose("Creating producer for {}", entityPath); + final RetryPolicy retryPolicy = RetryUtil.getRetryPolicy(clonedOptions.retry()); + + return session.createProducer(linkName, entityPath, clonedOptions.retry().tryTimeout(), retryPolicy) .cast(AmqpSendLink.class); }); @@ -254,18 +257,24 @@ public EventHubConsumer createConsumer(String consumerGroup, String partitionId, clonedOptions.scheduler(connectionOptions.scheduler()); } if (clonedOptions.retry() == null) { - clonedOptions.retry(connectionOptions.retryPolicy()); + clonedOptions.retry(connectionOptions.retry()); } final String linkName = StringUtil.getRandomString("PR"); - final String entityPath = String.format(Locale.US, RECEIVER_ENTITY_PATH_FORMAT, eventHubPath, consumerGroup, partitionId); + final String entityPath = + String.format(Locale.US, RECEIVER_ENTITY_PATH_FORMAT, eventHubName, consumerGroup, partitionId); final Mono receiveLinkMono = connectionMono.flatMap(connection -> { return connection.createSession(entityPath).cast(EventHubSession.class); }).flatMap(session -> { - logger.info("Creating consumer."); - return session.createConsumer(linkName, entityPath, getExpression(eventPosition), connectionOptions.timeout(), - clonedOptions.retry(), options.ownerLevel(), options.identifier()).cast(AmqpReceiveLink.class); + 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), + clonedOptions.retry().tryTimeout(), retryPolicy, options.ownerLevel(), options.identifier()) + .cast(AmqpReceiveLink.class); }); return new EventHubConsumer(receiveLinkMono, clonedOptions); @@ -279,7 +288,7 @@ public EventHubConsumer createConsumer(String consumerGroup, String partitionId, public void close() { if (hasConnection.getAndSet(false)) { try { - final AmqpConnection connection = connectionMono.block(connectionOptions.timeout()); + final AmqpConnection connection = connectionMono.block(connectionOptions.retry().tryTimeout()); if (connection != null) { connection.close(); } diff --git a/sdk/eventhubs/azure-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 similarity index 69% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubClientBuilder.java index a7152dd1e525..53c8e595fb9a 100644 --- a/sdk/eventhubs/azure-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 @@ -3,7 +3,7 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.Retry; +import com.azure.core.amqp.RetryOptions; import com.azure.core.amqp.TransportType; import com.azure.core.credentials.TokenCredential; import com.azure.core.exception.AzureException; @@ -18,6 +18,7 @@ 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; @@ -27,7 +28,6 @@ import java.net.Proxy; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; -import java.time.Duration; import java.util.Locale; import java.util.Objects; @@ -49,27 +49,37 @@ * * {@codesnippet com.azure.messaging.eventhubs.eventhubclientbuilder.connectionstring#string} * - *

Creating an {@link EventHubAsyncClient} using Event Hub with no {@link Retry}, different timeout and new + *

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

* * {@codesnippet com.azure.messaging.eventhubs.eventhubclientbuilder.retry-timeout-scheduler} * + *

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

+ * {@codesnippet com.azure.messaging.eventhubs.eventprocessor.instantiation} + * * @see EventHubAsyncClient + * @see EventProcessor */ -@ServiceClientBuilder(serviceClients = EventHubAsyncClient.class) +@ServiceClientBuilder(serviceClients = {EventHubAsyncClient.class, EventProcessor.class}) public class EventHubClientBuilder { private static final String AZURE_EVENT_HUBS_CONNECTION_STRING = "AZURE_EVENT_HUBS_CONNECTION_STRING"; + private static final RetryOptions DEFAULT_RETRY = new RetryOptions() + .tryTimeout(ClientConstants.OPERATION_TIMEOUT); private TokenCredential credentials; private Configuration configuration; - private Duration timeout; private ProxyConfiguration proxyConfiguration; - private Retry retry; + private RetryOptions retryOptions; private Scheduler scheduler; private TransportType transport; private String host; - private String eventHubPath; + 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}. @@ -82,18 +92,18 @@ public EventHubClientBuilder() { * Sets the credential information given a connection string to the Event Hub instance. * *

- * If the connection string is copied from the Event Hubs namespace, it will likely not contain the path to the - * desired Event Hub, which is needed. In this case, the path can be added manually by adding {@literal + * If the connection string is copied from the Event Hubs namespace, it will likely not contain the name to the + * desired Event Hub, which is needed. In this case, the name can be added manually by adding {@literal * "EntityPath=EVENT_HUB_NAME"} to the end of the connection string. For example, "EntityPath=telemetry-hub". *

* *

* If you have defined a shared access policy directly on the Event Hub itself, then copying the connection string - * from that Event Hub will result in a connection string that contains the path. + * 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 path and the shared access key properties are contained in this connection + * 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 @@ -111,26 +121,26 @@ public EventHubClientBuilder connectionString(String connectionString) { throw new AzureException("Could not create the EventHubSharedAccessKeyCredential.", e); } - return credential(properties.endpoint().getHost(), properties.eventHubPath(), tokenCredential); + return credential(properties.endpoint().getHost(), properties.eventHubName(), tokenCredential); } /** - * Sets the credential information given a connection string to the Event Hubs namespace and a path to a specific + * Sets the credential information given a connection string to the Event Hubs namespace and name to a specific * Event Hub instance. * * @param connectionString The connection string to use for connecting to the Event Hubs namespace; it is * expected that the shared access key properties are contained in this connection string, but not the Event - * Hub path. - * @param eventHubPath The path of the specific Event Hub to connect the client to. + * 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 eventHubPath} is null or empty. - * Or, if the {@code connectionString} contains the Event Hub path. + * @throws IllegalArgumentException if {@code connectionString} or {@code eventHubName} is null or empty. + * Or, if the {@code connectionString} contains the Event Hub name. * @throws AzureException If the shared access signature token credential could not be created using the * connection string. */ - public EventHubClientBuilder connectionString(String connectionString, String eventHubPath) { - if (ImplUtils.isNullOrEmpty(eventHubPath)) { - throw new IllegalArgumentException("'eventHubPath' cannot be null or empty"); + public EventHubClientBuilder connectionString(String connectionString, String eventHubName) { + if (ImplUtils.isNullOrEmpty(eventHubName)) { + throw new IllegalArgumentException("'eventHubName' cannot be null or empty"); } final ConnectionStringProperties properties = new ConnectionStringProperties(connectionString); @@ -142,21 +152,21 @@ public EventHubClientBuilder connectionString(String connectionString, String ev throw new AzureException("Could not create the EventHubSharedAccessKeyCredential.", e); } - if (!ImplUtils.isNullOrEmpty(properties.eventHubPath())) { + if (!ImplUtils.isNullOrEmpty(properties.eventHubName())) { throw new IllegalArgumentException(String.format(Locale.US, - "'connectionString' contains an Event Hub path [%s]. Please use the" + "'connectionString' contains an Event Hub name [%s]. Please use the" + " credentials(String connectionString) overload. Or supply a 'connectionString' without" - + " 'EntityPath' in it.", properties.eventHubPath())); + + " 'EntityPath' in it.", properties.eventHubName())); } - return credential(properties.endpoint().getHost(), eventHubPath, tokenCredential); + return credential(properties.endpoint().getHost(), eventHubName, tokenCredential); } /** * Sets the configuration store that is used during construction of the service client. * - * If not specified, the default configuration store is used to configure the {@link EventHubAsyncClient}. Use {@link - * Configuration#NONE} to bypass using configuration settings during construction. + * If not specified, the default configuration store is used to configure the {@link EventHubAsyncClient}. Use + * {@link Configuration#NONE} to bypass using configuration settings during construction. * * @param configuration The configuration store used to configure the {@link EventHubAsyncClient}. * @return The updated {@link EventHubClientBuilder} object. @@ -171,26 +181,26 @@ public EventHubClientBuilder configuration(Configuration configuration) { * * @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}". - * @param eventHubPath The path of the specific Event Hub to connect the client to. + * @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. * @return The updated {@link EventHubClientBuilder} object. - * @throws IllegalArgumentException if {@code host} or {@code eventHubPath} is null or empty. + * @throws IllegalArgumentException if {@code host} or {@code eventHubName} is null or empty. * @throws NullPointerException if {@code credentials} is null. */ - public EventHubClientBuilder credential(String host, String eventHubPath, TokenCredential credential) { + public EventHubClientBuilder credential(String host, String eventHubName, TokenCredential credential) { if (ImplUtils.isNullOrEmpty(host)) { throw new IllegalArgumentException("'host' cannot be null or empty"); } - if (ImplUtils.isNullOrEmpty(eventHubPath)) { - throw new IllegalArgumentException("'eventHubPath' cannot be null or empty."); + if (ImplUtils.isNullOrEmpty(eventHubName)) { + throw new IllegalArgumentException("'eventHubName' cannot be null or empty."); } Objects.requireNonNull(credential); this.host = host; this.credentials = credential; - this.eventHubPath = eventHubPath; + this.eventHubName = eventHubName; return this; } @@ -232,31 +242,19 @@ public EventHubClientBuilder transportType(TransportType transport) { } /** - * Sets the default operation timeout for operations performed using {@link EventHubAsyncClient} and {@link - * EventHubConsumer} such as starting the communication link with the service and sending messages. - * - * @param timeout Duration for operation timeout. - * @return The updated {@link EventHubClientBuilder} object. - */ - public EventHubClientBuilder timeout(Duration timeout) { - this.timeout = timeout; - return this; - } - - /** - * Sets the retry policy for {@link EventHubAsyncClient}. If not specified, {@link Retry#getDefaultRetry()} is used. + * Sets the retry policy for {@link EventHubAsyncClient}. If not specified, the default retry options are used. * - * @param retry The retry policy to use. + * @param retryOptions The retry policy to use. * @return The updated {@link EventHubClientBuilder} object. */ - public EventHubClientBuilder retry(Retry retry) { - this.retry = retry; + public EventHubClientBuilder retry(RetryOptions retryOptions) { + this.retryOptions = retryOptions; return this; } /** - * 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: @@ -266,7 +264,7 @@ public EventHubClientBuilder retry(Retry retry) { * 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, {@link Retry#getDefaultRetry() the default retry} is used.
  • + *
  • 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.
  • @@ -293,12 +291,8 @@ public EventHubAsyncClient buildAsyncClient() { connectionString(connectionString); } - if (timeout == null) { - timeout = ClientConstants.OPERATION_TIMEOUT; - } - - if (retry == null) { - retry = Retry.getDefaultRetry(); + if (retryOptions == null) { + retryOptions = DEFAULT_RETRY; } // If the proxy has been configured by the user but they have overridden the TransportType with something that @@ -321,8 +315,8 @@ public EventHubAsyncClient buildAsyncClient() { final CBSAuthorizationType authorizationType = credentials instanceof EventHubSharedAccessKeyCredential ? CBSAuthorizationType.SHARED_ACCESS_SIGNATURE : CBSAuthorizationType.JSON_WEB_TOKEN; - final ConnectionOptions parameters = new ConnectionOptions(host, eventHubPath, credentials, - authorizationType, timeout, transport, retry, proxyConfiguration, scheduler); + final ConnectionOptions parameters = new ConnectionOptions(host, eventHubName, credentials, authorizationType, + transport, retryOptions, proxyConfiguration, scheduler); return new EventHubAsyncClient(parameters, provider, handlerProvider); } @@ -352,4 +346,87 @@ 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-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 similarity index 98% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubConsumer.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubConsumer.java index af90f6076f6f..f19e07ed500b 100644 --- a/sdk/eventhubs/azure-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 @@ -83,6 +83,8 @@ public class EventHubConsumer implements Closeable { link.getErrors().subscribe(error -> { logger.info("Error received in ReceiveLink. {}", error.toString()); + + //TODO (conniey): Surface error to EmitterProcessor. }); link.getShutdownSignals().subscribe(signal -> { diff --git a/sdk/eventhubs/azure-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 similarity index 95% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProducer.java index 520dd8befb28..559d589e64dd 100644 --- a/sdk/eventhubs/azure-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 @@ -11,10 +11,10 @@ import com.azure.messaging.eventhubs.implementation.AmqpSendLink; import com.azure.messaging.eventhubs.implementation.ErrorContextProvider; import com.azure.messaging.eventhubs.implementation.EventDataUtil; +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.message.Message; -import org.reactivestreams.Publisher; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -58,39 +58,38 @@ *

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

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

    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 EventHubAsyncClient#createProducer() */ @Immutable @@ -125,7 +124,6 @@ public class EventHubProducer implements Closeable { /** * 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 Mono createBatch() { @@ -134,14 +132,14 @@ public Mono createBatch() { /** * Creates an {@link EventDataBatch} that can fit as many events as the transport allows. - * * @param options A set of options used to configure the {@link EventDataBatch}. + * * @return A new {@link EventDataBatch} that can fit as many events as the transport allows. */ public Mono createBatch(BatchOptions options) { Objects.requireNonNull(options); - final BatchOptions clone = (BatchOptions) options.clone(); + final BatchOptions clone = options.clone(); verifyPartitionKey(clone.partitionKey()); @@ -168,12 +166,12 @@ 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) { @@ -185,13 +183,13 @@ 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) { @@ -205,8 +203,8 @@ public Mono send(EventData event, SendOptions options) { * 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. + * * @return A {@link Mono} that completes when all events are pushed to the service. */ public Mono send(Iterable events) { @@ -219,9 +217,9 @@ 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) { @@ -234,36 +232,36 @@ public Mono send(Iterable events, SendOptions options) { * 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. + * * @return A {@link Mono} that completes when all events are pushed to the service. */ - public Mono send(Publisher events) { + public Mono send(Flux events) { Objects.requireNonNull(events); - return sendInternal(Flux.from(events), DEFAULT_SEND_OPTIONS); + return send(events, DEFAULT_SEND_OPTIONS); } /** * 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(Publisher events, SendOptions options) { + public Mono send(Flux events, SendOptions options) { Objects.requireNonNull(events); Objects.requireNonNull(options); - return sendInternal(Flux.from(events), options); + return sendInternal(events, options); } /** * Sends the batch to the associated Event Hub. - * * @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 EventHubProducer#createBatch() @@ -292,7 +290,6 @@ private Mono sendInternal(Flux events, SendOptions options) { verifyPartitionKey(partitionKey); return sendLinkMono.flatMap(link -> { - //TODO (conniey): When we implement partial success, update the maximum number of batches or remove it completely. return link.getLinkSize() .flatMap(size -> { final int batchSize = size > 0 ? size : MAX_MESSAGE_LENGTH_BYTES; @@ -302,11 +299,11 @@ private Mono sendInternal(Flux events, SendOptions options) { return events.collect(new EventDataCollector(batchOptions, 1, () -> link.getErrorContext())); }) - .flatMap(list -> send(Flux.fromIterable(list))); + .flatMap(list -> sendInternal(Flux.fromIterable(list))); }); } - private Mono send(Flux eventBatches) { + private Mono sendInternal(Flux eventBatches) { return eventBatches .flatMap(this::send) .then() @@ -333,14 +330,13 @@ private void verifyPartitionKey(String partitionKey) { /** * Disposes of the {@link EventHubProducer} by closing the underlying connection to the service. - * * @throws IOException if the underlying transport could not be closed and its resources could not be - * disposed. + * disposed. */ @Override public void close() throws IOException { if (!isDisposed.getAndSet(true)) { - final AmqpSendLink block = sendLinkMono.block(senderOptions.timeout()); + final AmqpSendLink block = sendLinkMono.block(senderOptions.retry().tryTimeout()); if (block != null) { block.close(); } diff --git a/sdk/eventhubs/azure-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 similarity index 92% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProperties.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubProperties.java index ab49b0d810e0..8378b550b2d3 100644 --- a/sdk/eventhubs/azure-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 @@ -19,15 +19,15 @@ */ @Immutable public final class EventHubProperties { - private final String path; + private final String name; private final Instant createdAt; private final String[] partitionIds; EventHubProperties( - final String path, + final String name, final Instant createdAt, final String[] partitionIds) { - this.path = path; + this.name = name; this.createdAt = createdAt; this.partitionIds = partitionIds != null ? Arrays.copyOf(partitionIds, partitionIds.length) @@ -39,8 +39,8 @@ public final class EventHubProperties { * * @return Name of the Event Hub. */ - public String path() { - return path; + public String name() { + return name; } /** diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredential.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredential.java 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 new file mode 100644 index 000000000000..90a61962c37c --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/EventProcessor.java @@ -0,0 +1,242 @@ +// 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.models.PartitionContext; +import com.azure.messaging.eventhubs.models.PartitionOwnership; +import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; +import com.azure.messaging.eventhubs.models.EventPosition; + +import java.io.IOException; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.reactivestreams.Publisher; +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

    + * + * {@codesnippet com.azure.messaging.eventhubs.eventprocessor.instantiation} + * + * @see EventHubAsyncClient + * @see EventHubClientBuilder + */ +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 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 Disposable runner; + private Scheduler scheduler; + + /** + * 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 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. + */ + 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"); + this.identifier = UUID.randomUUID().toString(); + logger.info("The instance ID for this event processors is {}", this.identifier); + } + + /** + * The identifier is a unique name given to this event processor instance. + * + * @return Identifier for this event processor. + */ + public String identifier() { + return this.identifier; + } + + /** + * Starts processing of events for all partitions of the Event Hub that this event processor can own, assigning a + * dedicated {@link PartitionProcessor} to each partition. If there are other Event Processors active for the same + * consumer group on the Event Hub, responsibility for partitions will be shared between them. + *

    + * Subsequent calls to start will be ignored if this event processor is already running. Calling start after {@link + * #stop()} is called will restart this event processor. + *

    + * + *

    Starting the processor to consume events from all partitions

    + * {@codesnippet com.azure.messaging.eventhubs.eventprocessor.startstop} + */ + public synchronized void start() { + if (!started.compareAndSet(false, true)) { + logger.info("Event processor is already running"); + return; + } + 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); + } + + /** + * Stops processing events for all partitions owned by this event processor. All {@link PartitionProcessor} will be + * shutdown and any open resources will be closed. + *

    + * Subsequent calls to stop will be ignored if the event processor is not running. + *

    + * + *

    Stopping the processor

    + * {@codesnippet com.azure.messaging.eventhubs.eventprocessor.startstop} + */ + public synchronized void stop() { + if (!started.compareAndSet(true, false)) { + 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); + + EventHubConsumer 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)); + } +} 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 new file mode 100644 index 000000000000..041c116e93cb --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/InMemoryPartitionManager.java @@ -0,0 +1,80 @@ +// 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.models.Checkpoint; +import com.azure.messaging.eventhubs.models.PartitionOwnership; +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}. + */ +public class InMemoryPartitionManager implements PartitionManager { + + private final Map partitionOwnershipMap = new ConcurrentHashMap<>(); + private final ClientLogger logger = new ClientLogger(InMemoryPartitionManager.class); + + /** + * {@inheritDoc} + * + * @param eventHubName The name of the Event Hub to list ownership of. + * @param consumerGroupName The name of the consumer group to list ownership of. + * @return A {@link Flux} of partition ownership information. + */ + @Override + public Flux listOwnership(String eventHubName, String consumerGroupName) { + logger.info("Listing partition ownership"); + return Flux.fromIterable(partitionOwnershipMap.values()); + } + + /** + * Returns a {@link Flux} of partition ownership details for successfully claimed partitions. If a partition is + * already claimed by an instance or if the ETag in the request doesn't match the previously stored ETag, then + * ownership claim is denied. + * + * @param requestedPartitionOwnerships Array of partition ownerships this instance is requesting to own. + * @return Successfully claimed partition ownerships. + */ + @Override + public Flux claimOwnership(PartitionOwnership... requestedPartitionOwnerships) { + return Flux.fromArray(requestedPartitionOwnerships) + .filter(partitionOwnership -> { + return !partitionOwnershipMap.containsKey(partitionOwnership.partitionId()) + || partitionOwnershipMap.get(partitionOwnership.partitionId()).eTag() + .equals(partitionOwnership.eTag()); + }) + .doOnNext(partitionOwnership -> logger + .info("Ownership of partition {} claimed by {}", partitionOwnership.partitionId(), + partitionOwnership.ownerId())) + .map(partitionOwnership -> { + partitionOwnership.eTag(UUID.randomUUID().toString()) + .lastModifiedTime(System.currentTimeMillis()); + partitionOwnershipMap.put(partitionOwnership.partitionId(), partitionOwnership); + return partitionOwnership; + }); + } + + /** + * Updates the in-memory storage with the provided checkpoint information. + * + * @param checkpoint The checkpoint containing the information to be stored in-memory. + * @return A new ETag associated with the updated checkpoint. + */ + @Override + public Mono updateCheckpoint(final Checkpoint checkpoint) { + String updatedETag = UUID.randomUUID().toString(); + partitionOwnershipMap.get(checkpoint.partitionId()) + .sequenceNumber(checkpoint.sequenceNumber()) + .offset(checkpoint.offset()) + .eTag(updatedETag); + logger.info("Updated checkpoint for partition {} with sequence number {}", checkpoint.partitionId(), + checkpoint.sequenceNumber()); + return Mono.just(updatedETag); + } +} diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionManager.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionManager.java new file mode 100644 index 000000000000..d7fb6945df95 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionManager.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import com.azure.messaging.eventhubs.models.Checkpoint; +import com.azure.messaging.eventhubs.models.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. + */ +public interface PartitionManager { + + /** + * Called to get the list of all existing partition ownership from the underlying data store. Could return empty + * results if there are is no existing ownership information. + * + * @param eventHubName The Event Hub name to get ownership information. + * @param consumerGroupName The consumer group name. + * @return A flux of partition ownership details of all the partitions that have/had an owner. + */ + Flux listOwnership(String eventHubName, String consumerGroupName); + + /** + * Called to claim ownership of a list of partitions. This will return the list of partitions that were owned + * successfully. + * + * @param requestedPartitionOwnerships Array of partition ownerships this instance is requesting to own. + * @return A flux of partitions this instance successfully claimed ownership. + */ + Flux claimOwnership(PartitionOwnership... requestedPartitionOwnerships); + + /** + * Updates the checkpoint in the data store for a partition. + * + * @param checkpoint Checkpoint information containing sequence number and offset to be stored for this + * partition. + * @return The new ETag on successful update. + */ + Mono updateCheckpoint(Checkpoint checkpoint); +} 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 new file mode 100644 index 000000000000..a73e0e0190d1 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProcessor.java @@ -0,0 +1,60 @@ +// 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; + +/** + * The interface defining all the operations that must be supported by a single partition processor. + *

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

    + */ +public interface PartitionProcessor { + + /** + * This method is called when this {@link EventProcessor} takes ownership of a new partition and before any + * events from this partition are received. + * + * @return a representation of the deferred computation of this call. + */ + Mono initialize(); + + /** + * 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. + * + * @param eventData {@link EventData} received from this partition. + * @return a representation of the deferred computation of this call. + */ + Mono processEvent(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 throwable The {@link Throwable} that caused this method to be called. + */ + void processError(Throwable 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 closeReason The reason for closing this partition processor. + * @return a representation of the deferred computation of this call. + */ + Mono close(CloseReason closeReason); + +} 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 new file mode 100644 index 000000000000..5f55d74e5b4a --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProcessorFactory.java @@ -0,0 +1,27 @@ +// 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-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProperties.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProperties.java similarity index 84% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProperties.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProperties.java index 767a655e3f74..0b7cc10c0572 100644 --- a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProperties.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionProperties.java @@ -12,7 +12,7 @@ */ @Immutable public final class PartitionProperties { - private final String eventHubPath; + private final String eventHubName; private final String id; private final long beginningSequenceNumber; private final long lastEnqueuedSequenceNumber; @@ -21,14 +21,14 @@ public final class PartitionProperties { private final boolean isEmpty; PartitionProperties( - final String eventHubPath, + final String eventHubName, final String id, final long beginningSequenceNumber, final long lastEnqueuedSequenceNumber, final String lastEnqueuedOffset, final Instant lastEnqueuedTime, final boolean isEmpty) { - this.eventHubPath = eventHubPath; + this.eventHubName = eventHubName; this.id = id; this.beginningSequenceNumber = beginningSequenceNumber; this.lastEnqueuedSequenceNumber = lastEnqueuedSequenceNumber; @@ -38,12 +38,12 @@ public final class PartitionProperties { } /** - * Gets the Event Hub path that contains the partition, relative to the Event Hubs namespace that contains it. + * Gets the name of the Event Hub that contains the partition. * - * @return The Event Hub path that contains the partition. + * @return The name of the Event Hub that contains the partition. */ - public String eventHubPath() { - return this.eventHubPath; + public String eventHubName() { + return this.eventHubName; } /** @@ -77,8 +77,8 @@ public long lastEnqueuedSequenceNumber() { * Gets the offset of the last enqueued message in the partition's stream. * *

    - * The offset is the relative position for event in the context of the stream. The offset should not be considered - * a stable value, as the same offset may refer to a different event as events reach the age limit for retention and + * The offset is the relative position for event in the context of the stream. The offset should not be considered a + * stable value, as the same offset may refer to a different event as events reach the age limit for retention and * are no longer visible within the stream. *

    * diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ActiveClientTokenManager.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ActiveClientTokenManager.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpConstants.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpConstants.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpConstants.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpConstants.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpErrorCode.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpErrorCode.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLink.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLink.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLink.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpReceiveLink.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpResponseMapper.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpResponseMapper.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpResponseMapper.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpResponseMapper.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpSendLink.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpSendLink.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpSendLink.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/AmqpSendLink.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/CBSAuthorizationType.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/CBSAuthorizationType.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/CBSAuthorizationType.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/CBSAuthorizationType.java diff --git a/sdk/eventhubs/azure-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 similarity index 91% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/CBSChannel.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/CBSChannel.java index 4ff385121c40..6f1059879317 100644 --- a/sdk/eventhubs/azure-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 @@ -5,6 +5,7 @@ import com.azure.core.amqp.AmqpConnection; import com.azure.core.amqp.CBSNode; +import com.azure.core.amqp.RetryOptions; import com.azure.core.credentials.TokenCredential; import com.azure.core.util.logging.ClientLogger; import org.apache.qpid.proton.Proton; @@ -13,7 +14,6 @@ import org.apache.qpid.proton.message.Message; import reactor.core.publisher.Mono; -import java.time.Duration; import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Locale; @@ -35,29 +35,29 @@ class CBSChannel extends EndpointStateNotifierBase implements CBSNode { private final TokenCredential credential; private final Mono cbsChannelMono; private final ReactorProvider provider; - private final Duration operationTimeout; private final CBSAuthorizationType authorizationType; + private final RetryOptions retryOptions; CBSChannel(AmqpConnection connection, TokenCredential tokenCredential, CBSAuthorizationType authorizationType, - ReactorProvider provider, ReactorHandlerProvider handlerProvider, Duration operationTimeout) { + ReactorProvider provider, ReactorHandlerProvider handlerProvider, RetryOptions retryOptions) { super(new ClientLogger(CBSChannel.class)); Objects.requireNonNull(connection); Objects.requireNonNull(tokenCredential); Objects.requireNonNull(authorizationType); Objects.requireNonNull(provider); - Objects.requireNonNull(operationTimeout); Objects.requireNonNull(handlerProvider); + Objects.requireNonNull(retryOptions); this.authorizationType = authorizationType; - this.operationTimeout = operationTimeout; + this.retryOptions = retryOptions; this.connection = connection; this.credential = tokenCredential; this.provider = provider; this.cbsChannelMono = connection.createSession(SESSION_NAME) .cast(ReactorSession.class) .map(session -> new RequestResponseChannel(connection.getIdentifier(), connection.getHost(), LINK_NAME, - CBS_ADDRESS, session.session(), handlerProvider)) + CBS_ADDRESS, session.session(), this.retryOptions, handlerProvider)) .cache(); } @@ -81,7 +81,7 @@ public Mono authorize(final String tokenAudience) { @Override public void close() { - final RequestResponseChannel channel = cbsChannelMono.block(operationTimeout); + final RequestResponseChannel channel = cbsChannelMono.block(retryOptions.tryTimeout()); if (channel != null) { channel.close(); } diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ClientConstants.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ClientConstants.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ClientConstants.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ClientConstants.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionOptions.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionOptions.java similarity index 69% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionOptions.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionOptions.java index 30fb02506097..194ff8154d49 100644 --- a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionOptions.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionOptions.java @@ -3,48 +3,44 @@ package com.azure.messaging.eventhubs.implementation; -import com.azure.core.amqp.Retry; +import com.azure.core.amqp.RetryOptions; import com.azure.core.amqp.TransportType; import com.azure.core.credentials.TokenCredential; import com.azure.messaging.eventhubs.models.ProxyConfiguration; import reactor.core.scheduler.Scheduler; -import java.time.Duration; import java.util.Objects; /** * A wrapper class that contains all parameters that are needed to establish a connection to an Event Hub. */ public class ConnectionOptions { - private final Duration timeout; private final TokenCredential tokenCredential; private final TransportType transport; - private final Retry retryPolicy; + private final RetryOptions retryOptions; private final ProxyConfiguration proxyConfiguration; private final Scheduler scheduler; private final String host; - private final String eventHubPath; + private final String eventHubName; private final CBSAuthorizationType authorizationType; - public ConnectionOptions(String host, String eventHubPath, TokenCredential tokenCredential, - CBSAuthorizationType authorizationType, Duration timeout, TransportType transport, - Retry retryPolicy, ProxyConfiguration proxyConfiguration, Scheduler scheduler) { + public ConnectionOptions(String host, String eventHubName, TokenCredential tokenCredential, + CBSAuthorizationType authorizationType, TransportType transport, RetryOptions retryOptions, + ProxyConfiguration proxyConfiguration, Scheduler scheduler) { Objects.requireNonNull(host); - Objects.requireNonNull(eventHubPath); - Objects.requireNonNull(timeout); + Objects.requireNonNull(eventHubName); Objects.requireNonNull(tokenCredential); Objects.requireNonNull(transport); - Objects.requireNonNull(retryPolicy); + Objects.requireNonNull(retryOptions); Objects.requireNonNull(proxyConfiguration); Objects.requireNonNull(scheduler); this.host = host; - this.eventHubPath = eventHubPath; - this.timeout = timeout; + this.eventHubName = eventHubName; this.tokenCredential = tokenCredential; this.authorizationType = authorizationType; this.transport = transport; - this.retryPolicy = retryPolicy; + this.retryOptions = retryOptions; this.proxyConfiguration = proxyConfiguration; this.scheduler = scheduler; } @@ -53,12 +49,8 @@ public String host() { return host; } - public String eventHubPath() { - return eventHubPath; - } - - public Duration timeout() { - return timeout; + public String eventHubName() { + return eventHubName; } public TokenCredential tokenCredential() { @@ -73,8 +65,8 @@ public TransportType transportType() { return transport; } - public Retry retryPolicy() { - return retryPolicy; + public RetryOptions retry() { + return retryOptions; } public ProxyConfiguration proxyConfiguration() { diff --git a/sdk/eventhubs/azure-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 similarity index 95% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionStringProperties.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ConnectionStringProperties.java index 0dcc2eebf695..5681a7e5d8d4 100644 --- a/sdk/eventhubs/azure-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 @@ -22,10 +22,10 @@ public class ConnectionStringProperties { private static final String ENTITY_PATH = "EntityPath"; private static final String ERROR_MESSAGE_FORMAT = "Could not parse 'connectionString'. Expected format: " + "'Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" - + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubPath}'. Actual: %s"; + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}'. Actual: %s"; private final URI endpoint; - private final String eventHubPath; + private final String eventHubName; private final String sharedAccessKeyName; private final String sharedAccessKey; @@ -43,7 +43,7 @@ public ConnectionStringProperties(String connectionString) { final String[] tokenValuePairs = connectionString.split(TOKEN_VALUE_PAIR_DELIMITER); URI endpoint = null; - String eventHubPath = null; + String eventHubName = null; String sharedAccessKeyName = null; String sharedAccessKeyValue = null; @@ -72,7 +72,7 @@ public ConnectionStringProperties(String connectionString) { } else if (key.equalsIgnoreCase(SHARED_ACCESS_KEY)) { sharedAccessKeyValue = value; } else if (key.equalsIgnoreCase(ENTITY_PATH)) { - eventHubPath = value; + eventHubName = value; } else { throw new IllegalArgumentException( String.format(Locale.US, "Illegal connection string parameter name: %s", key)); @@ -84,7 +84,7 @@ public ConnectionStringProperties(String connectionString) { } this.endpoint = endpoint; - this.eventHubPath = eventHubPath; + this.eventHubName = eventHubName; this.sharedAccessKeyName = sharedAccessKeyName; this.sharedAccessKey = sharedAccessKeyValue; } @@ -103,8 +103,8 @@ public URI endpoint() { * * @return The name of the specific Event Hub under the namespace. */ - public String eventHubPath() { - return eventHubPath; + public String eventHubName() { + return eventHubName; } /** diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EndpointStateNotifierBase.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EndpointStateNotifierBase.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ErrorContextProvider.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ErrorContextProvider.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ErrorContextProvider.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ErrorContextProvider.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventDataUtil.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventDataUtil.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubConnection.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubConnection.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubConnection.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubConnection.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubManagementNode.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubManagementNode.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubManagementNode.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubManagementNode.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubSession.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubSession.java similarity index 92% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubSession.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubSession.java index 8b1760894cb0..ee73afd6e050 100644 --- a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubSession.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/EventHubSession.java @@ -5,7 +5,7 @@ import com.azure.core.amqp.AmqpLink; import com.azure.core.amqp.AmqpSession; -import com.azure.core.amqp.Retry; +import com.azure.core.amqp.RetryPolicy; import com.azure.messaging.eventhubs.EventHubConsumer; import reactor.core.publisher.Mono; @@ -35,5 +35,5 @@ public interface EventHubSession extends AmqpSession { * @return A newly created AMQP link. */ Mono createConsumer(String linkName, String entityPath, String eventPositionExpression, Duration timeout, - Retry retry, Long ownerLevel, String consumerIdentifier); + RetryPolicy retry, Long ownerLevel, String consumerIdentifier); } diff --git a/sdk/eventhubs/azure-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 similarity index 91% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ManagementChannel.java index efd2d8f678c0..44e3fc8a87de 100644 --- a/sdk/eventhubs/azure-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 @@ -4,6 +4,7 @@ package com.azure.messaging.eventhubs.implementation; import com.azure.core.amqp.AmqpConnection; +import com.azure.core.amqp.RetryOptions; import com.azure.core.credentials.TokenCredential; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.EventHubProperties; @@ -54,40 +55,41 @@ public class ManagementChannel extends EndpointStateNotifierBase implements Even private final TokenCredential tokenProvider; private final Mono channelMono; private final ReactorProvider provider; - private final String eventHubPath; + private final String eventHubName; private final AmqpResponseMapper mapper; private final TokenResourceProvider audienceProvider; /** - * Creates an instance that is connected to the {@code eventHubPath}'s management node. + * Creates an instance that is connected to the {@code eventHubName}'s management node. * - * @param eventHubPath The name of the Event Hub. + * @param eventHubName The name of the Event Hub. * @param tokenProvider A provider that generates authorization tokens. * @param provider The dispatcher to execute work on Reactor. */ - ManagementChannel(AmqpConnection connection, String eventHubPath, TokenCredential tokenProvider, - TokenResourceProvider audienceProvider, ReactorProvider provider, + ManagementChannel(AmqpConnection connection, String eventHubName, TokenCredential tokenProvider, + TokenResourceProvider audienceProvider, ReactorProvider provider, RetryOptions retryOptions, ReactorHandlerProvider handlerProvider, AmqpResponseMapper mapper) { super(new ClientLogger(ManagementChannel.class)); Objects.requireNonNull(connection); - Objects.requireNonNull(eventHubPath); + Objects.requireNonNull(eventHubName); Objects.requireNonNull(tokenProvider); Objects.requireNonNull(audienceProvider); Objects.requireNonNull(provider); Objects.requireNonNull(handlerProvider); Objects.requireNonNull(mapper); + Objects.requireNonNull(retryOptions); this.audienceProvider = audienceProvider; this.connection = connection; this.tokenProvider = tokenProvider; this.provider = provider; - this.eventHubPath = eventHubPath; + this.eventHubName = eventHubName; this.mapper = mapper; this.channelMono = connection.createSession(SESSION_NAME) .cast(ReactorSession.class) .map(session -> new RequestResponseChannel(connection.getIdentifier(), connection.getHost(), LINK_NAME, - ADDRESS, session.session(), handlerProvider)) + ADDRESS, session.session(), retryOptions, handlerProvider)) .cache(); } @@ -98,7 +100,7 @@ public class ManagementChannel extends EndpointStateNotifierBase implements Even public Mono getEventHubProperties() { final Map properties = new HashMap<>(); properties.put(MANAGEMENT_ENTITY_TYPE_KEY, MANAGEMENT_EVENTHUB_ENTITY_TYPE); - properties.put(MANAGEMENT_ENTITY_NAME_KEY, eventHubPath); + properties.put(MANAGEMENT_ENTITY_NAME_KEY, eventHubName); properties.put(MANAGEMENT_OPERATION_KEY, READ_OPERATION_VALUE); return getProperties(properties, mapper::toEventHubProperties); @@ -111,7 +113,7 @@ public Mono getEventHubProperties() { public Mono getPartitionProperties(String partitionId) { final Map properties = new HashMap<>(); properties.put(MANAGEMENT_ENTITY_TYPE_KEY, MANAGEMENT_PARTITION_ENTITY_TYPE); - properties.put(MANAGEMENT_ENTITY_NAME_KEY, eventHubPath); + properties.put(MANAGEMENT_ENTITY_NAME_KEY, eventHubName); properties.put(MANAGEMENT_PARTITION_NAME_KEY, partitionId); properties.put(MANAGEMENT_OPERATION_KEY, READ_OPERATION_VALUE); @@ -119,7 +121,7 @@ public Mono getPartitionProperties(String partitionId) { } private Mono getProperties(Map properties, Function, T> mapper) { - final String tokenAudience = audienceProvider.getResourceString(eventHubPath); + final String tokenAudience = audienceProvider.getResourceString(eventHubName); return tokenProvider.getToken(tokenAudience).flatMap(accessToken -> { properties.put(MANAGEMENT_SECURITY_TOKEN_KEY, accessToken.token()); diff --git a/sdk/eventhubs/azure-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 similarity index 84% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorConnection.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorConnection.java index 0c8434e2516a..5b947d577af6 100644 --- a/sdk/eventhubs/azure-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 @@ -7,6 +7,8 @@ import com.azure.core.amqp.AmqpExceptionHandler; import com.azure.core.amqp.AmqpSession; import com.azure.core.amqp.CBSNode; +import com.azure.core.amqp.RetryPolicy; +import com.azure.core.amqp.implementation.RetryUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.handler.ConnectionHandler; import com.azure.messaging.eventhubs.implementation.handler.SessionHandler; @@ -38,6 +40,7 @@ public class ReactorConnection extends EndpointStateNotifierBase implements Even private final Disposable.Composite subscriptions; private final Mono managementChannelMono; private final TokenResourceProvider tokenResourceProvider; + private final RetryPolicy retryPolicy; private ReactorExecutor executor; //TODO (conniey): handle failures and recreating the Reactor. Resubscribing the handlers, etc. @@ -54,15 +57,17 @@ public class ReactorConnection extends EndpointStateNotifierBase implements Even * @param reactorProvider Provides proton-j Reactor instances. * @param handlerProvider Provides {@link BaseHandler} to listen to proton-j reactor events. */ - public ReactorConnection(String connectionId, ConnectionOptions connectionOptions, - ReactorProvider reactorProvider, ReactorHandlerProvider handlerProvider, AmqpResponseMapper mapper) { + public ReactorConnection(String connectionId, ConnectionOptions connectionOptions, ReactorProvider reactorProvider, + ReactorHandlerProvider handlerProvider, AmqpResponseMapper mapper) { super(new ClientLogger(ReactorConnection.class)); this.connectionOptions = connectionOptions; this.reactorProvider = reactorProvider; this.connectionId = connectionId; this.handlerProvider = handlerProvider; - this.handler = handlerProvider.createConnectionHandler(connectionId, connectionOptions.host(), connectionOptions.transportType()); + this.handler = handlerProvider.createConnectionHandler(connectionId, connectionOptions.host(), + connectionOptions.transportType()); + this.retryPolicy = RetryUtil.getRetryPolicy(connectionOptions.retry()); this.connectionMono = Mono.fromCallable(() -> getOrCreateConnection()) .doOnSubscribe(c -> hasConnection.set(true)); @@ -81,8 +86,8 @@ public ReactorConnection(String connectionId, ConnectionOptions connectionOption this.managementChannelMono = connectionMono.then( Mono.fromCallable(() -> (EventHubManagementNode) new ManagementChannel(this, - connectionOptions.eventHubPath(), connectionOptions.tokenCredential(), tokenResourceProvider, - reactorProvider, handlerProvider, mapper))).cache(); + connectionOptions.eventHubName(), connectionOptions.tokenCredential(), tokenResourceProvider, + reactorProvider, connectionOptions.retry(), handlerProvider, mapper))).cache(); } /** @@ -90,8 +95,9 @@ public ReactorConnection(String connectionId, ConnectionOptions connectionOption */ @Override public Mono getCBSNode() { - final Mono cbsNodeMono = getConnectionStates().takeUntil(x -> x == AmqpEndpointState.ACTIVE) - .timeout(connectionOptions.timeout()) + final Mono cbsNodeMono = RetryUtil.withRetry( + getConnectionStates().takeUntil(x -> x == AmqpEndpointState.ACTIVE), + connectionOptions.retry().tryTimeout(), retryPolicy) .then(Mono.fromCallable(() -> getOrCreateCBSNode())); return hasConnection.get() @@ -144,13 +150,13 @@ public Mono createSession(String sessionName) { } return connectionMono.map(connection -> sessionMap.computeIfAbsent(sessionName, key -> { - final SessionHandler handler = - handlerProvider.createSessionHandler(connectionId, getHost(), sessionName, connectionOptions.timeout()); + final SessionHandler handler = handlerProvider.createSessionHandler(connectionId, getHost(), sessionName, + connectionOptions.retry().tryTimeout()); final Session session = connection.session(); BaseHandler.setHandler(session, handler); - return new ReactorSession(session, handler, sessionName, reactorProvider, handlerProvider, - this.getCBSNode(), tokenResourceProvider, connectionOptions.timeout()); + return new ReactorSession(session, handler, sessionName, reactorProvider, handlerProvider, getCBSNode(), + tokenResourceProvider, connectionOptions.retry().tryTimeout()); })); } @@ -187,8 +193,7 @@ private synchronized CBSNode getOrCreateCBSNode() { logger.info("Setting CBS channel."); cbsChannel = new CBSChannel(this, connectionOptions.tokenCredential(), - connectionOptions.authorizationType(), reactorProvider, handlerProvider, - connectionOptions.timeout()); + connectionOptions.authorizationType(), reactorProvider, handlerProvider, connectionOptions.retry()); } return cbsChannel; @@ -203,7 +208,7 @@ private synchronized Connection getOrCreateConnection() throws IOException { reactorExceptionHandler = new ReactorExceptionHandler(); executor = new ReactorExecutor(reactor, connectionOptions.scheduler(), connectionId, - reactorExceptionHandler, connectionOptions.timeout(), connectionOptions.host()); + reactorExceptionHandler, connectionOptions.retry().tryTimeout(), connectionOptions.host()); executor.start(); } diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorDispatcher.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorDispatcher.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorExecutor.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorExecutor.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorHandlerProvider.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorHandlerProvider.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorProvider.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorProvider.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorReceiver.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorReceiver.java diff --git a/sdk/eventhubs/azure-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 similarity index 93% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorSender.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorSender.java index 865d0a8565ca..77c40942eb88 100644 --- a/sdk/eventhubs/azure-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 @@ -3,12 +3,13 @@ package com.azure.messaging.eventhubs.implementation; -import com.azure.core.amqp.Retry; +import com.azure.core.amqp.RetryPolicy; 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.exception.ExceptionUtil; import com.azure.core.amqp.exception.OperationCancelledException; +import com.azure.core.amqp.implementation.RetryUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.handler.SendLinkHandler; import org.apache.qpid.proton.Proton; @@ -44,6 +45,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import static com.azure.messaging.eventhubs.implementation.EventDataUtil.getDataSerializedSize; import static java.nio.charset.StandardCharsets.UTF_8; @@ -60,17 +62,19 @@ class ReactorSender extends EndpointStateNotifierBase implements AmqpSendLink { private final AtomicBoolean hasConnected = new AtomicBoolean(); private final AtomicBoolean hasAuthorized = new AtomicBoolean(true); + private final AtomicInteger retryAttempts = new AtomicInteger(); private final Object pendingSendLock = new Object(); private final ConcurrentHashMap pendingSendsMap = new ConcurrentHashMap<>(); private final PriorityQueue pendingSendsQueue = new PriorityQueue<>(1000, new DeliveryTagComparator()); private final ActiveClientTokenManager tokenManager; - private final Retry retry; + private final RetryPolicy retry; private final Duration timeout; private final Timer sendTimeoutTimer = new Timer("SendTimeout-timer"); private final Object errorConditionLock = new Object(); + private volatile Exception lastKnownLinkError; private volatile Instant lastKnownErrorReportedAt; @@ -81,7 +85,7 @@ class ReactorSender extends EndpointStateNotifierBase implements AmqpSendLink { private volatile int maxMessageSize; ReactorSender(String entityPath, Sender sender, SendLinkHandler handler, ReactorProvider reactorProvider, - ActiveClientTokenManager tokenManager, Duration timeout, Retry retry, int maxMessageSize) { + ActiveClientTokenManager tokenManager, Duration timeout, RetryPolicy retry, int maxMessageSize) { super(new ClientLogger(ReactorSender.class)); this.entityPath = entityPath; this.sender = sender; @@ -210,9 +214,9 @@ public Mono getLinkSize() { return Mono.just(maxMessageSize); } - return handler.getEndpointStates() - .takeUntil(state -> state == EndpointState.ACTIVE) - .timeout(timeout) + return RetryUtil.withRetry( + handler.getEndpointStates().takeUntil(state -> state == EndpointState.ACTIVE), + timeout, retry) .then(Mono.fromCallable(() -> { final UnsignedLong remoteMaxMessageSize = sender.getRemoteMaxMessageSize(); @@ -239,8 +243,9 @@ private Mono send(byte[] bytes, int arrayOffset, int messageFormat) { if (hasConnected.get()) { return sendWorkItem; } else { - return handler.getEndpointStates().takeUntil(x -> x == EndpointState.ACTIVE) - .timeout(timeout) + return RetryUtil.withRetry( + handler.getEndpointStates().takeUntil(state -> state == EndpointState.ACTIVE), + timeout, retry) .then(sendWorkItem); } } @@ -348,8 +353,8 @@ private void processDeliveredMessage(Delivery delivery) { if (outcome instanceof Accepted) { synchronized (errorConditionLock) { - this.lastKnownLinkError = null; - this.retry.resetRetryInterval(); + lastKnownLinkError = null; + retryAttempts.set(0); } workItem.sink().success(); @@ -359,24 +364,27 @@ private void processDeliveredMessage(Delivery delivery) { final Exception exception = ExceptionUtil.toException(error.getCondition().toString(), error.getDescription(), handler.getErrorContext(sender)); + final int retryAttempt; if (isGeneralSendError(error.getCondition())) { synchronized (errorConditionLock) { - this.lastKnownLinkError = exception; - this.retry.incrementRetryCount(); + lastKnownLinkError = exception; + retryAttempt = retryAttempts.incrementAndGet(); } + } else { + retryAttempt = retryAttempts.get(); } - final Duration retryInterval = retry.getNextRetryInterval(exception, workItem.timeoutTracker().remaining()); + final Duration retryInterval = retry.calculateRetryDelay(exception, retryAttempt); - if (retryInterval == null) { - this.cleanupFailedSend(workItem, exception); + if (retryInterval.compareTo(workItem.timeoutTracker().remaining()) > 0) { + cleanupFailedSend(workItem, exception); } else { workItem.lastKnownException(exception); try { reactorProvider.getReactorDispatcher().invoke(() -> send(workItem), retryInterval); } catch (IOException | RejectedExecutionException schedulerException) { exception.initCause(schedulerException); - this.cleanupFailedSend( + cleanupFailedSend( workItem, new AmqpException(false, String.format(Locale.US, "Entity(%s): send operation failed while scheduling a" @@ -385,10 +393,10 @@ private void processDeliveredMessage(Delivery delivery) { } } } else if (outcome instanceof Released) { - this.cleanupFailedSend(workItem, new OperationCancelledException(outcome.toString(), + cleanupFailedSend(workItem, new OperationCancelledException(outcome.toString(), handler.getErrorContext(sender))); } else { - this.cleanupFailedSend(workItem, new AmqpException(false, outcome.toString(), + cleanupFailedSend(workItem, new AmqpException(false, outcome.toString(), handler.getErrorContext(sender))); } } diff --git a/sdk/eventhubs/azure-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 similarity index 94% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorSession.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/ReactorSession.java index 66ee731b2062..afc7db936efe 100644 --- a/sdk/eventhubs/azure-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 @@ -6,7 +6,8 @@ import com.azure.core.amqp.AmqpEndpointState; import com.azure.core.amqp.AmqpLink; import com.azure.core.amqp.CBSNode; -import com.azure.core.amqp.Retry; +import com.azure.core.amqp.RetryPolicy; +import com.azure.core.amqp.implementation.RetryUtil; import com.azure.core.implementation.util.ImplUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.EventHubProducer; @@ -116,11 +117,12 @@ public Duration getOperationTimeout() { } @Override - public Mono createProducer(String linkName, String entityPath, Duration timeout, Retry retry) { + public Mono createProducer(String linkName, String entityPath, Duration timeout, RetryPolicy retry) { final ActiveClientTokenManager tokenManager = createTokenManager(entityPath); - return getConnectionStates().takeUntil(state -> state == AmqpEndpointState.ACTIVE) - .timeout(timeout) + return RetryUtil.withRetry( + getConnectionStates().takeUntil(state -> state == AmqpEndpointState.ACTIVE), + timeout, retry) .then(tokenManager.authorize().then(Mono.create(sink -> { final AmqpSendLink existingSender = openSendLinks.get(linkName); if (existingSender != null) { @@ -156,17 +158,17 @@ public Mono createProducer(String linkName, String entityPath, Duratio } @Override - public Mono createConsumer(String linkName, String entityPath, Duration timeout, Retry retry) { + public Mono createConsumer(String linkName, String entityPath, Duration timeout, RetryPolicy retry) { return createConsumer(linkName, entityPath, "", timeout, retry, null, null); } @Override public Mono createConsumer(String linkName, String entityPath, String eventPositionExpression, - Duration timeout, Retry retry, Long ownerLevel, String consumerIdentifier) { + Duration timeout, RetryPolicy retry, Long ownerLevel, String consumerIdentifier) { final ActiveClientTokenManager tokenManager = createTokenManager(entityPath); - return getConnectionStates().takeUntil(state -> state == AmqpEndpointState.ACTIVE) - .timeout(timeout) + return RetryUtil.withRetry( + getConnectionStates().takeUntil(state -> state == AmqpEndpointState.ACTIVE), timeout, retry) .then(tokenManager.authorize().then(Mono.create(sink -> { final AmqpReceiveLink existingReceiver = openReceiveLinks.get(linkName); if (existingReceiver != null) { diff --git a/sdk/eventhubs/azure-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 similarity index 85% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RequestResponseChannel.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RequestResponseChannel.java index 9295cc885f5e..4f3c5e0f70f5 100644 --- a/sdk/eventhubs/azure-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 @@ -3,9 +3,12 @@ package com.azure.messaging.eventhubs.implementation; +import com.azure.core.amqp.RetryOptions; +import com.azure.core.amqp.RetryPolicy; import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.exception.AmqpResponseCode; import com.azure.core.amqp.exception.ExceptionUtil; +import com.azure.core.amqp.implementation.RetryUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.handler.ReceiveLinkHandler; import com.azure.messaging.eventhubs.implementation.handler.SendLinkHandler; @@ -28,6 +31,7 @@ import java.io.Closeable; import java.io.IOException; +import java.time.Duration; import java.util.UUID; import java.util.concurrent.ConcurrentSkipListMap; import java.util.concurrent.atomic.AtomicBoolean; @@ -45,14 +49,19 @@ class RequestResponseChannel implements Closeable { private final Sender sendLink; private final Receiver receiveLink; private final String replyTo; + private final Duration operationTimeout; private final AtomicBoolean hasOpened = new AtomicBoolean(); private final AtomicLong requestId = new AtomicLong(0); private final SendLinkHandler sendLinkHandler; private final ReceiveLinkHandler receiveLinkHandler; private final Disposable subscription; + private final RetryPolicy retryPolicy; RequestResponseChannel(String connectionId, String host, String linkName, String path, Session session, - ReactorHandlerProvider handlerProvider) { + RetryOptions retryOptions, ReactorHandlerProvider handlerProvider) { + this.operationTimeout = retryOptions.tryTimeout(); + this.retryPolicy = RetryUtil.getRetryPolicy(retryOptions); + this.replyTo = path.replace("$", "") + "-client-reply-to"; this.sendLink = session.sender(linkName + ":sender"); final Target target = new Target(); @@ -108,22 +117,23 @@ Mono sendWithAck(final Message message, final ReactorDispatcher dispatc message.setMessageId(messageId); message.setReplyTo(replyTo); - //TODO (conniey): timeout here if we can't get the link handlers to pass an "Active" state. - return Mono.when( - sendLinkHandler.getEndpointStates().takeUntil(x -> x == EndpointState.ACTIVE), - receiveLinkHandler.getEndpointStates().takeUntil(x -> x == EndpointState.ACTIVE)).then( - Mono.create(sink -> { - try { - logger.verbose("Scheduling on dispatcher. Message Id {}", messageId); - unconfirmedSends.putIfAbsent(messageId, sink); - - dispatcher.invoke(() -> { - send(message); - }); - } catch (IOException e) { - sink.error(e); - } - })); + return RetryUtil.withRetry( + Mono.when(sendLinkHandler.getEndpointStates().takeUntil(x -> x == EndpointState.ACTIVE), + receiveLinkHandler.getEndpointStates().takeUntil(x -> x == EndpointState.ACTIVE)), + operationTimeout, retryPolicy) + .then( + Mono.create(sink -> { + try { + logger.verbose("Scheduling on dispatcher. Message Id {}", messageId); + unconfirmedSends.putIfAbsent(messageId, sink); + + dispatcher.invoke(() -> { + send(message); + }); + } catch (IOException e) { + sink.error(e); + } + })); } private void start() { diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RetriableWorkItem.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/RetriableWorkItem.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/StringUtil.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/StringUtil.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TimeoutTracker.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TimeoutTracker.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TimeoutTracker.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TimeoutTracker.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TokenResourceProvider.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/TokenResourceProvider.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandler.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandler.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/CustomIOHandler.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/CustomIOHandler.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/CustomIOHandler.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/CustomIOHandler.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/DispatchHandler.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/DispatchHandler.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/DispatchHandler.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/DispatchHandler.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/Handler.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/Handler.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/LinkHandler.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/LinkHandler.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/LinkHandler.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/LinkHandler.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ReactorHandler.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ReactorHandler.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ReactorHandler.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ReactorHandler.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ReceiveLinkHandler.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/ReceiveLinkHandler.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/SendLinkHandler.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/SendLinkHandler.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/SessionHandler.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/SessionHandler.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/WebSocketsConnectionHandler.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/WebSocketsConnectionHandler.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/WebSocketsConnectionHandler.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/WebSocketsConnectionHandler.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/package-info.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/package-info.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/package-info.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/handler/package-info.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/package-info.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/package-info.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/package-info.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/implementation/package-info.java diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/BatchOptions.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/BatchOptions.java similarity index 88% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/BatchOptions.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/BatchOptions.java index 622053df57d9..69e40d2e1f32 100644 --- a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/BatchOptions.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/BatchOptions.java @@ -1,7 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.messaging.eventhubs; +package com.azure.messaging.eventhubs.models; + +import com.azure.messaging.eventhubs.EventDataBatch; +import com.azure.messaging.eventhubs.EventHubProducer; /** * The set of options that can be specified when creating an {@link EventDataBatch}. @@ -61,7 +64,7 @@ public String partitionKey() { * @return A shallow clone of this object. */ @Override - public Object clone() { + public BatchOptions clone() { BatchOptions clone; try { clone = (BatchOptions) super.clone(); @@ -69,9 +72,7 @@ public Object clone() { clone = new BatchOptions(); } - clone.partitionKey(partitionKey); - clone.maximumSizeInBytes(maximumSizeInBytes); - - return clone; + return clone.partitionKey(partitionKey) + .maximumSizeInBytes(maximumSizeInBytes); } } diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/Checkpoint.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/Checkpoint.java new file mode 100644 index 000000000000..02e2b11f99ec --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/Checkpoint.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.models; + +import com.azure.core.implementation.annotation.Fluent; +import com.azure.messaging.eventhubs.PartitionProcessor; + +/** + * A model class to hold checkpoint data. A checkpoint represents the last successfully processed event by a {@link + * PartitionProcessor} for a particular partition of an Event Hub. + */ +@Fluent +public class Checkpoint { + + private String eventHubName; + private String consumerGroupName; + private String ownerId; + private String partitionId; + private String offset; + private long sequenceNumber; + private String eTag; + + /** + * Gets the Event Hub name associated with this checkpoint. + * + * @return The Event Hub name associated with this checkpoint. + */ + public String eventHubName() { + return eventHubName; + } + + /** + * Sets the Event Hub name associated with this checkpoint. + * + * @param eventHubName The Event Hub name associated with this checkpoint. + * @return The updated {@link Checkpoint} instance. + */ + public Checkpoint eventHubName(String eventHubName) { + this.eventHubName = eventHubName; + return this; + } + + /** + * Gets the consumer group name associated with this checkpoint. + * + * @return The consumer group name associated with this checkpoint. + */ + public String consumerGroupName() { + return consumerGroupName; + } + + /** + * Sets the consumer group name associated with this checkpoint. + * + * @param consumerGroupName The consumer group name associated with this checkpoint. + * @return The updated {@link Checkpoint} instance. + */ + public Checkpoint consumerGroupName(String consumerGroupName) { + this.consumerGroupName = consumerGroupName; + return this; + } + + /** + * Gets the partition id associated with this checkpoint. + * + * @return The partition id associated with this checkpoint. + */ + public String partitionId() { + return partitionId; + } + + /** + * Sets the partition id associated with this checkpoint. + * + * @param partitionId The partition id associated with this checkpoint. + * @return The updated {@link Checkpoint} instance. + */ + public Checkpoint partitionId(String partitionId) { + this.partitionId = partitionId; + return this; + } + + /** + * Sets the unique event processor identifier that created this checkpoint. + * + * @return The unique event processor identifier that created this checkpoint. + */ + public String ownerId() { + return ownerId; + } + + /** + * Gets the unique event processor identifier that created this checkpoint. + * + * @param ownerId The unique event processor identifier that created this checkpoint. + * @return The updated {@link Checkpoint} instance. + */ + public Checkpoint ownerId(String ownerId) { + this.ownerId = ownerId; + return this; + } + + /** + * Gets the offset of the last successfully processed event to store as checkpoint. + * + * @return The offset of the last successfully processed event to store as checkpoint. + */ + public String offset() { + return offset; + } + + /** + * Sets the offset of the last successfully processed event to store as checkpoint. + * + * @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) { + this.offset = offset; + return this; + } + + /** + * Gets the sequence number of the last successfully processed event to store as checkpoint. + * + * @return The sequence number of the last successfully processed event to store as checkpoint. + */ + public Long sequenceNumber() { + return sequenceNumber; + } + + /** + * Sets the sequence number of the last successfully processed event to store as checkpoint. + * + * @param sequenceNumber The sequence number of the last successfully processed event to store as checkpoint. + * @return The updated {@link Checkpoint} instance. + */ + public Checkpoint sequenceNumber(Long sequenceNumber) { + this.sequenceNumber = sequenceNumber; + return this; + } + + /** + * Gets the ETag that will be used to verify before updating the checkpoint. + * + * @return The unique identifier that was generated by last known successful update. + */ + public String eTag() { + return eTag; + } + + /** + * Sets the ETag that will be used by the checkpoint store to verify before updating the checkpoint. If the ETag in + * store does not match with this ETag, the checkpoint update is expected to fail. + * + * @param eTag The unique identifier that was generated by last known successful update. + * @return The updated {@link Checkpoint} instance. + */ + public Checkpoint eTag(String eTag) { + this.eTag = eTag; + return this; + } +} diff --git a/sdk/eventhubs/azure-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 similarity index 90% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptions.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptions.java index 3a751739c689..1b05c056f3d3 100644 --- a/sdk/eventhubs/azure-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 @@ -3,10 +3,9 @@ package com.azure.messaging.eventhubs.models; -import com.azure.core.amqp.Retry; +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.EventHubConsumer; import reactor.core.scheduler.Scheduler; @@ -23,8 +22,6 @@ */ @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 EventHubConsumer}. */ @@ -43,7 +40,7 @@ public class EventHubConsumerOptions implements Cloneable { private String identifier; private Long ownerLevel; - private Retry retry; + private RetryOptions retry; private Scheduler scheduler; private int prefetchCount; @@ -106,7 +103,7 @@ public EventHubConsumerOptions ownerLevel(Long priority) { * @param retry The retry policy to use when receiving events. * @return The updated {@link EventHubConsumerOptions} object. */ - public EventHubConsumerOptions retry(Retry retry) { + public EventHubConsumerOptions retry(RetryOptions retry) { this.retry = retry; return this; } @@ -158,12 +155,12 @@ public String identifier() { } /** - * Gets the retry policy when receiving events. If not specified, the retry policy configured on the associated + * Gets the retry options when receiving events. If not specified, the retry options configured on the associated * {@link EventHubAsyncClient} is used. * - * @return The retry policy when receiving events. + * @return The retry options when receiving events. */ - public Retry retry() { + public RetryOptions retry() { return retry; } @@ -204,6 +201,7 @@ public int prefetchCount() { * * @return A shallow clone of this object. */ + @Override public EventHubConsumerOptions clone() { EventHubConsumerOptions clone; try { @@ -212,20 +210,15 @@ public EventHubConsumerOptions clone() { clone = new EventHubConsumerOptions(); } + clone.scheduler(this.scheduler()) + .identifier(this.identifier()) + .prefetchCount(this.prefetchCount()) + .ownerLevel(this.ownerLevel()); + if (retry != null) { - try { - clone.retry((Retry) retry.clone()); - } catch (CloneNotSupportedException e) { - logger.error("Unable to create clone of retry.", e); - clone.retry(retry); - } + clone.retry(retry.clone()); } - clone.scheduler(this.scheduler()); - clone.identifier(this.identifier()); - clone.prefetchCount(this.prefetchCount()); - clone.ownerLevel(this.ownerLevel()); - return clone; } } diff --git a/sdk/eventhubs/azure-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 similarity index 56% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubProducerOptions.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventHubProducerOptions.java index b23c1f581e1b..2c91ad42da69 100644 --- a/sdk/eventhubs/azure-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 @@ -3,14 +3,11 @@ package com.azure.messaging.eventhubs.models; -import com.azure.core.amqp.Retry; +import com.azure.core.amqp.RetryOptions; import com.azure.core.implementation.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.EventHubAsyncClient; import com.azure.messaging.eventhubs.EventHubProducer; -import java.time.Duration; - /** * The set of options that can be specified when creating an {@link EventHubProducer} to configure its behavior. * @@ -19,11 +16,8 @@ */ @Fluent public class EventHubProducerOptions implements Cloneable { - private final ClientLogger logger = new ClientLogger(EventHubProducerOptions.class); - private String partitionId; - private Retry retry; - private Duration timeout; + private RetryOptions retryOptions; /** * Sets the identifier of the Event Hub partition that the {@link EventHubProducer} will be bound to, limiting it to @@ -43,36 +37,24 @@ public EventHubProducerOptions partitionId(String partitionId) { } /** - * Sets the retry policy used to govern retry attempts when an issue is encountered while sending. + * Sets the retry options used to govern retry attempts when an issue is encountered while sending. * - * @param retry The retry policy used to govern retry attempts when an issue is encountered while sending. + * @param retry The retry options used to govern retry attempts when an issue is encountered while sending. * @return The updated SenderOptions object. */ - public EventHubProducerOptions retry(Retry retry) { - this.retry = retry; - return this; - } - - /** - * Sets the default timeout to apply when sending events. If the timeout is reached, before the Event Hub - * acknowledges receipt of the event data being sent, the attempt will be considered failed and will be retried. - * - * @param timeout The timeout to apply when sending events. - * @return The updated {@link EventHubProducerOptions} object. - */ - public EventHubProducerOptions timeout(Duration timeout) { - this.timeout = timeout; + public EventHubProducerOptions retry(RetryOptions retry) { + this.retryOptions = retry; return this; } /** - * Gets the retry policy used to govern retry attempts when an issue is encountered while sending. + * Gets the retry options used to govern retry attempts when an issue is encountered while sending. * - * @return the retry policy used to govern retry attempts when an issue is encountered while sending. If {@code - * null}, then the retry policy 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 Retry retry() { - return retry; + public RetryOptions retry() { + return retryOptions; } /** @@ -88,22 +70,13 @@ public String partitionId() { return partitionId; } - /** - * Gets the default timeout when sending events. - * - * @return The default timeout when sending events. - */ - public Duration timeout() { - return timeout; - } - /** * Creates a clone of this instance. * * @return A shallow clone of this object. */ @Override - public Object clone() { + public EventHubProducerOptions clone() { EventHubProducerOptions clone; try { clone = (EventHubProducerOptions) super.clone(); @@ -111,17 +84,11 @@ public Object clone() { clone = new EventHubProducerOptions(); } - if (retry != null) { - try { - clone.retry((Retry) retry.clone()); - } catch (CloneNotSupportedException e) { - logger.error("Unable to create clone of retry.", e); - clone.retry(retry); - } - } - clone.partitionId(partitionId); - clone.timeout(timeout); + + if (retryOptions != null) { + clone.retry(retryOptions.clone()); + } return clone; } diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/EventPosition.java 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 new file mode 100644 index 000000000000..a83937928368 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/PartitionContext.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.models; + +import com.azure.core.implementation.annotation.Immutable; +import com.azure.messaging.eventhubs.PartitionProcessor; +import java.util.Objects; + +/** + * A model class to contain partition information that will be provided to each instance of {@link PartitionProcessor}. + */ +@Immutable +public class PartitionContext { + + private String partitionId; + private String eventHubName; + private String consumerGroupName; + + /** + * Creates an immutable instance containing the information for processing a partition. + * + * @param partitionId The partition id. + * @param eventHubName The Event Hub name. + * @param consumerGroupName The consumer group name. + */ + public PartitionContext(String partitionId, String eventHubName, String consumerGroupName) { + 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"); + } + + /** + * Gets the partition id associated to an instance of {@link PartitionProcessor}. + * + * @return The partition id associated to an instance of {@link PartitionProcessor}. + */ + public String partitionId() { + return partitionId; + } + + /** + * Gets the Event Hub name associated to an instance of {@link PartitionProcessor}. + * + * @return The Event Hub name associated to an instance of {@link PartitionProcessor}. + */ + public String eventHubName() { + return eventHubName; + } + + /** + * Gets the consumer group name associated to an instance of {@link PartitionProcessor}. + * + * @return The consumer group name associated to an instance of {@link PartitionProcessor}. + */ + public String consumerGroupName() { + return consumerGroupName; + } +} 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 new file mode 100644 index 000000000000..d2f54b75f375 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/PartitionOwnership.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs.models; + +import com.azure.core.implementation.annotation.Fluent; +import java.util.Objects; + +/** + * A model class to hold partition ownership information. + */ +@Fluent +public class PartitionOwnership { + + private String eventHubName; + private String consumerGroupName; + private String partitionId; + private String ownerId; + private long ownerLevel; + private String offset; + private Long sequenceNumber; + private Long lastModifiedTime; + private String eTag; + + /** + * Gets the Event Hub name associated with this ownership record. + * + * @return The Event Hub name associated with this ownership record. + */ + public String eventHubName() { + return eventHubName; + } + + /** + * Sets the Event Hub name associated with this ownership record. + * + * @param eventHubName The Event Hub name associated with this ownership record. + * @return The updated {@link PartitionOwnership} instance. + */ + public PartitionOwnership eventHubName(String eventHubName) { + this.eventHubName = Objects.requireNonNull(eventHubName, "eventHubName cannot be null"); + return this; + } + + /** + * Gets the consumer group name associated with this ownership record. + * + * @return The consumer group name associated with this ownership record. + */ + public String consumerGroupName() { + return consumerGroupName; + } + + /** + * Sets the consumer group name associated with this ownership record. + * + * @param consumerGroupName The consumer group name associated with this ownership record. + * @return The updated {@link PartitionOwnership} instance. + */ + public PartitionOwnership consumerGroupName(String consumerGroupName) { + this.consumerGroupName = Objects.requireNonNull(consumerGroupName, "consumerGroupName cannot be null"); + return this; + } + + /** + * Gets the partition id associated with this ownership record. + * + * @return The partition id associated with this ownership record. + */ + public String partitionId() { + return partitionId; + } + + /** + * Sets the partition id associated with this ownership record. + * + * @param partitionId The partition id associated with this ownership record. + * @return The updated {@link PartitionOwnership} instance. + */ + public PartitionOwnership partitionId(String partitionId) { + this.partitionId = Objects.requireNonNull(partitionId, "partitionId cannot be null"); + return this; + } + + /** + * Sets the unique event processor identifier as the owner of the partition id in this ownership record. + * + * @return The unique event processor identifier as the owner of the partition id in this ownership record. + */ + public String ownerId() { + return ownerId; + } + + /** + * Returns the unique event processor identifier that owns the partition id in this ownership record. + * + * @param ownerId The unique event processor identifier that owns the partition id in this ownership record. + * @return The updated {@link PartitionOwnership} instance. + */ + public PartitionOwnership ownerId(String ownerId) { + this.ownerId = Objects.requireNonNull(ownerId, "ownerId cannot be null"); + return this; + } + + /** + * Gets the owner level (aka epoch number) for the event processor identified by {@link #ownerId() this instance}. + * + * @return The owner level (aka epoch number) for the event processor identified by {@link #ownerId() this instance}. + */ + public long ownerLevel() { + return 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}. + * @return The updated {@link PartitionOwnership} instance. + */ + public PartitionOwnership ownerLevel(long ownerLevel) { + this.ownerLevel = ownerLevel; + return this; + } + + /** + * Gets the offset that serves as checkpoint for the partition id in this ownership record. + * + * @return The offset that serves as checkpoint for the partition id in this ownership record. + */ + public String offset() { + return offset; + } + + /** + * Sets the offset that serves as checkpoint for the partition id in this ownership record. + * + * @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) { + this.offset = offset; + return this; + } + + /** + * Gets the sequence number that serves as checkpoint for the partition id in this ownership record. + * + * @return The sequence number that serves as checkpoint for the partition id in this ownership record. + */ + public Long sequenceNumber() { + return sequenceNumber; + } + + /** + * Sets the sequence number that serves as checkpoint for the partition id in this ownership record. + * + * @param sequenceNumber The sequence number that serves as checkpoint for the partition id in this ownership record. + * @return The updated {@link PartitionOwnership} instance. + */ + public PartitionOwnership sequenceNumber(Long sequenceNumber) { + this.sequenceNumber = sequenceNumber; + return this; + } + + /** + * Gets the last modified time of this ownership record as epoch millis. + * + * @return The last modified time of this ownership record as epoch millis. + */ + public Long lastModifiedTime() { + return lastModifiedTime; + } + + /** + * Sets the last modified time of this ownership record as epoch millis. + * + * @param lastModifiedTime The last modified time of this ownership record as epoch millis. + * @return The updated {@link PartitionOwnership} instance. + */ + public PartitionOwnership lastModifiedTime(Long lastModifiedTime) { + this.lastModifiedTime = lastModifiedTime; + return this; + } + + /** + * Gets the ETag that was generated by the last known successful update to the partition ownership record. An ETag is + * a unique identifier * that is generated when a data record is successfully created/updated. The ETag is used to + * achieve optimistic concurrency in a distributed event processor setup. When multiple instances of event processor + * try to update the same partition ownership record, ETag is used to verify that the last values read by the instance + * requesting the update is still the latest ETag for this record. If the ETag in the store does not match the ETag in + * the update request, then the update is expected to fail as there was an update since the last time an event + * processor read this record. + * + * @return The eTag for this ownership record. + */ + public String eTag() { + return eTag; + } + + /** + * Sets the ETag with the last known successful update to partition ownership record. An ETag is a unique identifier + * that is generated when a data record is successfully created/updated. This 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. + * + * @param eTag The eTag for this ownership record. + * @return The updated {@link PartitionOwnership} instance. + */ + public PartitionOwnership eTag(String eTag) { + this.eTag = eTag; + return this; + } +} diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyAuthenticationType.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyAuthenticationType.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyAuthenticationType.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyAuthenticationType.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyConfiguration.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/ProxyConfiguration.java diff --git a/sdk/eventhubs/azure-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 similarity index 92% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/SendOptions.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/SendOptions.java index 5af97b9502b4..b9a1e278da81 100644 --- a/sdk/eventhubs/azure-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 @@ -4,8 +4,9 @@ package com.azure.messaging.eventhubs.models; import com.azure.core.implementation.annotation.Fluent; +import com.azure.messaging.eventhubs.EventData; import com.azure.messaging.eventhubs.EventHubProducer; -import org.reactivestreams.Publisher; +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 @@ -13,7 +14,7 @@ * * @see EventHubProducer#send(EventData, SendOptions) * @see EventHubProducer#send(Iterable, SendOptions) - * @see EventHubProducer#send(Publisher, SendOptions) + * @see EventHubProducer#send(Flux, SendOptions) */ @Fluent public class SendOptions implements Cloneable { @@ -56,7 +57,7 @@ public String partitionKey() { * @return A shallow clone of this object. */ @Override - public Object clone() { + public SendOptions clone() { SendOptions clone; try { clone = (SendOptions) super.clone(); @@ -64,8 +65,6 @@ public Object clone() { clone = new SendOptions(); } - clone.partitionKey(partitionKey); - - return clone; + return clone.partitionKey(partitionKey); } } diff --git a/sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/package-info.java b/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/package-info.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/package-info.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/models/package-info.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/main/java/com/azure/messaging/eventhubs/package-info.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/package-info.java diff --git a/sdk/eventhubs/azure-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 similarity index 99% rename from sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEvent.java index 49afe187916d..a1e501160f73 100644 --- a/sdk/eventhubs/azure-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 @@ -38,7 +38,7 @@ public static void main(String[] args) throws InterruptedException, IOException // 2. Creating an Event Hub instance. // 3. Creating a "Shared access policy" for your Event Hub instance. // 4. Copying the connection string from the policy's properties. - String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubPath}"; + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; // Instantiate a client that will be used to call the service. EventHubAsyncClient client = new EventHubClientBuilder() diff --git a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEventsFromKnownSequenceNumberPosition.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEventsFromKnownSequenceNumberPosition.java similarity index 99% rename from sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEventsFromKnownSequenceNumberPosition.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEventsFromKnownSequenceNumberPosition.java index 0d09760442e4..91822c13fb75 100644 --- a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEventsFromKnownSequenceNumberPosition.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/ConsumeEventsFromKnownSequenceNumberPosition.java @@ -37,7 +37,7 @@ public static void main(String[] args) throws InterruptedException, IOException // 2. Creating an Event Hub instance. // 3. Creating a "Shared access policy" for your Event Hub instance. // 4. Copying the connection string from the policy's properties. - String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubPath}"; + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; // Instantiate a client that will be used to call the service. EventHubAsyncClient client = new EventHubClientBuilder() diff --git a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventDataJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventDataJavaDocCodeSamples.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventDataJavaDocCodeSamples.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventDataJavaDocCodeSamples.java diff --git a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientBuilderJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientBuilderJavaDocCodeSamples.java similarity index 88% rename from sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientBuilderJavaDocCodeSamples.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientBuilderJavaDocCodeSamples.java index e9c8a26a9d0f..06fbd8df1297 100644 --- a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientBuilderJavaDocCodeSamples.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubClientBuilderJavaDocCodeSamples.java @@ -3,7 +3,7 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.Retry; +import com.azure.core.amqp.RetryOptions; import reactor.core.scheduler.Schedulers; import java.time.Duration; @@ -19,11 +19,11 @@ public class EventHubClientBuilderJavaDocCodeSamples { public void instantiation() { // BEGIN: com.azure.messaging.eventhubs.eventhubclientbuilder.connectionString#string-string String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" - + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubPath}"; - String eventHubPath = "my-event-hub"; + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + String eventHubName = "my-event-hub"; EventHubAsyncClient client = new EventHubClientBuilder() - .connectionString(connectionString, eventHubPath) + .connectionString(connectionString, eventHubName) .buildAsyncClient(); // END: com.azure.messaging.eventhubs.eventhubclientbuilder.connectionString#string-string @@ -36,7 +36,7 @@ public void instantiation() { public void instantiationInstance() { // BEGIN: com.azure.messaging.eventhubs.eventhubclientbuilder.connectionstring#string String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" - + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubPath}"; + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; EventHubAsyncClient client = new EventHubClientBuilder() .connectionString(connectionString) @@ -52,12 +52,13 @@ public void instantiationInstance() { public void instantiationRetry() { // BEGIN: com.azure.messaging.eventhubs.eventhubclientbuilder.retry-timeout-scheduler String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" - + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubPath}"; + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + RetryOptions retryOptions = new RetryOptions() + .tryTimeout(Duration.ofSeconds(30)); EventHubAsyncClient client = new EventHubClientBuilder() .connectionString(connectionString) - .retry(Retry.getNoRetry()) - .timeout(Duration.ofSeconds(30)) + .retry(retryOptions) .scheduler(Schedulers.newElastic("dedicated-event-hub-scheduler")) .buildAsyncClient(); // END: com.azure.messaging.eventhubs.eventhubclientbuilder.retry-timeout-scheduler diff --git a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubConsumerJavaDocCodeSamples.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubConsumerJavaDocCodeSamples.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubConsumerJavaDocCodeSamples.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubConsumerJavaDocCodeSamples.java diff --git a/sdk/eventhubs/azure-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 similarity index 95% rename from sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerJavaDocCodeSamples.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventHubProducerJavaDocCodeSamples.java index 1b68c477b21b..2b690c00b41f 100644 --- a/sdk/eventhubs/azure-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 @@ -3,6 +3,8 @@ 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 reactor.core.publisher.Flux; @@ -43,9 +45,11 @@ public void instantiate() throws IOException { */ public void instantiatePartitionProducer() throws IOException { // BEGIN: com.azure.messaging.eventhubs.eventhubproducer.instantiatePartitionProducer + RetryOptions retryOptions = new RetryOptions() + .tryTimeout(Duration.ofSeconds(45)); EventHubProducerOptions options = new EventHubProducerOptions() .partitionId("foo") - .timeout(Duration.ofSeconds(45)); + .retry(retryOptions); EventHubProducer producer = client.createProducer(options); // END: com.azure.messaging.eventhubs.eventhubproducer.instantiatePartitionProducer 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 new file mode 100644 index 000000000000..b2923eae52e3 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorJavaDocCodeSamples.java @@ -0,0 +1,110 @@ +// 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.models.PartitionContext; +import reactor.core.publisher.Mono; + +/** + * Code snippets for {@link EventProcessor}. + */ +public final class EventProcessorJavaDocCodeSamples { + + /** + * Code snippet for showing how to create a new instance of {@link EventProcessor}. + * + * @return An instance of {@link EventProcessor}. + */ + public EventProcessor createInstance() { + // BEGIN: com.azure.messaging.eventhubs.eventprocessor.instantiation + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + EventProcessor eventProcessor = new EventHubClientBuilder() + .connectionString(connectionString) + .partitionProcessorFactory((PartitionProcessorImpl::new)) + .consumerGroupName("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 new file mode 100644 index 000000000000..6cce5f64b134 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/EventProcessorSample.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import java.util.concurrent.TimeUnit; + +/** + * Sample code to demonstrate how a customer might use {@link EventProcessor}. + */ +public class EventProcessorSample { + + private static final String EH_CONNECTION_STRING = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + + /** + * Main method to demonstrate starting and stopping a {@link EventProcessor}. + * + * @param args The input arguments to this executable. + * @throws Exception If there are any errors while running the {@link EventProcessor}. + */ + public static void main(String[] args) throws Exception { + EventHubClientBuilder eventHubClientBuilder = new EventHubClientBuilder() + .connectionString(EH_CONNECTION_STRING) + .consumerGroupName(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME) + .partitionProcessorFactory(LogPartitionProcessor::new) + .partitionManager(new InMemoryPartitionManager()); + + EventProcessor eventProcessor = eventHubClientBuilder.buildEventProcessor(); + System.out.println("Starting event processor"); + eventProcessor.start(); + eventProcessor.start(); // should be a no-op + + // do other stuff + Thread.sleep(TimeUnit.MINUTES.toMillis(1)); + + System.out.println("Stopping event processor"); + eventProcessor.stop(); + + Thread.sleep(TimeUnit.SECONDS.toMillis(40)); + System.out.println("Starting a new instance of event processor"); + eventProcessor = eventHubClientBuilder.buildEventProcessor(); + eventProcessor.start(); + // do other stuff + Thread.sleep(TimeUnit.MINUTES.toMillis(1)); + System.out.println("Stopping event processor"); + eventProcessor.stop(); + System.out.println("Exiting process"); + } +} diff --git a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/GetEventHubMetadata.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/GetEventHubMetadata.java similarity index 96% rename from sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/GetEventHubMetadata.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/GetEventHubMetadata.java index 043c2f3434a2..35a3a72cb673 100644 --- a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/GetEventHubMetadata.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/GetEventHubMetadata.java @@ -22,7 +22,7 @@ public static void main(String[] args) throws InterruptedException { // 2. Creating an Event Hub instance. // 3. Creating a "Shared access policy" for your Event Hub instance. // 4. Copying the connection string from the policy's properties. - String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubPath}"; + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; // Instantiate a client that will be used to call the service. EventHubAsyncClient client = new EventHubClientBuilder() @@ -40,7 +40,7 @@ public static void main(String[] args) throws InterruptedException { System.out.printf( "Event Hub Name: %s; Partition Id: %s; Is partition empty? %s; First Sequence Number: %s; " + "Last Enqueued Time: %s; Last Enqueued Sequence Number: %s; Last Enqueued Offset: %s", - properties.eventHubPath(), properties.id(), properties.isEmpty(), + properties.eventHubName(), properties.id(), properties.isEmpty(), properties.beginningSequenceNumber(), properties.lastEnqueuedTime(), properties.lastEnqueuedSequenceNumber(), 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 new file mode 100644 index 000000000000..e5747d55d577 --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/LogPartitionProcessor.java @@ -0,0 +1,91 @@ +// 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 org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import reactor.core.publisher.Mono; + +/** + * A sample implementation of {@link PartitionProcessor}. This implementation logs the APIs that were called by {@link + * EventProcessor} while processing a partition. + */ +public class LogPartitionProcessor implements 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} + * + * @param eventData {@link EventData} received from this partition. + * @return a representation of the deferred computation of this call. + */ + @Override + public Mono processEvent(EventData eventData) { + logger.info( + "Processing event: Event Hub name = {}; consumer group name = {}; partition id = {}; sequence number = {}", + partitionContext.eventHubName(), partitionContext.consumerGroupName(), partitionContext.partitionId(), + eventData.sequenceNumber()); + return this.checkpointManager.updateCheckpoint(eventData); + } + + /** + * {@inheritDoc} + * + * @param throwable The {@link Throwable} that caused this method to be called. + */ + @Override + public void processError(Throwable throwable) { + logger + .warn("Processing error: Event Hub name = {}; consumer group name = {}; partition id = {}; throwable = {}", + partitionContext.eventHubName(), partitionContext.consumerGroupName(), partitionContext.partitionId(), + throwable.getMessage()); + } + + /** + * {@inheritDoc} + * + * @param closeReason The reason for closing this partition processor. + * @return a representation of the deferred computation of this call. + */ + @Override + public Mono close(CloseReason closeReason) { + logger.info( + "Closing partition processor: Event Hub name = {}; consumer group name = {}; partition id = {}; closeReason = {}", + partitionContext.eventHubName(), partitionContext.consumerGroupName(), partitionContext.partitionId(), + closeReason); + return Mono.empty(); + } +} diff --git a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEvent.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEvent.java similarity index 98% rename from sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEvent.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEvent.java index c0220ae09b5d..e5fd1adf5020 100644 --- a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEvent.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEvent.java @@ -23,7 +23,7 @@ public static void main(String[] args) { // 2. Creating an Event Hub instance. // 3. Creating a "Shared access policy" for your Event Hub instance. // 4. Copying the connection string from the policy's properties. - String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubPath}"; + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; // Instantiate a client that will be used to call the service. EventHubAsyncClient client = new EventHubClientBuilder() diff --git a/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventDataBatch.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventDataBatch.java new file mode 100644 index 000000000000..6ab2c414cf4b --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventDataBatch.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.messaging.eventhubs; + +import com.azure.messaging.eventhubs.models.BatchOptions; +import reactor.core.publisher.Flux; + +import java.io.IOException; +import java.util.concurrent.atomic.AtomicReference; + +import static java.nio.charset.StandardCharsets.UTF_8; + +/** + * Sample demonstrates how to send an {@link EventDataBatch} to an Azure Event Hub. + */ +public class PublishEventDataBatch { + /** + * Main method to invoke this demo on how to send an {@link EventDataBatch} to an Azure Event Hub. + * + * @param args Unused arguments to the program. + */ + public static void main(String[] args) { + Flux telemetryEvents = Flux.just( + new EventData("Roast beef".getBytes(UTF_8)), + new EventData("Cheese".getBytes(UTF_8)), + new EventData("Tofu".getBytes(UTF_8)), + new EventData("Turkey".getBytes(UTF_8))); + + // The connection string value can be obtained by: + // 1. Going to your Event Hubs namespace in Azure Portal. + // 2. Creating an Event Hub instance. + // 3. Creating a "Shared access policy" for your Event Hub instance. + // 4. Copying the connection string from the policy's properties. + final String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};" + + "SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; + + // Instantiate a client that will be used to call the service. + final EventHubAsyncClient client = new EventHubClientBuilder() + .connectionString(connectionString) + .buildAsyncClient(); + + // Create a producer. This overload of `createProducer` does not accept any arguments. Consequently, events + // sent from this producer are load balanced between all available partitions in the Event Hub instance. + final EventHubProducer producer = client.createProducer(); + + // Creating a batch where we want the events ending up in the same partition by setting the partition key. + final BatchOptions options = new BatchOptions() + .partitionKey("sandwiches") + .maximumSizeInBytes(256); + final AtomicReference currentBatch = new AtomicReference<>( + producer.createBatch(options).block()); + + // The sample Flux contains three events, but it could be an infinite stream of telemetry events. + telemetryEvents.subscribe(event -> { + final EventDataBatch batch = currentBatch.get(); + if (!batch.tryAdd(event)) { + producer.createBatch(options).map(newBatch -> { + currentBatch.set(newBatch); + return producer.send(batch); + }).block(); + } + }, error -> System.err.println("Error received:" + error), + () -> { + final EventDataBatch batch = currentBatch.getAndSet(null); + if (batch != null) { + producer.send(batch).block(); + } + + // Disposing of our producer and client. + try { + producer.close(); + } catch (IOException e) { + System.err.println("Error encountered while closing producer: " + e.toString()); + } + + client.close(); + }); + } +} diff --git a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java similarity index 99% rename from sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java index a5350f73288b..6a21e47592bc 100644 --- a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsToSpecificPartition.java @@ -29,7 +29,7 @@ public static void main(String[] args) { // 2. Creating an Event Hub instance. // 3. Creating a "Shared access policy" for your Event Hub instance. // 4. Copying the connection string from the policy's properties. - String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubPath}"; + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; // Instantiate a client that will be used to call the service. EventHubAsyncClient client = new EventHubClientBuilder() diff --git a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java similarity index 99% rename from sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java index a1c182706b7d..77f6a49bf1bc 100644 --- a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithCustomMetadata.java @@ -27,7 +27,7 @@ public static void main(String[] args) { // 2. Creating an Event Hub instance. // 3. Creating a "Shared access policy" for your Event Hub instance. // 4. Copying the connection string from the policy's properties. - String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubPath}"; + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; // Instantiate a client that will be used to call the service. EventHubAsyncClient client = new EventHubClientBuilder() diff --git a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java similarity index 99% rename from sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java index 6cf336cf573c..02ac1f07d5a2 100644 --- a/sdk/eventhubs/azure-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/samples/java/com/azure/messaging/eventhubs/PublishEventsWithPartitionKey.java @@ -27,7 +27,7 @@ public static void main(String[] args) { // 2. Creating an Event Hub instance. // 3. Creating a "Shared access policy" for your Event Hub instance. // 4. Copying the connection string from the policy's properties. - String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubPath}"; + String connectionString = "Endpoint={endpoint};SharedAccessKeyName={sharedAccessKeyName};SharedAccessKey={sharedAccessKey};EntityPath={eventHubName}"; // Instantiate a client that will be used to call the service. EventHubAsyncClient client = new EventHubClientBuilder() diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/BackCompatTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/BackCompatTest.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchIntegrationTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchIntegrationTest.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchTest.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataBatchTest.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventDataTest.java diff --git a/sdk/eventhubs/azure-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 similarity index 61% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientBuilderTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientBuilderTest.java index b8ab75b9237b..29b45f66fe9b 100644 --- a/sdk/eventhubs/azure-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 @@ -5,10 +5,11 @@ 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.Assert; import org.junit.Test; +import reactor.core.publisher.Mono; import java.net.InetSocketAddress; import java.net.Proxy; @@ -16,11 +17,13 @@ import java.net.URISyntaxException; import java.util.Locale; +import static org.junit.Assert.assertNotNull; + public class EventHubClientBuilderTest { private static final String NAMESPACE_NAME = "dummyNamespaceName"; private static final String DEFAULT_DOMAIN_NAME = "servicebus.windows.net/"; - private static final String ENTITY_PATH = "dummyEntityPath"; + 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(); @@ -29,7 +32,7 @@ public class EventHubClientBuilderTest { private static final String PROXY_PORT = "3128"; 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, ENTITY_PATH); + ENDPOINT, SHARED_ACCESS_KEY_NAME, SHARED_ACCESS_KEY, EVENT_HUB_NAME); private static final Proxy PROXY_ADDRESS = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(PROXY_HOST, Integer.parseInt(PROXY_PORT))); @Test(expected = IllegalArgumentException.class) @@ -43,7 +46,7 @@ public void defaultProxyConfigurationBuilder() { final EventHubClientBuilder builder = new EventHubClientBuilder(); final EventHubAsyncClient client = builder.connectionString(CORRECT_CONNECTION_STRING).buildAsyncClient(); - Assert.assertNotNull(client); + assertNotNull(client); } @Test @@ -59,7 +62,7 @@ public void customNoneProxyConfigurationBuilder() { .transportType(TransportType.AMQP_WEB_SOCKETS); // Assert - Assert.assertNotNull(builder.buildAsyncClient()); + assertNotNull(builder.buildAsyncClient()); } @Test(expected = IllegalArgumentException.class) @@ -74,7 +77,7 @@ public void throwsWithProxyWhenTransportTypeNotChanged() { .proxyConfiguration(proxyConfig); // Assert - Assert.assertNotNull(builder.buildAsyncClient()); + assertNotNull(builder.buildAsyncClient()); } private static URI getURI(String endpointFormat, String namespace, String domainName) { @@ -86,5 +89,47 @@ 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-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 similarity index 96% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientIntegrationTest.java index 81de57969447..4ed4cd14dc77 100644 --- a/sdk/eventhubs/azure-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 @@ -23,6 +23,7 @@ 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; @@ -30,6 +31,7 @@ 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; @@ -49,6 +51,7 @@ public static Iterable getTransportTypes() { 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; @@ -69,6 +72,8 @@ protected String testName() { @Override protected void beforeTest() { + skipIfNotRecordMode(); + final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); final ConnectionOptions connectionOptions = getConnectionOptions(); @@ -93,13 +98,11 @@ public void nullConstructor() throws NullPointerException { */ @Test public void receiveMessage() { - skipIfNotRecordMode(); - // Arrange final EventHubConsumerOptions options = new EventHubConsumerOptions() .prefetchCount(2); final EventHubConsumer consumer = client.createConsumer(DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, - EventPosition.earliest(), options); + EventPosition.fromEnqueuedTime(MESSAGES_PUSHED_INSTANT.get()), options); // Act & Assert StepVerifier.create(consumer.receive().filter(x -> isMatchingEvent(x, MESSAGE_TRACKING_VALUE)).take(NUMBER_OF_EVENTS)) @@ -192,6 +195,7 @@ private void setupEventTestData(EventHubAsyncClient client) { 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-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 similarity index 88% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubClientMetadataIntegrationTest.java index 7758f5d9c0aa..4c5e6b98c065 100644 --- a/sdk/eventhubs/azure-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 @@ -3,7 +3,6 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.Retry; import com.azure.core.amqp.TransportType; import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.exception.ErrorCondition; @@ -34,7 +33,7 @@ public class EventHubClientMetadataIntegrationTest extends ApiTestBase { private final String[] expectedPartitionIds = new String[]{"0", "1"}; private EventHubAsyncClient client; private ReactorHandlerProvider handlerProvider; - private String eventHubPath; + private String eventHubName; public EventHubClientMetadataIntegrationTest() { super(new ClientLogger(EventHubClientMetadataIntegrationTest.class)); @@ -52,7 +51,7 @@ protected String testName() { protected void beforeTest() { skipIfNotRecordMode(); - eventHubPath = getConnectionOptions().eventHubPath(); + eventHubName = getConnectionOptions().eventHubName(); handlerProvider = new ReactorHandlerProvider(getReactorProvider()); client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider); } @@ -71,7 +70,7 @@ public void getEventHubProperties() { StepVerifier.create(client.getProperties()) .assertNext(properties -> { Assert.assertNotNull(properties); - Assert.assertEquals(eventHubPath, properties.path()); + Assert.assertEquals(eventHubName, properties.name()); Assert.assertEquals(expectedPartitionIds.length, properties.partitionIds().length); }).verifyComplete(); } @@ -96,7 +95,7 @@ public void getPartitionProperties() { for (String partitionId : expectedPartitionIds) { StepVerifier.create(client.getPartitionProperties(partitionId)) .assertNext(properties -> { - Assert.assertEquals(eventHubPath, properties.eventHubPath()); + Assert.assertEquals(eventHubName, properties.eventHubName()); Assert.assertEquals(partitionId, properties.id()); }) .verifyComplete(); @@ -116,8 +115,8 @@ public void getPartitionPropertiesMultipleCalls() { // Assert StepVerifier.create(partitionProperties) - .assertNext(properties -> Assert.assertEquals(eventHubPath, properties.eventHubPath())) - .assertNext(properties -> Assert.assertEquals(eventHubPath, properties.eventHubPath())) + .assertNext(properties -> Assert.assertEquals(eventHubName, properties.eventHubName())) + .assertNext(properties -> Assert.assertEquals(eventHubName, properties.eventHubName())) .verifyComplete(); } @@ -128,13 +127,13 @@ public void getPartitionPropertiesMultipleCalls() { public void getPartitionPropertiesInvalidToken() throws InvalidKeyException, NoSuchAlgorithmException { // Arrange final ConnectionStringProperties original = getConnectionStringProperties(); - final ConnectionStringProperties invalidCredentials = getCredentials(original.endpoint(), original.eventHubPath(), + final ConnectionStringProperties invalidCredentials = getCredentials(original.endpoint(), original.eventHubName(), original.sharedAccessKeyName(), "invalid-sas-key-value"); final TokenCredential badTokenProvider = new EventHubSharedAccessKeyCredential( invalidCredentials.sharedAccessKeyName(), invalidCredentials.sharedAccessKey(), TIMEOUT); final ConnectionOptions connectionOptions = new ConnectionOptions(original.endpoint().getHost(), - original.eventHubPath(), badTokenProvider, getAuthorizationType(), TIMEOUT, - TransportType.AMQP, Retry.getNoRetry(), ProxyConfiguration.SYSTEM_DEFAULTS, getConnectionOptions().scheduler()); + original.eventHubName(), badTokenProvider, getAuthorizationType(), TransportType.AMQP, RETRY_OPTIONS, + ProxyConfiguration.SYSTEM_DEFAULTS, getConnectionOptions().scheduler()); final EventHubAsyncClient client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); // Act & Assert @@ -158,8 +157,8 @@ public void getPartitionPropertiesNonExistentHub() { // Arrange final ConnectionStringProperties original = getConnectionStringProperties(); final ConnectionOptions connectionOptions = new ConnectionOptions(original.endpoint().getHost(), - "invalid-event-hub", getTokenCredential(), getAuthorizationType(), TIMEOUT, - TransportType.AMQP, Retry.getNoRetry(), ProxyConfiguration.SYSTEM_DEFAULTS, getConnectionOptions().scheduler()); + "invalid-event-hub", getTokenCredential(), getAuthorizationType(), TransportType.AMQP, + RETRY_OPTIONS, ProxyConfiguration.SYSTEM_DEFAULTS, getConnectionOptions().scheduler()); final EventHubAsyncClient client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); // Act & Assert @@ -175,10 +174,11 @@ public void getPartitionPropertiesNonExistentHub() { .verify(); } - private static ConnectionStringProperties getCredentials(URI endpoint, String eventHubPath, String sasKeyName, String sasKeyValue) { + private static ConnectionStringProperties getCredentials(URI endpoint, String eventHubName, String sasKeyName, + String sasKeyValue) { final String connectionString = String.format(Locale.ROOT, "Endpoint=%s;SharedAccessKeyName=%s;SharedAccessKey=%s;EntityPath=%s;", endpoint.toString(), - sasKeyName, sasKeyValue, eventHubPath); + sasKeyName, sasKeyValue, eventHubName); return new ConnectionStringProperties(connectionString); } diff --git a/sdk/eventhubs/azure-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 similarity index 97% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerIntegrationTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerIntegrationTest.java index 45919dc24657..c6d0a5351478 100644 --- a/sdk/eventhubs/azure-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 @@ -3,7 +3,6 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.Retry; import com.azure.core.amqp.TransportType; import com.azure.core.amqp.exception.AmqpException; import com.azure.core.util.logging.ClientLogger; @@ -74,8 +73,8 @@ protected void beforeTest() { final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); final ConnectionStringProperties properties = new ConnectionStringProperties(getConnectionString()); final ConnectionOptions connectionOptions = new ConnectionOptions(properties.endpoint().getHost(), - properties.eventHubPath(), getTokenCredential(), getAuthorizationType(), TIMEOUT, TransportType.AMQP, - Retry.getNoRetry(), ProxyConfiguration.SYSTEM_DEFAULTS, Schedulers.newElastic("test-pool")); + properties.eventHubName(), getTokenCredential(), getAuthorizationType(), TransportType.AMQP, + RETRY_OPTIONS, ProxyConfiguration.SYSTEM_DEFAULTS, Schedulers.parallel()); client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); } diff --git a/sdk/eventhubs/azure-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 similarity index 99% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubConsumerTest.java index b2190471f9db..66eeada7b47a 100644 --- a/sdk/eventhubs/azure-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 @@ -5,7 +5,7 @@ import com.azure.core.amqp.AmqpEndpointState; import com.azure.core.amqp.AmqpShutdownSignal; -import com.azure.core.amqp.Retry; +import com.azure.core.amqp.RetryOptions; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.AmqpReceiveLink; import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; @@ -87,7 +87,7 @@ public void setup() { options = new EventHubConsumerOptions() .identifier("an-identifier") .prefetchCount(PREFETCH) - .retry(Retry.getNoRetry()) + .retry(new RetryOptions()) .scheduler(Schedulers.elastic()); consumer = new EventHubConsumer(receiveLinkMono, options); } diff --git a/sdk/eventhubs/azure-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 similarity index 95% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerIntegrationTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerIntegrationTest.java index 8542a7983ff9..d11f62b4209c 100644 --- a/sdk/eventhubs/azure-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 @@ -3,13 +3,13 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.Retry; 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; @@ -48,8 +48,8 @@ protected void beforeTest() { final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); final ConnectionStringProperties properties = new ConnectionStringProperties(getConnectionString()); final ConnectionOptions connectionOptions = new ConnectionOptions(properties.endpoint().getHost(), - properties.eventHubPath(), getTokenCredential(), getAuthorizationType(), TIMEOUT, TransportType.AMQP, - Retry.getNoRetry(), ProxyConfiguration.SYSTEM_DEFAULTS, Schedulers.newSingle("single-threaded")); + properties.eventHubName(), getTokenCredential(), getAuthorizationType(), TransportType.AMQP, RETRY_OPTIONS, + ProxyConfiguration.SYSTEM_DEFAULTS, Schedulers.parallel()); client = new EventHubAsyncClient(connectionOptions, getReactorProvider(), handlerProvider); } diff --git a/sdk/eventhubs/azure-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 similarity index 94% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubProducerTest.java index f7c545aacfe1..536c16489b1f 100644 --- a/sdk/eventhubs/azure-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 @@ -3,10 +3,11 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.Retry; +import com.azure.core.amqp.RetryOptions; import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.exception.ErrorCondition; 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; @@ -76,7 +77,8 @@ public void sendMultipleMessages() { when(sendLink.send(anyList())).thenReturn(Mono.empty()); final SendOptions options = new SendOptions(); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(Retry.getNoRetry()).timeout(Duration.ofSeconds(30)); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions() + .retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); final EventHubProducer producer = new EventHubProducer(Mono.just(sendLink), producerOptions); // Act @@ -103,7 +105,8 @@ public void sendSingleMessage() { when(sendLink.send(any(Message.class))).thenReturn(Mono.empty()); final SendOptions options = new SendOptions(); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(Retry.getNoRetry()).timeout(Duration.ofSeconds(30)); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions() + .retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); final EventHubProducer producer = new EventHubProducer(Mono.just(sendLink), producerOptions); // Act @@ -132,8 +135,7 @@ public void partitionProducerCannotSendWithPartitionKey() { final SendOptions options = new SendOptions().partitionKey("Some partition key"); final EventHubProducerOptions producerOptions = new EventHubProducerOptions() - .retry(Retry.getNoRetry()) - .timeout(Duration.ofSeconds(30)) + .retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))) .partitionId("my-partition-id"); final EventHubProducer producer = new EventHubProducer(Mono.just(sendLink), producerOptions); @@ -166,7 +168,7 @@ public void sendTooManyMessages() { }); final SendOptions options = new SendOptions(); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(Retry.getNoRetry()).timeout(Duration.ofSeconds(30)); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); final EventHubProducer producer = new EventHubProducer(Mono.just(link), producerOptions); // Act & Assert @@ -199,7 +201,7 @@ public void createsEventDataBatch() { // This event will be 1025 bytes when serialized. final EventData tooLargeEvent = new EventData(new byte[maxEventPayload + 1]); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(Retry.getNoRetry()).timeout(Duration.ofSeconds(30)); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); final EventHubProducer producer = new EventHubProducer(Mono.just(link), producerOptions); // Act & Assert @@ -237,7 +239,7 @@ public void createsEventDataBatchWithPartitionKey() { // This event is 1024 bytes when serialized. final EventData event = new EventData(new byte[eventPayload]); final BatchOptions options = new BatchOptions().partitionKey("some-key"); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(Retry.getNoRetry()).timeout(Duration.ofSeconds(30)); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); final EventHubProducer producer = new EventHubProducer(Mono.just(link), producerOptions); // Act & Assert @@ -263,7 +265,7 @@ public void createEventDataBatchWhenMaxSizeIsTooBig() { // This event is 1024 bytes when serialized. final BatchOptions options = new BatchOptions().maximumSizeInBytes(batchSize); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(Retry.getNoRetry()).timeout(Duration.ofSeconds(30)); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); final EventHubProducer producer = new EventHubProducer(Mono.just(link), producerOptions); // Act & Assert @@ -296,7 +298,7 @@ public void createsEventDataBatchWithSize() { final EventData tooLargeEvent = new EventData(new byte[maxEventPayload + 1]); final BatchOptions options = new BatchOptions().maximumSizeInBytes(batchSize); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(Retry.getNoRetry()).timeout(Duration.ofSeconds(30)); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); final EventHubProducer producer = new EventHubProducer(Mono.just(link), producerOptions); // Act & Assert @@ -325,7 +327,7 @@ public void batchOptionsIsCloned() { final String originalKey = "some-key"; final BatchOptions options = new BatchOptions().partitionKey(originalKey); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(Retry.getNoRetry()).timeout(Duration.ofSeconds(30)); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); final EventHubProducer producer = new EventHubProducer(Mono.just(link), producerOptions); // Act & Assert @@ -355,7 +357,7 @@ 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(Retry.getNoRetry()).timeout(Duration.ofSeconds(30)); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); final EventHubProducer producer = new EventHubProducer(Mono.just(link), producerOptions); // Act & Assert diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPropertiesTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPropertiesTest.java similarity index 85% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPropertiesTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPropertiesTest.java index 7a0b3e852932..05e2412bf137 100644 --- a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPropertiesTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubPropertiesTest.java @@ -18,15 +18,15 @@ public class EventHubPropertiesTest { @Test public void setsProperties() { // Arrange - final String path = "Some-event-hub-path"; + final String name = "Some-event-hub-name"; final Instant instant = Instant.ofEpochSecond(145620); final String[] partitionIds = new String[]{"one-partition", "two-partition", "three-partition"}; // Act - final EventHubProperties eventHubProperties = new EventHubProperties(path, instant, partitionIds); + final EventHubProperties eventHubProperties = new EventHubProperties(name, instant, partitionIds); // Assert - Assert.assertEquals(path, eventHubProperties.path()); + Assert.assertEquals(name, eventHubProperties.name()); Assert.assertEquals(instant, eventHubProperties.createdAt()); Assert.assertEquals(partitionIds.length, eventHubProperties.partitionIds().length); @@ -43,14 +43,14 @@ public void setsProperties() { @Test public void setsPropertiesNoPartitions() { // Arrange - final String path = "Some-event-hub-path"; + final String name = "Some-event-hub-name"; final Instant instant = Instant.ofEpochSecond(145620); // Act - final EventHubProperties eventHubProperties = new EventHubProperties(path, instant, null); + final EventHubProperties eventHubProperties = new EventHubProperties(name, instant, null); // Assert - Assert.assertEquals(path, eventHubProperties.path()); + Assert.assertEquals(name, eventHubProperties.name()); Assert.assertEquals(instant, eventHubProperties.createdAt()); Assert.assertNotNull(eventHubProperties.partitionIds()); Assert.assertEquals(0, eventHubProperties.partitionIds().length); diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredentialTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventHubSharedAccessKeyCredentialTest.java diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventPositionIntegrationTest.java 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 new file mode 100644 index 000000000000..f38ae353b97d --- /dev/null +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/EventProcessorTest.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.messaging.eventhubs; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.atLeast; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import com.azure.messaging.eventhubs.models.EventHubConsumerOptions; +import com.azure.messaging.eventhubs.models.EventPosition; +import com.azure.messaging.eventhubs.models.PartitionContext; +import java.util.concurrent.TimeUnit; +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; +import reactor.test.StepVerifier; + +/** + * Unit tests for {@link EventProcessor}. + */ +public class EventProcessorTest { + + @Mock + private EventHubAsyncClient eventHubAsyncClient; + + @Mock + private EventHubConsumer consumer1, consumer2, consumer3; + + @Mock + private EventData eventData1, eventData2, eventData3, eventData4; + + @Before + public void setup() { + MockitoAnnotations.initMocks(this); + } + + /** + * Tests all the happy cases for {@link EventProcessor}. + * + * @throws Exception if an error occurs while running the test. + */ + @Test + public void testWithSimplePartitionProcessor() throws Exception { + // Arrange + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.just("1")); + when(eventHubAsyncClient + .createConsumer(anyString(), anyString(), any(EventPosition.class), any(EventHubConsumerOptions.class))) + .thenReturn(consumer1); + when(consumer1.receive()).thenReturn(Flux.just(eventData1, eventData2)); + when(eventData1.sequenceNumber()).thenReturn(1L); + when(eventData2.sequenceNumber()).thenReturn(2L); + when(eventData1.offset()).thenReturn("1"); + when(eventData2.offset()).thenReturn("100"); + + final TestPartitionProcessor testPartitionProcessor = new TestPartitionProcessor(); + final InMemoryPartitionManager partitionManager = new InMemoryPartitionManager(); + + 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"); + eventProcessor.start(); + Thread.sleep(TimeUnit.SECONDS.toMillis(2)); + 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(); + + StepVerifier.create(partitionManager.listOwnership("test-eh", "test-consumer")) + .assertNext(partitionOwnership -> { + assertEquals("Partition", "1", partitionOwnership.partitionId()); + assertEquals("Consumer", "test-consumer", partitionOwnership.consumerGroupName()); + assertEquals("EventHub name", "test-eh", partitionOwnership.eventHubName()); + assertEquals("Sequence number", 2, (long) partitionOwnership.sequenceNumber()); + assertEquals("Offset", "100", partitionOwnership.offset()); + assertEquals("OwnerId", eventProcessor.identifier(), partitionOwnership.ownerId()); + assertTrue("LastModifiedTime", partitionOwnership.lastModifiedTime() >= beforeTest); + assertTrue("LastModifiedTime", partitionOwnership.lastModifiedTime() <= System.currentTimeMillis()); + assertNotNull(partitionOwnership.eTag()); + }).verifyComplete(); + + verify(eventHubAsyncClient, atLeastOnce()).getPartitionIds(); + verify(eventHubAsyncClient, atLeastOnce()) + .createConsumer(anyString(), anyString(), any(EventPosition.class), any(EventHubConsumerOptions.class)); + verify(consumer1, atLeastOnce()).receive(); + verify(consumer1, atLeastOnce()).close(); + } + + /** + * 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.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(); + + // Act + final EventProcessor eventProcessor = new EventProcessor(eventHubAsyncClient, + "test-consumer", + (partitionContext, checkpointManager) -> faultyPartitionProcessor, + EventPosition.latest(), partitionManager, "test-eh"); + eventProcessor.start(); + Thread.sleep(TimeUnit.SECONDS.toMillis(2)); + eventProcessor.stop(); + + // Assert + assertTrue(faultyPartitionProcessor.error); + } + + /** + * Tests {@link EventProcessor} that processes events from an Event Hub configured with multiple + * partitions. + * + * @throws Exception if an error occurs while running the test. + */ + @Test + public void testWithMultiplePartitions() throws Exception { + // Arrange + when(eventHubAsyncClient.getPartitionIds()).thenReturn(Flux.just("1", "2", "3")); + when(eventHubAsyncClient + .createConsumer(anyString(), eq("1"), any(EventPosition.class), any(EventHubConsumerOptions.class))) + .thenReturn(consumer1); + when(consumer1.receive()).thenReturn(Flux.just(eventData1, eventData2)); + when(eventData1.sequenceNumber()).thenReturn(1L); + when(eventData2.sequenceNumber()).thenReturn(2L); + when(eventData1.offset()).thenReturn("1"); + when(eventData2.offset()).thenReturn("100"); + + when(eventHubAsyncClient + .createConsumer(anyString(), eq("2"), any(EventPosition.class), any(EventHubConsumerOptions.class))) + .thenReturn(consumer2); + when(consumer2.receive()).thenReturn(Flux.just(eventData3)); + when(eventData3.sequenceNumber()).thenReturn(1L); + when(eventData3.offset()).thenReturn("1"); + + when(eventHubAsyncClient + .createConsumer(anyString(), eq("3"), any(EventPosition.class), any(EventHubConsumerOptions.class))) + .thenReturn(consumer3); + when(consumer3.receive()).thenReturn(Flux.just(eventData4)); + when(eventData4.sequenceNumber()).thenReturn(1L); + when(eventData4.offset()).thenReturn("1"); + + final InMemoryPartitionManager partitionManager = new InMemoryPartitionManager(); + // Act + final EventProcessor eventProcessor = new EventProcessor(eventHubAsyncClient, + "test-consumer", + TestPartitionProcessor::new, EventPosition.latest(), partitionManager, "test-eh"); + eventProcessor.start(); + Thread.sleep(TimeUnit.SECONDS.toMillis(2)); + eventProcessor.stop(); + + // Assert + StepVerifier.create(partitionManager.listOwnership("test-eh", "test-consumer")) + .expectNextCount(3).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(); + + verify(consumer3, atLeastOnce()).receive(); + verify(consumer3, atLeastOnce()).close(); + } + + private static final class FaultyPartitionProcessor implements PartitionProcessor { + + boolean error; + + @Override + public Mono initialize() { + return Mono.empty(); + } + + @Override + public Mono processEvent(EventData eventData) { + return Mono.error(new IllegalStateException()); + } + + @Override + public void processError(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) { + } + + @Override + public Mono close(CloseReason closeReason) { + return Mono.empty(); + } + } + +} diff --git a/sdk/eventhubs/azure-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 similarity index 98% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/InteropAmqpPropertiesTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/InteropAmqpPropertiesTest.java index c3aefcb3c4eb..41efd7a6bbcb 100644 --- a/sdk/eventhubs/azure-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 @@ -4,7 +4,7 @@ package com.azure.messaging.eventhubs; import com.azure.core.amqp.MessageConstant; -import com.azure.core.amqp.Retry; +import com.azure.core.amqp.RetryOptions; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.ApiTestBase; import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; @@ -59,7 +59,8 @@ protected void beforeTest() { final ReactorHandlerProvider handlerProvider = new ReactorHandlerProvider(getReactorProvider()); client = new EventHubAsyncClient(getConnectionOptions(), getReactorProvider(), handlerProvider); - final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID).retry(Retry.getNoRetry()).timeout(Duration.ofSeconds(30)); + final EventHubProducerOptions producerOptions = new EventHubProducerOptions().partitionId(PARTITION_ID) + .retry(new RetryOptions().tryTimeout(Duration.ofSeconds(30))); producer = client.createProducer(producerOptions); consumer = client.createConsumer(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, EventPosition.latest()); } diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPropertiesTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPropertiesTest.java similarity index 92% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPropertiesTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPropertiesTest.java index 501ec9189c82..bee7d63252fe 100644 --- a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPropertiesTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/PartitionPropertiesTest.java @@ -15,7 +15,7 @@ public class PartitionPropertiesTest { @Test public void setsProperties() { // Arrange - final String eventHub = "The event hub path"; + final String eventHub = "The event hub name"; final String id = "the partition id"; final long beginningSequence = 1235; final long endSequence = 8763; @@ -28,7 +28,7 @@ public void setsProperties() { lastEnqueuedOffset, lastEnqueuedTime, isEmpty); // Assert - Assert.assertEquals(eventHub, properties.eventHubPath()); + Assert.assertEquals(eventHub, properties.eventHubName()); Assert.assertEquals(id, properties.id()); Assert.assertEquals(beginningSequence, properties.beginningSequenceNumber()); Assert.assertEquals(endSequence, properties.lastEnqueuedSequenceNumber()); diff --git a/sdk/eventhubs/azure-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 similarity index 97% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/SetPrefetchCountTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/SetPrefetchCountTest.java index 80abf78fe0b7..4af9f36ea310 100644 --- a/sdk/eventhubs/azure-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,7 +3,6 @@ package com.azure.messaging.eventhubs; -import com.azure.core.amqp.Retry; import com.azure.core.util.logging.ClientLogger; import com.azure.messaging.eventhubs.implementation.ApiTestBase; import com.azure.messaging.eventhubs.implementation.ReactorHandlerProvider; @@ -86,7 +85,7 @@ public void setLargePrefetchCount() throws InterruptedException { final int eventCount = NUMBER_OF_EVENTS; final CountDownLatch countDownLatch = new CountDownLatch(eventCount); final EventHubConsumerOptions options = new EventHubConsumerOptions() - .retry(Retry.getDefaultRetry()) + .retry(RETRY_OPTIONS) .prefetchCount(2000); consumer = client.createConsumer(EventHubAsyncClient.DEFAULT_CONSUMER_GROUP_NAME, PARTITION_ID, @@ -153,7 +152,7 @@ private void setupEventTestData(EventHubAsyncClient client) { try { MESSAGES_PUSHED_INSTANT.set(Instant.now()); - producer.send(events).block(TIMEOUT); + producer.send(events).block(RETRY_OPTIONS.tryTimeout()); } finally { dispose(producer); } diff --git a/sdk/eventhubs/azure-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 similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/TestUtils.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/TestUtils.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ActiveClientTokenManagerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ActiveClientTokenManagerTest.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ActiveClientTokenManagerTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ActiveClientTokenManagerTest.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ApiTestBase.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ApiTestBase.java similarity index 92% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ApiTestBase.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ApiTestBase.java index d30d403d6413..f032f5db21a6 100644 --- a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ApiTestBase.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ApiTestBase.java @@ -3,7 +3,7 @@ package com.azure.messaging.eventhubs.implementation; -import com.azure.core.amqp.Retry; +import com.azure.core.amqp.RetryOptions; import com.azure.core.amqp.TransportType; import com.azure.core.credentials.TokenCredential; import com.azure.core.implementation.util.ImplUtils; @@ -36,11 +36,12 @@ */ public abstract class ApiTestBase extends TestBase { protected static final Duration TIMEOUT = Duration.ofSeconds(30); + protected static final RetryOptions RETRY_OPTIONS = new RetryOptions().tryTimeout(TIMEOUT); protected final ClientLogger logger; private static final String EVENT_HUB_CONNECTION_STRING_ENV_NAME = "AZURE_EVENTHUBS_CONNECTION_STRING"; private static final String CONNECTION_STRING = System.getenv(EVENT_HUB_CONNECTION_STRING_ENV_NAME); - private static final String TEST_CONNECTION_STRING = "Endpoint=sb://test-event-hub.servicebus.windows.net/;SharedAccessKeyName=myaccount;SharedAccessKey=ctzMq410TV3wS7upTBcunJTDLEJwMAZuFPfr0mrrA08=;EntityPath=eventhub1;"; + private static final String TEST_CONNECTION_STRING = "Endpoint=sb://test-event-hub.servicebus.windows.net/;SharedAccessKeyName=dummyaccount;SharedAccessKey=ctzMq410TV3wS7upTBcunJTDLEJwMAZuFPfr0mrrA08=;EntityPath=non-existent-hub;"; private ConnectionStringProperties properties; private Reactor reactor = mock(Reactor.class); @@ -60,7 +61,7 @@ protected ApiTestBase(ClientLogger logger) { public void setupTest() { logger.info("[{}]: Performing test set-up.", testName()); - final Scheduler scheduler = Schedulers.newElastic("AMQPConnection"); + final Scheduler scheduler = Schedulers.newParallel("AMQPConnection"); final String connectionString = getTestMode() == TestMode.RECORD ? CONNECTION_STRING : TEST_CONNECTION_STRING; @@ -86,9 +87,9 @@ public void setupTest() { reactorProvider = new MockReactorProvider(reactor, reactorDispatcher); } - connectionOptions = new ConnectionOptions(properties.endpoint().getHost(), properties.eventHubPath(), - tokenCredential, getAuthorizationType(), TIMEOUT, transportType, Retry.getNoRetry(), - ProxyConfiguration.SYSTEM_DEFAULTS, scheduler); + connectionOptions = new ConnectionOptions(properties.endpoint().getHost(), properties.eventHubName(), + tokenCredential, getAuthorizationType(), transportType, RETRY_OPTIONS, ProxyConfiguration.SYSTEM_DEFAULTS, + scheduler); beforeTest(); } diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java similarity index 93% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java index 35e5c44fe387..ec4fbd9acbef 100644 --- a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/CBSChannelTest.java @@ -5,6 +5,7 @@ import com.azure.core.amqp.AmqpConnection; import com.azure.core.amqp.CBSNode; +import com.azure.core.amqp.RetryOptions; import com.azure.core.amqp.exception.AmqpException; import com.azure.core.amqp.exception.ErrorCondition; import com.azure.core.credentials.TokenCredential; @@ -59,7 +60,7 @@ protected void beforeTest() { handlerProvider, mapper); cbsChannel = new CBSChannel(connection, getTokenCredential(), getAuthorizationType(), getReactorProvider(), - handlerProvider, Duration.ofMinutes(5)); + handlerProvider, new RetryOptions().tryTimeout(Duration.ofMinutes(5))); } @Override @@ -82,7 +83,7 @@ protected void afterTest() { @Test public void successfullyAuthorizes() { // Arrange - final String tokenAudience = tokenResourceProvider.getResourceString(credentials.eventHubPath()); + final String tokenAudience = tokenResourceProvider.getResourceString(credentials.eventHubName()); // Act & Assert StepVerifier.create(cbsChannel.authorize(tokenAudience)) @@ -95,7 +96,7 @@ public void unsuccessfulAuthorize() { skipIfNotRecordMode(); // Arrange - final String tokenAudience = tokenResourceProvider.getResourceString(credentials.eventHubPath()); + final String tokenAudience = tokenResourceProvider.getResourceString(credentials.eventHubName()); final Duration duration = Duration.ofMinutes(10); TokenCredential tokenProvider = null; @@ -106,7 +107,7 @@ public void unsuccessfulAuthorize() { } final CBSNode node = new CBSChannel(connection, tokenProvider, getAuthorizationType(), getReactorProvider(), - handlerProvider, Duration.ofMinutes(5)); + handlerProvider, new RetryOptions().tryTimeout(Duration.ofMinutes(5))); // Act & Assert StepVerifier.create(node.authorize(tokenAudience)) diff --git a/sdk/eventhubs/azure-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 similarity index 95% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ConnectionStringPropertiesTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ConnectionStringPropertiesTest.java index feca9c2332b5..ad08302d18f5 100644 --- a/sdk/eventhubs/azure-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 @@ -99,7 +99,7 @@ public void namespaceConnectionString() { Assert.assertEquals(HOST, properties.endpoint().getHost()); Assert.assertEquals(SAS_KEY, properties.sharedAccessKeyName()); Assert.assertEquals(SAS_VALUE, properties.sharedAccessKey()); - Assert.assertNull(properties.eventHubPath()); + Assert.assertNull(properties.eventHubName()); } /** @@ -117,16 +117,16 @@ public void parseConnectionString() { Assert.assertEquals(HOST, properties.endpoint().getHost()); Assert.assertEquals(SAS_KEY, properties.sharedAccessKeyName()); Assert.assertEquals(SAS_VALUE, properties.sharedAccessKey()); - Assert.assertEquals(EVENT_HUB, properties.eventHubPath()); + Assert.assertEquals(EVENT_HUB, properties.eventHubName()); } - private static String getConnectionString(String hostname, String eventHubPath, String sasKeyName, String sasKeyValue) { + private static String getConnectionString(String hostname, String eventHubName, String sasKeyName, String sasKeyValue) { final StringBuilder builder = new StringBuilder(); if (hostname != null) { builder.append(String.format(Locale.US, "Endpoint=%s;", hostname)); } - if (eventHubPath != null) { - builder.append(String.format(Locale.US, "EntityPath=%s;", eventHubPath)); + if (eventHubName != null) { + builder.append(String.format(Locale.US, "EntityPath=%s;", eventHubName)); } if (sasKeyName != null) { builder.append(String.format(Locale.US, "SharedAccessKeyName=%s;", sasKeyName)); diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EndpointStateNotifierBaseTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EndpointStateNotifierBaseTest.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EndpointStateNotifierBaseTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/EndpointStateNotifierBaseTest.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/MockReactorHandlerProvider.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/MockReactorHandlerProvider.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/MockReactorHandlerProvider.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/MockReactorHandlerProvider.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/MockReactorProvider.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/MockReactorProvider.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/MockReactorProvider.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/MockReactorProvider.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java similarity index 97% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java index 04ba78ec2fe9..e51dafd349de 100644 --- a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionIntegrationTest.java @@ -66,7 +66,7 @@ public void getCbsNodeAuthorize() { final TokenResourceProvider provider = new TokenResourceProvider(CBSAuthorizationType.SHARED_ACCESS_SIGNATURE, getConnectionStringProperties().endpoint().getHost()); - final String tokenAudience = provider.getResourceString(getConnectionStringProperties().eventHubPath()); + final String tokenAudience = provider.getResourceString(getConnectionStringProperties().eventHubName()); // Act & Assert StepVerifier.create(connection.getCBSNode().flatMap(node -> node.authorize(tokenAudience))) diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionTest.java similarity index 94% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionTest.java index e631a76f3fb9..b31dcb1a474a 100644 --- a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorConnectionTest.java @@ -5,12 +5,13 @@ import com.azure.core.amqp.AmqpConnection; import com.azure.core.amqp.AmqpEndpointState; -import com.azure.core.amqp.Retry; +import com.azure.core.amqp.RetryMode; +import com.azure.core.amqp.RetryOptions; import com.azure.core.amqp.TransportType; import com.azure.core.credentials.TokenCredential; -import com.azure.messaging.eventhubs.models.ProxyConfiguration; import com.azure.messaging.eventhubs.implementation.handler.ConnectionHandler; import com.azure.messaging.eventhubs.implementation.handler.SessionHandler; +import com.azure.messaging.eventhubs.models.ProxyConfiguration; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.transport.ErrorCondition; import org.apache.qpid.proton.engine.Connection; @@ -87,9 +88,10 @@ public void setup() throws IOException { sessionHandler = new SessionHandler(CONNECTION_ID, HOSTNAME, SESSION_NAME, reactorDispatcher, TEST_DURATION); reactorHandlerProvider = new MockReactorHandlerProvider(reactorProvider, connectionHandler, sessionHandler, null, null); + final RetryOptions retryOptions = new RetryOptions().tryTimeout(TEST_DURATION); final ConnectionOptions connectionOptions = new ConnectionOptions(CREDENTIAL_INFO.endpoint().getHost(), - CREDENTIAL_INFO.eventHubPath(), tokenProvider, CBSAuthorizationType.SHARED_ACCESS_SIGNATURE, TEST_DURATION, - TransportType.AMQP, Retry.getDefaultRetry(), ProxyConfiguration.SYSTEM_DEFAULTS, SCHEDULER); + CREDENTIAL_INFO.eventHubName(), tokenProvider, CBSAuthorizationType.SHARED_ACCESS_SIGNATURE, + TransportType.AMQP, retryOptions, ProxyConfiguration.SYSTEM_DEFAULTS, SCHEDULER); connection = new ReactorConnection(CONNECTION_ID, connectionOptions, reactorProvider, reactorHandlerProvider, responseMapper); } @@ -281,10 +283,15 @@ public void createCBSNode() { @Test public void createCBSNodeTimeoutException() { // Arrange - Duration timeout = Duration.ofSeconds(5); + Duration timeout = Duration.ofSeconds(2); + RetryOptions retryOptions = new RetryOptions() + .maxRetries(2) + .delay(Duration.ofMillis(200)) + .retryMode(RetryMode.FIXED) + .tryTimeout(timeout); ConnectionOptions parameters = new ConnectionOptions(CREDENTIAL_INFO.endpoint().getHost(), - CREDENTIAL_INFO.eventHubPath(), tokenProvider, CBSAuthorizationType.SHARED_ACCESS_SIGNATURE, timeout, - TransportType.AMQP, Retry.getDefaultRetry(), ProxyConfiguration.SYSTEM_DEFAULTS, Schedulers.elastic()); + CREDENTIAL_INFO.eventHubName(), tokenProvider, CBSAuthorizationType.SHARED_ACCESS_SIGNATURE, + TransportType.AMQP, retryOptions, ProxyConfiguration.SYSTEM_DEFAULTS, Schedulers.parallel()); // Act and Assert try (ReactorConnection connectionBad = new ReactorConnection(CONNECTION_ID, parameters, reactorProvider, reactorHandlerProvider, responseMapper)) { diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorReceiverTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorReceiverTest.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorReceiverTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorReceiverTest.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorSessionTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorSessionTest.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorSessionTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/ReactorSessionTest.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/TokenResourceProviderTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/TokenResourceProviderTest.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/TokenResourceProviderTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/TokenResourceProviderTest.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandlerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandlerTest.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandlerTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/ConnectionHandlerTest.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/DispatchHandlerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/DispatchHandlerTest.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/DispatchHandlerTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/DispatchHandlerTest.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/HandlerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/HandlerTest.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/HandlerTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/HandlerTest.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/WebSocketsConnectionHandlerTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/WebSocketsConnectionHandlerTest.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/WebSocketsConnectionHandlerTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/implementation/handler/WebSocketsConnectionHandlerTest.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/BatchOptionsTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/BatchOptionsTest.java similarity index 93% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/BatchOptionsTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/BatchOptionsTest.java index 9a1ab65b9e8a..43b3f7fb25b2 100644 --- a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/BatchOptionsTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/BatchOptionsTest.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.messaging.eventhubs; +package com.azure.messaging.eventhubs.models; import org.junit.Assert; import org.junit.Test; @@ -41,7 +41,7 @@ public void cloneIdentical() { BatchOptions options = new BatchOptions().partitionKey(partitionKey).maximumSizeInBytes(size); // Act - BatchOptions clone = (BatchOptions) options.clone(); + BatchOptions clone = options.clone(); // Assert Assert.assertNotSame(clone, options); @@ -66,7 +66,7 @@ public void cloneModifyContents() { int size = 24; BatchOptions options = new BatchOptions().partitionKey(originalPartitionKey).maximumSizeInBytes(originalSize); - BatchOptions clone = (BatchOptions) options.clone(); + BatchOptions clone = options.clone(); // Act clone.partitionKey(partitionKey) diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptionsTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptionsTest.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptionsTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubConsumerOptionsTest.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubProducerOptionsTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubProducerOptionsTest.java similarity index 57% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubProducerOptionsTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubProducerOptionsTest.java index eba44d5b987f..d91bd7bbc938 100644 --- a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubProducerOptionsTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/EventHubProducerOptionsTest.java @@ -3,8 +3,7 @@ package com.azure.messaging.eventhubs.models; -import com.azure.core.amqp.ExponentialRetry; -import com.azure.core.amqp.Retry; +import com.azure.core.amqp.RetryOptions; import org.junit.Assert; import org.junit.Test; @@ -16,22 +15,25 @@ public void cloneProperties() { // Arrange String partitionId = "my-partition-id"; Duration timeout = Duration.ofMinutes(10); - Retry retry = new ExponentialRetry(Duration.ofSeconds(20), Duration.ofSeconds(30), 3); + RetryOptions retryOptions = new RetryOptions() + .tryTimeout(timeout) + .delay(Duration.ofSeconds(20)) + .maxDelay(Duration.ofSeconds(30)) + .maxRetries(3); EventHubProducerOptions options = new EventHubProducerOptions(); options.partitionId(partitionId) - .timeout(timeout) - .retry(retry) + .retry(retryOptions) .partitionId(partitionId); // Act - EventHubProducerOptions clone = (EventHubProducerOptions) options.clone(); + EventHubProducerOptions clone = options.clone(); // Assert Assert.assertEquals(partitionId, clone.partitionId()); - Assert.assertEquals(timeout, clone.timeout()); - Assert.assertEquals(retry, clone.retry()); + Assert.assertEquals(timeout, clone.retry().tryTimeout()); + Assert.assertEquals(retryOptions, clone.retry()); - Assert.assertNotSame(retry, clone.retry()); + Assert.assertNotSame(retryOptions, clone.retry()); } } diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/ProxyConfigurationTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/ProxyConfigurationTest.java similarity index 100% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/ProxyConfigurationTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/ProxyConfigurationTest.java diff --git a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/SendOptionsTest.java b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/SendOptionsTest.java similarity index 90% rename from sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/SendOptionsTest.java rename to sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/SendOptionsTest.java index 199497e6bd64..807969dc58a4 100644 --- a/sdk/eventhubs/azure-eventhubs/src/test/java/com/azure/messaging/eventhubs/SendOptionsTest.java +++ b/sdk/eventhubs/azure-messaging-eventhubs/src/test/java/com/azure/messaging/eventhubs/models/SendOptionsTest.java @@ -1,9 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.messaging.eventhubs; +package com.azure.messaging.eventhubs.models; -import com.azure.messaging.eventhubs.models.SendOptions; import org.junit.Assert; import org.junit.Test; @@ -47,7 +46,7 @@ public void cloneIdentical() { SendOptions options = new SendOptions().partitionKey(partitionKey); // Act - SendOptions clone = (SendOptions) options.clone(); + SendOptions clone = options.clone(); // Assert Assert.assertNotSame(clone, options); @@ -67,7 +66,7 @@ public void cloneModifyContents() { String partitionKey = "A new partition key"; SendOptions options = new SendOptions().partitionKey(originalPartitionKey); - SendOptions clone = (SendOptions) options.clone(); + SendOptions clone = options.clone(); // Act clone.partitionKey(partitionKey); diff --git a/sdk/eventhubs/ci.yml b/sdk/eventhubs/ci.yml index 545d53726cac..9ecb29dd5ea3 100644 --- a/sdk/eventhubs/ci.yml +++ b/sdk/eventhubs/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/eventhubs/ @@ -13,11 +22,17 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/eventhubs/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: eventhubs \ No newline at end of file + ServiceDirectory: eventhubs + Artifacts: + - name: azure-messaging-eventhubs + safeName: azuremessagingeventhubs \ No newline at end of file diff --git a/sdk/eventhubs/pom.data.xml b/sdk/eventhubs/pom.data.xml index 563e3278b39d..29dd16eab970 100644 --- a/sdk/eventhubs/pom.data.xml +++ b/sdk/eventhubs/pom.data.xml @@ -7,7 +7,7 @@ com.azure azure-data-sdk-parent - 1.2.0 + 1.1.0 ../../pom.data.xml diff --git a/sdk/eventhubs/pom.service.xml b/sdk/eventhubs/pom.service.xml index 23edea1a17d6..f99125abb872 100644 --- a/sdk/eventhubs/pom.service.xml +++ b/sdk/eventhubs/pom.service.xml @@ -12,7 +12,9 @@ microsoft-azure-eventhubs microsoft-azure-eventhubs-eph microsoft-azure-eventhubs-extensions - ../core - azure-eventhubs + ../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 cf15b3009318..ee4d6ec67669 100644 --- a/sdk/identity/azure-identity/README.md +++ b/sdk/identity/azure-identity/README.md @@ -1,12 +1,34 @@ # Azure Identity client library for Java -The Azure Identity library provides Azure Active Directory token authentication support across the Azure SDK. It provides a set of TokenCredential implementations which can be used to construct Azure SDK clients which support AAD token authentication. - +The Azure Identity library provides Azure Active Directory token authentication support across the Azure SDK. It provides a set of TokenCredential implementations which can be used to construct Azure SDK clients which support AAD token authentication. + This library is in preview and currently supports: - - [Service principal authentication](https://docs.microsoft.com/en-us/azure/active-directory/develop/app-objects-and-service-principals) - - [Managed identity authentication](https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview) + - [Service principal authentication](https://docs.microsoft.com/azure/active-directory/develop/app-objects-and-service-principals) + - [Managed identity authentication](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/overview) + - [Device code authentication](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-device-code) + - Interactive browser authentication, based on [OAuth2 authentication code](https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-auth-code-flow) [Source code][source] | API reference documentation (Coming Soon) | [Azure Active Directory documentation][aad_doc] +## Table of contents +- [Getting started](#getting-started) + - [Adding the package to your project](#adding-the-package-to-your-project) + - [Prerequisites](#prerequisites) + - [Creating a Service Principal with the Azure CLI](#creating-a-service-principal-with-the-azure-cli) + - [Enable applications for device code flow](#enable-applications-for-device-code-flow) + - [Enable applications for interactive browser oauth 2 flow](#enable-applications-for-interactive-browser-oauth-2-flow) + - [Key concepts](#key-concepts) + - [Credentials](#credentials) + - [DefaultAzureCredential](#defaultazurecredential) + - [Environment variables](#environment-variables) +- [Examples](#examples) + - [Authenticating with `DefaultAzureCredential`](#authenticating-with-defaultazurecredential) + - [Authenticating a service principal with a client secret](#authenticating-a-service-principal-with-a-client-secret) + - [Authenticating a user account with device code flow](#authenticating-a-user-account-with-device-code-flow) + - [Chaining credentials](#chaining-credentials) +- [Troubleshooting](#troubleshooting) +- [Next steps](#next-steps) +- [Contributing](#contributing) + ## Getting started ### Adding the package to your project @@ -15,7 +37,7 @@ Maven dependency for Azure Secret Client library. Add it to your project's pom f com.azure azure-identity - 1.0.0-preview.1 + 1.0.0-preview.2 ``` @@ -42,33 +64,55 @@ Use the [Azure CLI][azure_cli] snippet below to create/get client secret credent ``` * Use the returned credentials above to set **AZURE_CLIENT_ID**(appId), **AZURE_CLIENT_SECRET**(password) and **AZURE_TENANT_ID**(tenant) [environment variables](#environment-variables). +#### Enable applications for device code flow +In order to authenticate a user through device code flow, you need to go to Azure Active Directory on Azure Portal and find you app registration and enable the following 2 configurations: + +![device code enable](./images/devicecode-enable.png) + +This will let the application authenticate, but the application still doesn't have permission to log you into Active Directory, or access resources on your behalf. Open API Permissions, and enable Microsoft Graph, and the resources you want to access, e.g., Azure Service Management, Key Vault, etc: + +![device code permissions](./images/devicecode-permissions.png) + +Note that you also need to be the admin of your tenant to grant consent to your application when you login for the first time. Also note after 2018 your Active Directory may require your application to be multi-tenant. Select "Accounts in any organizational directory" under Authentication panel (where you enabled Device Code) to make your application a multi-tenant app. + +#### Enable applications for interactive browser oauth 2 flow +You need to register an application in Azure Active Directory with permissions to login on behalf of a user to use InteractiveBrowserCredential. Follow all the steps above for device code flow to register your application to support logging you into Active Directory and access certain resources. Note the same limitations apply that an admin of your tenant must grant consent to your application before any user account can login. + +You may notice in `InteractiveBrowserCredentialBuilder`, a port number is required, and you need to add the redirect URI on this page too: + +![interactive redirect uri](./images/interactive-redirecturi.png) + +In this case, the port number is 8765. ## Key concepts ### Credentials -A credential is a class which contains or can obtain the data needed for a service client to authenticate requests. Service clients across Azure SDK accept credentials when they are constructed and use those credentials to authenticate requests to the service.Azure Identity offers a variety of credential classes in the `azure-identity` package capable of acquiring an AAD token. All of these credential classes are implementations of the `TokenCredential` abstract class in [Azure Core][azure_core_library], and can be used by any service client which can be constructed with a `TokenCredential`. +A credential is a class which contains or can obtain the data needed for a service client to authenticate requests. Service clients across Azure SDK accept credentials when they are constructed and use those credentials to authenticate requests to the service.Azure Identity offers a variety of credential classes in the `azure-identity` package capable of acquiring an AAD token. All of these credential classes are implementations of the `TokenCredential` abstract class in [Azure Core][azure_core_library], and can be used by any service client which can be constructed with a `TokenCredential`. -The credential types in Azure Identity differ in the types of AAD identities they can authenticate and how they are configured: +The credential types in Azure Identity differ in the types of AAD identities they can authenticate and how they are configured: |credential class|identity|configuration |-|-|- |`DefaultAzureCredential`|service principal or managed identity|none for managed identity; [environment variables](#environment-variables) for service principal -|`ManagedIdentityCredential`|managed identity|constructor parameters +|`ManagedIdentityCredential`|managed identity|`ManagedIdentityCredentialBuilder` |`EnvironmentCredential`|service principal|[environment variables](#environment-variables) -|`ClientSecretCredential`|service principal|constructor parameters -|`ClientCertificateCredential`|service principal|constructor parameters +|`ClientSecretCredential`|service principal|`ClientSecretCredentialBuilder` +|`ClientCertificateCredential`|service principal|`ClientCertificateCredentialBuilder` +|`DeviceCodeCredential`|user account|`DeviceCodeCredentialBuilder` +|`InteractiveBrowserCredential`|user account|`InteractiveBrowserCredentialBuilder` +|`UsernamePasswordCredential`|user account|`UsernamePasswordCredentialBuilder` Credentials can be chained together to be tried in turn until one succeeds using the `ChainedTokenCredential`; see [chaining credentials](#chaining-credentials) for details. ## DefaultAzureCredential -`DefaultAzureCredential` is appropriate for most scenarios where the application is intended to run in the Azure Cloud. This is because the `DefaultAzureCredential` determines the appropriate credential type based of the environment it is executing in. It supports authenticating both as a service principal or managed identity, and can be configured so that it will work both in a local development environment or when deployed to the cloud. +`DefaultAzureCredential` is appropriate for most scenarios where the application is intended to run in the Azure Cloud. This is because the `DefaultAzureCredential` determines the appropriate credential type based of the environment it is executing in. It supports authenticating both as a service principal or managed identity, and can be configured so that it will work both in a local development environment or when deployed to the cloud. The `DefaultAzureCredential` will first attempt to authenticate using credentials provided in the environment. In a development environment you can authenticate as a service principal with the `DefaultAzureCredential` by providing configuration in environment variables as described in the next section. If the environment configuration is not present or incomplete, the `DefaultAzureCredential` will then determine if a managed identity is available in the current environment. Authenticating as a managed identity requires no configuration, but does require platform support. See the -[managed identity documentation](https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-support-managed-identities) for more details on this. +[managed identity documentation](https://docs.microsoft.com/azure/active-directory/managed-identities-azure-resources/services-support-managed-identities) for more details on this. ## Environment variables @@ -81,17 +125,18 @@ principal authentication with these environment variables: |`AZURE_TENANT_ID`|id of the principal's Azure Active Directory tenant |`AZURE_CLIENT_SECRET`|one of the service principal's client secrets -# Examples +## Examples -## Authenticating with `DefaultAzureCredential` +### Authenticating with `DefaultAzureCredential` This example demonstrates authenticating the `SecretClient` from the [azure-keyvault-secrets][secrets_client_library] client library using the `DefaultAzureCredential`. ```java // The default credential first checks environment variables for configuration as described above. // If environment configuration is incomplete, it will try managed identity. import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.secrets.SecretClient; -DefaultAzureCredential defaultCredential = new DefaultAzureCredential(); +DefaultAzureCredential defaultCredential = new DefaultAzureCredentialBuilder().build(); // Azure SDK client builders accept the credential as a parameter @@ -102,18 +147,20 @@ SecretClient client = SecretClient.builder() ``` When executing this in a development machine you need to first [configure the environment](#environment-variables) setting the variables `AZURE_CLIENT_ID`, `AZURE_TENANT_ID` and `AZURE_CLIENT_SECRET` to the appropriate values for your service principal. -## Authenticating a service principal with a client secret +### Authenticating a service principal with a client secret This example demonstrates authenticating the `KeyClient` from the [azure-keyvault-keys][keys_client_library] client library using the `ClientSecretCredential`. ```java // using a client secret import com.azure.identity.credential.ClientSecretCredential; +import com.azure.identity.credential.ClientSecretCredentialBuilder; import com.azure.security.keyvault.keys.KeyClient; // authenticate with client secret, -ClientSecretCredential clientSecretCredential = new ClientSecretCredential() - .clientId("") - .clientSecret("") - .tenantId(""); +ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder() + .clientId("") + .clientSecret("") + .tenantId("") + .build(); KeyClient client = KeyClient.builder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") @@ -121,27 +168,51 @@ KeyClient client = KeyClient.builder() .build(); ``` -## Chaining credentials: +### Authenticating a user account with device code flow +This example demonstrates authenticating the `KeyClient` from the [azure-keyvault-keys][keys_client_library] client library using the `DeviceCodeCredential` on an IoT device. +```java +// using a client secret +import com.azure.identity.credential.DeviceCodeCredential; +import com.azure.identity.credential.DeviceCodeCredentialBuilder; +import com.azure.security.keyvault.keys.KeyClient; + +// authenticate with client secret, +DeviceCodeCredential deviceCodeCredential = new DeviceCodeCredentialBuilder() + .deviceCodeChallengeConsumer(challenge -> { + // lets user know of the challenge, e.g., display the message on an IoT device + displayMessage(challenge.message()); + }) + .build(); + +KeyClient client = KeyClient.builder() + .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") + .credential(deviceCodeCredential) + .build(); +``` + +When the challenge is displayed on the IoT device, it will contain the message "Please open the browser to {url} and type in code XXXXXXXX". When the user follows the directions and logs in on another computer, the credential will return the token to the `KeyClient`. + +### Chaining credentials The `ChainedTokenCredential` class provides the ability to link together multiple credential instances to be tried sequentially when authenticating. The following example demonstrates creating a credential which will attempt to authenticate using managed identity, and fall back to certificate authentication if a managed identity is unavailable in the current environment. This example authenticates an `EventHubClient` from the [azure-eventhubs][eventhubs_client_library] client library using the `ChainedTokenCredential`. ```java -import com.azure.identity.credential.ClientSecretCredential; -import com.azure.security.keyvault.secrets.SecretClient; - -ManagedIdentityCredential managedIdentityCredential = new ManagedIdentityCredential() - .clientId(""); +ManagedIdentityCredential managedIdentityCredential = new ManagedIdentityCredentialBuilder() + .clientId("") + .build(); -ClientSecretcredential secondServicePrincipal = new ClientSecretCredential() - .clientId("") - .clientSecret("") - .tenantId(""); +ClientSecretcredential secondServicePrincipal = new ClientSecretCredentialBuilder() + .clientId("") + .clientSecret("") + .tenantId("") + .build(); // when an access token is requested, the chain will try each // credential in order, stopping when one provides a token -ChainedTokenCredential credentialChain = new ChainedTokenCredential() - .addLast(managedIdentityCredential) - .addLast(secondServicePrincipal); +ChainedTokenCredential credentialChain = new ChainedTokenCredentialBuilder() + .addLast(managedIdentityCredential) + .addLast(secondServicePrincipal) + .build(); // the chain can be used anywhere a credential is required @@ -175,10 +246,10 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con [azure_cli]: https://docs.microsoft.com/cli/azure [azure_sub]: https://azure.microsoft.com/free/ -[source]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/identity/azure-identity -[aad_doc]: https://docs.microsoft.com/en-us/azure/active-directory/ +[source]: ./ +[aad_doc]: https://docs.microsoft.com/azure/active-directory/ [code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ -[keys_client_library]: https://github.com/Azure/azure-sdk-for-java/tree/master/keyvault/client/keys/ -[secrets_client_library]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/client/secrets/ -[eventhubs_client_library]: https://github.com/Azure/azure-sdk-for-java/tree/master/eventhubs/client/ -[azure_core_library]: https://github.com/Azure/azure-sdk-for-java/tree/master/core/ +[keys_client_library]: ../../keyvault/azure-keyvault-keys +[secrets_client_library]: ../../keyvault/azure-keyvault-secrets +[eventhubs_client_library]: ../../eventhubs/azure-messaging-eventhubs +[azure_core_library]: ../../core diff --git a/sdk/identity/azure-identity/images/devicecode-enable.png b/sdk/identity/azure-identity/images/devicecode-enable.png new file mode 100644 index 000000000000..2ec056dbf50a Binary files /dev/null and b/sdk/identity/azure-identity/images/devicecode-enable.png differ diff --git a/sdk/identity/azure-identity/images/devicecode-permissions.png b/sdk/identity/azure-identity/images/devicecode-permissions.png new file mode 100644 index 000000000000..5fb9621e44a0 Binary files /dev/null and b/sdk/identity/azure-identity/images/devicecode-permissions.png differ diff --git a/sdk/identity/azure-identity/images/interactive-redirecturi.png b/sdk/identity/azure-identity/images/interactive-redirecturi.png new file mode 100644 index 000000000000..120f744bd335 Binary files /dev/null and b/sdk/identity/azure-identity/images/interactive-redirecturi.png differ diff --git a/sdk/identity/azure-identity/pom.xml b/sdk/identity/azure-identity/pom.xml index e346e06f88f3..bbebaa1bd23c 100644 --- a/sdk/identity/azure-identity/pom.xml +++ b/sdk/identity/azure-identity/pom.xml @@ -6,12 +6,12 @@ com.azure azure-identity - 1.0.0-preview.1 + 1.0.0-preview.2 com.azure azure-client-sdk-parent - 1.1.0 + 1.2.0 ../../../pom.client.xml @@ -19,16 +19,40 @@ com.azure azure-core - 1.0.0-preview.1 + 1.0.0-preview.3 com.microsoft.azure - adal4j + msal4j + + 0.5.0-preview + + com.nimbusds + oauth2-oidc-sdk + + 6.13 + + junit junit test + + org.mockito + mockito-core + test + + + org.powermock + powermock-module-junit4 + test + + + org.powermock + powermock-api-mockito2 + test + 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 new file mode 100644 index 000000000000..1477db05264c --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/DeviceCodeChallenge.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity; + +import com.azure.core.implementation.annotation.Immutable; + +import java.time.Duration; + +/** + * Response returned from the STS device code endpoint containing information necessary for + * device code flow. + */ +@Immutable +public class DeviceCodeChallenge { + /** + * Creates an instance of a device code challenge. + * + * @param userCode code which user needs to provide when authenticating at the verification URI + * @param deviceCode code which should be included in the request for the access token + * @param verificationUri URI where user can authenticate + * @param expiresIn expiration time of device code in seconds + * @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) { + this.userCode = userCode; + this.deviceCode = deviceCode; + this.verificationUri = verificationUri; + this.expiresIn = Duration.ofSeconds(expiresIn); + this.interval = Duration.ofSeconds(interval); + this.message = message; + } + + private final String userCode; + + private final String deviceCode; + + private final String verificationUri; + + private final Duration expiresIn; + + private final Duration interval; + + private final String message; + + + /** + * @return code which user needs to provide when authenticating at the verification URI. + */ + public String userCode() { + return userCode; + } + + /** + * @return code which should be included in the request for the access token. + */ + public String deviceCode() { + return deviceCode; + } + + /** + * @return URI where user can authenticate. + */ + public String verificationUri() { + return verificationUri; + } + + /** + * @return expiration time of device code. + */ + public Duration expiresIn() { + return expiresIn; + } + + /** + * @return interval at which the STS should be polled at. + */ + public Duration interval() { + return interval; + } + + /** + * @return message which should be displayed to the user. + */ + public String message() { + return message; + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/IdentityClient.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/IdentityClient.java deleted file mode 100644 index 88715ab17fa7..000000000000 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/IdentityClient.java +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.identity; - -import com.azure.core.credentials.AccessToken; -import com.azure.core.http.ProxyOptions; -import com.azure.core.http.ProxyOptions.Type; -import com.azure.core.implementation.serializer.SerializerAdapter; -import com.azure.core.implementation.serializer.SerializerEncoding; -import com.azure.core.implementation.serializer.jackson.JacksonAdapter; -import com.azure.core.implementation.util.ScopeUtil; -import com.azure.identity.implementation.MSIToken; -import com.azure.identity.implementation.util.Adal4jUtil; -import com.microsoft.aad.adal4j.AsymmetricKeyCredential; -import com.microsoft.aad.adal4j.AuthenticationContext; -import com.microsoft.aad.adal4j.AuthenticationResult; -import com.microsoft.aad.adal4j.ClientCredential; -import reactor.core.Exceptions; -import reactor.core.publisher.Mono; -import reactor.core.publisher.MonoSink; - -import java.io.IOException; -import java.net.HttpURLConnection; -import java.net.MalformedURLException; -import java.net.Proxy; -import java.net.URL; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.util.Random; -import java.util.Scanner; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.function.Consumer; - -/** - * The identity client that contains APIs to retrieve access tokens - * from various configurations. - */ -public final class IdentityClient { - private final IdentityClientOptions options; - private final SerializerAdapter adapter = JacksonAdapter.createDefaultSerializerAdapter(); - private static final Random RANDOM = new Random(); - - /** - * Creates an IdentityClient with default options. - */ - public IdentityClient() { - this.options = new IdentityClientOptions(); - } - - /** - * Creates an IdentityClient with the given options. - * - * @param options the options configuring the client. - */ - public IdentityClient(IdentityClientOptions options) { - this.options = options; - } - - /** - * Asynchronously acquire a token from Active Directory with a client secret. - * - * @param tenantId the tenant ID of the application - * @param clientId the client ID of the application - * @param clientSecret the client secret of the application - * @param scopes the scopes to authenticate to - * @return a Publisher that emits an AccessToken - */ - public Mono authenticateWithClientSecret(String tenantId, String clientId, String clientSecret, String[] scopes) { - String resource = ScopeUtil.scopesToResource(scopes); - String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/" + tenantId; - ExecutorService executor = Executors.newSingleThreadExecutor(); - AuthenticationContext context = createAuthenticationContext(executor, authorityUrl, options.proxyOptions()); - return Mono.create((Consumer>) callback -> { - context.acquireToken( - resource, - new ClientCredential(clientId, clientSecret), - Adal4jUtil.authenticationDelegate(callback)); - }).map(ar -> new AccessToken(ar.getAccessToken(), OffsetDateTime.ofInstant(ar.getExpiresOnDate().toInstant(), ZoneOffset.UTC))) - .doFinally(s -> executor.shutdown()); - } - - /** - * Asynchronously acquire a token from Active Directory with a PKCS12 certificate. - * - * @param tenantId the tenant ID of the application - * @param clientId the client ID of the application - * @param pfxCertificatePath the path to the PKCS12 certificate of the application - * @param pfxCertificatePassword the password protecting the PFX certificate - * @param scopes the scopes to authenticate to - * @return a Publisher that emits an AccessToken - */ - public Mono authenticateWithPfxCertificate(String tenantId, String clientId, String pfxCertificatePath, String pfxCertificatePassword, String[] scopes) { - String resource = ScopeUtil.scopesToResource(scopes); - String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/" + tenantId; - ExecutorService executor = Executors.newSingleThreadExecutor(); - AuthenticationContext context = createAuthenticationContext(executor, authorityUrl, options.proxyOptions()); - return Mono.create((Consumer>) callback -> { - try { - context.acquireToken( - resource, - Adal4jUtil.createAsymmetricKeyCredential(clientId, Files.readAllBytes(Paths.get(pfxCertificatePath)), pfxCertificatePassword), - Adal4jUtil.authenticationDelegate(callback)); - } catch (IOException e) { - callback.error(e); - } - }).map(ar -> new AccessToken(ar.getAccessToken(), OffsetDateTime.ofInstant(ar.getExpiresOnDate().toInstant(), ZoneOffset.UTC))) - .doFinally(s -> executor.shutdown()); - } - - /** - * Asynchronously acquire a token from Active Directory with a PEM certificate. - * - * @param tenantId the tenant ID of the application - * @param clientId the client ID of the application - * @param pemCertificatePath the path to the PEM certificate of the application - * @param scopes the scopes to authenticate to - * @return a Publisher that emits an AccessToken - */ - public Mono authenticateWithPemCertificate(String tenantId, String clientId, String pemCertificatePath, String[] scopes) { - String resource = ScopeUtil.scopesToResource(scopes); - String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/" + tenantId; - ExecutorService executor = Executors.newSingleThreadExecutor(); - AuthenticationContext context = createAuthenticationContext(executor, authorityUrl, options.proxyOptions()); - return Mono.create((Consumer>) callback -> { - try { - context.acquireToken( - resource, - AsymmetricKeyCredential.create(clientId, Adal4jUtil.privateKeyFromPem(Files.readAllBytes(Paths.get(pemCertificatePath))), Adal4jUtil.publicKeyFromPem(Files.readAllBytes(Paths.get(pemCertificatePath)))), - Adal4jUtil.authenticationDelegate(callback)); - } catch (IOException e) { - callback.error(e); - } - }).map(ar -> new AccessToken(ar.getAccessToken(), OffsetDateTime.ofInstant(ar.getExpiresOnDate().toInstant(), ZoneOffset.UTC))) - .doFinally(s -> executor.shutdown()); - } - - private static AuthenticationContext createAuthenticationContext(ExecutorService executor, String authorityUrl, ProxyOptions proxyOptions) { - AuthenticationContext context; - try { - context = new AuthenticationContext(authorityUrl, false, executor); - } catch (MalformedURLException mue) { - throw Exceptions.propagate(mue); - } - if (proxyOptions != null) { - context.setProxy(new Proxy(proxyOptions.type() == Type.HTTP ? Proxy.Type.HTTP : Proxy.Type.SOCKS, proxyOptions.address())); - } - return context; - } - - /** - * Asynchronously acquire a token from the App Service Managed Service Identity endpoint. - * - * @param msiEndpoint the endpoint to acquire token from - * @param msiSecret the secret to acquire token with - * @param clientId the client ID of the application service - * @param scopes the scopes to authenticate to - * @return a Publisher that emits an AccessToken - */ - public Mono authenticateToManagedIdentityEnpoint(String msiEndpoint, String msiSecret, String clientId, String[] scopes) { - String resource = ScopeUtil.scopesToResource(scopes); - HttpURLConnection connection = null; - StringBuilder payload = new StringBuilder(); - - try { - payload.append("resource="); - payload.append(URLEncoder.encode(resource, "UTF-8")); - payload.append("&api-version="); - payload.append(URLEncoder.encode("2017-09-01", "UTF-8")); - if (clientId != null) { - payload.append("&client_id="); - payload.append(URLEncoder.encode(clientId, "UTF-8")); - } - } catch (IOException exception) { - return Mono.error(exception); - } - try { - URL url = new URL(String.format("%s?%s", msiEndpoint, payload)); - connection = (HttpURLConnection) url.openConnection(); - - connection.setRequestMethod("GET"); - if (msiSecret != null) { - connection.setRequestProperty("Secret", msiSecret); - } - connection.setRequestProperty("Metadata", "true"); - - connection.connect(); - - Scanner s = new Scanner(connection.getInputStream(), StandardCharsets.UTF_8.name()).useDelimiter("\\A"); - String result = s.hasNext() ? s.next() : ""; - - return Mono.just(adapter.deserialize(result, MSIToken.class, SerializerEncoding.JSON)); - } catch (IOException e) { - return Mono.error(e); - } finally { - if (connection != null) { - connection.disconnect(); - } - } - } - - /** - * Asynchronously acquire a token from the Virtual Machine IMDS endpoint. - * - * @param clientId the client ID of the virtual machine - * @param scopes the scopes to authenticate to - * @return a Publisher that emits an AccessToken - */ - public Mono authenticateToIMDSEndpoint(String clientId, String[] scopes) { - String resource = ScopeUtil.scopesToResource(scopes); - StringBuilder payload = new StringBuilder(); - final int imdsUpgradeTimeInMs = 70 * 1000; - - try { - payload.append("api-version="); - payload.append(URLEncoder.encode("2018-02-01", "UTF-8")); - payload.append("&resource="); - payload.append(URLEncoder.encode(resource, "UTF-8")); - if (clientId != null) { - payload.append("&client_id="); - payload.append(URLEncoder.encode(clientId, "UTF-8")); - } - } catch (IOException exception) { - return Mono.error(exception); - } - - int retry = 1; - while (retry <= options.maxRetry()) { - URL url = null; - HttpURLConnection connection = null; - try { - url = new URL(String.format("http://169.254.169.254/metadata/identity/oauth2/token?%s", payload.toString())); - - connection = (HttpURLConnection) url.openConnection(); - connection.setRequestMethod("GET"); - connection.setRequestProperty("Metadata", "true"); - connection.connect(); - - Scanner s = new Scanner(connection.getInputStream(), StandardCharsets.UTF_8.name()).useDelimiter("\\A"); - String result = s.hasNext() ? s.next() : ""; - - return Mono.just(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)); - } - int responseCode = 0; - try { - responseCode = connection.getResponseCode(); - } catch (IOException e) { - return Mono.error(e); - } - if (responseCode == 410 || responseCode == 429 || responseCode == 404 || (responseCode >= 500 && responseCode <= 599)) { - int retryTimeoutInMs = options.retryTimeout().apply(RANDOM.nextInt(retry)); - // Error code 410 indicates IMDS upgrade is in progress, which can take up to 70s - // - retryTimeoutInMs = (responseCode == 410 && retryTimeoutInMs < imdsUpgradeTimeInMs) ? imdsUpgradeTimeInMs : retryTimeoutInMs; - retry++; - if (retry > options.maxRetry()) { - break; - } else { - sleep(retryTimeoutInMs); - } - } else { - return Mono.error(new RuntimeException("Couldn't acquire access token from IMDS, verify your objectId, clientId or msiResourceId", exception)); - } - } finally { - if (connection != null) { - connection.disconnect(); - } - } - } - return Mono.error(new RuntimeException(String.format("MSI: Failed to acquire tokens after retrying %s times", options.maxRetry()))); - } - - private static void sleep(int millis) { - try { - Thread.sleep(millis); - } catch (InterruptedException ex) { - throw new RuntimeException(ex); - } - } -} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AadCredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AadCredential.java deleted file mode 100644 index 6a8710ff3cd2..000000000000 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AadCredential.java +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.identity.credential; - -import com.azure.core.credentials.TokenCredential; - -import java.util.ArrayList; -import java.util.List; - -/** - * The base class for credentials that acquires a token from AAD. - * - * @param a subtype of this class - */ -abstract class AadCredential> implements TokenCredential { - - private String clientId; - - private String tenantId; - - /** - * Creates an AadCredential. - */ - AadCredential() { - } - - /** - * @return the client ID for authenticating to AAD. - */ - public String clientId() { - return clientId; - } - - /** - * Sets the client ID for authentication to AAD. - * @param clientId the client ID for authentication - * @return the credential itself - */ - @SuppressWarnings("unchecked") - public T clientId(String clientId) { - this.clientId = clientId; - return (T) this; - } - - /** - * @return the tenant ID for authenticating to AAD. - */ - public String tenantId() { - return tenantId; - } - - /** - * Sets the tenant ID for authenticating to AAD. - * @param tenantId the tenant for authenticating to AAD - * @return the credential itself - */ - @SuppressWarnings("unchecked") - public T tenantId(String tenantId) { - this.tenantId = tenantId; - return (T) this; - } - - /** - * Validates tenant ID and client ID are provided. - * @throws IllegalArgumentException if any required parameter is missing. - */ - protected void validate() { - List missing = new ArrayList<>(); - if (clientId == null) { - missing.add("clientId"); - } - if (tenantId == null) { - missing.add("tenantId"); - } - if (missing.size() > 0) { - throw new IllegalArgumentException("Must provide non-null values for " - + String.join(", ", missing) + " properties in " + this.getClass().getSimpleName()); - } - } -} 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 new file mode 100644 index 000000000000..da06b7a55d55 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AadCredentialBuilderBase.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +/** + * The base class for credential builders that allow specifying a client id and tenant ID for an Azure Active Directory. + * @param the type of the credential builder + */ +public abstract class AadCredentialBuilderBase> extends CredentialBuilderBase { + String clientId; + + /** + * Specifies the Azure Active Directory endpoint to acquire tokens. + * @param authorityHost the Azure Active Directory endpoint + * @return {@link } itself + */ + @SuppressWarnings("unchecked") + public T authorityHost(String authorityHost) { + this.identityClientOptions.authorityHost(authorityHost); + return (T) this; + } + + /** + * Sets the client ID of the application. + * @param clientId the client ID of the application. + * @return {@link } itself + */ + @SuppressWarnings("unchecked") + public T clientId(String clientId) { + this.clientId = clientId; + return (T) this; + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AppServiceMSICredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AppServiceMSICredential.java index f3b2406b5df5..040debb81443 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AppServiceMSICredential.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/AppServiceMSICredential.java @@ -4,15 +4,17 @@ package com.azure.identity.credential; import com.azure.core.credentials.AccessToken; +import com.azure.core.implementation.annotation.Immutable; 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.IdentityClient; +import com.azure.identity.implementation.IdentityClient; import reactor.core.publisher.Mono; /** * The Managed Service Identity credential for App Service. */ +@Immutable class AppServiceMSICredential { private String msiEndpoint; private String msiSecret; @@ -21,9 +23,10 @@ class AppServiceMSICredential { /** * Creates an instance of AppServiceMSICredential. + * @param clientId the client id of user assigned or system assigned identity * @param identityClient the identity client to acquire a token with. */ - AppServiceMSICredential(IdentityClient identityClient) { + AppServiceMSICredential(String clientId, IdentityClient identityClient) { Configuration configuration = ConfigurationManager.getConfiguration(); if (configuration.contains(BaseConfigurations.MSI_ENDPOINT)) { msiEndpoint = configuration.get(BaseConfigurations.MSI_ENDPOINT); @@ -32,6 +35,7 @@ class AppServiceMSICredential { msiSecret = configuration.get(BaseConfigurations.MSI_SECRET); } this.identityClient = identityClient; + this.clientId = clientId; } /** @@ -47,26 +51,6 @@ public String msiSecret() { return this.msiSecret; } - /** - * Specifies the Managed Service Identity endpoint for the App Service. - * @param msiEndpoint the end point for acquiring a token on App Service. - * @return AppServiceMSICredential - */ - public AppServiceMSICredential msiEndpoint(String msiEndpoint) { - this.msiEndpoint = msiEndpoint; - return this; - } - - /** - * Specifies the Managed Service Identity secret for the App Service. - * @param msiSecret the secret for acquiring a token on App Service. - * @return AppServiceMSICredential - */ - public AppServiceMSICredential msiSecret(String msiSecret) { - this.msiSecret = msiSecret; - return this; - } - /** * @return the client id of user assigned or system assigned identity. */ @@ -74,23 +58,12 @@ public String clientId() { return this.clientId; } - /** - * Specifies the client id of user assigned or system assigned identity. - * - * @param clientId the client id - * @return VirtualMachineMSICredential - */ - public AppServiceMSICredential clientId(String clientId) { - this.clientId = clientId; - return this; - } - /** * Gets the token for a list of scopes. * @param scopes the scopes to get token for * @return a Publisher that emits an AccessToken */ public Mono authenticate(String[] scopes) { - return identityClient.authenticateToManagedIdentityEnpoint(msiEndpoint, msiSecret, clientId(), scopes); + return identityClient.authenticateToManagedIdentityEndpoint(msiEndpoint, msiSecret, scopes); } } 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 bbf43180151b..211d61a99e11 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 @@ -6,15 +6,19 @@ import com.azure.core.credentials.AccessToken; import com.azure.core.credentials.TokenCredential; import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.implementation.annotation.Immutable; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.util.ArrayDeque; import java.util.Deque; /** * 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).

    + * {@codesnippet com.azure.identity.credential.chainedtokencredential.construct} */ +@Immutable public class ChainedTokenCredential implements TokenCredential { private final Deque credentials; @@ -22,35 +26,14 @@ public class ChainedTokenCredential implements TokenCredential { * Create an instance of chained token credential that aggregates a list of token * credentials. */ - public ChainedTokenCredential() { - credentials = new ArrayDeque<>(); - } - - /** - * Adds a credential to try to authenticate at the front of the chain. - * @param credential the credential to be added to the front of chain - * @return the ChainedTokenCredential itself - */ - public ChainedTokenCredential addFirst(TokenCredential credential) { - credentials.addFirst(credential); - return this; - } - - /** - * Adds a credential to try to authenticate at the last of the chain. - * @param credential the credential to be added to the end of chain - * @return the ChainedTokenCredential itself - */ - public ChainedTokenCredential addLast(TokenCredential credential) { - credentials.addLast(credential); - return this; + ChainedTokenCredential(Deque credentials) { + this.credentials = credentials; } @Override public Mono getToken(String... scopes) { return Flux.fromIterable(credentials) - .flatMap(p -> p.getToken(scopes)) - .onErrorResume(t -> Mono.empty()) + .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))); } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ChainedTokenCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ChainedTokenCredentialBuilder.java new file mode 100644 index 000000000000..e01368b49e03 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ChainedTokenCredentialBuilder.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +import com.azure.core.credentials.TokenCredential; + +import java.util.ArrayDeque; +import java.util.Deque; + +/** + * Fluent credential builder for instantiating a {@link ChainedTokenCredential}. + * + * @see ChainedTokenCredential + */ +public class ChainedTokenCredentialBuilder { + private final Deque credentials; + + /** + * Creates an instance of the builder to config the credential. + */ + public ChainedTokenCredentialBuilder() { + this.credentials = new ArrayDeque<>(); + } + + /** + * Adds a credential to try to authenticate at the front of the chain. + * @param credential the credential to be added to the front of chain + * @return the ChainedTokenCredential itself + */ + public ChainedTokenCredentialBuilder addFirst(TokenCredential credential) { + credentials.addFirst(credential); + return this; + } + + /** + * Adds a credential to try to authenticate at the last of the chain. + * @param credential the credential to be added to the end of chain + * @return the ChainedTokenCredential itself + */ + public ChainedTokenCredentialBuilder addLast(TokenCredential credential) { + credentials.addLast(credential); + return this; + } + + /** + * @return a {@link ChainedTokenCredential} with the current configurations. + */ + public ChainedTokenCredential build() { + return new ChainedTokenCredential(new ArrayDeque<>(credentials)); + } +} 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 244c26c03462..2d19433e20e7 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 @@ -4,65 +4,51 @@ package com.azure.identity.credential; import com.azure.core.credentials.AccessToken; -import com.azure.identity.IdentityClient; -import com.azure.identity.IdentityClientOptions; +import com.azure.core.credentials.TokenCredential; +import com.azure.core.implementation.annotation.Immutable; +import com.azure.identity.implementation.IdentityClient; +import com.azure.identity.implementation.IdentityClientBuilder; +import com.azure.identity.implementation.IdentityClientOptions; import reactor.core.publisher.Mono; +import java.util.Objects; + /** * An AAD credential that acquires a token with a client certificate for an AAD application. + * + *

    Sample: Construct a simple ClientCertificateCredential

    + * {@codesnippet com.azure.identity.credential.clientcertificatecredential.construct} + * + *

    Sample: Construct a ClientCertificateCredential behind a proxy

    + * {@codesnippet com.azure.identity.credential.clientcertificatecredential.constructwithproxy} */ -public class ClientCertificateCredential extends AadCredential { +@Immutable +public class ClientCertificateCredential implements TokenCredential { private String clientCertificate; private String clientCertificatePassword; private final IdentityClient identityClient; /** * Creates a ClientSecretCredential with default identity client options. - */ - public ClientCertificateCredential() { - this(new IdentityClientOptions()); - } - - /** - * Creates a ClientSecretCredential with default identity client options. + * @param tenantId the tenant ID of the application + * @param clientId the client ID of the application + * @param certificatePath the PEM file / PFX file containing the certificate + * @param certificatePassword the password protecting the PFX file * @param identityClientOptions the options to configure the identity client */ - public ClientCertificateCredential(IdentityClientOptions identityClientOptions) { - this.identityClient = new IdentityClient(identityClientOptions); - } - - /** - * Sets the client certificate for authenticating to AAD. - * @param certificatePath the PEM file containing the certificate - * @return the credential itself - */ - public ClientCertificateCredential pemCertificate(String certificatePath) { - this.clientCertificate = certificatePath; - return this; - } - - /** - * Sets the client certificate for authenticating to AAD. - * @param certificatePath the password protected PFX file containing the certificate - * @param clientCertificatePassword the password protecting the PFX file - * @return the credential itself - */ - public ClientCertificateCredential pfxCertificate(String certificatePath, String clientCertificatePassword) { + ClientCertificateCredential(String tenantId, String clientId, String certificatePath, String certificatePassword, IdentityClientOptions identityClientOptions) { + Objects.requireNonNull(certificatePath); this.clientCertificate = certificatePath; - this.clientCertificatePassword = clientCertificatePassword; - return this; + this.clientCertificatePassword = certificatePassword; + identityClient = new IdentityClientBuilder().tenantId(tenantId).clientId(clientId).identityClientOptions(identityClientOptions).build(); } @Override public Mono getToken(String... scopes) { - validate(); - if (clientCertificate == null) { - return Mono.error(new IllegalArgumentException("Non-null value must be provided for clientCertificate property in ClientCertificateCredential")); - } if (clientCertificatePassword != null) { - return identityClient.authenticateWithPfxCertificate(tenantId(), clientId(), clientCertificate, clientCertificatePassword, scopes); + return identityClient.authenticateWithPfxCertificate(clientCertificate, clientCertificatePassword, scopes); } else { - return identityClient.authenticateWithPemCertificate(tenantId(), clientId(), clientCertificate, scopes); + return identityClient.authenticateWithPemCertificate(clientCertificate, scopes); } } } 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 new file mode 100644 index 000000000000..3e366ac9661d --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientCertificateCredentialBuilder.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +import com.azure.identity.implementation.util.ValidationUtil; + +import java.util.HashMap; + +/** + * Fluent credential builder for instantiating a {@link ClientCertificateCredential}. + * + * @see ClientCertificateCredential + */ +public class ClientCertificateCredentialBuilder extends AadCredentialBuilderBase { + private String tenantId; + private String clientCertificate; + private String clientCertificatePassword; + + /** + * Sets the tenant ID of the application. + * @param tenantId the tenant ID of the application. + * @return the ClientCertificateCredentialBuilder itself + */ + public ClientCertificateCredentialBuilder tenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Sets the client certificate for authenticating to AAD. + * + * @param certificatePath the PEM file containing the certificate + * @return the ClientCertificateCredentialBuilder itself + */ + public ClientCertificateCredentialBuilder pemCertificate(String certificatePath) { + this.clientCertificate = certificatePath; + return this; + } + + /** + * Sets the client certificate for authenticating to AAD. + * + * @param certificatePath the password protected PFX file containing the certificate + * @param clientCertificatePassword the password protecting the PFX file + * @return the ClientCertificateCredentialBuilder itself + */ + public ClientCertificateCredentialBuilder pfxCertificate(String certificatePath, String clientCertificatePassword) { + this.clientCertificate = certificatePath; + this.clientCertificatePassword = clientCertificatePassword; + return this; + } + + /** + * @return a {@link ClientCertificateCredential} with the current configurations. + */ + public ClientCertificateCredential build() { + ValidationUtil.validate(getClass().getSimpleName(), new HashMap() {{ + put("clientId", clientId); + put("tenantId", tenantId); + put("clientCertificate", clientCertificate); + }}); + 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 c74ffafe6652..adaad6cc3386 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 @@ -4,50 +4,47 @@ package com.azure.identity.credential; import com.azure.core.credentials.AccessToken; -import com.azure.identity.IdentityClient; -import com.azure.identity.IdentityClientOptions; +import com.azure.core.credentials.TokenCredential; +import com.azure.core.implementation.annotation.Immutable; +import com.azure.identity.implementation.IdentityClient; +import com.azure.identity.implementation.IdentityClientBuilder; +import com.azure.identity.implementation.IdentityClientOptions; import reactor.core.publisher.Mono; +import java.util.Objects; + /** * An AAD credential that acquires a token with a client secret for an AAD application. + * + *

    Sample: Construct a simple ClientSecretCredential

    + * {@codesnippet com.azure.identity.credential.clientsecretcredential.construct} + * + *

    Sample: Construct a ClientSecretCredential behind a proxy

    + * {@codesnippet com.azure.identity.credential.clientsecretcredential.constructwithproxy} */ -public class ClientSecretCredential extends AadCredential { +@Immutable +public class ClientSecretCredential implements TokenCredential { /* The client secret value. */ - private String clientSecret; + private final String clientSecret; private final IdentityClient identityClient; - /** - * Creates a ClientSecretCredential with default identity client options. - */ - public ClientSecretCredential() { - this(new IdentityClientOptions()); - } - /** * Creates a ClientSecretCredential with the given identity client options. * - * @param identityClientOptions the options for configuring the identity client - */ - public ClientSecretCredential(IdentityClientOptions identityClientOptions) { - identityClient = new IdentityClient(identityClientOptions); - } - - /** - * Sets the client secret for the authentication. + * @param tenantId the tenant ID of the application + * @param clientId the client ID of the application * @param clientSecret the secret value of the AAD application. - * @return the credential itself + * @param identityClientOptions the options for configuring the identity client */ - public ClientSecretCredential clientSecret(String clientSecret) { + 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(); this.clientSecret = clientSecret; - return this; } @Override public Mono getToken(String... scopes) { - validate(); - if (clientSecret == null) { - return Mono.error(new IllegalArgumentException("Non-null value must be provided for clientSecret property in ClientSecretCredential")); - } - return identityClient.authenticateWithClientSecret(tenantId(), clientId(), clientSecret, scopes); + return identityClient.authenticateWithClientSecret(clientSecret, scopes); } } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientSecretCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientSecretCredentialBuilder.java new file mode 100644 index 000000000000..42e128449a8a --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ClientSecretCredentialBuilder.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +import com.azure.identity.implementation.util.ValidationUtil; + +import java.util.HashMap; + +/** + * Fluent credential builder for instantiating a {@link ClientSecretCredential}. + * + * @see ClientSecretCredential + */ +public class ClientSecretCredentialBuilder extends AadCredentialBuilderBase { + private String tenantId; + private String clientSecret; + + /** + * Sets the tenant ID of the application. + * @param tenantId the tenant ID of the application. + * @return the ClientSecretCredentialBuilder itself + */ + public ClientSecretCredentialBuilder tenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Sets the client secret for the authentication. + * @param clientSecret the secret value of the AAD application. + * @return the ClientSecretCredentialBuilder itself + */ + public ClientSecretCredentialBuilder clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * @return a {@link ClientSecretCredentialBuilder} with the current configurations. + */ + public ClientSecretCredential build() { + ValidationUtil.validate(getClass().getSimpleName(), new HashMap() {{ + put("clientId", clientId); + put("tenantId", tenantId); + put("clientSecret", clientSecret); + }}); + return new ClientSecretCredential(tenantId, clientId, clientSecret, identityClientOptions); + } +} 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 new file mode 100644 index 000000000000..18c8f29e3773 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/CredentialBuilderBase.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +import com.azure.core.http.ProxyOptions; +import com.azure.identity.implementation.IdentityClientOptions; + +import java.util.function.Function; + +/** + * The base class for all the credential builders. + * @param the type of the credential builder + */ +public abstract class CredentialBuilderBase> { + IdentityClientOptions identityClientOptions; + + CredentialBuilderBase() { + this.identityClientOptions = new IdentityClientOptions(); + } + + /** + * Specifies the max number of retries when an authentication request fails. + * @param maxRetry the number of retries + * @return {@link } itself + */ + @SuppressWarnings("unchecked") + public T maxRetry(int maxRetry) { + this.identityClientOptions.maxRetry(maxRetry); + return (T) this; + } + + /** + * Specifies a Function to calculate seconds of timeout on every retried request. + * @param retryTimeout the Function that returns a timeout in seconds given the number of retry + * @return {@link } itself + */ + @SuppressWarnings("unchecked") + public T retryTimeout(Function retryTimeout) { + this.identityClientOptions.retryTimeout(retryTimeout); + return (T) this; + } + + /** + * Specifies he options for proxy configuration. + * @param proxyOptions the options for proxy configuration + * @return {@link } itself + */ + @SuppressWarnings("unchecked") + public T proxyOptions(ProxyOptions proxyOptions) { + this.identityClientOptions.proxyOptions(proxyOptions); + return (T) this; + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DefaultAzureCredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DefaultAzureCredential.java index 8d3d298edf4e..6f4e9e9e0c4c 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 @@ -3,22 +3,18 @@ package com.azure.identity.credential; -import com.azure.identity.IdentityClientOptions; +import com.azure.core.implementation.annotation.Immutable; +import com.azure.identity.implementation.IdentityClientOptions; + +import java.util.ArrayDeque; +import java.util.Arrays; /** * The base class for a token credential to be used in an Azure client library. */ +@Immutable public final class DefaultAzureCredential extends ChainedTokenCredential { - /** - * Creates default DefaultAzureCredential instance to use. This will use AZURE_CLIENT_ID, - * AZURE_CLIENT_SECRET, and AZURE_TENANT_ID environment variables to create a - * ClientSecretCredential. - */ - public DefaultAzureCredential() { - this(new IdentityClientOptions()); - } - /** * Creates default DefaultAzureCredential instance to use. This will use AZURE_CLIENT_ID, * AZURE_CLIENT_SECRET, and AZURE_TENANT_ID environment variables to create a @@ -26,9 +22,7 @@ public DefaultAzureCredential() { * * @param identityClientOptions the options to configure the IdentityClient */ - public DefaultAzureCredential(IdentityClientOptions identityClientOptions) { - super(); - addLast(new EnvironmentCredential(identityClientOptions)); - addLast(new ManagedIdentityCredential(identityClientOptions)); + DefaultAzureCredential(IdentityClientOptions identityClientOptions) { + super(new ArrayDeque<>(Arrays.asList(new EnvironmentCredential(identityClientOptions), new ManagedIdentityCredential(null, identityClientOptions)))); } } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DefaultAzureCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DefaultAzureCredentialBuilder.java new file mode 100644 index 000000000000..b06c00289ca0 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DefaultAzureCredentialBuilder.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +/** + * Fluent credential builder for instantiating a {@link DefaultAzureCredential}. + * + * @see DefaultAzureCredential + */ +public class DefaultAzureCredentialBuilder extends CredentialBuilderBase { + /** + * @return a {@link DefaultAzureCredential} with the current configurations. + */ + public DefaultAzureCredential build() { + return new DefaultAzureCredential(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 new file mode 100644 index 000000000000..5afd02040291 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DeviceCodeCredential.java @@ -0,0 +1,55 @@ +// 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.implementation.annotation.Immutable; +import com.azure.identity.DeviceCodeChallenge; +import com.azure.identity.implementation.IdentityClient; +import com.azure.identity.implementation.IdentityClientBuilder; +import com.azure.identity.implementation.IdentityClientOptions; +import com.azure.identity.implementation.MsalToken; +import reactor.core.publisher.Mono; + +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Consumer; + +/** + * An AAD credential that acquires a token with a device code for an AAD application. + */ +@Immutable +public class DeviceCodeCredential implements TokenCredential { + private final Consumer deviceCodeChallengeConsumer; + private final IdentityClient identityClient; + private final AtomicReference cachedToken; + + /** + * Creates a DeviceCodeCredential with the given identity client options. + * + * @param clientId the client ID of the application + * @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) { + this.deviceCodeChallengeConsumer = deviceCodeChallengeConsumer; + identityClient = new IdentityClientBuilder().tenantId("common").clientId(clientId).identityClientOptions(identityClientOptions).build(); + this.cachedToken = new AtomicReference<>(); + } + + @Override + public Mono getToken(String... scopes) { + return Mono.defer(() -> { + if (cachedToken.get() != null) { + return identityClient.authenticateWithUserRefreshToken(scopes, cachedToken.get()).onErrorResume(t -> Mono.empty()); + } else { + return Mono.empty(); + } + }).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 new file mode 100644 index 000000000000..9c8938c77c45 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/DeviceCodeCredentialBuilder.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +import com.azure.identity.DeviceCodeChallenge; +import com.azure.identity.implementation.util.ValidationUtil; + +import java.util.HashMap; +import java.util.function.Consumer; + +/** + * Fluent credential builder for instantiating a {@link DeviceCodeCredential}. + * + * @see DeviceCodeCredential + */ +public class DeviceCodeCredentialBuilder extends AadCredentialBuilderBase { + private Consumer deviceCodeChallengeConsumer; + + /** + * Sets the port for the local HTTP server, for which {@code http://localhost:{port}} must be + * registered as a valid reply URL on the application. + * + * @param deviceCodeChallengeConsumer a method allowing the user to meet the device code challenge + * @return the InteractiveBrowserCredentialBuilder itself + */ + public DeviceCodeCredentialBuilder deviceCodeChallengeConsumer(Consumer deviceCodeChallengeConsumer) { + this.deviceCodeChallengeConsumer = deviceCodeChallengeConsumer; + return this; + } + + /** + * @return a {@link DeviceCodeCredential} with the current configurations. + */ + public DeviceCodeCredential build() { + ValidationUtil.validate(getClass().getSimpleName(), new HashMap() {{ + put("clientId", clientId); + put("deviceCodeChallengeConsumer", deviceCodeChallengeConsumer); + }}); + return new DeviceCodeCredential(clientId, deviceCodeChallengeConsumer, identityClientOptions); + } +} 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 3faceb97827a..31236bcb21ef 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 @@ -6,33 +6,30 @@ import com.azure.core.credentials.AccessToken; import com.azure.core.credentials.TokenCredential; import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.implementation.annotation.Immutable; 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.IdentityClientOptions; +import com.azure.core.util.logging.ClientLogger; +import com.azure.identity.implementation.IdentityClientOptions; import reactor.core.publisher.Mono; /** * A credential provider that provides token credentials based on environment * variables. */ +@Immutable public class EnvironmentCredential implements TokenCredential { private Configuration configuration; private final IdentityClientOptions identityClientOptions; - - /** - * Creates an instance of the default environment credential provider. - */ - public EnvironmentCredential() { - this(new IdentityClientOptions()); - } + private final ClientLogger logger = new ClientLogger(EnvironmentCredential.class); /** * Creates an instance of the default environment credential provider. * @param identityClientOptions the options for configuring the identity client */ - public EnvironmentCredential(IdentityClientOptions identityClientOptions) { - this.configuration = ConfigurationManager.getConfiguration(); + EnvironmentCredential(IdentityClientOptions identityClientOptions) { + this.configuration = ConfigurationManager.getConfiguration().clone(); this.identityClientOptions = identityClientOptions; } @@ -43,13 +40,14 @@ public Mono getToken(String... scopes) { && configuration.contains(BaseConfigurations.AZURE_CLIENT_SECRET) && configuration.contains(BaseConfigurations.AZURE_TENANT_ID)) { // TODO: support other clouds - return new ClientSecretCredential(identityClientOptions) - .clientId(configuration.get(BaseConfigurations.AZURE_CLIENT_ID)) - .clientSecret(configuration.get(BaseConfigurations.AZURE_CLIENT_SECRET)) - .tenantId(configuration.get(BaseConfigurations.AZURE_TENANT_ID)); + return new ClientSecretCredential(configuration.get(BaseConfigurations.AZURE_TENANT_ID), + configuration.get(BaseConfigurations.AZURE_CLIENT_ID), + configuration.get(BaseConfigurations.AZURE_CLIENT_SECRET), + identityClientOptions); } // Other environment variables - throw new ClientAuthenticationException("Cannot create any credentials with the current environment variables", null); + logger.logAndThrow(new ClientAuthenticationException("Cannot create any credentials with the current environment variables", null)); + return null; }).flatMap(cred -> cred.getToken(scopes)); } } diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/EnvironmentCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/EnvironmentCredentialBuilder.java new file mode 100644 index 000000000000..eab63a49d172 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/EnvironmentCredentialBuilder.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +/** + * Fluent credential builder for instantiating a {@link EnvironmentCredential}. + * + * @see EnvironmentCredential + */ +public class EnvironmentCredentialBuilder extends AadCredentialBuilderBase { + /** + * @return a {@link EnvironmentCredential} with the current configurations. + */ + public EnvironmentCredential build() { + return new EnvironmentCredential(identityClientOptions); + } +} 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 new file mode 100644 index 000000000000..822b8fbe0135 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/InteractiveBrowserCredential.java @@ -0,0 +1,59 @@ +// 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.implementation.annotation.Immutable; +import com.azure.identity.implementation.IdentityClient; +import com.azure.identity.implementation.IdentityClientBuilder; +import com.azure.identity.implementation.IdentityClientOptions; +import com.azure.identity.implementation.MsalToken; +import reactor.core.publisher.Mono; + +import java.util.concurrent.atomic.AtomicReference; + +/** + * An AAD credential that acquires a token for an AAD application by prompting the login in the default browser. When + * 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}} + * listed as a valid reply URL. + */ +@Immutable +public class InteractiveBrowserCredential implements TokenCredential { + private final int port; + private final IdentityClient identityClient; + private final AtomicReference cachedToken; + + /** + * Creates a InteractiveBrowserCredential with the given identity client options and a listening port, for which + * {@code http://localhost:{port}} must be registered as a valid reply URL on the application. + * + * @param clientId the client ID of the application + * @param port the port on which the credential will listen for the browser authentication result + * @param identityClientOptions the options for configuring the identity client + */ + InteractiveBrowserCredential(String clientId, int port, IdentityClientOptions identityClientOptions) { + this.port = port; + identityClient = new IdentityClientBuilder().tenantId("common").clientId(clientId).identityClientOptions(identityClientOptions).build(); + cachedToken = new AtomicReference<>(); + } + + @Override + public Mono getToken(String... scopes) { + return Mono.defer(() -> { + if (cachedToken.get() != null) { + return identityClient.authenticateWithUserRefreshToken(scopes, cachedToken.get()).onErrorResume(t -> Mono.empty()); + } else { + return Mono.empty(); + } + }).switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithBrowserInteraction(scopes, port))) + .map(msalToken -> { + cachedToken.set(msalToken); + return msalToken; + }); + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/InteractiveBrowserCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/InteractiveBrowserCredentialBuilder.java new file mode 100644 index 000000000000..6db017738617 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/InteractiveBrowserCredentialBuilder.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +import com.azure.identity.implementation.util.ValidationUtil; + +import java.util.HashMap; + +/** + * Fluent credential builder for instantiating a {@link InteractiveBrowserCredential}. + * + * @see InteractiveBrowserCredential + */ +public class InteractiveBrowserCredentialBuilder extends AadCredentialBuilderBase { + private int port; + + /** + * Sets the port for the local HTTP server, for which {@code http://localhost:{port}} must be + * registered as a valid reply URL on the application. + * + * @param port the port on which the credential will listen for the browser authentication result + * @return the InteractiveBrowserCredentialBuilder itself + */ + public InteractiveBrowserCredentialBuilder port(int port) { + this.port = port; + return this; + } + + /** + * @return a {@link InteractiveBrowserCredential} with the current configurations. + */ + public InteractiveBrowserCredential build() { + ValidationUtil.validate(getClass().getSimpleName(), new HashMap() {{ + put("clientId", clientId); + put("port", port); + }}); + return new InteractiveBrowserCredential(clientId, port, identityClientOptions); + } +} 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 733e99df3f9b..15b0e0ccf177 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 @@ -5,39 +5,36 @@ import com.azure.core.credentials.AccessToken; import com.azure.core.credentials.TokenCredential; +import com.azure.core.implementation.annotation.Immutable; 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.IdentityClient; -import com.azure.identity.IdentityClientOptions; +import com.azure.identity.implementation.IdentityClient; +import com.azure.identity.implementation.IdentityClientBuilder; +import com.azure.identity.implementation.IdentityClientOptions; import reactor.core.publisher.Mono; /** * The base class for Managed Service Identity token based credentials. */ +@Immutable public final class ManagedIdentityCredential implements TokenCredential { private final AppServiceMSICredential appServiceMSICredential; private final VirtualMachineMSICredential virtualMachineMSICredential; - /** - * Creates an instance of the ManagedIdentityCredential with default identity client options. - */ - public ManagedIdentityCredential() { - this(new IdentityClientOptions()); - } - /** * Creates an instance of the ManagedIdentityCredential. + * @param clientId the client id of user assigned or system assigned identity * @param identityClientOptions the options for configuring the identity client. */ - public ManagedIdentityCredential(IdentityClientOptions identityClientOptions) { - IdentityClient identityClient = new IdentityClient(identityClientOptions); + ManagedIdentityCredential(String clientId, IdentityClientOptions identityClientOptions) { + IdentityClient identityClient = new IdentityClientBuilder().clientId(clientId).identityClientOptions(identityClientOptions).build(); Configuration configuration = ConfigurationManager.getConfiguration(); if (configuration.contains(BaseConfigurations.MSI_ENDPOINT)) { - appServiceMSICredential = new AppServiceMSICredential(identityClient); + appServiceMSICredential = new AppServiceMSICredential(clientId, identityClient); virtualMachineMSICredential = null; } else { - virtualMachineMSICredential = new VirtualMachineMSICredential(identityClient); + virtualMachineMSICredential = new VirtualMachineMSICredential(clientId, identityClient); appServiceMSICredential = null; } } @@ -49,21 +46,6 @@ public String clientId() { return this.appServiceMSICredential != null ? this.appServiceMSICredential.clientId() : this.virtualMachineMSICredential.clientId(); } - /** - * Specifies the client id of user assigned or system assigned identity. - * - * @param clientId the client id - * @return ManagedIdentityCredential - */ - public ManagedIdentityCredential clientId(String clientId) { - if (this.appServiceMSICredential != null) { - this.appServiceMSICredential.clientId(clientId); - } else { - this.virtualMachineMSICredential.clientId(clientId); - } - return this; - } - /** * @return the endpoint from which token needs to be retrieved. */ diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ManagedIdentityCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ManagedIdentityCredentialBuilder.java new file mode 100644 index 000000000000..165588d2bc95 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/ManagedIdentityCredentialBuilder.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +/** + * Fluent credential builder for instantiating a {@link ManagedIdentityCredential}. + * + * @see ManagedIdentityCredential + */ +public class ManagedIdentityCredentialBuilder extends CredentialBuilderBase { + private String clientId; + + /** + * Specifies the client id of user assigned or system assigned identity. + * + * @param clientId the client id + * @return the ManagedIdentityCredentialBuilder itself + */ + public ManagedIdentityCredentialBuilder clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * @return a {@link ManagedIdentityCredential} with the current configurations. + */ + public ManagedIdentityCredential build() { + return new ManagedIdentityCredential(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 new file mode 100644 index 000000000000..18a676209f30 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/UsernamePasswordCredential.java @@ -0,0 +1,61 @@ +// 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.implementation.annotation.Immutable; +import com.azure.identity.implementation.IdentityClient; +import com.azure.identity.implementation.IdentityClientBuilder; +import com.azure.identity.implementation.IdentityClientOptions; +import com.azure.identity.implementation.MsalToken; +import reactor.core.publisher.Mono; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; + +/** + * 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. + */ +@Immutable +public class UsernamePasswordCredential implements TokenCredential { + private final String username; + private final String password; + private final IdentityClient identityClient; + private final AtomicReference cachedToken; + + /** + * Creates a UserCredential with the given identity client options. + * + * @param clientId the client ID of the application + * @param username the username of the user + * @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) { + Objects.requireNonNull(username); + Objects.requireNonNull(password); + this.username = username; + this.password = password; + identityClient = new IdentityClientBuilder().tenantId("common").clientId(clientId).identityClientOptions(identityClientOptions).build(); + cachedToken = new AtomicReference<>(); + } + + @Override + public Mono getToken(String... scopes) { + return Mono.defer(() -> { + if (cachedToken.get() != null) { + return identityClient.authenticateWithUserRefreshToken(scopes, cachedToken.get()).onErrorResume(t -> Mono.empty()); + } else { + return Mono.empty(); + } + }).switchIfEmpty(Mono.defer(() -> identityClient.authenticateWithUsernamePassword(scopes, username, password))) + .map(msalToken -> { + cachedToken.set(msalToken); + return msalToken; + }); + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/UsernamePasswordCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/UsernamePasswordCredentialBuilder.java new file mode 100644 index 000000000000..ff558415c669 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/UsernamePasswordCredentialBuilder.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +import com.azure.identity.implementation.util.ValidationUtil; + +import java.util.HashMap; + +/** + * Fluent credential builder for instantiating a {@link UsernamePasswordCredential}. + * + * @see UsernamePasswordCredential + */ +public class UsernamePasswordCredentialBuilder extends AadCredentialBuilderBase { + private String username; + private String password; + + /** + * Sets the username of the user. + * @param username the username of the user + * @return the UserCredentialBuilder itself + */ + public UsernamePasswordCredentialBuilder username(String username) { + this.username = username; + return this; + } + + /** + * Sets the password of the user. + * @param password the password of the user + * @return the UserCredentialBuilder itself + */ + public UsernamePasswordCredentialBuilder password(String password) { + this.password = password; + return this; + } + + /** + * @return a {@link UsernamePasswordCredential} with the current configurations. + */ + public UsernamePasswordCredential build() { + ValidationUtil.validate(getClass().getSimpleName(), new HashMap() {{ + put("clientId", clientId); + put("username", username); + put("password", password); + }}); + return new UsernamePasswordCredential(clientId, username, password, identityClientOptions); + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/VirtualMachineMSICredential.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/VirtualMachineMSICredential.java index 219b9e88436b..032b4b58d6da 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/VirtualMachineMSICredential.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/credential/VirtualMachineMSICredential.java @@ -4,12 +4,14 @@ package com.azure.identity.credential; import com.azure.core.credentials.AccessToken; -import com.azure.identity.IdentityClient; +import com.azure.core.implementation.annotation.Immutable; +import com.azure.identity.implementation.IdentityClient; import reactor.core.publisher.Mono; /** * The Managed Service Identity credential for Virtual Machines. */ +@Immutable class VirtualMachineMSICredential { private final IdentityClient identityClient; @@ -17,9 +19,11 @@ class VirtualMachineMSICredential { /** * Creates an instance of VirtualMachineMSICredential. + * @param clientId the client id of user assigned or system assigned identity * @param identityClient the identity client to acquire a token with. */ - VirtualMachineMSICredential(IdentityClient identityClient) { + VirtualMachineMSICredential(String clientId, IdentityClient identityClient) { + this.clientId = clientId; this.identityClient = identityClient; } @@ -30,23 +34,12 @@ public String clientId() { return this.clientId; } - /** - * Specifies the client id of user assigned or system assigned identity. - * - * @param clientId the client id - * @return VirtualMachineMSICredential - */ - public VirtualMachineMSICredential clientId(String clientId) { - this.clientId = clientId; - return this; - } - /** * Gets the token for a list of scopes. * @param scopes the scopes to get token for * @return a Publisher that emits an AccessToken */ public Mono authenticate(String[] scopes) { - return identityClient.authenticateToIMDSEndpoint(clientId(), scopes); + return identityClient.authenticateToIMDSEndpoint(scopes); } } 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 new file mode 100644 index 000000000000..453f94697411 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/AuthorizationCodeListener.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation; + +import com.azure.core.implementation.http.UrlBuilder; +import reactor.core.publisher.Mono; +import reactor.core.publisher.MonoProcessor; +import reactor.netty.DisposableServer; +import reactor.netty.http.server.HttpServer; + +/** + * A local HTTP server that listens to the authorization code response from Azure Active Directory. + */ +public final class AuthorizationCodeListener { + private DisposableServer server; + private MonoProcessor authorizationCodeEmitter; + + private AuthorizationCodeListener(DisposableServer server, MonoProcessor authorizationCodeEmitter) { + this.server = server; + this.authorizationCodeEmitter = authorizationCodeEmitter; + } + + /** + * Starts the server asynchronously on a given port. "http://locahost:{port}" must be white-listed as a reply URL. + * @param port the port to listen on + * @return a Publisher emitting the listener instance + */ + 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)); + } + + /** + * Dispose the server + * @return a Publisher signaling the completion + */ + public Mono dispose() { + return Mono.fromRunnable(() -> server.disposeNow()); + } + + /** + * Listen for the next authorization code + * @return a Publisher emitting an authorization code + */ + public Mono listen() { + return authorizationCodeEmitter; + } + + private static String getCodeFromUri(String uri) { + UrlBuilder urlBuilder = UrlBuilder.parse(uri); + for (String query : urlBuilder.query().keySet()) { + if ("code".equalsIgnoreCase(query)) { + return urlBuilder.query().get(query); + } + } + return null; + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClient.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClient.java new file mode 100644 index 000000000000..02a7384879e5 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClient.java @@ -0,0 +1,412 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation; + +import com.azure.core.credentials.AccessToken; +import com.azure.core.http.ProxyOptions; +import com.azure.core.implementation.serializer.SerializerAdapter; +import com.azure.core.implementation.serializer.SerializerEncoding; +import com.azure.core.implementation.serializer.jackson.JacksonAdapter; +import com.azure.core.implementation.util.ScopeUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.identity.DeviceCodeChallenge; +import com.azure.identity.implementation.util.CertificateUtil; +import com.microsoft.aad.msal4j.AuthorizationCodeParameters; +import com.microsoft.aad.msal4j.ClientCredentialFactory; +import com.microsoft.aad.msal4j.ClientCredentialParameters; +import com.microsoft.aad.msal4j.ConfidentialClientApplication; +import com.microsoft.aad.msal4j.DeviceCodeFlowParameters; +import com.microsoft.aad.msal4j.PublicClientApplication; +import com.microsoft.aad.msal4j.SilentParameters; +import com.microsoft.aad.msal4j.UserNamePasswordParameters; +import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; + +import java.awt.Desktop; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.Proxy; +import java.net.Proxy.Type; +import java.net.URI; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.NoSuchProviderException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Random; +import java.util.Scanner; +import java.util.UUID; +import java.util.function.Consumer; + +/** + * The identity client that contains APIs to retrieve access tokens + * from various configurations. + */ +public class IdentityClient { + private static final SerializerAdapter SERIALIZER_ADAPTER = JacksonAdapter.createDefaultSerializerAdapter(); + private static final Random RANDOM = new Random(); + private static final ClientLogger LOGGER = new ClientLogger(IdentityClient.class); + + private final IdentityClientOptions options; + private final PublicClientApplication publicClientApplication; + private final String tenantId; + private final String clientId; + + /** + * Creates an IdentityClient with the given options. + * + * @param tenantId the tenant ID of the application. + * @param clientId the client ID of the application. + * @param options the options configuring the client. + */ + IdentityClient(String tenantId, String clientId, IdentityClientOptions options) { + if (tenantId == null) { + tenantId = "common"; + } + if (options == null) { + options = new IdentityClientOptions(); + } + this.tenantId = tenantId; + this.clientId = clientId; + this.options = options; + if (clientId == null) { + this.publicClientApplication = null; + } else { + String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/organizations/" + tenantId; + PublicClientApplication.Builder publicClientApplicationBuilder = PublicClientApplication.builder(clientId); + try { + publicClientApplicationBuilder = publicClientApplicationBuilder.authority(authorityUrl); + } catch (MalformedURLException e) { + LOGGER.logAndThrow(new RuntimeException(e)); + } + if (options.proxyOptions() != null) { + publicClientApplicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.proxyOptions())); + } + this.publicClientApplication = publicClientApplicationBuilder.build(); + } + } + + /** + * Asynchronously acquire a token from Active Directory with a client secret. + * + * @param clientSecret the client secret of the application + * @param scopes the scopes to authenticate to + * @return a Publisher that emits an AccessToken + */ + 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); + 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 (MalformedURLException e) { + return Mono.error(e); + } + } + + /** + * Asynchronously acquire a token from Active Directory with a PKCS12 certificate. + * + * @param pfxCertificatePath the path to the PKCS12 certificate of the application + * @param pfxCertificatePassword the password protecting the PFX certificate + * @param scopes the scopes to authenticate to + * @return a Publisher that emits an AccessToken + */ + public Mono authenticateWithPfxCertificate(String pfxCertificatePath, String pfxCertificatePassword, String[] scopes) { + String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/" + tenantId; + try { + ConfidentialClientApplication.Builder applicationBuilder = ConfidentialClientApplication.builder(clientId, ClientCredentialFactory.create(new FileInputStream(pfxCertificatePath), pfxCertificatePassword)).authority(authorityUrl); + if (options.proxyOptions() != null) { + applicationBuilder.proxy(proxyOptionsToJavaNetProxy(options.proxyOptions())); + } + ConfidentialClientApplication 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.error(e); + } + } + + /** + * Asynchronously acquire a token from Active Directory with a PEM certificate. + * + * @param pemCertificatePath the path to the PEM certificate of the application + * @param scopes the scopes to authenticate to + * @return a Publisher that emits an AccessToken + */ + public Mono authenticateWithPemCertificate(String pemCertificatePath, String[] scopes) { + 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); + 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 (IOException e) { + return Mono.error(e); + } + } + + /** + * Asynchronously acquire a token from Active Directory with a username and a password. + * + * @param scopes the scopes to authenticate to + * @param username the username of the user + * @param password the password of the user + * @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())) + .map(MsalToken::new); + } + + /** + * Asynchronously acquire a token from the currently logged in client. + * @param scopes the scopes to authenticate to + * @return a Publisher that emits an AccessToken + */ + public Mono authenticateWithUserRefreshToken(String[] scopes, MsalToken msalToken) { + SilentParameters parameters; + if (msalToken.account() != null) { + parameters = SilentParameters.builder(new HashSet<>(Arrays.asList(scopes)), msalToken.account()).build(); + } else { + parameters = SilentParameters.builder(new HashSet<>(Arrays.asList(scopes))).build(); + } + return Mono.defer(() -> { + try { + return Mono.fromFuture(publicClientApplication.acquireTokenSilently(parameters)).map(MsalToken::new); + } catch (MalformedURLException e) { + return Mono.error(e); + } + }); + } + + /** + * Asynchronously acquire a token from Active Directory with a device code challenge. Active Directory will provide + * a device code for login and the user must meet the challenge by authenticating in a browser on the current or a + * different device. + * + * @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 + */ + 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(); + return publicClientApplication.acquireToken(parameters); + }).map(MsalToken::new); + } + + /** + * Asynchronously acquire a token from Active Directory with an authorization code from an oauth flow. + * + * @param scopes the scopes to authenticate to + * @param authorizationCode the oauth2 authorization code + * @param redirectUri the redirectUri where the authorization code is sent to + * @return a Publisher that emits an AccessToken + */ + 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); + } + + /** + * Asynchronously acquire a token from Active Directory by opening a browser and wait for the user to login. The + * credential will run a minimal local HttpServer at the given port, so {@code http://localhost:{port}} must be + * listed as a valid reply URL for the application. + * + * @param scopes the scopes to authenticate to + * @param port the port on which the HTTP server is listening + * @return a Publisher that emits an AccessToken + */ + public Mono authenticateWithBrowserInteraction(String[] scopes, int port) { + String authorityUrl = options.authorityHost().replaceAll("/+$", "") + "/" + "common"; + return AuthorizationCodeListener.create(port) + .flatMap(server -> { + URI redirectUri; + URI browserUri; + try { + redirectUri = new URI(String.format("http://localhost:%s", port)); + browserUri = new URI(String.format("%s/oauth2/v2.0/authorize?response_type=code&response_mode=query&prompt=select_account&client_id=%s&redirect_uri=%s&state=%s&scope=%s", + authorityUrl, clientId, redirectUri.toString(), UUID.randomUUID(), String.join(" ", scopes))); + } catch (URISyntaxException e) { + return server.dispose().then(Mono.error(e)); + } + + return server.listen() + .mergeWith(Mono.fromRunnable(() -> { + try { + Desktop.getDesktop().browse(browserUri); + } catch (IOException e) { + LOGGER.logAndThrow(new RuntimeException(e)); + } + }).subscribeOn(Schedulers.newSingle("browser"))) + .next() + .flatMap(code -> authenticateWithAuthorizationCode(scopes, code, redirectUri)) + .onErrorResume(t -> server.dispose().then(Mono.error(t))) + .flatMap(msalToken -> server.dispose().then(Mono.just(msalToken))); + }); + } + + /** + * Asynchronously acquire a token from the App Service Managed Service Identity endpoint. + * + * @param msiEndpoint the endpoint to acquire token from + * @param msiSecret the secret to acquire token with + * @param scopes the scopes to authenticate to + * @return a Publisher that emits an AccessToken + */ + public Mono authenticateToManagedIdentityEndpoint(String msiEndpoint, String msiSecret, String[] scopes) { + String resource = ScopeUtil.scopesToResource(scopes); + HttpURLConnection connection = null; + StringBuilder payload = new StringBuilder(); + + try { + payload.append("resource="); + payload.append(URLEncoder.encode(resource, "UTF-8")); + payload.append("&api-version="); + payload.append(URLEncoder.encode("2017-09-01", "UTF-8")); + if (clientId != null) { + payload.append("&client_id="); + payload.append(URLEncoder.encode(clientId, "UTF-8")); + } + } catch (IOException exception) { + return Mono.error(exception); + } + try { + URL url = new URL(String.format("%s?%s", msiEndpoint, payload)); + connection = (HttpURLConnection) url.openConnection(); + + connection.setRequestMethod("GET"); + if (msiSecret != null) { + connection.setRequestProperty("Secret", msiSecret); + } + connection.setRequestProperty("Metadata", "true"); + + connection.connect(); + + Scanner s = new Scanner(connection.getInputStream(), StandardCharsets.UTF_8.name()).useDelimiter("\\A"); + String result = s.hasNext() ? s.next() : ""; + + return Mono.just(SERIALIZER_ADAPTER.deserialize(result, MSIToken.class, SerializerEncoding.JSON)); + } catch (IOException e) { + return Mono.error(e); + } finally { + if (connection != null) { + connection.disconnect(); + } + } + } + + /** + * Asynchronously acquire a token from the Virtual Machine IMDS endpoint. + * + * @param scopes the scopes to authenticate to + * @return a Publisher that emits an AccessToken + */ + public Mono authenticateToIMDSEndpoint(String[] scopes) { + String resource = ScopeUtil.scopesToResource(scopes); + StringBuilder payload = new StringBuilder(); + final int imdsUpgradeTimeInMs = 70 * 1000; + + try { + payload.append("api-version="); + payload.append(URLEncoder.encode("2018-02-01", "UTF-8")); + payload.append("&resource="); + payload.append(URLEncoder.encode(resource, "UTF-8")); + if (clientId != null) { + payload.append("&client_id="); + payload.append(URLEncoder.encode(clientId, "UTF-8")); + } + } catch (IOException exception) { + return Mono.error(exception); + } + + int retry = 1; + while (retry <= options.maxRetry()) { + URL url = null; + HttpURLConnection connection = null; + try { + url = new URL(String.format("http://169.254.169.254/metadata/identity/oauth2/token?%s", payload.toString())); + + connection = (HttpURLConnection) url.openConnection(); + connection.setRequestMethod("GET"); + connection.setRequestProperty("Metadata", "true"); + connection.connect(); + + Scanner s = new Scanner(connection.getInputStream(), StandardCharsets.UTF_8.name()).useDelimiter("\\A"); + String result = s.hasNext() ? s.next() : ""; + + 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)); + } + int responseCode = 0; + try { + responseCode = connection.getResponseCode(); + } catch (IOException e) { + return Mono.error(e); + } + if (responseCode == 410 || responseCode == 429 || responseCode == 404 || (responseCode >= 500 && responseCode <= 599)) { + int retryTimeoutInMs = options.retryTimeout().apply(RANDOM.nextInt(retry)); + // Error code 410 indicates IMDS upgrade is in progress, which can take up to 70s + // + retryTimeoutInMs = (responseCode == 410 && retryTimeoutInMs < imdsUpgradeTimeInMs) ? imdsUpgradeTimeInMs : retryTimeoutInMs; + retry++; + if (retry > options.maxRetry()) { + break; + } else { + sleep(retryTimeoutInMs); + } + } else { + return Mono.error(new RuntimeException("Couldn't acquire access token from IMDS, verify your objectId, clientId or msiResourceId", exception)); + } + } finally { + if (connection != null) { + connection.disconnect(); + } + } + } + return Mono.error(new RuntimeException(String.format("MSI: Failed to acquire tokens after retrying %s times", options.maxRetry()))); + } + + private static void sleep(int millis) { + try { + Thread.sleep(millis); + } catch (InterruptedException ex) { + LOGGER.logAndThrow(new RuntimeException(ex)); + } + } + + private static Proxy proxyOptionsToJavaNetProxy(ProxyOptions options) { + switch (options.type()) { + case SOCKS4: + case SOCKS5: + return new Proxy(Type.SOCKS, options.address()); + case HTTP: + default: + return new Proxy(Type.HTTP, options.address()); + } + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientBuilder.java new file mode 100644 index 000000000000..9bc41c4a6801 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientBuilder.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation; + +/** + * Fluent client builder for instantiating an {@link IdentityClient}. + * + * @see IdentityClient + */ +public final class IdentityClientBuilder { + private IdentityClientOptions identityClientOptions; + private String tenantId; + private String clientId; + + /** + * Sets the tenant ID for the client. + * @param tenantId the tenant ID for the client. + * @return the IdentityClientBuilder itself + */ + public IdentityClientBuilder tenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Sets the client ID for the client. + * @param clientId the client ID for the client. + * @return the IdentityClientBuilder itself + */ + public IdentityClientBuilder clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Sets the options for the client. + * @param identityClientOptions the options for the client. + * @return the IdentityClientBuilder itself + */ + public IdentityClientBuilder identityClientOptions(IdentityClientOptions identityClientOptions) { + this.identityClientOptions = identityClientOptions; + return this; + } + + /** + * @return a {@link IdentityClient} with the current configurations. + */ + public IdentityClient build() { + return new IdentityClient(tenantId, clientId, identityClientOptions); + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/IdentityClientOptions.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientOptions.java similarity index 98% rename from sdk/identity/azure-identity/src/main/java/com/azure/identity/IdentityClientOptions.java rename to sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientOptions.java index cc435305ecf7..d5f740d6079b 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/IdentityClientOptions.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentityClientOptions.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.identity; +package com.azure.identity.implementation; import com.azure.core.http.ProxyOptions; 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 80c70153aa55..01342c238800 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 @@ -4,6 +4,7 @@ package com.azure.identity.implementation; import com.azure.core.credentials.AccessToken; +import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; @@ -18,7 +19,8 @@ */ public final class MSIToken extends AccessToken { - private static OffsetDateTime epoch = OffsetDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); + private static final OffsetDateTime EPOCH = OffsetDateTime.of(1970, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC); + private static final ClientLogger LOGGER = new ClientLogger(MSIToken.class); @JsonProperty(value = "token_type") private String tokenType; @@ -41,7 +43,7 @@ public MSIToken(String token, OffsetDateTime expiresOn) { @JsonCreator private MSIToken(@JsonProperty(value = "access_token") String token, @JsonProperty(value = "expires_on") String expiresOn) { - this(token, epoch.plusSeconds(parseDateToEpochSeconds(expiresOn))); + this(token, EPOCH.plusSeconds(parseDateToEpochSeconds(expiresOn))); this.accessToken = token; this.expiresOn = expiresOn; } @@ -53,13 +55,13 @@ public String token() { @Override public OffsetDateTime expiresOn() { - return epoch.plusSeconds(parseDateToEpochSeconds(this.expiresOn)); + return EPOCH.plusSeconds(parseDateToEpochSeconds(this.expiresOn)); } @Override public boolean isExpired() { OffsetDateTime now = OffsetDateTime.now(); - OffsetDateTime expireOn = epoch.plusSeconds(parseDateToEpochSeconds(this.expiresOn)); + OffsetDateTime expireOn = EPOCH.plusSeconds(parseDateToEpochSeconds(this.expiresOn)); return now.plusMinutes(5).isAfter(expireOn); } @@ -77,7 +79,8 @@ private static Long parseDateToEpochSeconds(String dateTime) { System.err.println(e.getMessage()); } - throw new IllegalArgumentException(String.format("Unable to parse date time %s ", dateTime)); + LOGGER.logAndThrow(new IllegalArgumentException(String.format("Unable to parse date time %s ", dateTime))); + return null; } } 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 new file mode 100644 index 000000000000..13f154d1b37b --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/MsalToken.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation; + +import com.azure.core.credentials.AccessToken; +import com.microsoft.aad.msal4j.IAccount; +import com.microsoft.aad.msal4j.IAuthenticationResult; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** + * Type representing authentication result from the MSAL (Microsoft Authentication Library). + */ +public final class MsalToken extends AccessToken { + + private IAccount account; + + /** + * Creates an access token instance. + * + * @param msalResult the raw authentication result returned by MSAL + */ + public MsalToken(IAuthenticationResult msalResult) { + super(msalResult.accessToken(), OffsetDateTime.ofInstant(msalResult.expiresOnDate().toInstant(), ZoneOffset.UTC)); + this.account = msalResult.account(); + } + + /** + * @return the signed in account + */ + public IAccount account() { + return account; + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/package-info.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/package-info.java new file mode 100644 index 000000000000..5f9b624294a5 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing implementations for retrieving access tokens from various configurations + */ +package com.azure.identity.implementation; diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/Adal4jUtil.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/Adal4jUtil.java deleted file mode 100644 index 723cedb30c66..000000000000 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/Adal4jUtil.java +++ /dev/null @@ -1,126 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.identity.implementation.util; - -import com.azure.core.implementation.util.Base64Util; -import com.microsoft.aad.adal4j.AsymmetricKeyCredential; -import com.microsoft.aad.adal4j.AuthenticationCallback; -import com.microsoft.aad.adal4j.AuthenticationResult; -import reactor.core.Exceptions; -import reactor.core.publisher.MonoSink; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.security.KeyFactory; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.NoSuchProviderException; -import java.security.PrivateKey; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.PKCS8EncodedKeySpec; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -/** - * Utility class for various operations for interacting with adal4j. - */ -public final class Adal4jUtil { - /** - * Routes a callback based call in adal4j to a Mono emitter. - * @param callback the Mono emitter - * @return the callback to pass into adal4j - */ - public static AuthenticationCallback authenticationDelegate(final MonoSink callback) { - return new AuthenticationCallback() { - @Override - public void onSuccess(AuthenticationResult o) { - callback.success(o); - } - - @Override - public void onFailure(Throwable throwable) { - callback.error(throwable); - } - }; - } - - /** - * Creates an AsymmetricKeyCredential from a PKCS12 certificate. - * @param clientId the client ID of the application. - * @param clientCertificate the PKCS12 certificate - * @param clientCertificatePassword the password protecting the PKCS12 certificate - * @return the AsymmetricKeyCredential - */ - public static AsymmetricKeyCredential createAsymmetricKeyCredential(String clientId, byte[] clientCertificate, String clientCertificatePassword) { - try { - return AsymmetricKeyCredential.create(clientId, new ByteArrayInputStream(clientCertificate), clientCertificatePassword); - } catch (KeyStoreException kse) { - throw Exceptions.propagate(kse); - } catch (NoSuchProviderException nspe) { - throw Exceptions.propagate(nspe); - } catch (NoSuchAlgorithmException nsae) { - throw Exceptions.propagate(nsae); - } catch (CertificateException ce) { - throw Exceptions.propagate(ce); - } catch (IOException ioe) { - throw Exceptions.propagate(ioe); - } catch (UnrecoverableKeyException uke) { - throw Exceptions.propagate(uke); - } - } - - /** - * Extracts the PrivateKey from a PEM certificate. - * @param pem the contents of a PEM certificate. - * @return the PrivateKey - */ - 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 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", ""); - byte[] key = Base64Util.decode(base64.getBytes(StandardCharsets.UTF_8)); - PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(key); - try { - KeyFactory kf = KeyFactory.getInstance("RSA"); - return kf.generatePrivate(spec); - } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { - throw new RuntimeException(e); - } - } - - /** - * Extracts the X509Certificate certificate from a PEM certificate. - * @param pem the contents of a PEM certificate. - * @return the X509Certificate certificate - */ - 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 new IllegalArgumentException("PEM certificate provided does not contain -----BEGIN CERTIFICATE-----END CERTIFICATE----- block"); - } - try { - CertificateFactory factory = CertificateFactory.getInstance("X.509"); - InputStream stream = new ByteArrayInputStream(matcher.group().getBytes(StandardCharsets.UTF_8)); - return (X509Certificate) factory.generateCertificate(stream); - } catch (CertificateException e) { - throw new RuntimeException(e); - } - } - - private Adal4jUtil() { } -} 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 new file mode 100644 index 000000000000..551ec724960f --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/CertificateUtil.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.util; + +import com.azure.core.implementation.util.Base64Util; +import com.azure.core.util.logging.ClientLogger; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.security.KeyFactory; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.cert.CertificateException; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.security.spec.InvalidKeySpecException; +import java.security.spec.PKCS8EncodedKeySpec; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Utility class for various operations for interacting with certificates. + */ +public final class CertificateUtil { + private static final ClientLogger LOGGER = new ClientLogger(CertificateUtil.class); + + /** + * Extracts the PrivateKey from a PEM certificate. + * @param pem the contents of a PEM certificate. + * @return the PrivateKey + */ + 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()) { + LOGGER.logAndThrow(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", ""); + byte[] key = Base64Util.decode(base64.getBytes(StandardCharsets.UTF_8)); + PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(key); + try { + KeyFactory kf = KeyFactory.getInstance("RSA"); + return kf.generatePrivate(spec); + } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { + LOGGER.logAndThrow(new RuntimeException(e)); + return null; + } + } + + /** + * Extracts the X509Certificate certificate from a PEM certificate. + * @param pem the contents of a PEM certificate. + * @return the X509Certificate certificate + */ + 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()) { + LOGGER.logAndThrow(new IllegalArgumentException("PEM certificate provided does not contain -----BEGIN CERTIFICATE-----END CERTIFICATE----- block")); + } + try { + CertificateFactory factory = CertificateFactory.getInstance("X.509"); + InputStream stream = new ByteArrayInputStream(matcher.group().getBytes(StandardCharsets.UTF_8)); + return (X509Certificate) factory.generateCertificate(stream); + } catch (CertificateException e) { + LOGGER.logAndThrow(new RuntimeException(e)); + return null; + } + } + + private CertificateUtil() { } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/ValidationUtil.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/ValidationUtil.java new file mode 100644 index 000000000000..91d07e423df8 --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/ValidationUtil.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation.util; + +import com.azure.core.util.logging.ClientLogger; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * Utility class for validating parameters. + */ +public final class ValidationUtil { + public static void validate(String className, Map parameters) { + ClientLogger logger = new ClientLogger(className); + List missing = new ArrayList<>(); + for (Map.Entry entry : parameters.entrySet()) { + if (entry.getValue() == null) { + missing.add(entry.getKey()); + } + } + if (missing.size() > 0) { + logger.logAndThrow(new IllegalArgumentException("Must provide non-null values for " + + String.join(", ", missing) + " properties in " + className)); + } + } +} diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/package-info.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/package-info.java new file mode 100644 index 000000000000..17dda67f40ac --- /dev/null +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/util/package-info.java @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing utility classes for credentials and clients + */ +package com.azure.identity.implementation.util; diff --git a/sdk/identity/azure-identity/src/samples/java/com/azure/identity/credential/JavaDocCodeSnippets.java b/sdk/identity/azure-identity/src/samples/java/com/azure/identity/credential/JavaDocCodeSnippets.java new file mode 100644 index 000000000000..0089b9330f70 --- /dev/null +++ b/sdk/identity/azure-identity/src/samples/java/com/azure/identity/credential/JavaDocCodeSnippets.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.credential; + +import com.azure.core.http.ProxyOptions; +import com.azure.core.http.ProxyOptions.Type; + +import java.net.InetSocketAddress; + +/** + * This class contains code samples for generating javadocs through doclets for azure-identity. + */ +public final class JavaDocCodeSnippets { + + private String tenantId = System.getenv("AZURE_TENANT_ID"); + private String clientId = System.getenv("AZURE_CLIENT_ID"); + private String clientSecret = System.getenv("AZURE_CLIENT_SECRET"); + private String username = "sampleuser"; + private String password = "Samp1eP@ssw0rd"; + + /** + * Method to insert code snippets for {@link ClientSecretCredential} + */ + public void clientSecretCredentialCodeSnippets() { + // BEGIN: com.azure.identity.credential.clientsecretcredential.construct + ClientSecretCredential credential1 = new ClientSecretCredentialBuilder() + .tenantId(tenantId) + .clientId(clientId) + .clientSecret(clientSecret) + .build(); + // END: com.azure.identity.credential.clientsecretcredential.construct + + // BEGIN: com.azure.identity.credential.clientsecretcredential.constructwithproxy + ClientSecretCredential credential2 = new ClientSecretCredentialBuilder() + .tenantId(tenantId) + .clientId(clientId) + .clientSecret(clientSecret) + .proxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("10.21.32.43", 5465))) + .build(); + // END: com.azure.identity.credential.clientsecretcredential.constructwithproxy + } + + /** + * Method to insert code snippets for {@link ClientCertificateCredential} + */ + public void clientCertificateCredentialCodeSnippets() { + // BEGIN: com.azure.identity.credential.clientcertificatecredential.construct + ClientCertificateCredential credential1 = new ClientCertificateCredentialBuilder() + .tenantId(tenantId) + .clientId(clientId) + .pemCertificate("C:\\fakepath\\cert.pem") + .build(); + // END: com.azure.identity.credential.clientcertificatecredential.construct + + // BEGIN: com.azure.identity.credential.clientcertificatecredential.constructwithproxy + ClientCertificateCredential credential2 = new ClientCertificateCredentialBuilder() + .tenantId(tenantId) + .clientId(clientId) + .pfxCertificate("C:\\fakepath\\cert.pfx", "P@s$w0rd") + .proxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("10.21.32.43", 5465))) + .build(); + // END: com.azure.identity.credential.clientcertificatecredential.constructwithproxy + } + + /** + * Method to insert code snippets for {@link ClientCertificateCredential} + */ + public void chainedTokenCredentialCodeSnippets() { + // BEGIN: com.azure.identity.credential.chainedtokencredential.construct + UsernamePasswordCredential usernamePasswordCredential = new UsernamePasswordCredentialBuilder() + .clientId(clientId) + .username(username) + .password(password) + .build(); + InteractiveBrowserCredential interactiveBrowserCredential = new InteractiveBrowserCredentialBuilder() + .clientId(clientId) + .port(8765) + .build(); + ChainedTokenCredential credential = new ChainedTokenCredentialBuilder() + .addLast(usernamePasswordCredential) + .addLast(interactiveBrowserCredential) + .build(); + // END: com.azure.identity.credential.chainedtokencredential.construct + } +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/ManagedIdentityCredentialTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/ManagedIdentityCredentialTests.java deleted file mode 100644 index 704872498a33..000000000000 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/ManagedIdentityCredentialTests.java +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.identity; - -import com.azure.core.util.configuration.BaseConfigurations; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.identity.credential.ManagedIdentityCredential; -import org.junit.Assert; -import org.junit.Test; - -public class ManagedIdentityCredentialTests { - @Test - public void testAppServiceMSICredentialConfigurations() { - ConfigurationManager.getConfiguration() - .put(BaseConfigurations.MSI_ENDPOINT, "http://foo") - .put(BaseConfigurations.MSI_SECRET, "bar"); - ManagedIdentityCredential credential = new ManagedIdentityCredential(); - Assert.assertEquals("http://foo", credential.msiEndpoint()); - Assert.assertEquals("bar", credential.msiSecret()); - } - - @Test - public void testVirtualMachineMSICredentialConfigurations() { - ConfigurationManager.getConfiguration().remove(BaseConfigurations.MSI_ENDPOINT); - ConfigurationManager.getConfiguration().remove(BaseConfigurations.MSI_SECRET); - ManagedIdentityCredential credential = new ManagedIdentityCredential().clientId("foo"); - Assert.assertEquals("foo", credential.clientId()); - } -} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientCertificateCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientCertificateCredentialTest.java new file mode 100644 index 000000000000..b8ff9e60b4c7 --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientCertificateCredentialTest.java @@ -0,0 +1,130 @@ +// 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.identity.implementation.IdentityClient; +import com.azure.identity.util.TestUtils; +import com.microsoft.aad.msal4j.MsalServiceException; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.UUID; + +import static org.junit.Assert.fail; +import static org.mockito.Mockito.when; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(fullyQualifiedNames = "com.azure.identity.*") +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) +public class ClientCertificateCredentialTest { + + private final String tenantId = "contoso.com"; + private final String clientId = UUID.randomUUID().toString(); + + @Test + public void testValidCertificates() throws Exception { + // setup + String pemPath = "C:\\fakepath\\cert1.pem"; + String pfxPath = "C:\\fakepath\\cert2.pfx"; + String pfxPassword = "password"; + String token1 = "token1"; + String token2 = "token2"; + String[] scopes1 = new String[] { "https://management.azure.com" }; + String[] scopes2 = new String[] { "https://vault.azure.net" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateWithPemCertificate(pemPath, scopes1)).thenReturn(TestUtils.getMockAccessToken(token1, expiresOn)); + when(identityClient.authenticateWithPfxCertificate(pfxPath, pfxPassword, scopes2)).thenReturn(TestUtils.getMockAccessToken(token2, expiresOn)); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + ClientCertificateCredential credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).pemCertificate(pemPath).build(); + AccessToken token = credential.getToken(scopes1).block(); + Assert.assertEquals(token1, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).pfxCertificate(pfxPath, pfxPassword).build(); + token = credential.getToken(scopes2).block(); + Assert.assertEquals(token2, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + } + + @Test + public void testInvalidCertificates() throws Exception { + // setup + String pemPath = "C:\\fakepath\\cert1.pem"; + String pfxPath = "C:\\fakepath\\cert2.pfx"; + String pfxPassword = "password"; + String[] scopes1 = new String[] { "https://management.azure.com" }; + String[] scopes2 = new String[] { "https://vault.azure.net" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateWithPemCertificate(pemPath, scopes1)).thenThrow(new MsalServiceException("bad pem", "BadPem")); + when(identityClient.authenticateWithPfxCertificate(pfxPath, pfxPassword, scopes2)).thenThrow(new MsalServiceException("bad pfx", "BadPfx")); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + try { + ClientCertificateCredential credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).pemCertificate(pemPath).build(); + credential.getToken(scopes1).block(); + } catch (MsalServiceException e) { + Assert.assertEquals("bad pem", e.getMessage()); + } + try { + ClientCertificateCredential credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).pfxCertificate(pfxPath, pfxPassword).build(); + credential.getToken(scopes2).block(); + fail(); + } catch (MsalServiceException e) { + Assert.assertEquals("bad pfx", e.getMessage()); + } + } + + @Test + public void testInvalidParameters() throws Exception { + // setup + String pemPath = "C:\\fakepath\\cert1.pem"; + String token1 = "token1"; + String[] scopes = new String[] { "https://management.azure.com" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateWithPemCertificate(pemPath, scopes)).thenReturn(TestUtils.getMockAccessToken(token1, expiresOn)); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + try { + ClientCertificateCredential credential = new ClientCertificateCredentialBuilder().clientId(clientId).pemCertificate(pemPath).build(); + credential.getToken(scopes).block(); + fail(); + } catch (IllegalArgumentException e) { + Assert.assertTrue(e.getMessage().contains("tenantId")); + } + try { + ClientCertificateCredential credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).pemCertificate(pemPath).build(); + credential.getToken(scopes).block(); + fail(); + } catch (IllegalArgumentException e) { + Assert.assertTrue(e.getMessage().contains("clientId")); + } + try { + ClientCertificateCredential credential = new ClientCertificateCredentialBuilder().tenantId(tenantId).clientId(clientId).build(); + credential.getToken(scopes).block(); + fail(); + } catch (IllegalArgumentException e) { + Assert.assertTrue(e.getMessage().contains("clientCertificate")); + } + } +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientSecretCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientSecretCredentialTest.java new file mode 100644 index 000000000000..9ef7f6a253e0 --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ClientSecretCredentialTest.java @@ -0,0 +1,124 @@ +// 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.identity.implementation.IdentityClient; +import com.azure.identity.util.TestUtils; +import com.microsoft.aad.msal4j.MsalServiceException; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.UUID; + +import static org.junit.Assert.fail; +import static org.mockito.Mockito.when; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(fullyQualifiedNames = "com.azure.identity.*") +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) +public class ClientSecretCredentialTest { + + private final String tenantId = "contoso.com"; + private final String clientId = UUID.randomUUID().toString(); + + @Test + public void testValidSecrets() throws Exception { + // setup + String secret = "secret"; + String token1 = "token1"; + String token2 = "token2"; + String[] scopes1 = new String[] { "https://management.azure.com" }; + String[] scopes2 = new String[] { "https://vault.azure.net" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateWithClientSecret(secret, scopes1)).thenReturn(TestUtils.getMockAccessToken(token1, expiresOn)); + when(identityClient.authenticateWithClientSecret(secret, scopes2)).thenReturn(TestUtils.getMockAccessToken(token2, expiresOn)); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + ClientSecretCredential credential = new ClientSecretCredentialBuilder().tenantId(tenantId).clientId(clientId).clientSecret(secret).build(); + AccessToken token = credential.getToken(scopes1).block(); + Assert.assertEquals(token1, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + token = credential.getToken(scopes2).block(); + Assert.assertEquals(token2, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + } + + @Test + public void testInvalidSecrets() throws Exception { + // setup + String secret = "secret"; + String badSecret = "badsecret"; + String token1 = "token1"; + String[] scopes = new String[] { "https://management.azure.com" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateWithClientSecret(secret, scopes)).thenReturn(TestUtils.getMockAccessToken(token1, expiresOn)); + when(identityClient.authenticateWithClientSecret(badSecret, scopes)).thenThrow(new MsalServiceException("bad secret", "BadSecret")); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + ClientSecretCredential credential = new ClientSecretCredentialBuilder().tenantId(tenantId).clientId(clientId).clientSecret(secret).build(); + AccessToken token = credential.getToken(scopes).block(); + Assert.assertEquals(token1, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + try { + credential = new ClientSecretCredentialBuilder().tenantId(tenantId).clientId(clientId).clientSecret(badSecret).build(); + credential.getToken(scopes).block(); + fail(); + } catch (MsalServiceException e) { + Assert.assertEquals("bad secret", e.getMessage()); + } + } + + @Test + public void testInvalidParameters() throws Exception { + // setup + String secret = "secret"; + String token1 = "token1"; + String[] scopes = new String[] { "https://management.azure.com" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateWithClientSecret(secret, scopes)).thenReturn(TestUtils.getMockAccessToken(token1, expiresOn)); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + try { + ClientSecretCredential credential = new ClientSecretCredentialBuilder().clientId(clientId).clientSecret(secret).build(); + credential.getToken(scopes).block(); + fail(); + } catch (IllegalArgumentException e) { + Assert.assertTrue(e.getMessage().contains("tenantId")); + } + try { + ClientSecretCredential credential = new ClientSecretCredentialBuilder().tenantId(tenantId).clientSecret(secret).build(); + credential.getToken(scopes).block(); + fail(); + } catch (IllegalArgumentException e) { + Assert.assertTrue(e.getMessage().contains("clientId")); + } + try { + ClientSecretCredential credential = new ClientSecretCredentialBuilder().tenantId(tenantId).clientId(clientId).build(); + credential.getToken(scopes).block(); + fail(); + } catch (IllegalArgumentException e) { + Assert.assertTrue(e.getMessage().contains("clientSecret")); + } + } +} 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 new file mode 100644 index 000000000000..9c25f03cdca8 --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/DefaultAzureCredentialTest.java @@ -0,0 +1,106 @@ +// 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.exception.ClientAuthenticationException; +import com.azure.core.util.configuration.Configuration; +import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.identity.implementation.IdentityClient; +import com.azure.identity.util.TestUtils; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import reactor.core.publisher.Mono; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.UUID; + +import static org.junit.Assert.fail; +import static org.mockito.Mockito.when; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(fullyQualifiedNames = "com.azure.identity.*") +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) +public class DefaultAzureCredentialTest { + + private final String tenantId = "contoso.com"; + private final String clientId = UUID.randomUUID().toString(); + + @Test + public void testUseEnvironmentCredential() throws Exception { + Configuration configuration = ConfigurationManager.getConfiguration(); + + try { + // setup + String secret = "secret"; + String token1 = "token1"; + String[] scopes1 = new String[]{"https://management.azure.com"}; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + configuration.put("AZURE_CLIENT_ID", clientId); + configuration.put("AZURE_CLIENT_SECRET", secret); + configuration.put("AZURE_TENANT_ID", tenantId); + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateWithClientSecret(secret, scopes1)).thenReturn(TestUtils.getMockAccessToken(token1, expiresOn)); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); + AccessToken token = credential.getToken(scopes1).block(); + Assert.assertEquals(token1, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + } finally { + // clean up + configuration.remove("AZURE_CLIENT_ID"); + configuration.remove("AZURE_CLIENT_SECRET"); + configuration.remove("AZURE_TENANT_ID"); + } + } + + @Test + public void testUseManagedIdentityCredential() throws Exception { + // setup + String token1 = "token1"; + String[] scopes = new String[] { "https://management.azure.com" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateToIMDSEndpoint(scopes)).thenReturn(TestUtils.getMockAccessToken(token1, expiresOn)); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); + AccessToken token = credential.getToken(scopes).block(); + Assert.assertEquals(token1, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + } + + @Test + public void testNoCredentialWorks() throws Exception { + // setup + String[] scopes = new String[] { "https://management.azure.com" }; + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateToIMDSEndpoint(scopes)).thenReturn(Mono.error(new RuntimeException("Hidden error message"))); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + try { + DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); + credential.getToken(scopes).block(); + fail(); + } catch (ClientAuthenticationException e) { + Assert.assertTrue(e.getMessage().contains("No credential can provide a token")); + } + } +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/DeviceCodeCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/DeviceCodeCredentialTest.java new file mode 100644 index 000000000000..7fd33b6b8e4a --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/DeviceCodeCredentialTest.java @@ -0,0 +1,72 @@ +// 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.identity.DeviceCodeChallenge; +import com.azure.identity.implementation.IdentityClient; +import com.azure.identity.util.TestUtils; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.exceptions.misusing.InvalidUseOfMatchersException; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import reactor.core.publisher.Mono; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.UUID; +import java.util.function.Consumer; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(fullyQualifiedNames = "com.azure.identity.*") +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) +public class DeviceCodeCredentialTest { + + private final String tenantId = "contoso.com"; + private final String clientId = UUID.randomUUID().toString(); + + @Test + public void testValidDeviceCode() throws Exception { + // setup + Consumer consumer = deviceCodeChallenge -> { /* do nothing */ }; + String token1 = "token1"; + String token2 = "token2"; + String[] scopes1 = new String[] { "https://management.azure.com" }; + String[] scopes2 = new String[] { "https://vault.azure.net" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateWithDeviceCode(eq(scopes1), eq(consumer))).thenReturn(TestUtils.getMockMsalToken(token1, expiresOn)); + when(identityClient.authenticateWithUserRefreshToken(any(), any())) + .thenAnswer(invocation -> { + String[] argument = (String[]) invocation.getArguments()[0]; + if (argument.length == 1 && argument[0].equals(scopes2[0])) { + return TestUtils.getMockMsalToken(token2, expiresOn); + } else if (argument.length == 1 && argument[0].equals(scopes1[0])) { + return Mono.error(new UnsupportedOperationException("nothing cached")); + } else { + throw new InvalidUseOfMatchersException(String.format("Argument %s does not match", (Object) argument)); + } + }); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + DeviceCodeCredential credential = new DeviceCodeCredentialBuilder().deviceCodeChallengeConsumer(consumer).clientId(clientId).build(); + AccessToken token = credential.getToken(scopes1).block(); + Assert.assertEquals(token1, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + token = credential.getToken(scopes2).block(); + Assert.assertEquals(token2, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + } +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/EnvironmentCredentialTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/EnvironmentCredentialTests.java similarity index 94% rename from sdk/identity/azure-identity/src/test/java/com/azure/identity/EnvironmentCredentialTests.java rename to sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/EnvironmentCredentialTests.java index d90ed0e462da..b9d62395654d 100644 --- a/sdk/identity/azure-identity/src/test/java/com/azure/identity/EnvironmentCredentialTests.java +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/EnvironmentCredentialTests.java @@ -1,13 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.identity; +package com.azure.identity.credential; import com.azure.core.credentials.AccessToken; 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.credential.EnvironmentCredential; import org.junit.Assert; import org.junit.Test; import reactor.core.publisher.Mono; @@ -24,7 +23,7 @@ public void testCreateEnvironmentCredential() { configuration.put(BaseConfigurations.AZURE_CLIENT_SECRET, "bar"); configuration.put(BaseConfigurations.AZURE_TENANT_ID, "baz"); - EnvironmentCredential credential = new EnvironmentCredential(); + EnvironmentCredential credential = new EnvironmentCredentialBuilder().build(); // authentication will fail client-id=foo, but should be able to create ClientSecretCredential AccessToken token = credential.getToken("qux/.default") diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/InteractiveBrowserCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/InteractiveBrowserCredentialTest.java new file mode 100644 index 000000000000..a8a5e2b17c85 --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/InteractiveBrowserCredentialTest.java @@ -0,0 +1,73 @@ +// 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.identity.implementation.IdentityClient; +import com.azure.identity.util.TestUtils; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.exceptions.misusing.InvalidUseOfMatchersException; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import reactor.core.publisher.Mono; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Random; +import java.util.UUID; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.when; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(fullyQualifiedNames = "com.azure.identity.*") +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) +public class InteractiveBrowserCredentialTest { + + private final String tenantId = "contoso.com"; + private final String clientId = UUID.randomUUID().toString(); + + @Test + public void testValidInteractive() throws Exception { + Random random = new Random(); + + // setup + String token1 = "token1"; + String token2 = "token2"; + String[] scopes1 = new String[] { "https://management.azure.com" }; + String[] scopes2 = new String[] { "https://vault.azure.net" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + int port = random.nextInt(10000) + 10000; + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateWithBrowserInteraction(eq(scopes1), eq(port))).thenReturn(TestUtils.getMockMsalToken(token1, expiresOn)); + when(identityClient.authenticateWithUserRefreshToken(any(), any())) + .thenAnswer(invocation -> { + String[] argument = (String[]) invocation.getArguments()[0]; + if (argument.length == 1 && argument[0].equals(scopes2[0])) { + return TestUtils.getMockMsalToken(token2, expiresOn); + } else if (argument.length == 1 && argument[0].equals(scopes1[0])) { + return Mono.error(new UnsupportedOperationException("nothing cached")); + } else { + throw new InvalidUseOfMatchersException(String.format("Argument %s does not match", (Object) argument)); + } + }); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + InteractiveBrowserCredential credential = new InteractiveBrowserCredentialBuilder().port(port).clientId(clientId).build(); + AccessToken token = credential.getToken(scopes1).block(); + Assert.assertEquals(token1, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + token = credential.getToken(scopes2).block(); + Assert.assertEquals(token2, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + } +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ManagedIdentityCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ManagedIdentityCredentialTest.java new file mode 100644 index 000000000000..4273c0efb929 --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/ManagedIdentityCredentialTest.java @@ -0,0 +1,106 @@ +// 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.util.configuration.BaseConfigurations; +import com.azure.core.util.configuration.Configuration; +import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.identity.implementation.IdentityClient; +import com.azure.identity.util.TestUtils; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.UUID; + +import static org.mockito.Mockito.when; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(fullyQualifiedNames = "com.azure.identity.*") +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) +public class ManagedIdentityCredentialTest { + + private final String tenantId = "contoso.com"; + private final String clientId = UUID.randomUUID().toString(); + + @Test + public void testAppServiceMSICredentialConfigurations() { + Configuration configuration = ConfigurationManager.getConfiguration(); + + try { + configuration + .put(BaseConfigurations.MSI_ENDPOINT, "http://foo") + .put(BaseConfigurations.MSI_SECRET, "bar"); + ManagedIdentityCredential credential = new ManagedIdentityCredentialBuilder().build(); + Assert.assertEquals("http://foo", credential.msiEndpoint()); + Assert.assertEquals("bar", credential.msiSecret()); + } finally { + configuration.remove(BaseConfigurations.MSI_ENDPOINT); + configuration.remove(BaseConfigurations.MSI_SECRET); + } + } + + @Test + public void testVirtualMachineMSICredentialConfigurations() { + ManagedIdentityCredential credential = new ManagedIdentityCredentialBuilder().clientId("foo").build(); + Assert.assertEquals("foo", credential.clientId()); + } + + @Test + public void testMSIEndpoint() throws Exception { + Configuration configuration = ConfigurationManager.getConfiguration(); + + try { + // setup + String endpoint = "http://localhost"; + String secret = "secret"; + String token1 = "token1"; + String[] scopes1 = new String[]{"https://management.azure.com"}; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + configuration.put("MSI_ENDPOINT", endpoint); + configuration.put("MSI_SECRET", secret); + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateToManagedIdentityEndpoint(endpoint, secret, scopes1)).thenReturn(TestUtils.getMockAccessToken(token1, expiresOn)); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + ManagedIdentityCredential credential = new ManagedIdentityCredentialBuilder().clientId(clientId).build(); + AccessToken token = credential.getToken(scopes1).block(); + Assert.assertEquals(token1, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + } finally { + // clean up + configuration.remove("MSI_ENDPOINT"); + configuration.remove("MSI_SECRET"); + } + } + + @Test + public void testIMDS() throws Exception { + // setup + String token1 = "token1"; + String[] scopes = new String[] { "https://management.azure.com" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateToIMDSEndpoint(scopes)).thenReturn(TestUtils.getMockAccessToken(token1, expiresOn)); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + ManagedIdentityCredential credential = new ManagedIdentityCredentialBuilder().clientId(clientId).build(); + AccessToken token = credential.getToken(scopes).block(); + Assert.assertEquals(token1, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + } +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/UsernamePasswordCredentialTest.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/UsernamePasswordCredentialTest.java new file mode 100644 index 000000000000..5072acdfcdec --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/credential/UsernamePasswordCredentialTest.java @@ -0,0 +1,135 @@ +// 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.identity.implementation.IdentityClient; +import com.azure.identity.util.TestUtils; +import com.microsoft.aad.msal4j.MsalServiceException; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.exceptions.misusing.InvalidUseOfMatchersException; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import reactor.core.publisher.Mono; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.UUID; + +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(fullyQualifiedNames = "com.azure.identity.*") +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) +public class UsernamePasswordCredentialTest { + + private final String clientId = UUID.randomUUID().toString(); + + @Test + public void testValidUserCredential() throws Exception { + // setup + String username = "testuser"; + String password = "P@ssw0rd"; + String token1 = "token1"; + String token2 = "token2"; + String[] scopes1 = new String[] { "https://management.azure.com" }; + String[] scopes2 = new String[] { "https://vault.azure.net" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateWithUsernamePassword(scopes1, username, password)).thenReturn(TestUtils.getMockMsalToken(token1, expiresOn)); + when(identityClient.authenticateWithUserRefreshToken(any(), any())) + .thenAnswer(invocation -> { + String[] argument = (String[]) invocation.getArguments()[0]; + if (argument.length == 1 && argument[0].equals(scopes2[0])) { + return TestUtils.getMockMsalToken(token2, expiresOn); + } else if (argument.length == 1 && argument[0].equals(scopes1[0])) { + return Mono.error(new UnsupportedOperationException("nothing cached")); + } else { + throw new InvalidUseOfMatchersException(String.format("Argument %s does not match", (Object) argument)); + } + }); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + UsernamePasswordCredential credential = new UsernamePasswordCredentialBuilder().clientId(clientId).username(username).password(password).build(); + AccessToken token = credential.getToken(scopes1).block(); + Assert.assertEquals(token1, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + token = credential.getToken(scopes2).block(); + Assert.assertEquals(token2, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + } + + @Test + public void testInvalidUserCredential() throws Exception { + // setup + String username = "testuser"; + String badPassword = "Password"; + String[] scopes = new String[] { "https://management.azure.com" }; + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateWithUsernamePassword(scopes, username, badPassword)).thenThrow(new MsalServiceException("bad credential", "BadCredential")); + when(identityClient.authenticateWithUserRefreshToken(any(), any())) + .thenAnswer(invocation -> Mono.error(new UnsupportedOperationException("nothing cached"))); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + try { + UsernamePasswordCredential credential = new UsernamePasswordCredentialBuilder().clientId(clientId).username(username).password(badPassword).build(); + credential.getToken(scopes).block(); + fail(); + } catch (MsalServiceException e) { + Assert.assertEquals("bad credential", e.getMessage()); + } + } + + @Test + public void testInvalidParameters() throws Exception { + // setup + String username = "testuser"; + String password = "P@ssw0rd"; + String token1 = "token1"; + String[] scopes = new String[] { "https://management.azure.com" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + IdentityClient identityClient = PowerMockito.mock(IdentityClient.class); + when(identityClient.authenticateWithUsernamePassword(scopes, username, password)).thenReturn(TestUtils.getMockMsalToken(token1, expiresOn)); + when(identityClient.authenticateWithUserRefreshToken(any(), any())) + .thenAnswer(invocation -> Mono.error(new UnsupportedOperationException("nothing cached"))); + PowerMockito.whenNew(IdentityClient.class).withAnyArguments().thenReturn(identityClient); + + // test + try { + UsernamePasswordCredential credential = new UsernamePasswordCredentialBuilder().username(username).password(password).build(); + credential.getToken(scopes).block(); + fail(); + } catch (IllegalArgumentException e) { + Assert.assertTrue(e.getMessage().contains("clientId")); + } + try { + UsernamePasswordCredential credential = new UsernamePasswordCredentialBuilder().clientId(clientId).username(username).build(); + credential.getToken(scopes).block(); + fail(); + } catch (IllegalArgumentException e) { + Assert.assertTrue(e.getMessage().contains("password")); + } + try { + UsernamePasswordCredential credential = new UsernamePasswordCredentialBuilder().clientId(clientId).password(password).build(); + credential.getToken(scopes).block(); + fail(); + } catch (IllegalArgumentException e) { + Assert.assertTrue(e.getMessage().contains("username")); + } + } +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientIntegrationTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientIntegrationTests.java new file mode 100644 index 000000000000..3dbf250db57f --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientIntegrationTests.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation; + +import com.azure.core.credentials.AccessToken; +import com.azure.core.http.ProxyOptions; +import com.azure.core.http.ProxyOptions.Type; +import org.junit.Assert; +import org.junit.Ignore; + +import java.net.InetSocketAddress; + +public class IdentityClientIntegrationTests { + private static final String AZURE_TENANT_ID = "AZURE_TENANT_ID"; + private static final String AZURE_CLIENT_ID = "AZURE_CLIENT_ID"; + private static final String AZURE_CLI_CLIENT_ID = "AZURE_CLI_CLIENT_ID"; + private static final String AZURE_CLIENT_SECRET = "AZURE_CLIENT_SECRET"; + private static final String AZURE_CLIENT_CERTIFICATE = "AZURE_CLIENT_CERTIFICATE"; + private final String[] scopes = new String[] { "https://management.azure.com/.default" }; + + @Ignore("Integration test") + public void clientSecretCanGetToken() { + IdentityClient client = new IdentityClient(System.getenv(AZURE_TENANT_ID), System.getenv(AZURE_CLIENT_ID), new IdentityClientOptions().proxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); + AccessToken token = client.authenticateWithClientSecret(System.getenv(AZURE_CLIENT_SECRET), scopes).block(); + Assert.assertNotNull(token); + Assert.assertNotNull(token.token()); + Assert.assertNotNull(token.expiresOn()); + Assert.assertFalse(token.isExpired()); + token = client.authenticateWithClientSecret(System.getenv(AZURE_CLIENT_SECRET), new String[] { "https://vault.azure.net/.default" }).block(); + Assert.assertNotNull(token); + Assert.assertNotNull(token.token()); + Assert.assertNotNull(token.expiresOn()); + Assert.assertFalse(token.isExpired()); + } + + @Ignore("Integration tests") + public void deviceCodeCanGetToken() { + IdentityClient client = new IdentityClient("common", System.getenv(AZURE_CLIENT_ID), new IdentityClientOptions().proxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); + MsalToken token = client.authenticateWithDeviceCode(scopes, deviceCode -> { + System.out.println(deviceCode.message()); + try { + Thread.sleep(60000); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + }).block(); + Assert.assertNotNull(token); + Assert.assertNotNull(token.token()); + Assert.assertNotNull(token.expiresOn()); + Assert.assertFalse(token.isExpired()); + token = client.authenticateWithUserRefreshToken(new String[] { "https://vault.azure.net/.default" }, token).block(); + Assert.assertNotNull(token); + Assert.assertNotNull(token.token()); + Assert.assertNotNull(token.expiresOn()); + Assert.assertFalse(token.isExpired()); + } + + @Ignore("Integration tests") + public void browserCanGetToken() { + IdentityClient client = new IdentityClient("common", System.getenv(AZURE_CLIENT_ID), new IdentityClientOptions().proxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); + MsalToken token = client.authenticateWithBrowserInteraction(scopes, 8765).block(); + Assert.assertNotNull(token); + Assert.assertNotNull(token.token()); + Assert.assertNotNull(token.expiresOn()); + Assert.assertFalse(token.isExpired()); + token = client.authenticateWithUserRefreshToken(new String[] { "https://vault.azure.net/.default" }, token).block(); + Assert.assertNotNull(token); + Assert.assertNotNull(token.token()); + Assert.assertNotNull(token.expiresOn()); + Assert.assertFalse(token.isExpired()); + } + + @Ignore("Integration tests") + public void usernamePasswordCanGetToken() { + IdentityClient client = new IdentityClient("common", System.getenv(AZURE_CLIENT_ID), new IdentityClientOptions().proxyOptions(new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))); + MsalToken token = client.authenticateWithUsernamePassword(scopes, System.getenv("username"), System.getenv("password")).block(); + Assert.assertNotNull(token); + Assert.assertNotNull(token.token()); + Assert.assertNotNull(token.expiresOn()); + Assert.assertFalse(token.isExpired()); + token = client.authenticateWithUserRefreshToken(new String[] { "https://vault.azure.net/.default" }, token).block(); + Assert.assertNotNull(token); + Assert.assertNotNull(token.token()); + Assert.assertNotNull(token.expiresOn()); + Assert.assertFalse(token.isExpired()); + } +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientTests.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientTests.java new file mode 100644 index 000000000000..3988dc803351 --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/implementation/IdentityClientTests.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.implementation; + +import com.azure.core.credentials.AccessToken; +import com.azure.identity.util.TestUtils; +import com.microsoft.aad.msal4j.AsymmetricKeyCredential; +import com.microsoft.aad.msal4j.ClientCredentialParameters; +import com.microsoft.aad.msal4j.ClientSecret; +import com.microsoft.aad.msal4j.ConfidentialClientApplication; +import com.microsoft.aad.msal4j.DeviceCodeFlowParameters; +import com.microsoft.aad.msal4j.MsalServiceException; +import com.microsoft.aad.msal4j.PublicClientApplication; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.Random; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.atomic.AtomicBoolean; + +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.when; +import static org.powermock.api.mockito.PowerMockito.whenNew; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({ ConfidentialClientApplication.class, ConfidentialClientApplication.Builder.class, PublicClientApplication.class, PublicClientApplication.Builder.class, IdentityClient.class }) +@PowerMockIgnore({"com.sun.org.apache.xerces.*", "javax.xml.*", "org.xml.*"}) +public class IdentityClientTests { + + private static final Random RANDOM = new Random(); + private final String tenantId = "contoso.com"; + private final String clientId = UUID.randomUUID().toString(); + + @Test + public void testValidSecret() throws Exception { + // setup + String secret = "secret"; + String accessToken = "token"; + String[] scopes = new String[] { "https://management.azure.com" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + mockForClientSecret(secret, scopes, accessToken, expiresOn); + + // test + IdentityClient client = new IdentityClientBuilder().tenantId(tenantId).clientId(clientId).build(); + AccessToken token = client.authenticateWithClientSecret(secret, scopes).block(); + Assert.assertEquals(accessToken, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + } + + @Test + public void testInvalidSecret() throws Exception { + // setup + String secret = "secret"; + String accessToken = "token"; + String[] scopes = new String[] { "https://management.azure.com" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + mockForClientSecret(secret, scopes, accessToken, expiresOn); + + // test + try { + IdentityClient client = new IdentityClientBuilder().tenantId(tenantId).clientId(clientId).build(); + client.authenticateWithClientSecret("bad secret", scopes).block(); + fail(); + } catch (MsalServiceException e) { + Assert.assertEquals("Invalid clientSecret", e.getMessage()); + } + } + + @Test + public void testValidCertificate() throws Exception { + // setup + String pfxPath = getClass().getResource("/keyStore.pfx").getPath(); + String accessToken = "token"; + String[] scopes = new String[] { "https://management.azure.com" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + mockForClientCertificate(scopes, accessToken, expiresOn); + + // test + IdentityClient client = new IdentityClientBuilder().tenantId(tenantId).clientId(clientId).build(); + AccessToken token = client.authenticateWithPfxCertificate(pfxPath, "StrongPass!123", scopes).block(); + Assert.assertEquals(accessToken, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + } + + @Test + public void testInvalidCertificatePassword() throws Exception { + // setup + String pfxPath = getClass().getResource("/keyStore.pfx").getPath(); + String accessToken = "token"; + String[] scopes = new String[] { "https://management.azure.com" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + mockForClientCertificate(scopes, accessToken, expiresOn); + + // test + try { + IdentityClient client = new IdentityClientBuilder().tenantId(tenantId).clientId(clientId).build(); + client.authenticateWithPfxCertificate(pfxPath, "BadPassword", scopes).block(); + fail(); + } catch (Exception e) { + Assert.assertTrue(e.getMessage().contains("password was incorrect")); + } + } + + @Test + public void testValidDeviceCodeFlow() throws Exception { + // setup + String accessToken = "token"; + String[] scopes = new String[] { "https://management.azure.com" }; + OffsetDateTime expiresOn = OffsetDateTime.now(ZoneOffset.UTC).plusHours(1); + + // mock + mockForDeviceCodeFlow(scopes, accessToken, expiresOn); + + // test + IdentityClient client = new IdentityClientBuilder().tenantId(tenantId).clientId(clientId).build(); + AccessToken token = client.authenticateWithDeviceCode(scopes, deviceCodeChallenge -> { /* do nothing */ }).block(); + Assert.assertEquals(accessToken, token.token()); + Assert.assertEquals(expiresOn.getSecond(), token.expiresOn().getSecond()); + } + + /****** mocks ******/ + + private void mockForClientSecret(String secret, String[] scopes, String accessToken, OffsetDateTime expiresOn) throws Exception { + ConfidentialClientApplication application = PowerMockito.mock(ConfidentialClientApplication.class); + when(application.acquireToken(any(ClientCredentialParameters.class))).thenAnswer(invocation -> { + ClientCredentialParameters argument = (ClientCredentialParameters) invocation.getArguments()[0]; + if (argument.scopes().size() == 1 && scopes[0].equals(argument.scopes().iterator().next())) { + return TestUtils.getMockAuthenticationResult(accessToken, expiresOn); + } else { + return CompletableFuture.runAsync(() -> { + throw new MsalServiceException("Invalid scopes", "InvalidScopes"); + }); + } + }); + ConfidentialClientApplication.Builder builder = PowerMockito.mock(ConfidentialClientApplication.Builder.class); + when(builder.build()).thenReturn(application); + when(builder.authority(any())).thenReturn(builder); + whenNew(ConfidentialClientApplication.Builder.class).withAnyArguments().thenAnswer(invocation -> { + String cid = (String) invocation.getArguments()[0]; + ClientSecret clientSecret = (ClientSecret) invocation.getArguments()[1]; + if (!clientId.equals(cid)) { + throw new MsalServiceException("Invalid clientId", "InvalidClientId"); + } + if (!secret.equals(clientSecret.clientSecret())) { + throw new MsalServiceException("Invalid clientSecret", "InvalidClientSecret"); + } + return builder; + }); + } + + private void mockForClientCertificate(String[] scopes, String accessToken, OffsetDateTime expiresOn) throws Exception { + ConfidentialClientApplication application = PowerMockito.mock(ConfidentialClientApplication.class); + when(application.acquireToken(any(ClientCredentialParameters.class))).thenAnswer(invocation -> { + ClientCredentialParameters argument = (ClientCredentialParameters) invocation.getArguments()[0]; + if (argument.scopes().size() == 1 && scopes[0].equals(argument.scopes().iterator().next())) { + return TestUtils.getMockAuthenticationResult(accessToken, expiresOn); + } else { + return CompletableFuture.runAsync(() -> { + throw new MsalServiceException("Invalid scopes", "InvalidScopes"); + }); + } + }); + ConfidentialClientApplication.Builder builder = PowerMockito.mock(ConfidentialClientApplication.Builder.class); + when(builder.build()).thenReturn(application); + when(builder.authority(any())).thenReturn(builder); + whenNew(ConfidentialClientApplication.Builder.class).withAnyArguments().thenAnswer(invocation -> { + String cid = (String) invocation.getArguments()[0]; + AsymmetricKeyCredential keyCredential = (AsymmetricKeyCredential) invocation.getArguments()[1]; + if (!clientId.equals(cid)) { + throw new MsalServiceException("Invalid clientId", "InvalidClientId"); + } + if (keyCredential == null || keyCredential.key() == null) { + throw new MsalServiceException("Invalid clientCertificate", "InvalidClientCertificate"); + } + return builder; + }); + } + + private void mockForDeviceCodeFlow(String[] scopes, String accessToken, OffsetDateTime expiresOn) throws Exception { + PublicClientApplication application = PowerMockito.mock(PublicClientApplication.class); + AtomicBoolean cached = new AtomicBoolean(false); + when(application.acquireToken(any(DeviceCodeFlowParameters.class))).thenAnswer(invocation -> { + DeviceCodeFlowParameters argument = (DeviceCodeFlowParameters) invocation.getArguments()[0]; + if (argument.scopes().size() != 1 || !scopes[0].equals(argument.scopes().iterator().next())) { + return CompletableFuture.runAsync(() -> { + throw new MsalServiceException("Invalid scopes", "InvalidScopes"); + }); + } + if (argument.deviceCodeConsumer() == null) { + return CompletableFuture.runAsync(() -> { + throw new MsalServiceException("Invalid device code consumer", "InvalidDeviceCodeConsumer"); + }); + } + cached.set(true); + return TestUtils.getMockAuthenticationResult(accessToken, expiresOn); + }); + PublicClientApplication.Builder builder = PowerMockito.mock(PublicClientApplication.Builder.class); + when(builder.build()).thenReturn(application); + when(builder.authority(any())).thenReturn(builder); + whenNew(PublicClientApplication.Builder.class).withArguments(clientId).thenReturn(builder); + } +} diff --git a/sdk/identity/azure-identity/src/test/java/com/azure/identity/util/TestUtils.java b/sdk/identity/azure-identity/src/test/java/com/azure/identity/util/TestUtils.java new file mode 100644 index 000000000000..50f7969fe41f --- /dev/null +++ b/sdk/identity/azure-identity/src/test/java/com/azure/identity/util/TestUtils.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.identity.util; + +import com.azure.core.credentials.AccessToken; +import com.azure.identity.implementation.MsalToken; +import com.microsoft.aad.msal4j.Account; +import com.microsoft.aad.msal4j.IAccount; +import com.microsoft.aad.msal4j.IAuthenticationResult; +import reactor.core.publisher.Mono; + +import java.time.OffsetDateTime; +import java.util.Date; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; + +/** + * Utilities for identity tests. + */ +public final class TestUtils { + /** + * Creates a mock {@link IAuthenticationResult} instance. + * @param accessToken the access token to return + * @param expiresOn the expiration time + * @return a completable future of the result + */ + public static CompletableFuture getMockAuthenticationResult(String accessToken, OffsetDateTime expiresOn) { + return CompletableFuture.completedFuture(new IAuthenticationResult() { + @Override + public String accessToken() { + return accessToken; + } + + @Override + public String idToken() { + return null; + } + + @Override + public IAccount account() { + return new Account(UUID.randomUUID().toString(), "http://login.microsoftonline.com", "testuser"); + } + + @Override + public String environment() { + return null; + } + + @Override + public String scopes() { + return null; + } + + @Override + public Date expiresOnDate() { + // Access token dials back 2 minutes + return Date.from(expiresOn.plusMinutes(2).toInstant()); + } + }); + } + + /** + * Creates a mock {@link MsalToken} instance. + * @param accessToken the access token to return + * @param expiresOn the expiration time + * @return a Mono publisher of the result + */ + public static Mono getMockMsalToken(String accessToken, OffsetDateTime expiresOn) { + return Mono.fromFuture(getMockAuthenticationResult(accessToken, expiresOn)) + .map(MsalToken::new); + } + + /** + * Creates a mock {@link AccessToken} instance. + * @param accessToken the access token to return + * @param expiresOn the expiration time + * @return a Mono publisher of the result + */ + public static Mono getMockAccessToken(String accessToken, OffsetDateTime expiresOn) { + return Mono.just(new AccessToken(accessToken, expiresOn.plusMinutes(2))); + } + + private TestUtils() { + } +} diff --git a/sdk/identity/azure-identity/src/test/resources/keyStore.pfx b/sdk/identity/azure-identity/src/test/resources/keyStore.pfx new file mode 100644 index 000000000000..299c76023380 Binary files /dev/null and b/sdk/identity/azure-identity/src/test/resources/keyStore.pfx differ diff --git a/sdk/identity/ci.yml b/sdk/identity/ci.yml index ae4d32447fdf..afc37e6ac1b1 100644 --- a/sdk/identity/ci.yml +++ b/sdk/identity/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/identity/ @@ -13,11 +22,17 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/identity/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: identity \ No newline at end of file + ServiceDirectory: identity + Artifacts: + - name: azure-identity + safeName: azureidentity \ No newline at end of file diff --git a/sdk/identity/pom.service.xml b/sdk/identity/pom.service.xml index 6b09f2a0921b..66d3b25c5489 100644 --- a/sdk/identity/pom.service.xml +++ b/sdk/identity/pom.service.xml @@ -9,6 +9,7 @@ pom 1.0.0 + ../core/azure-core azure-identity diff --git a/sdk/keyvault/azure-keyvault-keys/CHANGELOG.md b/sdk/keyvault/azure-keyvault-keys/CHANGELOG.md index 63af0c66276a..0e4d0192748a 100644 --- a/sdk/keyvault/azure-keyvault-keys/CHANGELOG.md +++ b/sdk/keyvault/azure-keyvault-keys/CHANGELOG.md @@ -1,5 +1,19 @@ # Release History +## 4.0.0-preview.2 (2019-08-06) +For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). + +- Added service side Cryptography Operations support for asymmetric keys (sign, un/wrap, verify, encrypt and decrypt) +- Added client side Cryptography Operations support both asymmetric and symmetric keys. +- Added Cryptography clients to `azure-keyvault-keys` package. + - `azure-keyvault-keys` contains a `CryptographyClient` and `CryptographyAsyncClient` for cryptography operations and `KeyClient` and `KeyAsyncClient` for key operations. + - see this package's + [documentation](https://github.com/Azure/azure-sdk-for-java/tree/master/keyvault/client/keys/README.md) and + [samples](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys) for more information. +- Added support for HTTP challenge based authentication, allowing clients to interact with vaults in sovereign clouds. +- Combined KeyClientBuilder, KeyAsyncClientBuilder into KeyClientBuilder. Methods to create both sync and async clients type were added. +- Removed static builder method from clients. Builders are now instantiable. + ## 4.0.0-preview.1 (2019-06-28) Version 4.0.0-preview.1 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html). diff --git a/sdk/keyvault/azure-keyvault-keys/README.md b/sdk/keyvault/azure-keyvault-keys/README.md index e0899f1f273f..dbbf755a3df8 100644 --- a/sdk/keyvault/azure-keyvault-keys/README.md +++ b/sdk/keyvault/azure-keyvault-keys/README.md @@ -14,7 +14,7 @@ Maven dependency for Azure Key Client library. Add it to your project's pom file com.azure azure-keyvault-keys - 4.0.0-preview.1 + 4.0.0-preview.2 ``` @@ -64,7 +64,7 @@ Here is [Azure Cloud Shell](https://shell.azure.com/bash) snippet below to az keyvault set-policy --name --spn $AZURE_CLIENT_ID --key-permissions backup delete get list set ``` > --key-permissions: - > Accepted values: backup, delete, get, list, purge, recover, restore, set + > Accepted values: backup, delete, get, list, purge, recover, restore, create * Use the above mentioned Key Vault name to retreive details of your Vault which also contains your Key Vault URL: ```Bash @@ -75,16 +75,37 @@ Here is [Azure Cloud Shell](https://shell.azure.com/bash) snippet below to Once you've populated the **AZURE_CLIENT_ID**, **AZURE_CLIENT_SECRET** and **AZURE_TENANT_ID** environment variables and replaced **your-vault-url** with the above returned URI, you can create the KeyClient: ```Java -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.keys.KeyClient; KeyClient client = new KeyClientBuilder() .endpoint() - .credential(new DefaultAzureCredential()) - .buildClient); + .credential(new DefaultAzureCredentialBuilder().build()) + .buildClient(); ``` -> NOTE: For using Asynchronous client use KeyAsyncClient instead of KeyClient +> NOTE: For using Asynchronous client use KeyAsyncClient instead of KeyClient and call buildAsyncClient() + + +#### Create Cryptography Client +Once you've populated the **AZURE_CLIENT_ID**, **AZURE_CLIENT_SECRET** and **AZURE_TENANT_ID** environment variables and replaced **your-vault-url** with the above returned URI, you can create the CryptographyClient: +```Java +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.keys.cryptography.CryptographyClient; + +// 1. Create client with json web key. +CryptographyClient cryptoClient = new CryptographyClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .jsonWebKey("") + .buildClient(); + +// 2. Create client with key identifier from key vault. +cryptoClient = new CryptographyClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .keyIdentifier("") + .buildClient(); +``` +> NOTE: For using Asynchronous client use CryptographyAsyncClient instead of CryptographyClient and call buildAsyncClient() ## Key concepts ### Key @@ -98,6 +119,10 @@ KeyClient client = new KeyClientBuilder() ### Key Client: The Key client performs the interactions with the Azure Key Vault service for getting, setting, updating, deleting, and listing keys and its versions. An asynchronous and synchronous, KeyClient, client exists in the SDK allowing for selection of a client based on an application's use case. Once you've initialized a Key, you can interact with the primary resource types in Key Vault. +### Cryptography Client: +The Cryptography client performs the cryptographic operations locally or calls the Azure Key Vault service depending on how much key information is available locally. It supports encrypting, decrypting, signing, verifying, key wrapping, key unwrapping and retrieving the configured key. An asynchronous and synchronous, CryptographyClient, client exists in the SDK allowing for selection of a client based on an application's use case. + + ## Examples ### Sync API The following sections provide several code snippets covering some of the most common Azure Key Vault Key Service tasks, including: @@ -106,19 +131,21 @@ The following sections provide several code snippets covering some of the most c - [Update an existing Key](#update-an-existing-key) - [Delete a Key](#delete-a-key) - [List Keys](#list-keys) +- [Encrypt](#encrypt) +- [Decrypt](#decrypt) ### Create a Key Create a Key to be stored in the Azure Key Vault. - `setKey` creates a new key in the key vault. if the key with name already exists then a new version of the key is created. ```Java -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.keys.models.Key; import com.azure.security.keyvault.keys.KeyClient; KeyClient keyClient = new KeyClientBuilder() .endpoint() - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); Key rsaKey = keyClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") @@ -165,7 +192,7 @@ System.out.printf("Deleted Key's deletion date %s", deletedKey.deletedDate().toS ### List Keys List the keys in the key vault by calling `listKeys`. -```Java +```java // List operations don't return the keys with key material information. So, for each returned key we call getKey to get the key with its key material information. for (KeyBase key : keyClient.listKeys()) { Key keyWithMaterial = keyClient.getKey(key).value(); @@ -173,6 +200,37 @@ for (KeyBase key : keyClient.listKeys()) { } ``` +### Encrypt + +Encrypt plain text by calling `encrypt`. +```java +CryptographyClient cryptoClient = new CryptographyClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .keyIdentifier(") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") @@ -233,7 +294,7 @@ keyAsyncClient.getKey("keyName").subscribe(keyResponse -> { ### Delete a Key Asynchronously Delete an existing Key by calling `deleteKey`. -```Java +```java keyAsyncClient.deleteKey("keyName").subscribe(deletedKeyResponse -> System.out.printf("Deleted Key's deletion time %s \n", deletedKeyResponse.value().deletedDate().toString())); ``` @@ -248,6 +309,43 @@ keyAsyncClient.listKeys() System.out.printf("Key returned with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id())); ``` +### Encrypt Asynchronously + +Encrypt plain text by calling `encrypt`. +```java +CryptographyAsyncClient cryptoAsyncClient = new CryptographyClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .keyIdentifier("") + .buildAsyncClient(); + +byte[] plainText = new byte[100]; +new Random(0x1234567L).nextBytes(plainText); + +// Let's encrypt a simple plain text of size 100 bytes. +cryptoAsyncClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plainText) + .subscribe(encryptResult -> { + System.out.printf("Returned cipherText size is %d bytes with algorithm %s\n", encryptResult.cipherText().length, encryptResult.algorithm().toString()); + }); +``` + +### Decrypt Asynchronously + +Decrypt encrypted content by calling `decrypt`. +```java +byte[] plainText = new byte[100]; +new Random(0x1234567L).nextBytes(plainText); + +// Let's encrypt a simple plain text of size 100 bytes. +cryptoAsyncClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plainText) + .subscribe(encryptResult -> { + System.out.printf("Returned cipherText size is %d bytes with algorithm %s\n", encryptResult.cipherText().length, encryptResult.algorithm().toString()); + //Let's decrypt the encrypted response. + cryptoAsyncClient.decrypt(EncryptionAlgorithm.RSA_OAEP, encryptResult.cipherText()) + .subscribe(decryptResult -> System.out.printf("Returned plainText size is %d bytes\n", decryptResult.plainText().length)); + }); + +``` + ## Troubleshooting ### General Key Vault clients raise exceptions. For example, if you try to retrieve a key after it is deleted a `404` error is returned, indicating resource not found. In the following snippet, the error is handled gracefully by catching the exception and displaying additional information about the error. @@ -290,6 +388,27 @@ Several KeyVault Java SDK samples are available to you in the SDK's GitHub repos * List deleted keys * Recover a deleted key * Purge Deleted key + +### Encrypt And Decrypt Operations Samples: +* [EncryptAndDecryptOperations.java][sample_encryptDecrypt] and [EncryptAndDecryptOperationsAsync.java][sample_encryptDecryptAsync] - Contains samples for following scenarios: + * Encrypting plain text with asymmetric key + * Decrypting plain text with asymmetric key + * Encrypting plain text with symmetric key + * Decrypting plain text with symmetric key + +### Sign And Verify Operations Samples: +* [SignAndVerifyOperations.java][sample_signVerify] and [SignAndVerifyOperationsAsync.java][sample_signVerifyAsync] - Contains samples for following scenarios: + * Signing a digest + * Verifying signature against a digest + * Signing raw data content + * Verifyng signature against raw data content + +### Key Wrap And Unwrap Operations Samples: +* [KeyWrapUnwrapOperations.java][sample_wrapUnwrap] and [KeyWrapUnwrapOperationsAsync.java][sample_wrapUnwrapAsync] - Contains samples for following scenarios: + * Wrapping a key with asymmetric key + * Unwrapping a key with asymmetric key + * Wrapping a key with symmetric key + * Unwrapping a key with symmetric key ### Additional Documentation For more extensive documentation on Azure Key Vault, see the [API reference documentation][azkeyvault_rest]. @@ -302,25 +421,31 @@ When you submit a pull request, a CLA-bot will automatically determine whether y This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. -[source_code]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-keys/src +[source_code]: src [api_documentation]: https://azure.github.io/azure-sdk-for-java/track2reports/index.html -[azkeyvault_docs]: https://docs.microsoft.com/en-us/azure/key-vault/ +[azkeyvault_docs]: https://docs.microsoft.com/azure/key-vault/ [azure_identity]: https://github.com/Azure/azure-sdk-for-java/tree/master/identity/client [maven]: https://maven.apache.org/ [azure_subscription]: https://azure.microsoft.com/ -[azure_keyvault]: https://docs.microsoft.com/en-us/azure/key-vault/quick-create-portal +[azure_keyvault]: https://docs.microsoft.com/azure/key-vault/quick-create-portal [azure_cli]: https://docs.microsoft.com/cli/azure -[rest_api]: https://docs.microsoft.com/en-us/rest/api/keyvault/ -[azkeyvault_rest]: https://docs.microsoft.com/en-us/rest/api/keyvault/ -[azure_create_application_in_portal]:https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal -[azure_keyvault_cli]:https://docs.microsoft.com/en-us/azure/key-vault/quick-create-cli -[azure_keyvault_cli_full]:https://docs.microsoft.com/en-us/cli/azure/keyvault?view=azure-cli-latest -[keys_samples]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys -[sample_helloWorld]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java -[sample_helloWorldAsync]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java -[sample_list]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperations.java -[sample_listAsync]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java -[sample_BackupRestore]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java -[sample_BackupRestoreAsync]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java -[sample_ManageDeleted]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeys.java -[sample_ManageDeletedAsync]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java +[rest_api]: https://docs.microsoft.com/rest/api/keyvault/ +[azkeyvault_rest]: https://docs.microsoft.com/rest/api/keyvault/ +[azure_create_application_in_portal]:https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +[azure_keyvault_cli]:https://docs.microsoft.com/azure/key-vault/quick-create-cli +[azure_keyvault_cli_full]:https://docs.microsoft.com/cli/azure/keyvault?view=azure-cli-latest +[keys_samples]: src/samples/java/com/azure/security/keyvault/keys +[sample_helloWorld]: src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java +[sample_helloWorldAsync]: src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java +[sample_list]: src/samples/java/com/azure/security/keyvault/keys/ListOperations.java +[sample_listAsync]: src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java +[sample_BackupRestore]: src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java +[sample_BackupRestoreAsync]: src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java +[sample_ManageDeleted]: src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeys.java +[sample_ManageDeletedAsync]: src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java +[sample_encryptDecrypt]: src/samples/java/com/azure/security/keyvault/keys/cryptography/EncryptDecryptOperations.java +[sample_encryptDecryptAsync]: src/samples/java/com/azure/security/keyvault/keys/cryptography/EncryptDecryptOperationsAsync.java +[sample_signVerify]: src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperations.java +[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 diff --git a/sdk/keyvault/azure-keyvault-keys/pom.xml b/sdk/keyvault/azure-keyvault-keys/pom.xml index 340ef6f343eb..dd71f32f8494 100644 --- a/sdk/keyvault/azure-keyvault-keys/pom.xml +++ b/sdk/keyvault/azure-keyvault-keys/pom.xml @@ -5,7 +5,7 @@ azure-keyvault-parent com.azure - 4.0.0-preview.1 + 4.0.0-preview.2 ../pom.client.xml @@ -13,7 +13,7 @@ com.azure azure-keyvault-keys - 4.0.0-preview.1 + 4.0.0-preview.2 azure-keyvault-keys https://github.com/Azure/azure-sdk-for-java @@ -66,7 +66,7 @@ com.azure azure-identity - 1.0.0-preview.1 + 1.0.0-preview.2 test diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/AzureKeyVaultConfiguration.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/AzureKeyVaultConfiguration.java deleted file mode 100644 index dcf3e16da1bf..000000000000 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/AzureKeyVaultConfiguration.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.security.keyvault.keys; - -class AzureKeyVaultConfiguration { - //TODO: Eventually remove these hardcoded strings with https://github.com/Azure/azure-sdk-for-java/issues/3141 - static final String SDK_NAME = "Azure-Keyvault"; - static final String SDK_VERSION = "1.0.0-SNAPSHOT"; -} 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 1a43375dc288..4f3ccce61ea4 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 @@ -16,6 +16,7 @@ import com.azure.core.implementation.annotation.ReturnType; import com.azure.core.implementation.annotation.ServiceClient; import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.security.keyvault.keys.models.DeletedKey; @@ -85,23 +86,43 @@ public final class KeyAsyncClient { * *

    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.

    - *
    -     * keyAsyncClient.createKey("keyName", KeyType.EC).subscribe(keyResponse ->
    -     *   System.out.printf("Key is created with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
    -     * 
    + * + * {@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}. * @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) { + return withContext(context -> createKeyWithResponse(name, keyType, context)).flatMap(FluxUtil::toMono); + } + + /** + * 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. + * + *

    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.

    + * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createKeyWithResponse#keyCreateOptions} + * + * @param keyCreateOptions The key configuration object containing information about the key being created. + * @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> createKey(String name, KeyType keyType) { - return withContext(context -> createKey(name, keyType, context)); + public Mono> createKeyWithResponse(KeyCreateOptions keyCreateOptions) { + return withContext(context -> createKeyWithResponse(keyCreateOptions, context)); } - Mono> createKey(String name, KeyType keyType, Context context) { + 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)) @@ -122,27 +143,21 @@ Mono> createKey(String name, KeyType keyType, Context context) { *

    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.

    - *
    -     * KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA)
    -     *    .notBefore(OffsetDateTime.now().plusDays(1))
    -     *    .expires(OffsetDateTime.now().plusYears(1));
          *
    -     * keyAsyncClient.createKey(keyCreateOptions).subscribe(keyResponse ->
    -     *   System.out.printf("Key is created with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
    -     * 
    + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createKey#keyCreateOptions} * * @param keyCreateOptions The key configuration object containing information about the key being created. * @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 a {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. + * @return A {@link Mono} containing the {@link Key created key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createKey(KeyCreateOptions keyCreateOptions) { - return withContext(context -> createKey(keyCreateOptions, context)); + public Mono createKey(KeyCreateOptions keyCreateOptions) { + return createKeyWithResponse(keyCreateOptions).flatMap(FluxUtil::toMono); } - Mono> createKey(KeyCreateOptions keyCreateOptions, Context context) { + Mono> createKeyWithResponse(KeyCreateOptions keyCreateOptions, Context context) { Objects.requireNonNull(keyCreateOptions, "The key create options parameter cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() .kty(keyCreateOptions.keyType()) @@ -154,7 +169,6 @@ Mono> createKey(KeyCreateOptions keyCreateOptions, Context context .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. @@ -169,15 +183,32 @@ Mono> createKey(KeyCreateOptions keyCreateOptions, Context context *

    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.

    - *
    -     * RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName", KeyType.RSA)
    -     *    .keySize(2048)
    -     *    .notBefore(OffsetDateTime.now().plusDays(1))
    -     *    .expires(OffsetDateTime.now().plusYears(1));
          *
    -     * keyAsyncClient.createRsaKey(rsaKeyCreateOptions).subscribe(keyResponse ->
    -     *   System.out.printf("RSA Key is created with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
    -     * 
    + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createRsaKey#RsaKeyCreateOptions} + * + * @param rsaKeyCreateOptions The key configuration object containing information about the rsa key being created. + * @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) { + return createRsaKeyWithResponse(rsaKeyCreateOptions).flatMap(FluxUtil::toMono); + } + + /** + * 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#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. * @throws NullPointerException if {@code rsaKeyCreateOptions} is {@code null}. @@ -186,11 +217,11 @@ Mono> createKey(KeyCreateOptions keyCreateOptions, Context context * @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> createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions) { - return withContext(context -> createRsaKey(rsaKeyCreateOptions, context)); + public Mono> createRsaKeyWithResponse(RsaKeyCreateOptions rsaKeyCreateOptions) { + return withContext(context -> createRsaKeyWithResponse(rsaKeyCreateOptions, context)); } - Mono> createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions, Context context) { + Mono> createRsaKeyWithResponse(RsaKeyCreateOptions rsaKeyCreateOptions, Context context) { Objects.requireNonNull(rsaKeyCreateOptions, "The Rsa key options parameter cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() .kty(rsaKeyCreateOptions.keyType()) @@ -217,15 +248,36 @@ Mono> createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions, Contex *

    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.

    - *
    -     * EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName", KeyType.EC)
    -     *    .curve(KeyCurveName.P_384)
    -     *    .notBefore(OffsetDateTime.now().plusDays(1))
    -     *    .expires(OffsetDateTime.now().plusYears(1));
          *
    -     * keyAsyncClient.createEcKey(ecKeyCreateOptions).subscribe(keyResponse ->
    -     *   System.out.printf("EC Key is created with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
    -     * 
    + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createEcKey#EcKeyCreateOptions} + * + * @param ecKeyCreateOptions The key options object containing information about the ec key being created. + * @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) { + return createEcKeyWithResponse(ecKeyCreateOptions).flatMap(FluxUtil::toMono); + } + + /** + * 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#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.

    + * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createEcKeyWithResponse#EcKeyCreateOptions} * * @param ecKeyCreateOptions The key options object containing information about the ec key being created. * @throws NullPointerException if {@code ecKeyCreateOptions} is {@code null}. @@ -234,11 +286,11 @@ Mono> createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions, Contex * @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> createEcKey(EcKeyCreateOptions ecKeyCreateOptions) { - return withContext(context -> createEcKey(ecKeyCreateOptions, context)); + public Mono> createEcKeyWithResponse(EcKeyCreateOptions ecKeyCreateOptions) { + return withContext(context -> createEcKeyWithResponse(ecKeyCreateOptions, context)); } - Mono> createEcKey(EcKeyCreateOptions ecKeyCreateOptions, Context context) { + Mono> createEcKeyWithResponse(EcKeyCreateOptions ecKeyCreateOptions, Context context) { Objects.requireNonNull(ecKeyCreateOptions, "The Ec key options options cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() .kty(ecKeyCreateOptions.keyType()) @@ -269,11 +321,11 @@ Mono> createEcKey(EcKeyCreateOptions ecKeyCreateOptions, Context c * @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) { - return withContext(context -> importKey(name, keyMaterial, context)); + public Mono importKey(String name, JsonWebKey keyMaterial) { + return withContext(context -> importKeyWithResponse(name, keyMaterial, context)).flatMap(FluxUtil::toMono); } - Mono> importKey(String name, JsonWebKey keyMaterial, Context context) { + 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)) @@ -281,6 +333,37 @@ Mono> importKey(String name, JsonWebKey keyMaterial, Context conte .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. + * + *

    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.

    + *
    +     * 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()));
    +     * 
    + * + * @param keyImportOptions The key import configuration object containing information about the json web key being imported. + * @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) { + return importKeyWithResponse(keyImportOptions).flatMap(FluxUtil::toMono); + } + /** * 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. @@ -308,11 +391,11 @@ Mono> importKey(String name, JsonWebKey keyMaterial, Context conte * @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(KeyImportOptions keyImportOptions) { - return withContext(context -> importKey(keyImportOptions, context)); + public Mono> importKeyWithResponse(KeyImportOptions keyImportOptions) { + return withContext(context -> importKeyWithResponse(keyImportOptions, context)); } - Mono> importKey(KeyImportOptions keyImportOptions, Context context) { + Mono> importKeyWithResponse(KeyImportOptions keyImportOptions, Context context) { Objects.requireNonNull(keyImportOptions, "The key import configuration parameter cannot be null."); KeyImportRequestParameters parameters = new KeyImportRequestParameters() .key(keyImportOptions.keyMaterial()) @@ -330,12 +413,28 @@ Mono> importKey(KeyImportOptions keyImportOptions, Context context *

    Code Samples

    *

    Gets a specific version of the key in the key vault. Subscribes to the call asynchronously and prints out the * returned key details when a response has been received.

    - *
    -     * String keyVersion = "6A385B124DEF4096AF1361A85B16C204";
    -     * keyAsyncClient.getKey("keyName", keyVersion).subscribe(keyResponse ->
    -     *   System.out.printf("Key returned with name %s, id %s and version %s", keyResponse.value().name(),
    -     *   keyResponse.value().id(), keyResponse.value().version()));
    -     * 
    + * + * {@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. + * @return A {@link Mono} containing the requested {@link Key key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getKey(String name, String version) { + return getKeyWithResponse(name, version).flatMap(FluxUtil::toMono); + } + + /** + * 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 + * returned key details when a response has been received.

    + * + * {@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. @@ -344,14 +443,11 @@ Mono> importKey(KeyImportOptions keyImportOptions, Context context * @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> getKey(String name, String version) { - if (version == null) { - return getKey(name); - } - return withContext(context -> getKey(name, version, context)); + public Mono> getKeyWithResponse(String name, String version) { + return withContext(context -> getKeyWithResponse(name, version == null ? "" : version, context)); } - Mono> getKey(String name, String version, Context context) { + 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())) @@ -365,20 +461,17 @@ Mono> getKey(String name, String version, Context context) { *

    Code Samples

    *

    Gets latest version of the key in the key vault. Subscribes to the call asynchronously and prints out the * returned key details when a response has been received.

    - *
    -     * keyAsyncClient.getKey("keyName").subscribe(keyResponse ->
    -     *   System.out.printf("Key with name %s, id %s \n", keyResponse.value().name(),
    -     *   keyResponse.value().id()));
    -     * 
    + * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getKey#string} * * @param name The name of the 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 a {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. + * @return A {@link Mono} containing the requested {@link Key key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getKey(String name) { - return getKey(name, ""); + public Mono getKey(String name) { + return getKeyWithResponse(name, "").flatMap(FluxUtil::toMono); } /** @@ -388,11 +481,28 @@ public Mono> getKey(String name) { *

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

    - *
    -     * keyAsyncClient.listKeys().subscribe(keyBase ->
    -     *     client.getKey(keyBase).subscribe(keyResponse ->
    -     *       System.out.printf("Key with name %s and value %s \n", keyResponse.value().name(), keyResponse.value().id())));
    -     * 
    + * + * {@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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getKey(KeyBase keyBase) { + return getKeyWithResponse(keyBase).flatMap(FluxUtil::toMono); + } + + /** + * 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. + * 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. @@ -400,12 +510,9 @@ public Mono> getKey(String name) { * @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> getKey(KeyBase keyBase) { + public Mono> getKeyWithResponse(KeyBase keyBase) { Objects.requireNonNull(keyBase, "The Key Base parameter cannot be null."); - if (keyBase.version() == null) { - return getKey(keyBase.name()); - } - return getKey(keyBase.name(), keyBase.version()); + return withContext(context -> getKeyWithResponse(keyBase.name(), keyBase.version() == null ? "" : keyBase.version(), context)); } /** @@ -416,28 +523,21 @@ public Mono> getKey(KeyBase keyBase) { *

    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.

    - *
    -     * keyAsyncClient.getKey("keyName").subscribe(keyResponse -> {
    -     *     Key key = keyResponse.value();
    -     *     //Update the not before time of the key.
    -     *     key.notBefore(OffsetDateTime.now().plusDays(50));
    -     *     keyAsyncClient.updateKey(key).subscribe(updatedKeyResponse ->
    -     *         System.out.printf("Key's updated not before time %s \n", updatedKeyResponse.value().notBefore().toString()));
    -     *   });
    -     * 
    + * + * {@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 a {@link Response} whose {@link Response#value() value} contains the {@link KeyBase updated key}. + * @return A {@link Mono} containing the {@link KeyBase updated key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateKey(KeyBase key) { - return withContext(context -> updateKey(key, context)); + public Mono updateKey(KeyBase key) { + return withContext(context -> updateKeyWithResponse(key, context).flatMap(FluxUtil::toMono)); } - Mono> updateKey(KeyBase key, Context context) { + Mono> updateKeyWithResponse(KeyBase key, Context context) { Objects.requireNonNull(key, "The key input parameter cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() .tags(key.tags()) @@ -448,7 +548,6 @@ Mono> updateKey(KeyBase key, Context context) { .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. @@ -457,15 +556,8 @@ Mono> updateKey(KeyBase key, Context context) { *

    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.

    - *
    -     * keyAsyncClient.getKey("keyName").subscribe(keyResponse -> {
    -     *     Key key = keyResponse.value();
    -     *     //Update the not before time of the key and associate Encrypt and Decrypt operations with it.
    -     *     key.notBefore(OffsetDateTime.now().plusDays(50));
    -     *     keyAsyncClient.updateKey(key, KeyOperation.ENCRYPT, KeyOperation.DECRYPT).subscribe(updatedKeyResponse ->
    -     *         System.out.printf("Key's updated not before time %s \n", updatedKeyResponse.value().notBefore().toString()));
    -     *   });
    -     * 
    + * + * {@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. @@ -475,11 +567,34 @@ Mono> updateKey(KeyBase key, Context context) { * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link KeyBase updated key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateKey(KeyBase key, KeyOperation... keyOperations) { - return withContext(context -> updateKey(key, context, keyOperations)); + public Mono> updateKeyWithResponse(KeyBase key, KeyOperation... keyOperations) { + return withContext(context -> updateKeyWithResponse(key, context, keyOperations)); + } + + /** + * 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.

    + * + * {@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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateKey(KeyBase key, KeyOperation... keyOperations) { + return updateKeyWithResponse(key, keyOperations).flatMap(FluxUtil::toMono); } - Mono> updateKey(KeyBase key, Context context, KeyOperation... keyOperations) { + Mono> updateKeyWithResponse(KeyBase key, Context context, KeyOperation... keyOperations) { Objects.requireNonNull(key, "The key input parameter cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() .tags(key.tags()) @@ -491,6 +606,28 @@ Mono> updateKey(KeyBase key, Context context, KeyOperation... keyO .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. + * + *

    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.

    + * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.deleteKey#string} + * + * @param name The name of the key to be deleted. + * @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) { + return deleteKeyWithResponse(name).flatMap(FluxUtil::toMono); + } /** * 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 @@ -502,10 +639,8 @@ Mono> updateKey(KeyBase key, Context context, KeyOperation... keyO *

    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.

    - *
    -     * keyAsyncClient.deleteKey("keyName").subscribe(deletedKeyResponse ->
    -     *   System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.value().recoveryId()));
    -     * 
    + * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.deleteKeyWithResponse#string} * * @param name The name of the key to be deleted. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. @@ -513,11 +648,11 @@ Mono> updateKey(KeyBase key, Context context, KeyOperation... keyO * @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> deleteKey(String name) { - return withContext(context -> deleteKey(name, context)); + public Mono> deleteKeyWithResponse(String name) { + return withContext(context -> deleteKeyWithResponse(name, context)); } - Mono> deleteKey(String name, Context context) { + 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())) @@ -531,11 +666,29 @@ Mono> deleteKey(String name, Context context) { *

    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.

    - *
          * //Assuming key is deleted on a soft-delete enabled vault.
    -     * keyAsyncClient.getDeletedKey("keyName").subscribe(deletedKeyResponse ->
    -     *   System.out.printf("Deleted Key with recovery Id %s \n", deletedKeyResponse.value().recoveryId()));
    -     * 
    + * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getDeletedKey#string} + * + * @param name The name of the 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) { + return getDeletedKeyWithResponse(name).flatMap(FluxUtil::toMono); + } + + /** + * 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.

    + * //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. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. @@ -543,11 +696,11 @@ Mono> deleteKey(String name, Context context) { * @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> getDeletedKey(String name) { - return withContext(context -> getDeletedKey(name, context)); + public Mono> getDeletedKeyWithResponse(String name) { + return withContext(context -> getDeletedKeyWithResponse(name, context)); } - Mono> getDeletedKey(String name, Context context) { + 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())) @@ -561,11 +714,8 @@ Mono> getDeletedKey(String name, Context context) { *

    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.

    - *
          * //Assuming key is deleted on a soft-delete enabled vault.
    -     * keyAsyncClient.purgeDeletedKey("deletedKeyName").subscribe(purgeResponse ->
    -     *   System.out.printf("Purge Status response %rsaPrivateExponent \n", purgeResponse.statusCode()));
    -     * 
    + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.purgeDeletedKey#string} * * @param name The name of the deleted key. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. @@ -592,11 +742,29 @@ Mono purgeDeletedKey(String name, Context context) { *

    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.

    - *
          * //Assuming key is deleted on a soft-delete enabled vault.
    -     * keyAsyncClient.recoverDeletedKey("deletedKeyName").subscribe(recoveredKeyResponse ->
    -     *   System.out.printf("Recovered Key with name %s \n", recoveredKeyResponse.value().name()));
    -     * 
    + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKey#string} + * + * @param name The name of the deleted key to be recovered. + * @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) { + return recoverDeletedKeyWithResponse(name).flatMap(FluxUtil::toMono); + } + + /** + * 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.

    + * //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. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. @@ -604,11 +772,11 @@ Mono purgeDeletedKey(String name, Context context) { * @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> recoverDeletedKey(String name) { - return withContext(context -> recoverDeletedKey(name, context)); + public Mono> recoverDeletedKeyWithResponse(String name) { + return withContext(context -> recoverDeletedKeyWithResponse(name, context)); } - Mono> recoverDeletedKey(String name, Context context) { + 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())) @@ -628,10 +796,34 @@ Mono> recoverDeletedKey(String name, Context context) { *

    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.

    - *
    -     * keyAsyncClient.backupKey("keyName").subscribe(keyBackupResponse ->
    -     *   System.out.printf("Key's Backup Byte array's length %s \n", keyBackupResponse.value().length));
    -     * 
    + * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.backupKey#string} + * + * @param name The name of the 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 backed up key blob. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono backupKey(String name) { + return backupKeyWithResponse(name).flatMap(FluxUtil::toMono); + } + + /** + * 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.

    + * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.backupKeyWithResponse#string} * * @param name The name of the key. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. @@ -639,11 +831,11 @@ Mono> recoverDeletedKey(String name, Context context) { * @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> backupKey(String name) { - return withContext(context -> backupKey(name, context)); + public Mono> backupKeyWithResponse(String name) { + return withContext(context -> backupKeyWithResponse(name, context)); } - Mono> backupKey(String name, Context context) { + 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)) @@ -664,22 +856,45 @@ Mono> backupKey(String name, Context context) { *

    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.

    - *
          * //Pass the Key Backup Byte array to the restore operation.
    -     * keyAsyncClient.restoreKey(keyBackupByteArray).subscribe(keyResponse ->
    -     *   System.out.printf("Restored Key with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
    -     * 
    + * + * {@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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono restoreKey(byte[] backup) { + return restoreKeyWithResponse(backup).flatMap(FluxUtil::toMono); + } + + /** + * 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.

    + * //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. * @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> restoreKey(byte[] backup) { - return withContext(context -> restoreKey(backup, context)); + public Mono> restoreKeyWithResponse(byte[] backup) { + return withContext(context -> restoreKeyWithResponse(backup, context)); } - Mono> restoreKey(byte[] backup, Context context) { + 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")) @@ -694,11 +909,8 @@ Mono> restoreKey(byte[] backup, Context context) { * *

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

    - *
    -     * Flux<Key> keys = keyAsyncClient.listKeys()
    -     *   .flatMap(keyAsyncClient::getKey)
    -     *   .map(Response::value);
    -     * 
    + * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.listKeys} * * @return A {@link PagedFlux} containing {@link KeyBase key} of all the keys in the vault. */ @@ -747,10 +959,8 @@ private Mono> listKeysFirstPage(Context context) { *

    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.

    - *
    -     * keyAsyncClient.listDeletedKeys().subscribe(deletedKey ->
    -     *   System.out.printf("Deleted key's recovery Id %s \n", deletedKey.recoveryId()));
    -     * 
    + * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.listDeletedKeys} * * @return A {@link PagedFlux} containing all of the {@link DeletedKey deleted keys} in the vault. */ @@ -799,11 +1009,8 @@ private Mono> listDeletedKeysFirstPage(Context context *

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

    - *
    -     * Flux<Key> keys = keyAsyncClient.listKeyVersions("keyName")
    -     *   .flatMap(keyAsyncClient::getKey)
    -     *   .map(Response::value);
    -     * 
    + * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.listKeyVersions} * * @param name The name of the key. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. 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 44e8bac28851..13653b711a1e 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 @@ -9,6 +9,7 @@ import com.azure.core.http.rest.Response; 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; @@ -22,6 +23,7 @@ import com.azure.security.keyvault.keys.models.webkey.KeyType; import java.util.List; +import java.util.Objects; /** * The KeyClient provides synchronous methods to manage {@link Key keys} in the Azure Key Vault. The client @@ -61,10 +63,10 @@ public final class KeyClient { * @param keyType The type of key to create. For valid values, see {@link KeyType KeyType}. * @throws ResourceModifiedException if {@code name} or {@code keyType} is null. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. + * @return The {@link Key created key}. */ - public Response createKey(String name, KeyType keyType) { - return client.createKey(name, keyType).block(); + public Key createKey(String name, KeyType keyType) { + return client.createKeyWithResponse(name, keyType, Context.NONE).block().value(); } /** @@ -79,23 +81,41 @@ public Response createKey(String name, KeyType keyType) { * *

    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.

    - *
    -     * KeyCreateOptions KeyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA)
    -     *    .notBefore(OffsetDateTime.now().plusDays(1))
    -     *    .expires(OffsetDateTime.now().plusYears(1));
    +     * {@codesnippet com.azure.keyvault.keys.keyclient.createKey#keyOptions}
          *
    -     * Key key = keyClient.createKey(keyCreateOptions).value();
    -     * System.out.printf("Key is created with name %s and id %s \n", key.name(), key.id());
    -     * 
    + * @param keyCreateOptions The key options object containing information about the key being created. + * @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(); + } + + /** + * 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. + * + *

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

    + * + *

    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} * * @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. * @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 createKey(KeyCreateOptions keyCreateOptions) { - return client.createKey(keyCreateOptions).block(); + public Response createKeyWithResponse(KeyCreateOptions keyCreateOptions, Context context) { + return client.createKeyWithResponse(keyCreateOptions, context).block(); } /** @@ -111,24 +131,42 @@ public Response createKey(KeyCreateOptions keyCreateOptions) { * *

    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.

    - *
    -     * RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName", KeyType.RSA)
    -     *    .keySize(2048)
    -     *    .notBefore(OffsetDateTime.now().plusDays(1))
    -     *    .expires(OffsetDateTime.now().plusYears(1));
    +     * {@codesnippet com.azure.keyvault.keys.keyclient.createRsaKey#keyOptions}
          *
    -     * Key rsaKey = keyClient.createRsaKey(rsaKeyCreateOptions).value();
    -     * System.out.printf("Key is created with name %s and id %s \n", rsaKey.name(), rsaKey.id());
    -     * 
    + * @param rsaKeyCreateOptions The key options object containing information about the rsa key being created. + * @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. + * + *

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

    + * + *

    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.

    + * {@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. * @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 createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions) { - return client.createRsaKey(rsaKeyCreateOptions).block(); + public Response createRsaKeyWithResponse(RsaKeyCreateOptions rsaKeyCreateOptions, Context context) { + return client.createRsaKeyWithResponse(rsaKeyCreateOptions, context).block(); } /** @@ -145,24 +183,43 @@ public Response createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions) { *

    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.

    - *
    -     * EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName", KeyType.EC)
    -     *    .curve(KeyCurveName.P_384)
    -     *    .notBefore(OffsetDateTime.now().plusDays(1))
    -     *    .expires(OffsetDateTime.now().plusYears(1));
    +     * {@codesnippet com.azure.keyvault.keys.keyclient.createEcKey#keyOptions}
          *
    -     * Key ecKey = keyClient.createEcKey(ecKeyCreateOptions).value();
    -     * System.out.printf("Key is created with name %s and id %s \n", ecKey.name(), ecKey.id());
    -     * 
    + * @param ecKeyCreateOptions The key options object containing information about the ec key being created. + * @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. + * + *

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

    + * + *

    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.

    + * {@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. * @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 createEcKey(EcKeyCreateOptions ecKeyCreateOptions) { - return client.createEcKey(ecKeyCreateOptions).block(); + public Response createEcKeyWithResponse(EcKeyCreateOptions ecKeyCreateOptions, Context context) { + return client.createEcKeyWithResponse(ecKeyCreateOptions, context).block(); } /** @@ -172,17 +229,46 @@ public Response createEcKey(EcKeyCreateOptions ecKeyCreateOptions) { *

    Code Samples

    *

    Imports a new key into key vault. Prints out the details of the imported key.

    *
    -     * Key importedKey = keyClient.importKey("keyName", jsonWebKeyToImport).value();
    +     * Key importedKey = keyClient.importKey("keyName", jsonWebKeyToImport);
          * System.out.printf("Key is imported with name %s and id %s \n", importedKey.name(), importedKey.id());
          * 
    * * @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 A {@link Response} whose {@link Response#value() value} contains the {@link Key imported key}. + * @return The {@link Key imported key}. + */ + 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. + * + *

    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.

    + *
    +     * KeyImportOptions keyImportOptions = new KeyImportOptions("keyName", jsonWebKeyToImport)
    +     *   .hsm(true)
    +     *   .expires(OffsetDateTime.now().plusDays(60));
    +     *
    +     * Key importedKey = keyClient.importKey(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. + * @throws NullPointerException if {@code keyImportOptions} is {@code null}. + * @throws HttpRequestException if {@code name} is empty string. + * @return The {@link Key imported key}. */ - public Response importKey(String name, JsonWebKey keyMaterial) { - return client.importKey(name, keyMaterial).block(); + public Key importKey(KeyImportOptions keyImportOptions) { + return importKeyWithResponse(keyImportOptions, Context.NONE).value(); } /** @@ -201,17 +287,18 @@ public Response importKey(String name, JsonWebKey keyMaterial) { * .hsm(true) * .expires(OffsetDateTime.now().plusDays(60)); * - * Key importedKey = keyClient.importKey(keyImportOptions).value(); + * Key importedKey = keyClient.importKey(keyImportOptions, new Context(key1, value1)).value(); * 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 context Additional context that is passed through the Http pipeline during the service call. * @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 importKey(KeyImportOptions keyImportOptions) { - return client.importKey(keyImportOptions).block(); + public Response importKeyWithResponse(KeyImportOptions keyImportOptions, Context context) { + return client.importKeyWithResponse(keyImportOptions, context).block(); } /** @@ -219,20 +306,34 @@ public Response importKey(KeyImportOptions keyImportOptions) { * *

    Code Samples

    *

    Gets a specific version of the key in the key vault. Prints out the details of the returned key.

    - *
    -     * String keyVersion = "6A385B124DEF4096AF1361A85B16C204";
    -     * Key keyWithVersion = keyClient.getKey("keyName", keyVersion).value();
    -     * System.out.printf("Key is returned with name %s and id %s \n", keyWithVersion.name(), keyWithVersion.id());
    -     * 
    + * {@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. + * @return The requested {@link Key key}. + */ + 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. + * + *

    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.getKeyWithResponse#string-string-Context} + * + * @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. * @return A {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. */ - public Response getKey(String name, String version) { - return client.getKey(name, version).block(); + public Response getKeyWithResponse(String name, String version, Context context) { + return client.getKeyWithResponse(name, version, context).block(); } /** @@ -241,20 +342,34 @@ public Response getKey(String name, String version) { * *

    Code Samples

    *

    Gets the latest version of the key in the key vault. Prints out the details of the returned key.

    - *
    -     * Key key = keyClient.getKey("keyName").value();
    -     * System.out.printf("Key is returned with name %s and id %s \n", key.name(), key.value().id());
    -     * 
    + * {@codesnippet com.azure.keyvault.keys.keyclient.getKey#string} * * @param name The name of the 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 Response} whose {@link Response#value() value} contains the requested {@link Key key}. + * @return The requested {@link Key key}. */ - public Response getKey(String name) { - return getKey(name, ""); + 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. + * + *

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

    + * {@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}. + */ + 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 @@ -263,18 +378,17 @@ public Response getKey(String name) { *

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

    - *
    -     * keyClient.listKeys().stream().map(keyClient::getKey).forEach(keyResponse ->
    -     *   System.out.printf("Key is returned with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
    -     * 
    + * {@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}. */ - public Response getKey(KeyBase keyBase) { - return client.getKey(keyBase).block(); + 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(); } /** @@ -284,21 +398,36 @@ public Response getKey(KeyBase keyBase) { * *

    Code Samples

    *

    Gets the latest version of the key, changes its expiry time and the updates the key in the key vault.

    - *
    -     * Key key = keyClient.getKey("keyName").value();
    -     * key.expires(OffsetDateTime.now().plusDays(60));
    -     * KeyBase updatedKeyBase = keyClient.updateKey(key).value();
    -     * Key updatedKey = keyClient.getKey(updatedKeyBase.name()).value();
    -     * 
    + * {@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}. + */ + 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. + * + *

    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.

    + * {@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}. */ - public Response updateKey(KeyBase key) { - return client.updateKey(key).block(); + public Key updateKey(KeyBase key, KeyOperation... keyOperations) { + return updateKeyWithResponse(key, Context.NONE, keyOperations).value(); } /** @@ -308,22 +437,18 @@ public Response updateKey(KeyBase key) { * *

    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.

    - *
    -     * Key key = keyClient.getKey("keyName").value();
    -     * key.expires(OffsetDateTime.now().plusDays(60));
    -     * KeyBase updatedKeyBase = keyClient.updateKey(key, KeyOperation.ENCRYPT, KeyOperation.DECRYPT).value();
    -     * Key updatedKey = keyClient.getKey(updatedKeyBase.name()).value();
    -     * 
    + * {@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}. */ - public Response updateKey(KeyBase key, KeyOperation... keyOperations) { - return client.updateKey(key, keyOperations).block(); + public Response updateKeyWithResponse(KeyBase key, Context context, KeyOperation... keyOperations) { + return client.updateKeyWithResponse(key, context, keyOperations).block(); } /** @@ -335,18 +460,36 @@ public Response updateKey(KeyBase key, KeyOperation... keyOperations) { * *

    Code Samples

    *

    Deletes the key from the keyvault. Prints out the recovery id of the deleted key returned in the response.

    - *
    -     * DeletedKey deletedKey = keyClient.deleteKey("keyName").value();
    -     * System.out.printf("Deleted Key's Recovery Id %s", deletedKey.recoveryId()));
    -     * 
    + * {@codesnippet com.azure.keyvault.keys.keyclient.deleteKey#string} * * @param name The name of the key to be deleted. * @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. + * + *

    Code Samples

    + *

    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. + * @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 deleteKey(String name) { - return client.deleteKey(name).block(); + public Response deleteKeyWithResponse(String name, Context context) { + return client.deleteKeyWithResponse(name, context).block(); } /** @@ -356,19 +499,37 @@ public Response deleteKey(String name) { *

    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.
    -     * DeletedKey deletedKey = keyClient.getDeletedKey("keyName").value();
    -     * System.out.printf("Deleted Key with recovery Id %s \n", deletedKey.recoveryId());
    +     * {@codesnippet com.azure.keyvault.keys.keyclient.getDeletedKey#string}
          * 
    * * @param name The name of the 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. + * + *

    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.getDeletedKeyWithResponse#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. + * @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 getDeletedKey(String name) { - return client.getDeletedKey(name).block(); + public Response getDeletedKeyWithResponse(String name, Context context) { + return client.getDeletedKeyWithResponse(name, context).block(); } /** @@ -377,11 +538,8 @@ public Response getDeletedKey(String name) { * *

    Code Samples

    *

    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.
    -     * VoidResponse purgeResponse = keyClient.purgeDeletedKey("deletedKeyName");
    -     * System.out.printf("Purge Status Code: %rsaPrivateExponent", purgeResponse.statusCode());
    -     * 
    + * {@codesnippet com.azure.keyvault.keys.keyclient.purgeDeletedKey#string} * * @param name The name of the deleted key. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. @@ -389,7 +547,26 @@ public Response getDeletedKey(String name) { * @return A {@link VoidResponse}. */ public VoidResponse purgeDeletedKey(String name) { - return client.purgeDeletedKey(name).block(); + 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. + * + *

    Code Samples

    + *

    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. + * @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(); } /** @@ -399,19 +576,36 @@ public VoidResponse purgeDeletedKey(String name) { * *

    Code Samples

    *

    Recovers the deleted key from the key vault enabled for soft-delete.

    - *
          * //Assuming key is deleted on a soft-delete enabled key vault.
    -     * Key recoveredKey =  keyClient.recoverDeletedKey("deletedKeyName").value();
    -     * System.out.printf("Recovered key with name %s", recoveredKey.name());
    -     * 
    + * {@codesnippet com.azure.keyvault.keys.keyclient.recoverDeletedKey#string} * * @param name The name of the deleted key to be recovered. * @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. + * + *

    Code Samples

    + *

    Recovers the deleted key from the key vault enabled for soft-delete.

    + * //Assuming key is deleted on a soft-delete enabled key vault. + * {@codesnippet com.azure.keyvault.keys.keyclient.recoverDeletedKeyWithResponse#string-Context} + * + * @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. + * @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 recoverDeletedKey(String name) { - return client.recoverDeletedKey(name).block(); + public Response recoverDeletedKeyWithResponse(String name, Context context) { + return client.recoverDeletedKeyWithResponse(name, context).block(); } /** @@ -426,18 +620,39 @@ public Response recoverDeletedKey(String name) { * *

    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

    - *
    -     * byte[] keyBackup = keyClient.backupKey("keyName").value();
    -     * System.out.printf("Key's Backup Byte array's length %s", keyBackup.length);
    -     * 
    + * {@codesnippet com.azure.keyvault.keys.keyclient.backupKey#string} * * @param name The name of the 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 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. + * + *

    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

    + * {@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. + * @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 backupKey(String name) { - return client.backupKey(name).block(); + public Response backupKeyWithResponse(String name, Context context) { + return client.backupKeyWithResponse(name, context).block(); } /** @@ -451,18 +666,38 @@ public Response backupKey(String name) { * *

    Code Samples

    *

    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.
    -     * KeyClient.restoreKey(keyBackupByteArray).subscribe(keyResponse ->
    -     *   System.out.printf("Restored Key with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
    -     * 
    + * {@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}. + */ + 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. + * + *

    Code Samples

    + *

    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}. */ - public Response restoreKey(byte[] backup) { - return client.restoreKey(backup).block(); + public Response restoreKeyWithResponse(byte[] backup, Context context) { + return client.restoreKeyWithResponse(backup, context).block(); } /** @@ -472,17 +707,28 @@ public Response restoreKey(byte[] backup) { * *

    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.

    - *
    -     * for (KeyBase key : keyClient.listKeys()) {
    -     *   Key keyWithMaterial = keyClient.getKey(key).value();
    -     *   System.out.printf("Received key with name %s and type %s", keyWithMaterial.name(), keyWithMaterial.keyMaterial().kty());
    -     * }
    -     * 
    + * {@codesnippet com.azure.keyvault.keys.keyclient.listKeys} * * @return A {@link List} containing {@link KeyBase key} of all the keys in the vault. */ public Iterable listKeys() { - return client.listKeys().toIterable(); + return listKeys(Context.NONE); + } + + /** + * 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.

    + * {@codesnippet com.azure.keyvault.keys.keyclient.listKeys#Context} + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link List} containing {@link KeyBase key} of all the keys in the vault. + */ + public Iterable listKeys(Context context) { + return client.listKeys(context).toIterable(); } /** @@ -492,16 +738,28 @@ public Iterable listKeys() { * *

    Code Samples

    *

    Lists the deleted keys in the key vault and for each deleted key prints out its recovery id.

    - *
    -     * for (DeletedKey deletedKey : keyClient.listDeletedKeys()) {
    -     *   System.out.printf("Deleted key's recovery Id %s", deletedKey.recoveryId());
    -     * }
    -     * 
    + * {@codesnippet com.azure.keyvault.keys.keyclient.listDeletedKeys} * * @return A {@link List} containing all of the {@link DeletedKey deleted keys} in the vault. */ public Iterable listDeletedKeys() { - return client.listDeletedKeys().toIterable(); + return listDeletedKeys(Context.NONE); + } + + /** + * Lists {@link DeletedKey deleted keys} of the key vault. The deleted keys are retrieved as JSON Web Key structures + * that contain the public part of a deleted key. The Get Deleted Keys operation is applicable for vaults enabled + * for soft-delete. This operation requires the {@code keys/list} permission. + * + *

    Code Samples

    + *

    Lists the deleted keys in the key vault and for each deleted key prints out its recovery id.

    + * {@codesnippet com.azure.keyvault.keys.keyclient.listDeletedKeys#Context} + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link List} containing all of the {@link DeletedKey deleted keys} in the vault. + */ + public Iterable listDeletedKeys(Context context) { + return client.listDeletedKeys(context).toIterable(); } /** @@ -519,6 +777,25 @@ public Iterable listDeletedKeys() { * @return A {@link List} containing {@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 Iterable listKeyVersions(String name) { - return client.listKeyVersions(name).toIterable(); + return listKeyVersions(name, Context.NONE); + } + + /** + * List all versions of the specified key. 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 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.

    + * {@codesnippet com.azure.keyvault.keys.keyclient.listKeyVersions} + * + * @param name The name of the key. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @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 List} containing {@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 Iterable listKeyVersions(String name, Context context) { + return client.listKeyVersions(name, context).toIterable(); } } 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 63cf4e554a5f..ad0ff55cc413 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 @@ -3,12 +3,13 @@ package com.azure.security.keyvault.keys; +import com.azure.core.http.HttpPipelineBuilder; +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.credentials.TokenCredential; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; -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; @@ -16,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.security.keyvault.keys.implementation.AzureKeyVaultConfiguration; import java.net.MalformedURLException; import java.net.URL; @@ -88,6 +90,7 @@ public KeyClientBuilder() { 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. @@ -121,12 +124,14 @@ public KeyAsyncClient buildAsyncClient() { // Closest to API goes first, closest to wire goes last. final List policies = new ArrayList<>(); policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, buildConfiguration)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); - policies.add(new BearerTokenAuthenticationPolicy(credential, KeyAsyncClient.KEY_VAULT_SCOPE)); + policies.add(new KeyVaultCredentialPolicy(credential)); policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyService.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyService.java index db392baeedfc..496c2a510559 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyService.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyService.java @@ -3,20 +3,21 @@ package com.azure.security.keyvault.keys; -import com.azure.core.implementation.annotation.Post; -import com.azure.core.implementation.annotation.Host; -import com.azure.core.implementation.annotation.ServiceInterface; +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.UnexpectedResponseExceptionType; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.Patch; +import com.azure.core.implementation.annotation.Post; +import com.azure.core.implementation.annotation.Put; import com.azure.core.implementation.annotation.PathParam; import com.azure.core.implementation.annotation.QueryParam; -import com.azure.core.implementation.annotation.HeaderParam; -import com.azure.core.implementation.annotation.BodyParam; -import com.azure.core.implementation.annotation.Get; -import com.azure.core.implementation.annotation.Delete; -import com.azure.core.implementation.annotation.Patch; import com.azure.core.implementation.annotation.ReturnValueWireType; +import com.azure.core.implementation.annotation.ServiceInterface; +import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; @@ -66,7 +67,7 @@ Mono> getKey(@HostParam("url") String url, @HeaderParam("Content-Type") String type, Context context); - @Post("keys/{key-name}") + @Put("keys/{key-name}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> importKey(@HostParam("url") String url, 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 new file mode 100644 index 000000000000..4c81737628a1 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyVaultCredentialPolicy.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys; + +import com.azure.core.credentials.TokenCredential; +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.implementation.util.ImplUtils; +import reactor.core.publisher.Mono; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; + +/** + * A policy that authenticates requests with Azure Key Vault service. The content added by this policy + * is leveraged in {@link TokenCredential} to get and set the correct "Authorization" header value. + * + * @see TokenCredential + */ +public final class KeyVaultCredentialPolicy implements HttpPipelinePolicy { + private static final String WWW_AUTHENTICATE = "WWW-Authenticate"; + private static final String BEARER_TOKEN_PREFIX = "Bearer "; + private static final String AUTHORIZATION = "Authorization"; + private final ScopeTokenCache cache; + + /** + * Creates KeyVaultCredentialPolicy. + * + * @param credential the token credential to authenticate the request + */ + public KeyVaultCredentialPolicy(TokenCredential credential) { + Objects.requireNonNull(credential); + this.cache = new ScopeTokenCache((scopes) -> credential.getToken(scopes)); + } + + /** + * Adds the required header to authenticate a request to Azure Key Vault service. + * + * @param context The request context + * @param next The next HTTP pipeline policy to process the {@code context's} request after this policy completes. + * @return A {@link Mono} representing the HTTP response that will arrive asynchronously. + */ + @Override + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + return next.clone().process() + // Ignore body + .doOnNext(HttpResponse::close) + .map(res -> res.headerValue(WWW_AUTHENTICATE)) + .map(header -> extractChallenge(header, BEARER_TOKEN_PREFIX)) + .flatMap(map -> { + cache.scopes(map.get("resource") + "/.default"); + return cache.getToken(); + }) + .flatMap(token -> { + context.httpRequest().header(AUTHORIZATION, BEARER_TOKEN_PREFIX + token.token()); + return next.process(); + }); + } + + /** + * Extracts the challenge off the authentication header. + * + * @param authenticateHeader The authentication header containing all the challenges. + * @param authChallengePrefix The authentication challenge name. + * @return a challenge map. + */ + private static Map extractChallenge(String authenticateHeader, String authChallengePrefix) { + if (!isValidChallenge(authenticateHeader, authChallengePrefix)) { + return null; + } + authenticateHeader = authenticateHeader.toLowerCase(Locale.ROOT).replace(authChallengePrefix.toLowerCase(Locale.ROOT), ""); + + String[] challenges = authenticateHeader.split(", "); + Map challengeMap = new HashMap<>(); + for (String pair : challenges) { + String[] keyValue = pair.split("="); + challengeMap.put(keyValue[0].replaceAll("\"", ""), keyValue[1].replaceAll("\"", "")); + } + return challengeMap; + } + + /** + * Verifies whether a challenge is bearer or not. + * + * @param authenticateHeader The authentication header containing all the challenges. + * @param authChallengePrefix The authentication challenge name. + * @return A boolean indicating tha challenge is valid or not. + */ + private static boolean isValidChallenge(String authenticateHeader, String authChallengePrefix) { + return (!ImplUtils.isNullOrEmpty(authenticateHeader) + && authenticateHeader.toLowerCase(Locale.ROOT).startsWith(authChallengePrefix.toLowerCase(Locale.ROOT))); + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/ScopeTokenCache.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/ScopeTokenCache.java new file mode 100644 index 000000000000..90082140d362 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/ScopeTokenCache.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys; + +import com.azure.core.credentials.AccessToken; +import reactor.core.publisher.FluxSink; +import reactor.core.publisher.Mono; +import reactor.core.publisher.ReplayProcessor; + +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Function; + +/** + * A token cache that supports caching a token and refreshing it. + */ +class ScopeTokenCache { + private static final int REFRESH_TIMEOUT_SECONDS = 30; + + private final AtomicBoolean wip; + private AccessToken cache; + private final ReplayProcessor emitterProcessor = ReplayProcessor.create(1); + private final FluxSink sink = emitterProcessor.sink(FluxSink.OverflowStrategy.BUFFER); + private final Function> getNew; + private String[] scopes; + + /** + * Creates an instance of RefreshableTokenCredential with default scheme "Bearer". + * + * @param getNew a method to get a new token + */ + ScopeTokenCache(Function> getNew) { + this.wip = new AtomicBoolean(false); + this.getNew = getNew; + } + + public void scopes(String... scopes) { + this.scopes = scopes; + } + + /** + * Asynchronously get a token from either the cache or replenish the cache with a new token. + * @return a Publisher that emits an AccessToken + */ + public Mono getToken() { + if (cache != null && !cache.isExpired()) { + return Mono.just(cache); + } + return Mono.defer(() -> { + if (!wip.getAndSet(true)) { + return getNew.apply(scopes).doOnNext(ac -> cache = ac) + .doOnNext(sink::next) + .doOnError(sink::error) + .doOnTerminate(() -> wip.set(false)); + } else { + return emitterProcessor.next(); + } + }); + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes128Cbc.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes128Cbc.java new file mode 100644 index 000000000000..e0f115382fd7 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes128Cbc.java @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class Aes128Cbc extends AesCbc { + + private static final int KEY_SIZE = 128; + public static final String ALGORITHM_NAME = "A128CBC"; + + Aes128Cbc() { + super(ALGORITHM_NAME, KEY_SIZE); + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes128CbcHmacSha256.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes128CbcHmacSha256.java new file mode 100644 index 000000000000..27ffdb85314f --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes128CbcHmacSha256.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class Aes128CbcHmacSha256 extends AesCbcHmacSha2 { + + static final String ALGORITHM_NAME = "A128CBC-HS256"; + + Aes128CbcHmacSha256() { + super(ALGORITHM_NAME); + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes192Cbc.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes192Cbc.java new file mode 100644 index 000000000000..f1e4a06faa3e --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes192Cbc.java @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class Aes192Cbc extends AesCbc { + + private static final int KEY_SIZE = 192; + public static final String ALGORITHM_NAME = "A192CBC"; + + Aes192Cbc() { + super(ALGORITHM_NAME, KEY_SIZE); + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes192CbcHmacSha384.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes192CbcHmacSha384.java new file mode 100644 index 000000000000..88c9593f3eab --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes192CbcHmacSha384.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class Aes192CbcHmacSha384 extends AesCbcHmacSha2 { + + public static final String ALGORITHM_NAME = "A192CBC-HS384"; + + Aes192CbcHmacSha384() { + super(ALGORITHM_NAME); + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes256Cbc.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes256Cbc.java new file mode 100644 index 000000000000..31a3faaf1d55 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes256Cbc.java @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class Aes256Cbc extends AesCbc { + + private static final int KEY_SIZE = 256; + public static final String ALGORITHM_NAME = "A256CBC"; + + Aes256Cbc() { + super(ALGORITHM_NAME, KEY_SIZE); + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes256CbcHmacSha512.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes256CbcHmacSha512.java new file mode 100644 index 000000000000..9354e2ce16ce --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Aes256CbcHmacSha512.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class Aes256CbcHmacSha512 extends AesCbcHmacSha2 { + + public static final String ALGORITHM_NAME = "A256CBC-HS512"; + + Aes256CbcHmacSha512() { + super(ALGORITHM_NAME); + } +} 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 new file mode 100644 index 000000000000..9b05ac28a861 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesCbc.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.util.Arrays; + +abstract class AesCbc extends SymmetricEncryptionAlgorithm { + + final int keySizeInBytes; + final int keySize; + static class AesCbcDecryptor implements ICryptoTransform { + + private final Cipher cipher; + + AesCbcDecryptor(byte[] key, byte[] iv, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + + // Create the cipher using the Provider if specified + if (provider == null) { + cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + } else { + cipher = Cipher.getInstance("AES/CBC/PKCS5Padding", provider); + } + + cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "AES"), new IvParameterSpec(iv)); + } + + @Override + public byte[] doFinal(byte[] plaintext) throws IllegalBlockSizeException, BadPaddingException { + return cipher.doFinal(plaintext); + } + } + + static class AesCbcEncryptor implements ICryptoTransform { + + private final Cipher cipher; + + AesCbcEncryptor(byte[] key, byte[] iv, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + + // Create the cipher using the Provider if specified + if (provider == null) { + cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); + } else { + cipher = Cipher.getInstance("AES/CBC/PKCS5Padding", provider); + } + + cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "AES"), new IvParameterSpec(iv)); + } + + @Override + public byte[] doFinal(byte[] plaintext) throws IllegalBlockSizeException, BadPaddingException { + return cipher.doFinal(plaintext); + } + } + + protected AesCbc(String name, int size) { + super(name); + keySize = size; + keySizeInBytes = size >> 3; + } + + @Override + 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 { + + 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 { + + 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 { + + 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 new file mode 100644 index 000000000000..8153af80073f --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesCbcHmacSha2.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.util.logging.ClientLogger; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.Mac; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.SecretKeySpec; +import java.math.BigInteger; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; + +abstract class AesCbcHmacSha2 extends SymmetricEncryptionAlgorithm { + static final long BYTE_TO_BITS = 8L; + final ClientLogger logger = new ClientLogger(AesCbcHmacSha2.class); + + static class AesCbcHmacSha2Decryptor implements IAuthenticatedCryptoTransform { + + final byte[] aadLength; + final Mac hmac; + final byte[] hmacKey; + final ICryptoTransform inner; + final ClientLogger logger = new ClientLogger(AesCbcHmacSha2Decryptor.class); + + byte[] tag; + + 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 + Triplet parameters = getAlgorithmParameters(name, key); + + // Save the MAC provider and key + hmac = parameters.getRight(); + hmacKey = parameters.getMiddle(); + + // Create the AES provider + inner = new AesCbc.AesCbcDecryptor(parameters.getLeft(), iv, provider); + + aadLength = toBigEndian(authenticationData.length * BYTE_TO_BITS); + + // Save the tag + tag = authenticationTag; + + // Prime the hash. + hmac.update(authenticationData); + hmac.update(iv); + } + + @Override + public byte[] getTag() { + return tag; + } + + @Override + public byte[] doFinal(byte[] input) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException { + + // Add the cipher text to the running hash + hmac.update(input); + + // Add the associated_data_length bytes to the hash + byte[] hash = hmac.doFinal(aadLength); + + // Compute the new tag + byte[] tag = new byte[hmacKey.length]; + System.arraycopy(hash, 0, tag, 0, hmacKey.length); + + // Check the tag before performing the final decrypt + if (!ByteExtensions.sequenceEqualConstantTime(tag, tag)) { + logger.logAndThrow(new IllegalArgumentException("Data is not authentic")); + } + + return inner.doFinal(input); + } + + private static byte[] toBigEndian(long i) { + + byte[] shortRepresentation = BigInteger.valueOf(i).toByteArray(); + byte[] longRepresentation = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }; + + System.arraycopy(shortRepresentation, 0, longRepresentation, longRepresentation.length - shortRepresentation.length, shortRepresentation.length); + + return longRepresentation; + } + + private static Triplet getAlgorithmParameters(String algorithm, byte[] key) throws InvalidKeyException, NoSuchAlgorithmException { + + byte[] aesKey; + byte[] hmacKey; + Mac hmac; + + 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)); + } + + hmacKey = new byte[128 >> 3]; + aesKey = new byte[128 >> 3]; + + // The HMAC key precedes the AES key + System.arraycopy(key, 0, hmacKey, 0, 128 >> 3); + System.arraycopy(key, 128 >> 3, aesKey, 0, 128 >> 3); + + hmac = Mac.getInstance("HmacSHA256"); + hmac.init(new SecretKeySpec(hmacKey, "HmacSHA256")); + + } 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)); + } + + hmacKey = new byte[192 >> 3]; + aesKey = new byte[192 >> 3]; + + // The HMAC key precedes the AES key + System.arraycopy(key, 0, hmacKey, 0, 192 >> 3); + System.arraycopy(key, 192 >> 3, aesKey, 0, 192 >> 3); + + hmac = Mac.getInstance("HmacSHA384"); + hmac.init(new SecretKeySpec(hmacKey, "HmacSHA384")); + } 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)); + } + + hmacKey = new byte[256 >> 3]; + aesKey = new byte[256 >> 3]; + + // The HMAC key precedes the AES key + System.arraycopy(key, 0, hmacKey, 0, 256 >> 3); + System.arraycopy(key, 256 >> 3, aesKey, 0, 256 >> 3); + + hmac = Mac.getInstance("HmacSHA512"); + hmac.init(new SecretKeySpec(hmacKey, "HmacSHA512")); + } else { + throw new IllegalArgumentException(String.format("Unsupported algorithm: %s", algorithm)); + } + + return new Triplet<>(aesKey, hmacKey, hmac); + } + } + + static class AesCbcHmacSha2Encryptor implements IAuthenticatedCryptoTransform { + + final byte[] aadLength; + final Mac hmac; + final byte[] hmacKey; + final ICryptoTransform inner; + + byte[] tag; + + 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); + + // Save the MAC provider and key + this.hmac = parameters.getRight(); + this.hmacKey = parameters.getMiddle(); + + // Create the AES encryptor + this.inner = new AesCbc.AesCbcEncryptor(parameters.getLeft(), iv, provider); + + this.aadLength = toBigEndian(authenticationData.length * BYTE_TO_BITS); + + // Prime the hash. + hmac.update(authenticationData); + hmac.update(iv); + } + + private static byte[] toBigEndian(long i) { + + byte[] shortRepresentation = BigInteger.valueOf(i).toByteArray(); + byte[] longRepresentation = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }; + + System.arraycopy(shortRepresentation, 0, longRepresentation, longRepresentation.length - shortRepresentation.length, shortRepresentation.length); + + return longRepresentation; + } + + private static Triplet getAlgorithmParameters(String algorithm, byte[] key) throws InvalidKeyException, NoSuchAlgorithmException { + + byte[] aesKey; + byte[] hmacKey; + Mac hmac; + + 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)); + } + + hmacKey = new byte[128 >> 3]; + aesKey = new byte[128 >> 3]; + + // The HMAC key precedes the AES key + System.arraycopy(key, 0, hmacKey, 0, 128 >> 3); + System.arraycopy(key, 128 >> 3, aesKey, 0, 128 >> 3); + + hmac = Mac.getInstance("HmacSHA256"); + hmac.init(new SecretKeySpec(hmacKey, "HmacSHA256")); + + } 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)); + } + + hmacKey = new byte[192 >> 3]; + aesKey = new byte[192 >> 3]; + + // The HMAC key precedes the AES key + System.arraycopy(key, 0, hmacKey, 0, 192 >> 3); + System.arraycopy(key, 192 >> 3, aesKey, 0, 192 >> 3); + + hmac = Mac.getInstance("HmacSHA384"); + hmac.init(new SecretKeySpec(hmacKey, "HmacSHA384")); + } 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)); + } + + hmacKey = new byte[256 >> 3]; + aesKey = new byte[256 >> 3]; + + // The HMAC key precedes the AES key + System.arraycopy(key, 0, hmacKey, 0, 256 >> 3); + System.arraycopy(key, 256 >> 3, aesKey, 0, 256 >> 3); + + hmac = Mac.getInstance("HmacSHA512"); + hmac.init(new SecretKeySpec(hmacKey, "HmacSHA512")); + } else { + throw new IllegalArgumentException(String.format("Unsupported algorithm: %s", algorithm)); + } + + return new Triplet<>(aesKey, hmacKey, hmac); + } + + @Override + public byte[] getTag() { + return tag; + } + + @Override + public byte[] doFinal(byte[] input) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException { + + // Encrypt the block + byte[] output = inner.doFinal(input); + + // Add the cipher text to the running hash + hmac.update(output); + + // Add the associated_data_length bytes to the hash + byte[] hash = hmac.doFinal(aadLength); + + // Compute the tag + tag = new byte[hmacKey.length]; + System.arraycopy(hash, 0, tag, 0, tag.length); + + return output; + } + } + + protected AesCbcHmacSha2(String name) { + super(name); + } + + @Override + 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 { + if (key == null) { + logger.logAndThrow(new IllegalArgumentException("No key material")); + } + + if (iv == null) { + logger.logAndThrow(new IllegalArgumentException("No initialization vector")); + } + + if (authenticationData == null) { + logger.logAndThrow(new IllegalArgumentException("No authentication data")); + } + + if (authenticationTag == null) { + logger.logAndThrow(new IllegalArgumentException("No authentication tag")); + } + + // Create the Decryptor + return new AesCbcHmacSha2Decryptor(getName(), key, iv, authenticationData, authenticationTag, provider); + } + + @Override + 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 { + + if (key == null) { + throw new IllegalArgumentException("No key material"); + } + + if (iv == null) { + throw new IllegalArgumentException("No initialization vector"); + } + + if (authenticationData == null) { + throw new IllegalArgumentException("No authentication data"); + } + + // Create the Encryptor + return new AesCbcHmacSha2Encryptor(getName(), key, iv, authenticationData, provider); + } +} 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 new file mode 100644 index 000000000000..80f95041ee02 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +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 String CIPHER_NAME = "AESWrap"; + + static class AesKwDecryptor implements ICryptoTransform { + + final Cipher cipher; + + AesKwDecryptor(byte[] key, byte[] iv, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + + if (provider == null) { + cipher = Cipher.getInstance(CIPHER_NAME); + } else { + cipher = Cipher.getInstance(CIPHER_NAME, provider); + } + + // 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 + if (provider == null) { + cipher.init(Cipher.UNWRAP_MODE, new SecretKeySpec(key, "AES")); + } else { + cipher.init(Cipher.UNWRAP_MODE, new SecretKeySpec(key, "AES"), new IvParameterSpec(iv)); + } + } + + @Override + public byte[] doFinal(byte[] plaintext) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException, NoSuchAlgorithmException { + + return cipher.unwrap(plaintext, "AESWrap", Cipher.SECRET_KEY).getEncoded(); + } + + } + + static class AesKwEncryptor implements ICryptoTransform { + + final Cipher cipher; + + AesKwEncryptor(byte[] key, byte[] iv, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException { + + if (provider == null) { + cipher = Cipher.getInstance(CIPHER_NAME); + } else { + cipher = Cipher.getInstance(CIPHER_NAME, provider); + } + + // 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 + if (provider == null) { + cipher.init(Cipher.WRAP_MODE, new SecretKeySpec(key, "AES")); + } else { + cipher.init(Cipher.WRAP_MODE, new SecretKeySpec(key, "AES"), new IvParameterSpec(iv)); + } + } + + @Override + public byte[] doFinal(byte[] plaintext) throws IllegalBlockSizeException, BadPaddingException, InvalidKeyException { + + return cipher.wrap(new SecretKeySpec(plaintext, "AES")); + } + + } + + protected AesKw(String name) { + super(name); + } + + @Override + 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 { + + return createEncryptor(key, null, provider); + } + + @Override + 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 { + + if (key == null) { + throw 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"); + } + + if (iv != null) { + // iv length must be 64 bits + if (iv.length != 8) { + throw 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"); + } + } + + return new AesKwEncryptor(key, iv == null ? DEFAULT_IV : iv, provider); + + } + + @Override + 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 { + + return createDecryptor(key, null, provider); + } + + @Override + 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 { + + if (key == null) { + throw 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"); + } + + + if (iv != null) { + // iv length must be 64 bits + if (iv.length != 8) { + throw 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"); + } + } + + return new AesKwDecryptor(key, iv == null ? DEFAULT_IV : iv, 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 new file mode 100644 index 000000000000..f710f03eee0c --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw128.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import javax.crypto.NoSuchPaddingException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.util.Arrays; + +class AesKw128 extends AesKw { + + public static final String ALGORITHM_NAME = "A128KW"; + + static final int KEY_SIZE_IN_BYTES = 128 >> 3; + + AesKw128() { + super(ALGORITHM_NAME); + } + + @Override + 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 { + + 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/AesKw192.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw192.java new file mode 100644 index 000000000000..a6f758e86212 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw192.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import javax.crypto.NoSuchPaddingException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.util.Arrays; + +class AesKw192 extends AesKw { + + public static final String ALGORITHM_NAME = "A192KW"; + + static final int KEY_SIZE_IN_BYTES = 192 >> 3; + + AesKw192() { + super(ALGORITHM_NAME); + } + + @Override + 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 { + + 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/AesKw256.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw256.java new file mode 100644 index 000000000000..d3243c41c6a4 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AesKw256.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import javax.crypto.NoSuchPaddingException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.util.Arrays; + +class AesKw256 extends AesKw { + + public static final String ALGORITHM_NAME = "A256KW"; + + static final int KEY_SIZE_IN_BYTES = 256 >> 3; + + AesKw256() { + super(ALGORITHM_NAME); + } + + @Override + 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 { + 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/Algorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Algorithm.java new file mode 100644 index 000000000000..441c1307ccb8 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Algorithm.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +/** + * Abstract base class for all Algorithm objects. + * + */ +abstract class Algorithm { + + private final String name; + + Algorithm(String name) { + if (Strings.isNullOrWhiteSpace(name)) { + throw new IllegalArgumentException("name"); + } + + this.name = name; + } + + /* + * Gets the name of the algorithm. + * + * @return The name of the algorithm. + */ + public String getName() { + return name; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AlgorithmResolver.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AlgorithmResolver.java new file mode 100644 index 000000000000..ad703e5c170a --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AlgorithmResolver.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +class AlgorithmResolver { + + public static final AlgorithmResolver Default = new AlgorithmResolver(); + + static { + Default.put(Aes128CbcHmacSha256.ALGORITHM_NAME, new Aes128CbcHmacSha256()); + Default.put(Aes192CbcHmacSha384.ALGORITHM_NAME, new Aes192CbcHmacSha384()); + Default.put(Aes256CbcHmacSha512.ALGORITHM_NAME, new Aes256CbcHmacSha512()); + + Default.put(Aes128Cbc.ALGORITHM_NAME, new Aes128Cbc()); + Default.put(Aes192Cbc.ALGORITHM_NAME, new Aes192Cbc()); + Default.put(Aes256Cbc.ALGORITHM_NAME, new Aes256Cbc()); + + Default.put(AesKw128.ALGORITHM_NAME, new AesKw128()); + Default.put(AesKw192.ALGORITHM_NAME, new AesKw192()); + Default.put(AesKw256.ALGORITHM_NAME, new AesKw256()); + + Default.put(Rsa15.ALGORITHM_NAME, new Rsa15()); + Default.put(RsaOaep.ALGORITHM_NAME, new RsaOaep()); + + Default.put(Es256k.ALGORITHM_NAME, new Es256k()); + Default.put(Es256.ALGORITHM_NAME, new Es256()); + Default.put(Es384.ALGORITHM_NAME, new Es384()); + Default.put(Es512.ALGORITHM_NAME, new Es512()); + } + + private final Map algorithms = new ConcurrentHashMap<>(); + + /** + * Returns the implementation for an algorithm name. + * + * @param algorithmName The algorithm name. + * @return The implementation for the algorithm or null. + */ + public Algorithm get(String algorithmName) { + return algorithms.get(algorithmName); + } + + /** + * Add/Update a named algorithm implementation. + * + * @param algorithmName The algorithm name. + * @param provider The implementation of the algorithm. + */ + public void put(String algorithmName, Algorithm provider) { + algorithms.put(algorithmName, provider); + } + + /** + * Remove a named algorithm implementation. + * + * @param algorithmName The algorithm name + */ + public void remove(String algorithmName) { + algorithms.remove(algorithmName); + } +} 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 new file mode 100644 index 000000000000..53b576760d98 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AsymmetricEncryptionAlgorithm.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import javax.crypto.NoSuchPaddingException; +import java.security.InvalidKeyException; +import java.security.KeyPair; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; + +/** + * Abstract base class for all asymmetric encryption implementation. + * + */ +abstract class AsymmetricEncryptionAlgorithm extends LocalEncryptionAlgorithm { + + /** + * Constructor. + * + * @param name The name of the algorithm. + */ + protected AsymmetricEncryptionAlgorithm(String name) { + super(name); + } + + /** + * Creates a {@link ICryptoTransform} implementation for encryption 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 + */ + public abstract ICryptoTransform createEncryptor(KeyPair keyPair) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; + + /** + * Creates a {@link ICryptoTransform} implementation for encryption that + * uses the specified {@link KeyPair} and {@link Provider}. + * + * @param keyPair The key pair to use. + * @param provider The provider to use. + * @return + * @throws InvalidKeyException + * @throws NoSuchAlgorithmException + * @throws 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 + */ + public abstract ICryptoTransform createDecryptor(KeyPair keyPair) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException; + + /** + * Creates a {@link ICryptoTransform} implementation for decryption that + * uses the specified {@link KeyPair} and {@link Provider}. + * + * @param keyPair The key pair to use. + * @param provider The provider to use. + * @return + * @throws InvalidKeyException + * @throws NoSuchAlgorithmException + * @throws 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/AsymmetricSignatureAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AsymmetricSignatureAlgorithm.java new file mode 100644 index 000000000000..1ba2e99465b5 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/AsymmetricSignatureAlgorithm.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class AsymmetricSignatureAlgorithm extends LocalSignatureAlgorithm { + + protected AsymmetricSignatureAlgorithm(String name) { + super(name); + } + +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/ByteExtensions.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/ByteExtensions.java new file mode 100644 index 000000000000..e244fe30e92c --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/ByteExtensions.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import java.util.Arrays; + +class ByteExtensions { + + static byte[] or(byte[] self, byte[] other) { + return or(self, other, 0); + } + + static byte[] or(byte[] self, byte[] other, int offset) { + if (self == null) { + throw new IllegalArgumentException("self"); + } + + if (other == null) { + throw new IllegalArgumentException("other"); + } + + if (self.length > other.length - offset) { + throw new IllegalArgumentException("self and other lengths do not match"); + } + + byte[] result = new byte[self.length]; + + for (int i = 0; i < self.length; i++) { + result[i] = (byte) (self[i] | other[offset + i]); + } + + return result; + } + + static byte[] xor(byte[] self, byte[] other) { + return xor(self, other, 0); + } + + static byte[] xor(byte[] self, byte[] other, int offset) { + if (self == null) { + throw new IllegalArgumentException("self"); + } + + if (other == null) { + throw new IllegalArgumentException("other"); + } + + if (self.length > other.length - offset) { + throw new IllegalArgumentException("self and other lengths do not match"); + } + + byte[] result = new byte[self.length]; + + for (int i = 0; i < self.length; i++) { + result[i] = (byte) (self[i] ^ other[offset + i]); + } + + return result; + } + + static void zero(byte[] self) { + if (self != null) { + Arrays.fill(self, (byte) 0); + } + } + + /* + * Compares two byte arrays in constant time. + * + * @param self + * The first byte array to compare + * @param other + * The second byte array to compare + * @return + * True if the two byte arrays are equal. + */ + static boolean sequenceEqualConstantTime(byte[] self, byte[] other) { + if (self == null) { + throw new IllegalArgumentException("self"); + } + + if (other == null) { + throw new IllegalArgumentException("other"); + } + + // Constant time comparison of two byte arrays + long difference = (self.length & 0xffffffffL) ^ (other.length & 0xffffffffL); + + for (int i = 0; i < self.length && i < other.length; i++) { + difference |= (self[i] ^ other[i]) & 0xffffffffL; + } + + return difference == 0; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptoUtil.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptoUtil.java new file mode 100644 index 000000000000..4ddfdb80e355 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptoUtil.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class CryptoUtil { + + /* + * Determines whether the key is valid and of required size. + * + * @param key The key to be checked. + * @param keySizeInBytes The minimum size required for the key + */ + static void validate(byte[] key, int keySizeInBytes) { + if (key == null) { + throw new IllegalArgumentException("key must not be null"); + } + + if (key.length < keySizeInBytes) { + throw new IllegalArgumentException(String.format("key must be at least %d bits long", keySizeInBytes << 3)); + } + } +} 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 new file mode 100644 index 000000000000..053fb631ade8 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClient.java @@ -0,0 +1,569 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.rest.Response; +import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceClient; +import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.implementation.util.FluxUtil; +import com.azure.core.implementation.util.ImplUtils; +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; +import com.azure.security.keyvault.keys.cryptography.models.KeyUnwrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignResult; +import com.azure.security.keyvault.keys.cryptography.models.VerifyResult; +import com.azure.security.keyvault.keys.models.Key; +import com.azure.security.keyvault.keys.models.webkey.JsonWebKey; +import com.azure.security.keyvault.keys.models.webkey.KeyOperation; +import reactor.core.publisher.Mono; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.List; +import java.util.Objects; + +import static com.azure.core.implementation.util.FluxUtil.withContext; + +/** + * 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. + * + *

    Samples to construct the sync client

    + * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.instantiation} + * + * @see CryptographyClientBuilder + */ +@ServiceClient(builder = CryptographyClientBuilder.class, isAsync = true, serviceInterfaces = CryptographyService.class) +public final class CryptographyAsyncClient { + static final String KEY_VAULT_SCOPE = "https://vault.azure.net/.default"; + private JsonWebKey key; + private final CryptographyService service; + private final CryptographyServiceClient cryptographyServiceClient; + private LocalKeyCryptographyClient localKeyCryptographyClient; + private final ClientLogger logger = new ClientLogger(CryptographyAsyncClient.class); + + /** + * Creates a CryptographyAsyncClient that uses {@code pipeline} to service requests + * + * @param key the JsonWebKey to use for cryptography operations. + * @param pipeline HttpPipeline that the HTTP requests and responses flow through. + */ + CryptographyAsyncClient(JsonWebKey key, HttpPipeline pipeline) { + Objects.requireNonNull(key); + if (!key.isValid()) { + throw new IllegalArgumentException("Json Web Key is not valid"); + } + if (key.keyOps() == null) { + throw new IllegalArgumentException("Json Web Key's key operations property is not configured"); + } + + if (key.kty() == null) { + throw new IllegalArgumentException("Json Web Key's key type property is not configured"); + } + this.key = key; + service = RestProxy.create(CryptographyService.class, pipeline); + if (!Strings.isNullOrEmpty(key.kid())) { + unpackAndValidateId(key.kid()); + cryptographyServiceClient = new CryptographyServiceClient(key.kid(), service); + } else { + cryptographyServiceClient = null; + } + initializeCryptoClients(); + } + + /** + * Creates a CryptographyAsyncClient that uses {@code pipeline} to service requests + * + * @param kid THe Azure Key vault key identifier to use for cryptography operations. + * @param pipeline HttpPipeline that the HTTP requests and responses flow through. + */ + CryptographyAsyncClient(String kid, HttpPipeline pipeline) { + unpackAndValidateId(kid); + service = RestProxy.create(CryptographyService.class, pipeline); + cryptographyServiceClient = new CryptographyServiceClient(kid, service); + this.key = null; + } + + private void initializeCryptoClients() { + if (localKeyCryptographyClient != null) { + return; + } + switch (key.kty()) { + case RSA: + case RSA_HSM: + localKeyCryptographyClient = new RsaKeyCryptographyClient(key, cryptographyServiceClient); + break; + case EC: + case EC_HSM: + localKeyCryptographyClient = new EcKeyCryptographyClient(key, cryptographyServiceClient); + break; + case OCT: + localKeyCryptographyClient = new SymmetricKeyCryptographyClient(key, cryptographyServiceClient); + break; + default: + throw 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. + * + *

    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.

    + * {@codesnippet com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.getKeyWithResponse} + * + * @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() { + return withContext(context -> getKeyWithResponse(context)); + } + + /** + * 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.

    + * {@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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getKey() { + return getKeyWithResponse().flatMap(FluxUtil::toMono); + } + + Mono> getKeyWithResponse(Context context) { + return cryptographyServiceClient.getKey(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. + * + *

    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#asymmetric-encrypt} + * + * @param algorithm The algorithm to be used for encryption. + * @param plaintext The content to be encrypted. + * @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)); + } + + /** + * 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 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} + * + * @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 + * @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) { + return withContext(context -> encrypt(algorithm, plaintext, context, iv, 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."); + + boolean keyAvailableLocally = ensureValidKeyAvailable(); + + if (!keyAvailableLocally) { + return cryptographyServiceClient.encrypt(algorithm, plaintext, context); + } + + if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.ENCRYPT)) { + return Mono.error(new UnsupportedOperationException(String.format("Encrypt Operation is missing permission/not supported for key with id %s", key.kid()))); + } + 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. + * + *

    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#asymmetric-decrypt} + * + * @param algorithm The algorithm to be used for decryption. + * @param cipherText The content to be decrypted. + * @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}

    + * + *

    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} + * + * @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. + * @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)); + } + + 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(); + + if (!keyAvailableLocally) { + return cryptographyServiceClient.decrypt(algorithm, cipherText, context); + } + + if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.DECRYPT)) { + return Mono.error(new UnsupportedOperationException(String.format("Decrypt Operation is not allowed for key with id %s", key.kid()))); + } + 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}

    + * + *

    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} + * + * @param algorithm The algorithm to use for signing. + * @param digest The content from which signature is to be created. + * @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)); + } + + Mono sign(SignatureAlgorithm algorithm, byte[] digest, Context context) { + Objects.requireNonNull(algorithm, "Signature algorithm cannot be null."); + Objects.requireNonNull(digest, "Digest content to be signed cannot be null."); + boolean keyAvailableLocally = ensureValidKeyAvailable(); + + if (!keyAvailableLocally) { + return cryptographyServiceClient.sign(algorithm, digest, context); + } + + if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.SIGN)) { + return Mono.error(new UnsupportedOperationException(String.format("Sign Operation is not allowed for key with id %s", key.kid()))); + } + + 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. + * + *

    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} + * + * @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. + * @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)); + } + + Mono verify(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context) { + Objects.requireNonNull(algorithm, "Signature algorithm cannot be null."); + Objects.requireNonNull(digest, "Digest content cannot be null."); + Objects.requireNonNull(signature, "Signature to be verified cannot be null."); + boolean keyAvailableLocally = ensureValidKeyAvailable(); + + if (!keyAvailableLocally) { + return cryptographyServiceClient.verify(algorithm, digest, signature, context); + } + + if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.VERIFY)) { + return Mono.error(new UnsupportedOperationException(String.format("Verify Operation is not allowed for key with id %s", key.kid()))); + } + return localKeyCryptographyClient.verifyAsync(algorithm, digest, signature, context, 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}

    + * + *

    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} + * + * @param algorithm The encryption algorithm to use for wrapping the key. + * @param key The key content to be wrapped + * @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)); + } + + Mono wrapKey(KeyWrapAlgorithm algorithm, byte[] key, Context context) { + Objects.requireNonNull(algorithm, "Key Wrap algorithm cannot be null."); + Objects.requireNonNull(key, "Key content to be wrapped cannot be null."); + boolean keyAvailableLocally = ensureValidKeyAvailable(); + + if (!keyAvailableLocally) { + return cryptographyServiceClient.wrapKey(algorithm, key, context); + } + + if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.WRAP_KEY)) { + return Mono.error(new UnsupportedOperationException(String.format("Wrap Key Operation is not allowed for key with id %s", this.key.kid()))); + } + + 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}

    + * + *

    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} + * + * @param algorithm The encryption algorithm to use for wrapping the key. + * @param encryptedKey The encrypted key content to unwrap. + * @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)); + } + + Mono unwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context) { + Objects.requireNonNull(algorithm, "Key Wrap algorithm cannot be null."); + Objects.requireNonNull(encryptedKey, "Encrypted key content to be unwrapped cannot be null."); + + boolean keyAvailableLocally = ensureValidKeyAvailable(); + + if (!keyAvailableLocally) { + return cryptographyServiceClient.unwrapKey(algorithm, encryptedKey, context); + } + + if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.WRAP_KEY)) { + return Mono.error(new UnsupportedOperationException(String.format("Unwrap Key Operation is not allowed for key with id %s", this.key.kid()))); + } + 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 + * {@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} + * + * @param algorithm The algorithm to use for signing. + * @param data The content from which signature is to be created. + * @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)); + } + + Mono signData(SignatureAlgorithm algorithm, byte[] data, Context context) { + Objects.requireNonNull(algorithm, "Signature algorithm cannot be null."); + Objects.requireNonNull(data, "Data to be signed cannot be null."); + + boolean keyAvailableLocally = ensureValidKeyAvailable(); + + if (!keyAvailableLocally) { + return cryptographyServiceClient.signData(algorithm, data, context); + } + + if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.SIGN)) { + return Mono.error(new UnsupportedOperationException(String.format("Sign Operation is not allowed for key with id %s", this.key.kid()))); + } + 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}

    + * + *

    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} + * + * @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. + * @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)); + } + + Mono verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] signature, Context context) { + Objects.requireNonNull(algorithm, "Signature algorithm cannot be null."); + Objects.requireNonNull(data, "Data cannot be null."); + Objects.requireNonNull(signature, "Signature to be verified cannot be null."); + boolean keyAvailableLocally = ensureValidKeyAvailable(); + + if (!keyAvailableLocally) { + return cryptographyServiceClient.verifyData(algorithm, data, signature, context); + } + + if (!checkKeyPermissions(this.key.keyOps(), KeyOperation.VERIFY)) { + return Mono.error(new UnsupportedOperationException(String.format("Verify Operation is not allowed for key with id %s", this.key.kid()))); + } + return localKeyCryptographyClient.verifyDataAsync(algorithm, data, signature, context, key); + } + + private void unpackAndValidateId(String keyId) { + if (ImplUtils.isNullOrEmpty(keyId)) { + throw new IllegalArgumentException("Key Id is invalid"); + } + try { + URL url = new URL(keyId); + String[] tokens = url.getPath().split("/"); + String endpoint = url.getProtocol() + "://" + url.getHost(); + 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"); + } else if (Strings.isNullOrEmpty(keyName)) { + throw new IllegalArgumentException("Key name in key id is invalid"); + } else if (Strings.isNullOrEmpty(version)) { + throw new IllegalArgumentException("Key version in key id is invalid"); + } + } catch (MalformedURLException e) { + throw new IllegalArgumentException("The key identifier is malformed", e); + } + } + + private boolean checkKeyPermissions(List operations, KeyOperation keyOperation) { + return operations.contains(keyOperation); + } + + private boolean ensureValidKeyAvailable() { + boolean keyAvailableLocally = true; + if (this.key == null) { + try { + this.key = getKey().block().keyMaterial(); + keyAvailableLocally = this.key.isValid(); + initializeCryptoClients(); + } catch (HttpResponseException | NullPointerException e) { + logger.info("Failed to retrieve key from key vault"); + keyAvailableLocally = false; + } + } + return keyAvailableLocally; + } + + CryptographyServiceClient getCryptographyServiceClient() { + return cryptographyServiceClient; + } +} 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 new file mode 100644 index 000000000000..a81b0222a896 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClient.java @@ -0,0 +1,526 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.Response; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceClient; +import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.util.Context; +import com.azure.security.keyvault.keys.cryptography.models.DecryptResult; +import com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.EncryptResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyUnwrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignResult; +import com.azure.security.keyvault.keys.cryptography.models.VerifyResult; +import com.azure.security.keyvault.keys.models.Key; + +/** + * 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. + * + *

    Samples to construct the sync client

    + * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.instantiation} + * + * @see CryptographyClientBuilder + */ +@ServiceClient(builder = CryptographyClientBuilder.class, serviceInterfaces = CryptographyService.class) +public final class CryptographyClient { + private final CryptographyAsyncClient client; + + /** + * Creates a KeyClient that uses {@code pipeline} to service requests + * + * @param client The {@link CryptographyAsyncClient} that the client routes its request through. + */ + CryptographyClient(CryptographyAsyncClient client) { + this.client = client; + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Key getKey() { + return getKeyWithResponse(Context.NONE).value(); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getKeyWithResponse(Context context) { + return client.getKeyWithResponse(context).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}

    + * + *

    Code Samples

    + *

    Encrypts the content. Prints out the encrypted content details.

    + * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt} + * + * @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 + * @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) { + 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 + * 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#symmetric-encrypt-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. + * @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) { + 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}

    + * + *

    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} + * + * @param algorithm The algorithm to be used for encryption. + * @param plaintext The content to be encrypted. + * @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}

    + * + *

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

    + * + *

    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} + * + * @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. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @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) { + 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}

    + * + *

    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} + * + * @param algorithm The algorithm to be used for decryption. + * @param cipherText The content to be decrypted. + * @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); + } + + /** + * 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}

    + * + *

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

    + * + *

    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} + * + * @param algorithm The algorithm to use for signing. + * @param digest The content from which signature is to be created. + * @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}

    + * + *

    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} + * + * @param algorithm The algorithm to use for signing. + * @param digest The content from which signature was created. + * @param signature The signature to be verified. + * @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}

    + * + *

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

    + * + *

    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} + * + * @param algorithm The encryption algorithm to use for wrapping the key. + * @param key The key content to be wrapped + * @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); + } + + /** + * 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}

    + * + *

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

    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} + * + * @param algorithm The encryption algorithm to use for wrapping the key. + * @param encryptedKey The encrypted key content to unwrap. + * @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}

    + * + *

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

    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} + * + * @param algorithm The algorithm to use for signing. + * @param data The content from which signature is to be created. + * @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 + * 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}

    + * + *

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

    + * + *

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

    + * + *

    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} + * + * @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. + * @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(); + } + + CryptographyServiceClient getServiceClient() { + return client.getCryptographyServiceClient(); + } +} 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 new file mode 100644 index 000000000000..a73e91537de5 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientBuilder.java @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.credentials.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; +import com.azure.core.util.configuration.Configuration; +import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.security.keyvault.keys.KeyVaultCredentialPolicy; +import com.azure.security.keyvault.keys.implementation.AzureKeyVaultConfiguration; +import com.azure.security.keyvault.keys.models.webkey.JsonWebKey; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link 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}).

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

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

    + * + * {@codesnippet com.azure.security.keyvault.keys.cryptography.cryptographyclient.instantiation} + * + * @see CryptographyAsyncClient + * @see CryptographyClient + */ +@ServiceClientBuilder(serviceClients = CryptographyClient.class) +public final class CryptographyClientBuilder { + private final List policies; + private TokenCredential credential; + private HttpPipeline pipeline; + private JsonWebKey jsonWebKey; + private String keyId; + private HttpClient httpClient; + private HttpLogDetailLevel httpLogDetailLevel; + private RetryPolicy retryPolicy; + private Configuration configuration; + + /** + * The constructor with defaults. + */ + public CryptographyClientBuilder() { + retryPolicy = new RetryPolicy(); + httpLogDetailLevel = HttpLogDetailLevel.NONE; + policies = new ArrayList<>(); + } + + /** + * Creates a {@link CryptographyClient} based on options set in the builder. + * 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}.

    + * + * @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. + */ + public CryptographyClient buildClient() { + return new CryptographyClient(buildAsyncClient()); + } + /** + * Creates a {@link CryptographyAsyncClient} based on options set in the builder. + * 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}.

    + * + * @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. + */ + public CryptographyAsyncClient buildAsyncClient() { + 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"); + } + + if (pipeline != null) { + if (jsonWebKey != null) { + return new CryptographyAsyncClient(jsonWebKey, pipeline); + } else { + return new CryptographyAsyncClient(keyId, pipeline); + } + } + + if (credential == null) { + throw 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)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new KeyVaultCredentialPolicy(credential)); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); + + HttpPipeline pipeline = new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); + + if (jsonWebKey != null) { + return new CryptographyAsyncClient(jsonWebKey, pipeline); + } else { + return new CryptographyAsyncClient(keyId, pipeline); + } + } + + /** + * 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.

    + + * @param keyId The jsonWebKey identifier representing the jsonWebKey stored in jsonWebKey vault. + * @return the updated {@link CryptographyClientBuilder} object. + */ + public CryptographyClientBuilder keyIdentifier(String keyId) { + this.keyId = keyId; + return this; + } + + /** + * 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.

    + * + * @param jsonWebKey The Json web jsonWebKey to be used for cryptography operations. + * @return the updated {@link CryptographyClientBuilder} object. + */ + public CryptographyClientBuilder jsonWebKey(JsonWebKey jsonWebKey) { + this.jsonWebKey = jsonWebKey; + return this; + } + + /** + * Sets the credential to use when authenticating HTTP requests. + * + * @param credential The credential to use for authenticating HTTP requests. + * @return the updated {@link CryptographyClientBuilder} object. + * @throws NullPointerException if {@code credential} is {@code null}. + */ + public CryptographyClientBuilder credential(TokenCredential credential) { + Objects.requireNonNull(credential); + this.credential = credential; + return this; + } + + /** + * Sets the logging level for HTTP requests and responses. + * + *

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

    + * + * @param logLevel The amount of logging output when sending and receiving HTTP requests/responses. + * @return the updated {@link CryptographyClientBuilder} object. + * @throws NullPointerException if {@code logLevel} is {@code null}. + */ + public CryptographyClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { + Objects.requireNonNull(logLevel); + httpLogDetailLevel = logLevel; + return this; + } + + /** + * 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. + * @throws NullPointerException if {@code policy} is {@code null}. + */ + public CryptographyClientBuilder addPolicy(HttpPipelinePolicy policy) { + Objects.requireNonNull(policy); + policies.add(policy); + return this; + } + + /** + * Sets the HTTP client to use for sending and receiving requests to and from the service. + * + * @param client The HTTP client to use for requests. + * @return the updated {@link CryptographyClientBuilder} object. + * @throws NullPointerException If {@code client} is {@code null}. + */ + public CryptographyClientBuilder httpClient(HttpClient client) { + Objects.requireNonNull(client); + this.httpClient = client; + return this; + } + + /** + * Sets the HTTP pipeline to use for the service client. + * + * If {@code pipeline} is set, all other settings are ignored, aside from + * ({@link 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. + */ + public CryptographyClientBuilder 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 CryptographyClientBuilder object. + */ + public CryptographyClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyService.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyService.java new file mode 100644 index 000000000000..36251be31ab5 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyService.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.rest.Response; +import com.azure.core.implementation.annotation.BodyParam; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.Post; +import com.azure.core.implementation.annotation.PathParam; +import com.azure.core.implementation.annotation.QueryParam; +import com.azure.core.implementation.annotation.ServiceInterface; +import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; +import com.azure.core.util.Context; +import com.azure.security.keyvault.keys.models.Key; +import reactor.core.publisher.Mono; + +/** + * The interface defining all the services for {@link CryptographyAsyncClient} to be used + * by the proxy service to perform REST calls. + * + * This is package-private so that these REST calls are transparent to the user. + */ +@Host("{url}") +@ServiceInterface(name = "KeyVault") +interface CryptographyService { + + @Post("keys/{key-name}/{key-version}/encrypt") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {400}, value = ResourceModifiedException.class) + @UnexpectedResponseExceptionType(code = {404}, value = ResourceNotFoundException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> encrypt(@HostParam("url") String url, + @PathParam("key-name") String keyName, + @PathParam("key-version") String keyVersion, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("body") KeyOperationParameters parameters, + @HeaderParam("Content-Type") String type, + Context context); + + + @Post("keys/{key-name}/{key-version}/decrypt") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {400}, value = ResourceModifiedException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> decrypt(@HostParam("url") String url, + @PathParam("key-name") String keyName, + @PathParam("key-version") String keyVersion, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("body") KeyOperationParameters parameters, + @HeaderParam("Content-Type") String type, + Context context); + + + + @Post("keys/{key-name}/{key-version}/sign") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {400}, value = ResourceModifiedException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> sign(@HostParam("url") String url, + @PathParam("key-name") String keyName, + @PathParam("key-version") String keyVersion, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("body") KeySignRequest parameters, + @HeaderParam("Content-Type") String type, + Context context); + + + @Post("keys/{key-name}/{key-version}/verify") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {400}, value = ResourceModifiedException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> verify(@HostParam("url") String url, + @PathParam("key-name") String keyName, + @PathParam("key-version") String keyVersion, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("body") KeyVerifyRequest parameters, + @HeaderParam("Content-Type") String type, + Context context); + + + + @Post("keys/{key-name}/{key-version}/wrapkey") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {400}, value = ResourceModifiedException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> wrapKey(@HostParam("url") String url, + @PathParam("key-name") String keyName, + @PathParam("key-version") String keyVersion, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("body") KeyWrapUnwrapRequest parameters, + @HeaderParam("Content-Type") String type, + Context context); + + + @Post("keys/{key-name}/{key-version}/unwrapkey") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {400}, value = ResourceModifiedException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> unwrapKey(@HostParam("url") String url, + @PathParam("key-name") String keyName, + @PathParam("key-version") String keyVersion, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @BodyParam("body") KeyWrapUnwrapRequest parameters, + @HeaderParam("Content-Type") String type, + Context context); + + + @Get("keys/{key-name}/{key-version}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(code = {404}, value = ResourceNotFoundException.class) + @UnexpectedResponseExceptionType(code = {403}, value = ResourceModifiedException.class) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getKey(@HostParam("url") String url, + @PathParam("key-name") String keyName, + @PathParam("key-version") String keyVersion, + @QueryParam("api-version") String apiVersion, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Content-Type") String type, + Context context); +} 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 new file mode 100644 index 000000000000..57da3971289a --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/CryptographyServiceClient.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.http.rest.Response; +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; +import com.azure.security.keyvault.keys.cryptography.models.KeyUnwrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignResult; +import com.azure.security.keyvault.keys.cryptography.models.VerifyResult; +import com.azure.security.keyvault.keys.models.Key; +import reactor.core.publisher.Mono; + +import java.net.MalformedURLException; +import java.net.URL; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Objects; + +class CryptographyServiceClient { + static final String API_VERSION = "7.0"; + static final String ACCEPT_LANGUAGE = "en-US"; + static final String CONTENT_TYPE_HEADER_VALUE = "application/json"; + + private final ClientLogger logger = new ClientLogger(CryptographyServiceClient.class); + private final CryptographyService service; + private String endpoint; + private String version; + private String keyName; + + /* + * Creates a CryptographyServiceClient that uses {@code service} to service requests + * + * @param service the service to use for cryptography operations. + */ + CryptographyServiceClient(CryptographyService service) { + this.service = service; + } + + CryptographyServiceClient(String keyId, CryptographyService service) { + Objects.requireNonNull(keyId); + unpackId(keyId); + this.service = service; + } + + Mono> getKey(Context context) { + if (version == null) { + version = ""; + } + return getKey(keyName, version, 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)); + } + + 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))); + } + + 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()))); + } + + 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))); + } + + 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()))); + } + + 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))); + } + + 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()))); + } + + + Mono signData(SignatureAlgorithm algorithm, byte[] data, Context context) { + try { + HashAlgorithm hashAlgorithm = SignatureHashResolver.DEFAULT.get(algorithm); + MessageDigest md = MessageDigest.getInstance(hashAlgorithm.toString()); + md.update(data); + byte[] digest = md.digest(); + return sign(algorithm, digest, context); + } catch (NoSuchAlgorithmException e) { + return Mono.error(e); + } + } + + + Mono verifyData(SignatureAlgorithm algorithm, byte[] data, byte[] signature, Context context) { + try { + HashAlgorithm hashAlgorithm = SignatureHashResolver.DEFAULT.get(algorithm); + MessageDigest md = MessageDigest.getInstance(hashAlgorithm.toString()); + md.update(data); + byte[] digest = md.digest(); + return verify(algorithm, digest, signature, context); + } catch (NoSuchAlgorithmException e) { + return Mono.error(e); + } + } + + private void unpackId(String keyId) { + if (keyId != null && keyId.length() > 0) { + try { + URL url = new URL(keyId); + String[] tokens = url.getPath().split("/"); + this.endpoint = url.getProtocol() + "://" + url.getHost(); + this.keyName = (tokens.length >= 3 ? tokens[2] : null); + this.version = (tokens.length >= 4 ? tokens[3] : null); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + } + } + + +} 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 new file mode 100644 index 000000000000..6ed03573e553 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/EcKeyCryptographyClient.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.util.Context; +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; +import com.azure.security.keyvault.keys.cryptography.models.KeyUnwrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignResult; +import com.azure.security.keyvault.keys.cryptography.models.VerifyResult; +import com.azure.security.keyvault.keys.models.webkey.JsonWebKey; +import reactor.core.publisher.Mono; + +import java.security.KeyPair; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; +import java.security.Security; +import java.security.MessageDigest; + +class EcKeyCryptographyClient extends LocalKeyCryptographyClient { + private KeyPair keyPair; + private CryptographyServiceClient serviceClient; + private Provider provider; + + /** + * Creates a EcKeyCryptographyClient that uses {@code service} to service requests + * + * @param serviceClient the client to use for service side cryptography operations. + */ + EcKeyCryptographyClient(CryptographyServiceClient serviceClient) { + super(serviceClient); + this.serviceClient = serviceClient; + } + + EcKeyCryptographyClient(JsonWebKey key, CryptographyServiceClient serviceClient) { + super(serviceClient); + this.provider = Security.getProvider("SunEC"); + this.keyPair = key.toEC(key.hasPrivateKey(), provider); + this.serviceClient = serviceClient; + } + + private KeyPair getKeyPair(JsonWebKey key) { + if (keyPair == null) { + keyPair = key.toEC(key.hasPrivateKey()); + } + return keyPair; + } + + @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"); + } + + @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"); + } + + @Override + Mono signAsync(SignatureAlgorithm algorithm, byte[] digest, Context context, JsonWebKey key) { + keyPair = getKeyPair(key); + + // Interpret the requested algorithm + Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); + + if (baseAlgorithm == null) { + if (serviceCryptoAvailable()) { + return serviceClient.sign(algorithm, digest, context); + } + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } else if (!(baseAlgorithm instanceof AsymmetricSignatureAlgorithm)) { + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } + + if (keyPair.getPrivate() == null) { + if (serviceCryptoAvailable()) { + return serviceClient.sign(algorithm, digest, context); + } + return Mono.error(new IllegalArgumentException("Private portion of the key not available to perform sign operation")); + } + + Ecdsa algo; + if (baseAlgorithm instanceof Ecdsa) { + algo = (Ecdsa) baseAlgorithm; + } else { + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } + + ISignatureTransform signer = algo.createSignatureTransform(keyPair, provider); + + try { + return Mono.just(new SignResult(signer.sign(digest), algorithm)); + } catch (Exception e) { + return Mono.error(e); + } + } + + @Override + Mono verifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, Context context, JsonWebKey key) { + + keyPair = getKeyPair(key); + + // Interpret the requested algorithm + Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); + + if (baseAlgorithm == null) { + if (serviceCryptoAvailable()) { + return serviceClient.verify(algorithm, digest, signature, context); + } + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } else if (!(baseAlgorithm instanceof AsymmetricSignatureAlgorithm)) { + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } + + if (keyPair.getPublic() == null) { + 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")); + } + + Ecdsa algo; + if (baseAlgorithm instanceof Ecdsa) { + algo = (Ecdsa) baseAlgorithm; + } else { + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } + + ISignatureTransform signer = algo.createSignatureTransform(keyPair, provider); + + try { + return Mono.just(new VerifyResult(signer.verify(digest, signature))); + } catch (Exception e) { + return Mono.error(e); + } + } + + @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"); + } + + @Override + Mono signDataAsync(SignatureAlgorithm algorithm, byte[] data, Context context, JsonWebKey key) { + try { + HashAlgorithm hashAlgorithm = SignatureHashResolver.DEFAULT.get(algorithm); + MessageDigest md = MessageDigest.getInstance(hashAlgorithm.toString()); + md.update(data); + byte[] digest = md.digest(); + return signAsync(algorithm, digest, context, key); + } catch (NoSuchAlgorithmException e) { + return Mono.error(e); + } + } + + @Override + 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()); + md.update(data); + byte[] digest = md.digest(); + + return verifyAsync(algorithm, digest, signature, context, key); + } catch (NoSuchAlgorithmException e) { + return Mono.error(e); + } + } + + private boolean serviceCryptoAvailable() { + return serviceClient != null; + } +} 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 new file mode 100644 index 000000000000..3b88ce11c0ee --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Ecdsa.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import java.security.GeneralSecurityException; +import java.security.KeyPair; +import java.security.Provider; +import java.security.Signature; + +abstract class Ecdsa extends AsymmetricSignatureAlgorithm { + + protected Ecdsa() { + super("NONEwithECDSA"); + } + + public ISignatureTransform createSignatureTransform(KeyPair key, Provider provider) { + return new EcdsaSignatureTransform(key, provider, this); + } + + public abstract int getDigestLength(); + public abstract int getCoordLength(); + + class EcdsaSignatureTransform implements ISignatureTransform { + private static final String ALGORITHM = "NONEwithECDSA"; + private final KeyPair keyPair; + private final Provider provider; + private final Ecdsa algorithm; + + EcdsaSignatureTransform(KeyPair keyPair, Provider provider, Ecdsa algorithm) { + this.keyPair = keyPair; + this.provider = provider; + this.algorithm = algorithm; + } + + @Override + public byte[] sign(byte[] digest) throws GeneralSecurityException { + checkDigestLength(digest); + Signature signature = Signature.getInstance(ALGORITHM, provider); + signature.initSign(keyPair.getPrivate()); + signature.update(digest); + return SignatureEncoding.fromAsn1Der(signature.sign(), algorithm); + } + + @Override + public boolean verify(byte[] digest, byte[] signature) throws GeneralSecurityException { + Signature verify = Signature.getInstance(ALGORITHM, provider); + checkDigestLength(digest); + signature = SignatureEncoding.toAsn1Der(signature, algorithm); + verify.initVerify(keyPair.getPublic()); + verify.update(digest); + return verify.verify(signature); + } + + private void checkDigestLength(byte[] digest) { + if (digest.length != getDigestLength()) { + throw new IllegalArgumentException("Invalid digest length."); + } + } + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Es256.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Es256.java new file mode 100644 index 000000000000..32a7f2009f3e --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Es256.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class Es256 extends Ecdsa { + public static final String ALGORITHM_NAME = "ES256"; + + @Override + public int getDigestLength() { + return 32; + } + + @Override + public int getCoordLength() { + return 32; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Es256k.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Es256k.java new file mode 100644 index 000000000000..b6a74efbd56e --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Es256k.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class Es256k extends Ecdsa { + public static final String ALGORITHM_NAME = "ES256K"; + + @Override + public int getDigestLength() { + return 32; + } + + @Override + public int getCoordLength() { + return 32; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Es384.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Es384.java new file mode 100644 index 000000000000..0f312d6ee253 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Es384.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class Es384 extends Ecdsa { + public static final String ALGORITHM_NAME = "ES384"; + + @Override + public int getDigestLength() { + return 48; + } + + @Override + public int getCoordLength() { + return 48; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Es512.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Es512.java new file mode 100644 index 000000000000..84aa845e3d90 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Es512.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class Es512 extends Ecdsa { + public static final String ALGORITHM_NAME = "ES512"; + + @Override + public int getDigestLength() { + return 64; + } + + @Override + public int getCoordLength() { + return 66; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/HashAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/HashAlgorithm.java new file mode 100644 index 000000000000..d47c3595da47 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/HashAlgorithm.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +enum HashAlgorithm { + + SHA_256("SHA-256"), + SHA_384("SHA-384"), + SHA_512("SHA-512"); + + private String value; + + /** + * Creates a custom value for EncryptionAlgorithm. + * + * @param value the custom value + */ + HashAlgorithm(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + + public int hash() { + return value.hashCode(); + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/IAuthenticatedCryptoTransform.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/IAuthenticatedCryptoTransform.java new file mode 100644 index 000000000000..48644fc8598c --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/IAuthenticatedCryptoTransform.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +interface IAuthenticatedCryptoTransform extends ICryptoTransform { + + byte[] getTag(); +} 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 new file mode 100644 index 000000000000..ae37b8924669 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/ICryptoTransform.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +/** + * Defines the basic operations of cryptographic transformations. + * + */ +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; +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/ISignatureTransform.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/ISignatureTransform.java new file mode 100644 index 000000000000..7b7899735381 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/ISignatureTransform.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import java.security.GeneralSecurityException; + +interface ISignatureTransform { + + byte[] sign(byte[] digest) throws GeneralSecurityException; + + boolean verify(byte[] digest, byte[] signature) throws GeneralSecurityException; +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyEncryptionAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyEncryptionAlgorithm.java new file mode 100644 index 000000000000..bf4596114bc9 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyEncryptionAlgorithm.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +/** + * Abstract base class for all encryption implementation. + * + */ +abstract class KeyEncryptionAlgorithm extends Algorithm { + + /** + * Constructor. + * @param name The name of the algorithm. + */ + protected KeyEncryptionAlgorithm(String name) { + super(name); + } + +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationParameters.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationParameters.java new file mode 100644 index 000000000000..c63b136214e5 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationParameters.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.implementation.Base64Url; +import com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The key operations parameters. + */ +class KeyOperationParameters { + /** + * algorithm identifier. Possible values include: 'RSA-OAEP', + * 'RSA-OAEP-256', 'RSA1_5'. + */ + @JsonProperty(value = "alg", required = true) + private EncryptionAlgorithm algorithm; + + /** + * The value property. + */ + @JsonProperty(value = "value", required = true) + private Base64Url value; + + /** + * Get the algorithm value. + * + * @return the algorithm value + */ + public EncryptionAlgorithm algorithm() { + return this.algorithm; + } + + /** + * Set the algorithm value. + * + * @param algorithm the algorithm value to set + * @return the KeyOperationsParameters object itself. + */ + public KeyOperationParameters algorithm(EncryptionAlgorithm algorithm) { + this.algorithm = algorithm; + return this; + } + + /** + * Get the value value. + * + * @return the value value + */ + public byte[] value() { + if (this.value == null) { + return new byte[0]; + } + return this.value.decodedBytes(); + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the KeyOperationsParameters object itself. + */ + public KeyOperationParameters value(byte[] value) { + if (value == null) { + this.value = null; + } else { + this.value = Base64Url.encode(value); + } + return this; + } + +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationResult.java new file mode 100644 index 000000000000..0a9d4081ee0e --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyOperationResult.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.implementation.Base64Url; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The key operation result. + */ +class KeyOperationResult { + /** + * Key identifier. + */ + @JsonProperty(value = "kid", access = JsonProperty.Access.WRITE_ONLY) + private String kid; + + /** + * The result property. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Base64Url result; + + /** + * Get the kid value. + * + * @return the kid value + */ + public String kid() { + return this.kid; + } + + /** + * Get the result value. + * + * @return the result value + */ + public byte[] result() { + if (this.result == null) { + return new byte[0]; + } + return this.result.decodedBytes(); + } + +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeySignRequest.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeySignRequest.java new file mode 100644 index 000000000000..6eddd008e9dd --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeySignRequest.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.implementation.Base64Url; +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The key verify parameters. + */ +class KeySignRequest { + /** + * The signing/verification algorithm. For more information on possible + * algorithm types, see SignatureAlgorithm. Possible values + * include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', + * 'ES256', 'ES384', 'ES512', 'ES256K'. + */ + @JsonProperty(value = "alg", required = true) + private SignatureAlgorithm algorithm; + + /** + * The value property. + */ + @JsonProperty(value = "value", required = true) + private Base64Url value; + + + /** + * Get the algorithm value. + * + * @return the algorithm value + */ + public SignatureAlgorithm algorithm() { + return this.algorithm; + } + + /** + * Set the algorithm value. + * + * @param algorithm the algorithm value to set + * @return the KeyVerifyParameters object itself. + */ + public KeySignRequest algorithm(SignatureAlgorithm algorithm) { + this.algorithm = algorithm; + return this; + } + + /** + * Get the value value. + * + * @return the value value + */ + public byte[] value() { + if (this.value == null) { + return new byte[0]; + } + return this.value.decodedBytes(); + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the KeySignParameters object itself. + */ + public KeySignRequest value(byte[] value) { + if (value == null) { + this.value = null; + } else { + this.value = Base64Url.encode(value); + } + return this; + } + +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyRequest.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyRequest.java new file mode 100644 index 000000000000..d095a0cad18d --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyRequest.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.implementation.Base64Url; +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The key verify parameters. + */ +class KeyVerifyRequest { + /** + * The signing/verification algorithm. For more information on possible + * algorithm types, see SignatureAlgorithm. Possible values + * include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', + * 'ES256', 'ES384', 'ES512', 'ES256K'. + */ + @JsonProperty(value = "alg", required = true) + private SignatureAlgorithm algorithm; + + /** + * The digest used for signing. + */ + @JsonProperty(value = "digest", required = true) + private Base64Url digest; + + /** + * The signature to be verified. + */ + @JsonProperty(value = "value", required = true) + private Base64Url signature; + + /** + * Get the algorithm value. + * + * @return the algorithm value + */ + public SignatureAlgorithm algorithm() { + return this.algorithm; + } + + /** + * Set the algorithm value. + * + * @param algorithm the algorithm value to set + * @return the KeyVerifyParameters object itself. + */ + public KeyVerifyRequest algorithm(SignatureAlgorithm algorithm) { + this.algorithm = algorithm; + return this; + } + + /** + * Get the digest value. + * + * @return the digest value + */ + public byte[] digest() { + if (this.digest == null) { + return new byte[0]; + } + return this.digest.decodedBytes(); + } + + /** + * Set the digest value. + * + * @param digest the digest value to set + * @return the KeyVerifyParameters object itself. + */ + public KeyVerifyRequest digest(byte[] digest) { + if (digest == null) { + this.digest = null; + } else { + this.digest = Base64Url.encode(digest); + } + return this; + } + + /** + * Get the signature value. + * + * @return the signature value + */ + public byte[] signature() { + if (this.signature == null) { + return new byte[0]; + } + return this.signature.decodedBytes(); + } + + /** + * Set the signature value. + * + * @param signature the signature value to set + * @return the KeyVerifyParameters object itself. + */ + public KeyVerifyRequest signature(byte[] signature) { + if (signature == null) { + this.signature = null; + } else { + this.signature = Base64Url.encode(signature); + } + return this; + } + +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyResponse.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyResponse.java new file mode 100644 index 000000000000..551d6e691a45 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyVerifyResponse.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.fasterxml.jackson.annotation.JsonProperty; + +class KeyVerifyResponse { + + /** + * True if the signature is verified, otherwise false. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private Boolean value; + + /** + * Get the value value. + * + * @return the value value + */ + public Boolean value() { + return this.value; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapRequest.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapRequest.java new file mode 100644 index 000000000000..317a61962edd --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapRequest.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.implementation.Base64Url; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The key operations parameters. + */ +class KeyWrapUnwrapRequest { + /** + * algorithm identifier. Possible values include: 'RSA-OAEP', + * 'RSA-OAEP-256', 'RSA1_5'. + */ + @JsonProperty(value = "alg", required = true) + private KeyWrapAlgorithm algorithm; + + /** + * The value property. + */ + @JsonProperty(value = "value", required = true) + private Base64Url value; + + /** + * Get the algorithm value. + * + * @return the algorithm value + */ + public KeyWrapAlgorithm algorithm() { + return this.algorithm; + } + + /** + * Set the algorithm value. + * + * @param algorithm the algorithm value to set + * @return the KeyOperationsParameters object itself. + */ + public KeyWrapUnwrapRequest algorithm(KeyWrapAlgorithm algorithm) { + this.algorithm = algorithm; + return this; + } + + /** + * Get the value value. + * + * @return the value value + */ + public byte[] value() { + if (this.value == null) { + return new byte[0]; + } + return this.value.decodedBytes(); + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the KeyOperationsParameters object itself. + */ + public KeyWrapUnwrapRequest value(byte[] value) { + if (value == null) { + this.value = null; + } else { + this.value = Base64Url.encode(value); + } + return this; + } + +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalEncryptionAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalEncryptionAlgorithm.java new file mode 100644 index 000000000000..78e42a4bd7e3 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalEncryptionAlgorithm.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +/* + * Abstract base class for all encryption implementation. + * + */ +abstract class LocalEncryptionAlgorithm extends Algorithm { + + protected LocalEncryptionAlgorithm(String name) { + super(name); + } + +} 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 new file mode 100644 index 000000000000..84fb76d2f65d --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalKeyCryptographyClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.util.Context; +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; +import com.azure.security.keyvault.keys.cryptography.models.KeyUnwrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignResult; +import com.azure.security.keyvault.keys.cryptography.models.VerifyResult; +import com.azure.security.keyvault.keys.models.webkey.JsonWebKey; +import reactor.core.publisher.Mono; + +abstract class LocalKeyCryptographyClient { + CryptographyServiceClient serviceClient; + + LocalKeyCryptographyClient(CryptographyServiceClient serviceClient) { + this.serviceClient = serviceClient; + } + + LocalKeyCryptographyClient(JsonWebKey key, CryptographyServiceClient serviceClient) { + this.serviceClient = serviceClient; + } + + 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 signAsync(SignatureAlgorithm algorithm, byte[] digest, 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 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); + +} 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 new file mode 100644 index 000000000000..fa7aa7826fd9 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalKeyWrapAlgorithm.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import javax.crypto.NoSuchPaddingException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; + +/** + * Abstract base class for all key wrap implementation. + * + */ +abstract class LocalKeyWrapAlgorithm extends Algorithm { + + /* + * Constructor. + * + * @param name The name of the algorithm. + */ + LocalKeyWrapAlgorithm(String name) { + super(name); + } + + /* + * Creates a {@link ICryptoTransform} implementation for encryption. + * Uses the default AES-KW initialization vector. + * @param key + * The AES key material to be used. + * @return A {@link ICryptoTransform} implementation + */ + abstract ICryptoTransform createEncryptor(byte[] key) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + + /* + * Creates a {@link ICryptoTransform} implementation for encryption that + * uses the specified provider for the Java Security API. Uses the default AES-KW initialization vector. + * + * @param key + * The AES key material to be used. + * @param provider + * The provider to use. + * @return A {@link ICryptoTransform} implementation + */ + abstract ICryptoTransform createEncryptor(byte[] key, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + + /* + * Creates a {@link ICryptoTransform} implementation for encryption + * using the supplied initialization vector. + * @param key + * The AES key material to be used. + * @param iv + * The initialization vector to be used. + * @return A {@link ICryptoTransform} implementation + */ + abstract ICryptoTransform createEncryptor(byte[] key, byte[] iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + + /* + * Creates a {@link ICryptoTransform} implementation for encryption + * using the supplied initialization vector and the specific provider for the Java Security API. + * @param key + * The AES key material to be used. + * @param iv + * The initialization vector to be used. + * @param provider + * The provider to use. + * @return A {@link ICryptoTransform} implementation + */ + abstract ICryptoTransform createEncryptor(byte[] key, byte[] iv, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + + /* + * Creates a {@link ICryptoTransform} implementation for decryption. + * Uses the default AES-KW initialization vector. + * @param key + * The AES key material to be used. + * @return A {@link ICryptoTransform} implementation + */ + abstract ICryptoTransform createDecryptor(byte[] key) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + + /* + * Creates a {@link ICryptoTransform} implementation for decryption that + * uses the specified provider for the Java Security API. Uses the default AES-KW initialization vector. + * + * @param key + * The AES key material to be used. + * @param provider + * The provider to use. + * @return A {@link ICryptoTransform} implementation + */ + abstract ICryptoTransform createDecryptor(byte[] key, Provider provider) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + + /* + * Creates a {@link ICryptoTransform} implementation for decryption + * using the supplied initialization vector. + * @param key + * The AES key material to be used. + * @param iv + * The initialization vector to be used. + * @return A {@link ICryptoTransform} implementation + */ + abstract ICryptoTransform createDecryptor(byte[] key, byte[] iv) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException; + + /* + * Creates a {@link ICryptoTransform} implementation for decryption + * using the supplied initialization vector and the specific provider for the Java Security API. + * @param key + * The AES key material to be used. + * @param iv + * The initialization vector to be used. + * @param provider + * The provider to use. + * @return A {@link ICryptoTransform} implementation + */ + 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/LocalSignatureAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalSignatureAlgorithm.java new file mode 100644 index 000000000000..18735c946c81 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/LocalSignatureAlgorithm.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +abstract class LocalSignatureAlgorithm extends Algorithm { + + protected LocalSignatureAlgorithm(String name) { + super(name); + } + +} 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 new file mode 100644 index 000000000000..318265ab4aef --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Rsa15.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import java.security.InvalidKeyException; +import java.security.KeyPair; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; + +class Rsa15 extends RsaEncryption { + + static class Rsa15Decryptor implements ICryptoTransform { + + private final Cipher cipher; + + Rsa15Decryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + + // Create a cipher object using the provider, if specified + if (provider == null) { + cipher = Cipher.getInstance(RSA15); + } else { + cipher = Cipher.getInstance(RSA15, provider); + } + + // encrypt the plain text using the public key + cipher.init(Cipher.DECRYPT_MODE, keyPair.getPrivate()); + } + + @Override + public byte[] doFinal(byte[] plaintext) throws IllegalBlockSizeException, BadPaddingException { + + return cipher.doFinal(plaintext); + } + + } + + static class Rsa15Encryptor implements ICryptoTransform { + + private final Cipher cipher; + + Rsa15Encryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + + // Create a cipher object using the provider, if specified + if (provider == null) { + cipher = Cipher.getInstance(RSA15); + } else { + cipher = Cipher.getInstance(RSA15, provider); + } + + // encrypt the plain text using the public key + cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPublic()); + } + + @Override + public byte[] doFinal(byte[] plaintext) throws IllegalBlockSizeException, BadPaddingException { + + return cipher.doFinal(plaintext); + } + + } + + static final String RSA15 = "RSA/ECB/PKCS1Padding"; + + public static final String ALGORITHM_NAME = "RSA1_5"; + + Rsa15() { + super(ALGORITHM_NAME); + } + + @Override + 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 { + return new Rsa15Encryptor(keyPair, provider); + } + + @Override + 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 { + return new Rsa15Decryptor(keyPair, provider); + } + +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/RsaEncryption.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/RsaEncryption.java new file mode 100644 index 000000000000..3a1a4dc4f601 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/RsaEncryption.java @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +abstract class RsaEncryption extends AsymmetricEncryptionAlgorithm { + + protected RsaEncryption(String name) { + super(name); + } + +} 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 new file mode 100644 index 000000000000..d93614614772 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/RsaKeyCryptographyClient.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.util.Context; +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; +import com.azure.security.keyvault.keys.cryptography.models.KeyUnwrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignResult; +import com.azure.security.keyvault.keys.cryptography.models.VerifyResult; +import com.azure.security.keyvault.keys.models.webkey.JsonWebKey; +import reactor.core.publisher.Mono; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import java.security.InvalidKeyException; +import java.security.KeyPair; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +class RsaKeyCryptographyClient extends LocalKeyCryptographyClient { + private KeyPair keyPair; + + /* + * Creates a RsaKeyCryptographyClient that uses {@code serviceClient) to service requests + * + * @param keyPair the key pair to use for cryptography operations. + */ + RsaKeyCryptographyClient(CryptographyServiceClient serviceClient) { + super(serviceClient); + } + + RsaKeyCryptographyClient(JsonWebKey key, CryptographyServiceClient serviceClient) { + super(serviceClient); + keyPair = key.toRSA(key.hasPrivateKey()); + } + + private KeyPair getKeyPair(JsonWebKey key) { + if (keyPair == null) { + keyPair = key.toRSA(key.hasPrivateKey()); + } + return keyPair; + } + + @Override + 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")); + } + + // Interpret the requested algorithm + Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); + + if (baseAlgorithm == null) { + if (serviceCryptoAvailable()) { + return serviceClient.encrypt(algorithm, plaintext, context); + } + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } else if (!(baseAlgorithm instanceof AsymmetricEncryptionAlgorithm)) { + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } + + if (keyPair.getPublic() == null) { + if (serviceCryptoAvailable()) { + return serviceClient.encrypt(algorithm, plaintext, context); + } + return Mono.error(new IllegalArgumentException("Public portion of the key not available to perform encrypt operation")); + } + + AsymmetricEncryptionAlgorithm algo = (AsymmetricEncryptionAlgorithm) baseAlgorithm; + + ICryptoTransform transform; + + try { + transform = algo.createEncryptor(keyPair); + return Mono.just(new EncryptResult(transform.doFinal(plaintext), (byte[]) null, algorithm)); + } 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) { + + if (iv != null || authenticationData != null || authenticationTag != null) { + return Mono.error(new IllegalArgumentException("iv, authenticationData and authenticationTag parameters are not supported for Rsa decrypt operation")); + } + + keyPair = getKeyPair(jsonWebKey); + + Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); + + if (baseAlgorithm == null) { + if (serviceCryptoAvailable()) { + return serviceClient.decrypt(algorithm, cipherText, context); + } + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } else if (!(baseAlgorithm instanceof AsymmetricEncryptionAlgorithm)) { + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } + + if (keyPair.getPrivate() == null) { + if (serviceCryptoAvailable()) { + return serviceClient.decrypt(algorithm, cipherText, context); + } + return Mono.error(new IllegalArgumentException("Private portion of the key not available to perform decrypt operation")); + } + + AsymmetricEncryptionAlgorithm algo = (AsymmetricEncryptionAlgorithm) baseAlgorithm; + + ICryptoTransform transform; + + try { + transform = algo.createDecryptor(keyPair); + return Mono.just(new DecryptResult(transform.doFinal(cipherText))); + } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) { + return Mono.error(e); + } + } + + @Override + Mono signAsync(SignatureAlgorithm algorithm, byte[] digest, Context context, JsonWebKey key) { + + return serviceClient.sign(algorithm, digest, context); + } + + @Override + 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. + } + + @Override + Mono wrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] key, Context context, JsonWebKey jsonWebKey) { + + keyPair = getKeyPair(jsonWebKey); + + Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); + + if (baseAlgorithm == null) { + if (serviceCryptoAvailable()) { + return serviceClient.wrapKey(algorithm, key, context); + } + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } else if (!(baseAlgorithm instanceof AsymmetricEncryptionAlgorithm)) { + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } + + if (keyPair.getPublic() == null) { + 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")); + } + + AsymmetricEncryptionAlgorithm algo = (AsymmetricEncryptionAlgorithm) baseAlgorithm; + + ICryptoTransform transform; + + try { + transform = algo.createEncryptor(keyPair); + return Mono.just(new KeyWrapResult(transform.doFinal(key), algorithm)); + } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) { + return Mono.error(e); + } + } + + @Override + Mono unwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context, JsonWebKey jsonWebKey) { + + keyPair = getKeyPair(jsonWebKey); + + // Interpret the requested algorithm + Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); + + if (baseAlgorithm == null) { + if (serviceCryptoAvailable()) { + return serviceClient.unwrapKey(algorithm, encryptedKey, context); + } + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } else if (!(baseAlgorithm instanceof AsymmetricEncryptionAlgorithm)) { + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } + + if (keyPair.getPrivate() == null) { + if (serviceCryptoAvailable()) { + return serviceClient.unwrapKey(algorithm, encryptedKey, context); + } + return Mono.error(new IllegalArgumentException("Private portion of the key not available to perform unwrap operation")); + } + + AsymmetricEncryptionAlgorithm algo = (AsymmetricEncryptionAlgorithm) baseAlgorithm; + + ICryptoTransform transform; + + try { + transform = algo.createDecryptor(keyPair); + return Mono.just(new KeyUnwrapResult(transform.doFinal(encryptedKey))); + } catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | IllegalBlockSizeException | BadPaddingException e) { + return Mono.error(e); + } + } + + @Override + Mono signDataAsync(SignatureAlgorithm algorithm, byte[] data, Context context, JsonWebKey key) { + try { + HashAlgorithm hashAlgorithm = SignatureHashResolver.DEFAULT.get(algorithm); + MessageDigest md = MessageDigest.getInstance(hashAlgorithm.toString()); + md.update(data); + byte[] digest = md.digest(); + return signAsync(algorithm, digest, context, key); + } catch (NoSuchAlgorithmException e) { + return Mono.error(e); + } + } + + @Override + 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()); + md.update(data); + byte[] digest = md.digest(); + return verifyAsync(algorithm, digest, signature, context, key); + } catch (NoSuchAlgorithmException e) { + return Mono.error(e); + } + } + + private boolean serviceCryptoAvailable() { + return serviceClient != null; + } + +} 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 new file mode 100644 index 000000000000..396d63b49c02 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/RsaOaep.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import java.security.InvalidKeyException; +import java.security.KeyPair; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; + +class RsaOaep extends RsaEncryption { + + static class RsaOaepDecryptor implements ICryptoTransform { + + private final Cipher cipher; + + RsaOaepDecryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + + // Create a cipher object using the provider, if specified + if (provider == null) { + cipher = Cipher.getInstance(RSAOAEP); + } else { + cipher = Cipher.getInstance(RSAOAEP, provider); + } + + // encrypt the plain text using the public key + cipher.init(Cipher.DECRYPT_MODE, keyPair.getPrivate()); + } + + @Override + public byte[] doFinal(byte[] plaintext) throws IllegalBlockSizeException, BadPaddingException { + + return cipher.doFinal(plaintext); + } + + } + + static class RsaOaepEncryptor implements ICryptoTransform { + + private final Cipher cipher; + + RsaOaepEncryptor(KeyPair keyPair, Provider provider) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException { + + // Create a cipher object using the provider, if specified + if (provider == null) { + cipher = Cipher.getInstance(RSAOAEP); + } else { + cipher = Cipher.getInstance(RSAOAEP, provider); + } + + // encrypt the plain text using the public key + cipher.init(Cipher.ENCRYPT_MODE, keyPair.getPublic()); + } + + @Override + public byte[] doFinal(byte[] plaintext) throws IllegalBlockSizeException, BadPaddingException { + + return cipher.doFinal(plaintext); + } + + } + + static final String RSAOAEP = "RSA/ECB/OAEPWithSHA1AndMGF1Padding"; + + public static final String ALGORITHM_NAME = "RSA-OAEP"; + + RsaOaep() { + super(ALGORITHM_NAME); + } + + @Override + 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 { + + return new RsaOaepEncryptor(keyPair, provider); + } + + @Override + 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 { + + 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 new file mode 100644 index 000000000000..732e19f0f925 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SignatureEncoding.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import org.apache.commons.codec.binary.Hex; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.math.BigInteger; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; + +final class SignatureEncoding { + // SignatureEncoding is intended to be a static class + private SignatureEncoding() { } + + /* + * Converts an ASN.1 DER encoded ECDSA signature to a raw signature in the form R|S + * @param asn1DerSignature An ASN.1 DER encoded signature + * @param algorithm The algorithm used to produce the given ASN.1 DER encoded signature + * @return The raw format of the given ASN.1 DER encoded signature in the form R|S + */ + static byte[] fromAsn1Der(byte[] asn1DerSignature, String algorithm) throws NoSuchAlgorithmException { + Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm); + + // verify the given algoritm could be resolved + if (baseAlgorithm == null) { + throw new NoSuchAlgorithmException(algorithm); + } + + // verify the given algoritm is an Ecdsa signature algorithm + if (!(baseAlgorithm instanceof Ecdsa)) { + throw new IllegalArgumentException("Invalid algorithm; must be an instance of ECDSA."); + } + + return SignatureEncoding.fromAsn1Der(asn1DerSignature, (Ecdsa) baseAlgorithm); + } + + /* + * Converts an ASN.1 DER encoded ECDSA signature to a raw signature in the form R|S + * @param asn1DerSignature An ASN.1 DER encoded signature + * @param algorithm The algorithm used to produce the given ASN.1 DER encoded signature + * @return The raw format of the given ASN.1 DER encoded signature in the form R|S + */ + static byte[] fromAsn1Der(byte[] asn1DerSignature, Ecdsa algorithm) { + + try { + return Asn1DerSignatureEncoding.decode(asn1DerSignature, algorithm); + } catch (IllegalArgumentException ex) { + throw (IllegalArgumentException) new IllegalArgumentException( + 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. + */ + static byte[] toAsn1Der(byte[] signature, String algorithm) throws NoSuchAlgorithmException { + Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm); + + // verify the given algoritm could be resolved + if (baseAlgorithm == null) { + throw new NoSuchAlgorithmException(algorithm); + } + + // verify the given algoritm is an Ecdsa signature algorithm + if (!(baseAlgorithm instanceof Ecdsa)) { + throw new IllegalArgumentException("Invalid algorithm; must be an instance of ECDSA."); + } + + return SignatureEncoding.toAsn1Der(signature, (Ecdsa) baseAlgorithm); + } + + /* + * 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); + } + } +} + + +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) + // * 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. + + private Asn1DerSignatureEncoding() { + + } + + static byte[] encode(byte[] signature, Ecdsa algorithm) { + int coordLength = algorithm.getCoordLength(); + + // verify that the signature is the correct length for the given algorithm + if (signature.length != (coordLength * 2)) { + throw new IllegalArgumentException("Invalid signature."); + } + + // r is the first half of the signature + BigInteger r = new BigInteger(1, Arrays.copyOfRange(signature, 0, signature.length / 2)); + + // s is the second half of the signature + BigInteger s = new BigInteger(1, Arrays.copyOfRange(signature, signature.length / 2, signature.length)); + + // vr and vs are the compacted ASN.1 integer encoding, same as BigInteger encoding + byte[] rfield = encodeIntField(r); + + byte[] sfield = encodeIntField(s); + + ByteArrayOutputStream asn1DerSignature = new ByteArrayOutputStream(); + + asn1DerSignature.write(0x30); + + // add the length of the fields + writeFieldLength(asn1DerSignature, rfield.length + sfield.length); + + // write the fields + asn1DerSignature.write(rfield, 0, rfield.length); + + asn1DerSignature.write(sfield, 0, sfield.length); + + return asn1DerSignature.toByteArray(); + } + + static byte[] decode(byte[] bytes, Ecdsa algorithm) { + int coordLength = algorithm.getCoordLength(); + + ByteArrayInputStream asn1DerSignature = new ByteArrayInputStream(bytes); + + // verify byte 0 is 0x30 + if (asn1DerSignature.read() != 0x30) { + throw new IllegalArgumentException("Invalid signature."); + } + + int objLen = readFieldLength(asn1DerSignature); + + // verify the object lenth is equal to the remaining length of the + // _asn1DerSignature + if (objLen != asn1DerSignature.available()) { + throw new IllegalArgumentException(String.format("Invalid signature; invalid field len %d", objLen)); + } + + byte[] rawSignature = new byte[coordLength * 2]; + + // decode the r feild to the first half of _rawSignature + decodeIntField(asn1DerSignature, rawSignature, 0, coordLength); + + // decode the s feild to the second half of _rawSignature + decodeIntField(asn1DerSignature, rawSignature, rawSignature.length / 2, coordLength); + + return rawSignature; + } + + static byte[] encodeIntField(BigInteger i) { + ByteArrayOutputStream field = new ByteArrayOutputStream(); + + field.write(0x02); + + // get this byte array for the asn1 encoded integer + byte[] vi = i.toByteArray(); + + // write the length of the field + writeFieldLength(field, vi.length); + + // write the field value + field.write(vi, 0, vi.length); + + return field.toByteArray(); + } + + static void writeFieldLength(ByteArrayOutputStream field, int len) { + // if the length of vi is less then 0x80 we can fit the length in one byte + if (len < 0x80) { + field.write(len); + } else { + // get the len as a byte array + byte[] blen = BigInteger.valueOf(len).toByteArray(); + + int lenlen = blen.length; + + // the byte array might have a leading zero byte if so we need to discard this + if (blen[0] == 0) { + lenlen--; + } + + // write the continuation byte containing the length length in bytes + field.write(0x80 | lenlen); + + // write the field lenth bytes + field.write(blen, blen.length - lenlen, lenlen); + } + } + + static void decodeIntField(ByteArrayInputStream bytes, byte[] dest, int index, int intlen) { + // verify the first byte of field is 0x02 + if (bytes.read() != 0x02) { + throw new IllegalArgumentException("Invalid signature."); + } + + //get the length of the field + int len = readFieldLength(bytes); + + // if the most significant bit of the raw int was set an extra zero byte will be prepended to + // the asn1der encoded value so len can have a max value of intlen + 1 + + // validate that that len is within the max range and doesn't run past the end of bytes + if (len > intlen + 1 || len > bytes.available()) { + throw new IllegalArgumentException("Invalid signature."); + } + + // if len is greater than intlen increment _bytesRead and decrement len + if (len > intlen) { + bytes.skip(1); + len--; + } + + bytes.read(dest, index + (intlen - len), len); + } + + static int readFieldLength(ByteArrayInputStream bytes) { + int firstLenByte = bytes.read(); + + // if the high order bit of len is not set it is a single byte length so return + if ((firstLenByte & 0x80) == 0x00) { + return firstLenByte; + } + + // otherwise mask off the high order bit to get the number of bytes to read + int numLenBytes = firstLenByte ^ 0x80; + + // if the number of len bytes is greater than the remaining signature the signature is invalid + if (numLenBytes > bytes.available()) { + throw new IllegalArgumentException("Invalid signature."); + } + + byte[] lenBytes = new byte[numLenBytes]; + + bytes.read(lenBytes, 0, numLenBytes); + + BigInteger bigLen = new BigInteger(1, lenBytes); + + // for DSA signatures no feilds should be longer than can be expressed in an integer + // this means that the bitLength must be 31 or less to account for the leading zero of + // a positive integer + if (bigLen.bitLength() >= 31) { + throw new IllegalArgumentException("Invalid signature."); + } + + return bigLen.intValue(); + } +} + diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SignatureHashResolver.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SignatureHashResolver.java new file mode 100644 index 000000000000..75ab30cfc01c --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SignatureHashResolver.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +class SignatureHashResolver { + + public static final SignatureHashResolver DEFAULT = new SignatureHashResolver(); + + static { + DEFAULT.put(SignatureAlgorithm.ES256, HashAlgorithm.SHA_256); + DEFAULT.put(SignatureAlgorithm.ES256K, HashAlgorithm.SHA_256); + DEFAULT.put(SignatureAlgorithm.ES384, HashAlgorithm.SHA_384); + + DEFAULT.put(SignatureAlgorithm.ES512, HashAlgorithm.SHA_512); + DEFAULT.put(SignatureAlgorithm.RS256, HashAlgorithm.SHA_256); + DEFAULT.put(SignatureAlgorithm.RS384, HashAlgorithm.SHA_384); + DEFAULT.put(SignatureAlgorithm.RS512, HashAlgorithm.SHA_512); + DEFAULT.put(SignatureAlgorithm.PS256, HashAlgorithm.SHA_256); + DEFAULT.put(SignatureAlgorithm.PS512, HashAlgorithm.SHA_512); + DEFAULT.put(SignatureAlgorithm.PS384, HashAlgorithm.SHA_384); + } + + private final ConcurrentMap algorithms = new ConcurrentHashMap<>(); + + /** + * Returns the hash algorithm used for signature algorithm. + * + * @param signatureAlgorithm The signature algorithm. + * @return The hash algorithm or null. + */ + public HashAlgorithm get(SignatureAlgorithm signatureAlgorithm) { + return algorithms.get(signatureAlgorithm); + } + + /** + * Add/Update a named algorithm implementation. + * + * @param algorithm The signature algorithm. + * @param hashAlgorithm The hash algorithm. + */ + public void put(SignatureAlgorithm algorithm, HashAlgorithm hashAlgorithm) { + algorithms.put(algorithm, hashAlgorithm); + } + + /** + * Remove a named algorithm implementation. + * + * @param algorithm The algorithm to be removed + */ + public void remove(SignatureAlgorithm algorithm) { + algorithms.remove(algorithm); + } + +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Strings.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Strings.java new file mode 100644 index 000000000000..b7528ce14552 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Strings.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class Strings { + + /** + * Determines whether the parameter string is either null or empty. + * + * @param arg The string to be checked. + * @return true if the string is null or empty. + */ + public static boolean isNullOrEmpty(String arg) { + + if (arg == null || arg.length() == 0) { + return true; + } + + return false; + } + + /** + * Determines whether the parameter string is null, empty or whitespace. + * + * @param arg The string to be checked. + * @return true if the string is null, empty or whitespace. + */ + public static boolean isNullOrWhiteSpace(String arg) { + + if (Strings.isNullOrEmpty(arg) || arg.trim().isEmpty()) { + return true; + } + + return false; + } +} 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 new file mode 100644 index 000000000000..8ba05b92e23e --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricEncryptionAlgorithm.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import javax.crypto.NoSuchPaddingException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; +import java.security.Provider; + +/** + * Abstract base class for all symmetric encryption implementation. + * + */ +abstract class SymmetricEncryptionAlgorithm extends LocalEncryptionAlgorithm { + + /* + * Constructor. + * + * @param name The name of the algorithm. + */ + SymmetricEncryptionAlgorithm(String name) { + super(name); + } + + /* + * Creates a {@link ICryptoTransform} implementation for encryption + * using the supplied initialization vector and the specific provider for the Java Security API. + * @param key + * The key material to be used. + * @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) + * @return A {@link ICryptoTransform} implementation + */ + abstract ICryptoTransform createEncryptor(byte[] key, byte[] iv, byte[] authenticationData) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidAlgorithmParameterException; + + /* + * Creates a {@link ICryptoTransform} implementation for encryption + * using the supplied initialization vector and the specific provider for the Java Security API. + * @param key + * The key material to be used. + * @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) + * @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; + + /* + * Creates a {@link ICryptoTransform} implementation for decryption + * using the supplied initialization vector and the specific provider for the Java Security API. + * @param key + * The key material to be used. + * @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) + * @param authenticationTag + * 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; + + /* + * Creates a {@link ICryptoTransform} implementation for decryption + * using the supplied initialization vector and the specific provider for the Java Security API. + * @param key + * The key material to be used. + * @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) + * @param authenticationTag + * 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; + +} 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 new file mode 100644 index 000000000000..1597cced6e73 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/SymmetricKeyCryptographyClient.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.util.Context; +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; +import com.azure.security.keyvault.keys.cryptography.models.KeyUnwrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignResult; +import com.azure.security.keyvault.keys.cryptography.models.VerifyResult; +import com.azure.security.keyvault.keys.models.webkey.JsonWebKey; +import reactor.core.publisher.Mono; + +import java.security.NoSuchAlgorithmException; + +class SymmetricKeyCryptographyClient extends LocalKeyCryptographyClient { + private byte[] key; + + /* + * Creates a RsaKeyCryptographyClient that uses {@code serviceClient) to service requests + * + * @param key the key pair to use for cryptography operations. + */ + SymmetricKeyCryptographyClient(CryptographyServiceClient serviceClient) { + super(serviceClient); + } + + SymmetricKeyCryptographyClient(JsonWebKey key, CryptographyServiceClient serviceClient) { + super(serviceClient); + this.key = key.toAes().getEncoded(); + } + + private byte[] getKey(JsonWebKey key) { + if (this.key == null) { + this.key = key.toAes().getEncoded(); + } + return this.key; + } + + @Override + Mono encryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext, byte[] iv, byte[] authenticationData, Context context, JsonWebKey jsonWebKey) { + key = getKey(jsonWebKey); + + Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); + + if (baseAlgorithm == null || !(baseAlgorithm instanceof SymmetricEncryptionAlgorithm)) { + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } + + SymmetricEncryptionAlgorithm algo = (SymmetricEncryptionAlgorithm) baseAlgorithm; + + ICryptoTransform transform; + + try { + transform = algo.createEncryptor(key, iv, authenticationData); + } catch (Exception e) { + return Mono.error(e); + } + + byte[] cipherText; + + try { + cipherText = transform.doFinal(plaintext); + } catch (Exception e) { + return Mono.error(e); + } + + byte[] authenticationTag = null; + + if (transform instanceof IAuthenticatedCryptoTransform) { + + IAuthenticatedCryptoTransform authenticatedTransform = (IAuthenticatedCryptoTransform) transform; + + authenticationTag = authenticatedTransform.getTag().clone(); + } + + return Mono.just(new EncryptResult(cipherText, authenticationTag, algorithm)); + } + + @Override + Mono decryptAsync(EncryptionAlgorithm algorithm, byte[] cipherText, byte[] iv, byte[] authenticationData, byte[] authenticationTag, Context context, JsonWebKey jsonWebKey) { + + key = getKey(jsonWebKey); + + // Interpret the algorithm + Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); + + if (baseAlgorithm == null || !(baseAlgorithm instanceof SymmetricEncryptionAlgorithm)) { + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } + + SymmetricEncryptionAlgorithm algo = (SymmetricEncryptionAlgorithm) baseAlgorithm; + + ICryptoTransform transform; + + try { + transform = algo.createDecryptor(key, iv, authenticationData, authenticationTag); + } catch (Exception e) { + return Mono.error(e); + } + + try { + return Mono.just(new DecryptResult(transform.doFinal(cipherText))); + } catch (Exception e) { + return Mono.error(e); + } + } + + @Override + Mono signAsync(SignatureAlgorithm algorithm, byte[] digest, Context context, JsonWebKey key) { + return Mono.error(new UnsupportedOperationException("Sign operation not supported for OCT/Symmetric key")); + } + + @Override + 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")); + } + + @Override + Mono wrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] key, Context context, JsonWebKey jsonWebKey) { + + this.key = getKey(jsonWebKey); + + if (key == null || key.length == 0) { + throw new IllegalArgumentException("key"); + } + + // Interpret the algorithm + Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); + + if (baseAlgorithm == null || !(baseAlgorithm instanceof LocalKeyWrapAlgorithm)) { + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } + + LocalKeyWrapAlgorithm algo = (LocalKeyWrapAlgorithm) baseAlgorithm; + + ICryptoTransform transform = null; + + try { + transform = algo.createEncryptor(this.key, null, null); + } catch (Exception e) { + return Mono.error(e); + } + + byte[] encrypted = null; + + try { + encrypted = transform.doFinal(key); + } catch (Exception e) { + return Mono.error(e); + } + + return Mono.just(new KeyWrapResult(encrypted, algorithm)); + } + + @Override + Mono unwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, Context context, JsonWebKey jsonWebKey) { + key = getKey(jsonWebKey); + + Algorithm baseAlgorithm = AlgorithmResolver.Default.get(algorithm.toString()); + + if (baseAlgorithm == null || !(baseAlgorithm instanceof LocalKeyWrapAlgorithm)) { + return Mono.error(new NoSuchAlgorithmException(algorithm.toString())); + } + + LocalKeyWrapAlgorithm algo = (LocalKeyWrapAlgorithm) baseAlgorithm; + + ICryptoTransform transform; + + try { + transform = algo.createDecryptor(key, null, null); + } catch (Exception e) { + return Mono.error(e); + } + + byte[] decrypted; + + try { + decrypted = transform.doFinal(encryptedKey); + } catch (Exception e) { + return Mono.error(e); + } + + return Mono.just(new KeyUnwrapResult(decrypted)); + } + + @Override + Mono signDataAsync(SignatureAlgorithm algorithm, byte[] data, Context context, JsonWebKey key) { + return signAsync(algorithm, data, context, key); + } + + @Override + 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/Triplet.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Triplet.java new file mode 100644 index 000000000000..267ea2e8c1ce --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/Triplet.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +class Triplet { + + private final T left; + private final U middle; + private final V right; + + Triplet(T left, U middle, V right) { + this.left = left; + this.middle = middle; + this.right = right; + } + + public T getLeft() { + return left; + } + + public U getMiddle() { + return middle; + } + + public V getRight() { + return right; + } +} 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 new file mode 100644 index 000000000000..d6eb0f8f75f3 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/DecryptResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography.models; + +import com.azure.core.implementation.util.ImplUtils; + +/** + * Represents the details of decrypt operation result. + */ +public final class DecryptResult { + /** + * The decrypted content. + */ + private byte[] plainText; + + /** + * Creates the instance of Decrypt Result holding decrypted content. + * @param plainText The decrypted content. + */ + public DecryptResult(byte[] plainText) { + this.plainText = ImplUtils.clone(plainText); + } + + /** + * Get the encrypted content. + * @return The decrypted content. + */ + public byte[] plainText() { + return ImplUtils.clone(plainText); + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptResult.java new file mode 100644 index 000000000000..318004f05bb9 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptResult.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography.models; + +import com.azure.core.implementation.util.ImplUtils; + +/** + * Represents the details of encrypt operation result. + */ +public final class EncryptResult { + + /** + * Creates the instance of Encrypt Result holding encryption operation response information. + * @param cipherText The encrypted content. + * @param authenticationTag The authentication tag. + * @param algorithm The algorithm used to encrypt the content. + */ + public EncryptResult(byte[] cipherText, byte[] authenticationTag, EncryptionAlgorithm algorithm) { + this.cipherText = ImplUtils.clone(cipherText); + this.authenticationTag = ImplUtils.clone(authenticationTag); + this.algorithm = algorithm; + } + + /** + * THe encrypted content. + */ + private byte[] cipherText; + + /** + * The authentication tag. + */ + private byte[] authenticationTag; + + /** + * The encrypyion algorithm used for the encryption operation. + */ + private EncryptionAlgorithm algorithm; + + /** + * Get the encrypted content. + * @return The encrypted content. + */ + public byte[] cipherText() { + return ImplUtils.clone(cipherText); + } + + /** + * Get the authentication tag. + * @return The authentication tag. + */ + public byte[] authenticationTag() { + return ImplUtils.clone(authenticationTag); + } + + /** + * Get the encryption algorithm used for encryption. + * @return The encryption algorithm used. + */ + public EncryptionAlgorithm algorithm() { + return algorithm; + } + +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptionAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptionAlgorithm.java new file mode 100644 index 000000000000..da87988a302b --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/EncryptionAlgorithm.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography.models; + +import com.fasterxml.jackson.annotation.JsonValue; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * Defines values for EncryptionAlgorithm. + */ +public enum EncryptionAlgorithm { + + RSA_OAEP("RSA-OAEP"), + RSA_OAEP_256("RSA-OAEP-256"), + RSA1_5("RSA1_5"), + A256CBC_HS512("A256CBC-HS512"), + A128CBC_HS256("A128CBC-HS256"), + A192CBC_HS384("A192CBC-HS384"), + A256CBC("A256CBC"), + A192CBC("A192CBC"), + A128CBC("A128CBC"); + + private String value; + + /** + * Creates a custom value for EncryptionAlgorithm. + * + * @param value the custom value + */ + EncryptionAlgorithm(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + /** + * 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)); +} 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 new file mode 100644 index 000000000000..d839f72abf03 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyUnwrapResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography.models; + +import com.azure.core.implementation.util.ImplUtils; + +/** + * Represents the details of key unwrap operation result. + */ +public final class KeyUnwrapResult { + /** + * The unwrapped key content. + */ + private byte[] key; + + /** + * Creates the instance of KeyUnwrap Result holding the unwrapped key content. + * @param key The unwrapped key content. + */ + public KeyUnwrapResult(byte[] key) { + this.key = ImplUtils.clone(key); + } + + /** + * Get the unwrapped key content. + * @return The unwrapped key content. + */ + public byte[] key() { + return ImplUtils.clone(key); + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyWrapAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyWrapAlgorithm.java new file mode 100644 index 000000000000..2d3ed0e7791e --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyWrapAlgorithm.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography.models; + +import com.fasterxml.jackson.annotation.JsonValue; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +/** + * Defines values for EncryptionAlgorithm. + */ +public enum KeyWrapAlgorithm { + + RSA_OAEP("RSA-OAEP"), + RSA_OAEP_256("RSA-OAEP-256"), + RSA1_5("RSA1_5"), + A192KW("A192KW"), + A128KW("A128KW"), + A256KW("A256KW"); + + private String value; + + /** + * Creates a custom value for KeyWrapAlgorithm. + * + * @param value the custom value + */ + KeyWrapAlgorithm(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + /** + * All the JWK encryption implementation. + */ + public static final List ALL_ALGORITHMS = Collections + .unmodifiableList(Arrays.asList(RSA_OAEP, RSA1_5, RSA_OAEP_256, A192KW, A128KW, A256KW)); +} 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 new file mode 100644 index 000000000000..23f660b13457 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/KeyWrapResult.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography.models; + +import com.azure.core.implementation.util.ImplUtils; + +/** + * Represents the details of wrap operation result. + */ +public final class KeyWrapResult { + + /** + * Creates the instance of KeyWrapResult holding the key wrap operation response details. + * @param encryptedKey The unwrapped key content. + * @param algorithm The algorithm used to wrap the key content. + */ + public KeyWrapResult(byte[] encryptedKey, KeyWrapAlgorithm algorithm) { + this.encryptedKey = ImplUtils.clone(encryptedKey); + this.algorithm = algorithm; + } + + /** + * The encrypted key content + */ + private byte[] encryptedKey; + + /** + * The key wrap algorithm used to wrap the key content. + */ + private KeyWrapAlgorithm algorithm; + + /** + * Get the encrypted key content. + * @return The encrypted key. + */ + public byte[] encryptedKey() { + return ImplUtils.clone(encryptedKey); + } + + /** + * Get the key wrap algorithm used to wrap the key content. + * @return The key wrap algorithm. + */ + public KeyWrapAlgorithm algorithm() { + return algorithm; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignResult.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignResult.java new file mode 100644 index 000000000000..34ea80ef373a --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignResult.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography.models; + +import com.azure.core.implementation.util.ImplUtils; + +/** + * Represents the details of sign operation result. + */ +public final class SignResult { + + /** + * Creates the instance of SignResult holding the sign operation response details. + * @param signature The signature created from the digest. + * @param algorithm The algorithm used to sign the digest. + */ + public SignResult(byte[] signature, SignatureAlgorithm algorithm) { + this.signature = ImplUtils.clone(signature); + this.algorithm = algorithm; + } + + /** + * The signature created from the digest. + */ + private byte[] signature; + + /** + * The algorithm used to create the signature. + */ + private SignatureAlgorithm algorithm; + + /** + * Get the signature created from the digest. + * @return The signature. + */ + public byte[] signature() { + return ImplUtils.clone(signature); + } + + /** + * Get the signature algorithm used to create the signature. + * @return The signature algorithm. + */ + public SignatureAlgorithm algorithm() { + return algorithm; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignatureAlgorithm.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignatureAlgorithm.java new file mode 100644 index 000000000000..e0c15a1ef131 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/SignatureAlgorithm.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography.models; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for SignatureAlgorithm. + */ +public enum SignatureAlgorithm { + + PS256("PS256"), + PS384("PS384"), + PS512("PS512"), + RS256("RS256"), + RS384("RS384"), + RS512("RS512"), + ES256("ES256"), + ES384("ES384"), + ES512("ES512"), + ES256K("ES256K"); + + private String value; + + /** + * Creates a custom value for SignatureAlgorithm. + * + * @param value + * the custom value + */ + SignatureAlgorithm(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return value; + } + + /** + * All the JWK signature implementation. + */ + public static final List ALL_ALGORITHMS = Collections.unmodifiableList( + Arrays.asList(RS256, RS384, RS512, PS256, PS384, PS512, ES256, ES384, ES512, ES256K)); +} 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 new file mode 100644 index 000000000000..aa92321c876d --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/VerifyResult.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography.models; + +/** + * Represents the details of verify operation result. + */ +public final class VerifyResult { + /** + * THe verify operation result. + */ + private Boolean isValid; + + /** + * Creates the instance of Verify Result holding the verification response information. + * @param isValid The verification info. + */ + public VerifyResult(Boolean isValid) { + this.isValid = isValid; + } + + /** + * Get the verify operation result. + * @return The verification result. + */ + public Boolean isValid() { + return isValid; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/package-info.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/package-info.java new file mode 100644 index 000000000000..805b49079b4c --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing classes used for representing output/results of encryption, decryption, signing, verifying, + * key wrapping and unwrapping operations. + */ +package com.azure.security.keyvault.keys.cryptography.models; + 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 new file mode 100644 index 000000000000..985135aee564 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/cryptography/package-info.java @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +/** + * Package containing classes for creating {@link com.azure.security.keyvault.keys.cryptography.CryptographyAsyncClient} and + * {@link com.azure.security.keyvault.keys.cryptography.CryptographyClient} to perform cryptography operations. + */ +package com.azure.security.keyvault.keys.cryptography; diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/AzureKeyVaultConfiguration.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/AzureKeyVaultConfiguration.java new file mode 100644 index 000000000000..0ce4fe272ee4 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/implementation/AzureKeyVaultConfiguration.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.implementation; + +public final class AzureKeyVaultConfiguration { + //TODO: Eventually remove these hardcoded strings with https://github.com/Azure/azure-sdk-for-java/issues/3141 + public static final String SDK_NAME = "Azure-Keyvault"; + public static final String SDK_VERSION = "4.0.0-preview.2"; +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java index e54ebdad9d15..c15b94a41cea 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java @@ -3,7 +3,7 @@ package com.azure.security.keyvault.keys; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.keys.models.Key; import com.azure.security.keyvault.keys.models.RsaKeyCreateOptions; @@ -33,7 +33,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. KeyClient keyClient = new KeyClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); // Let's create a Rsa key valid for 1 year. if the key @@ -45,7 +45,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // Backups are good to have, if in case keys get accidentally deleted by you. // For long term storage, it is ideal to write the backup to a file. String backupFilePath = "YOUR_BACKUP_FILE_PATH"; - byte[] keyBackup = keyClient.backupKey("CloudRsaKey").value(); + byte[] keyBackup = keyClient.backupKey("CloudRsaKey"); writeBackupToFile(keyBackup, backupFilePath); // The Cloud Rsa key is no longer in use, so you delete it. @@ -62,7 +62,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // After sometime, the key is required again. We can use the backup value to restore it in the key vault. byte[] backupFromFile = Files.readAllBytes(new File(backupFilePath).toPath()); - Key restoredKey = keyClient.restoreKey(backupFromFile).value(); + Key restoredKey = keyClient.restoreKey(backupFromFile); } private static void writeBackupToFile(byte[] bytes, String filePath) { diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java index c1b1191e861e..0a748467c3bb 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java @@ -3,7 +3,7 @@ package com.azure.security.keyvault.keys; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.keys.models.RsaKeyCreateOptions; import java.io.File; @@ -32,7 +32,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. KeyAsyncClient keyAsyncClient = new KeyClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); // Let's create Cloud Rsa key valid for 1 year. if the key @@ -41,7 +41,7 @@ public static void main(String[] args) throws IOException, InterruptedException, .expires(OffsetDateTime.now().plusYears(1)) .keySize(2048)) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); @@ -49,7 +49,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // For long term storage, it is ideal to write the backup to a file. String backupFilePath = "YOUR_BACKUP_FILE_PATH"; keyAsyncClient.backupKey("CloudRsaKey").subscribe(backupResponse -> { - byte[] backupBytes = backupResponse.value(); + byte[] backupBytes = backupResponse; writeBackupToFile(backupBytes, backupFilePath); }); @@ -57,7 +57,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // The Cloud Rsa key is no longer in use, so you delete it. keyAsyncClient.deleteKey("CloudRsaKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.value().recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); //To ensure file is deleted on server side. Thread.sleep(30000); @@ -72,7 +72,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // After sometime, the key is required again. We can use the backup value to restore it in the key vault. byte[] backupFromFile = Files.readAllBytes(new File(backupFilePath).toPath()); keyAsyncClient.restoreKey(backupFromFile).subscribe(keyResponse -> - System.out.printf("Restored Key with name %s \n", keyResponse.value().name())); + System.out.printf("Restored Key with name %s \n", keyResponse.name())); //To ensure key is restored on server side. Thread.sleep(15000); diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java index c9b3a3866ed8..e4a68fc53350 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java @@ -3,7 +3,9 @@ package com.azure.security.keyvault.keys; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.keys.models.Key; import com.azure.security.keyvault.keys.models.RsaKeyCreateOptions; @@ -28,23 +30,27 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. KeyClient keyClient = new KeyClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); // Let's create a Rsa key valid for 1 year. if the key // already exists in the key vault, then a new version of the key is created. - keyClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") - .expires(OffsetDateTime.now().plusYears(1)) - .keySize(2048)); + Response createKeyResponse = keyClient.createRsaKeyWithResponse(new RsaKeyCreateOptions("CloudRsaKey") + .expires(OffsetDateTime.now().plusYears(1)) + .keySize(2048), new Context("key1", "value1")); + + // Let's validate create key operation succeeded using the status code information in the response. + System.out.printf("Create Key operation succeeded with status code %s \n", createKeyResponse.statusCode()); // Let's Get the Cloud Rsa Key from the key vault. - Key cloudRsaKey = keyClient.getKey("CloudRsaKey").value(); - System.out.printf("Key is returned with name %s and type %s \n", cloudRsaKey.name(), cloudRsaKey.keyMaterial().kty()); + Key cloudRsaKey = keyClient.getKey("CloudRsaKey"); + System.out.printf("Key is returned with name %s and type %s \n", cloudRsaKey.name(), + cloudRsaKey.keyMaterial().kty()); // After one year, the Cloud Rsa Key is still required, we need to update the expiry time of the key. // The update method can be used to update the expiry attribute of the key. cloudRsaKey.expires(cloudRsaKey.expires().plusYears(1)); - Key updatedKey = keyClient.updateKey(cloudRsaKey).value(); + Key updatedKey = keyClient.updateKey(cloudRsaKey); System.out.printf("Key's updated expiry time %s \n", updatedKey.expires()); // We need the Cloud Rsa key with bigger key size, so you want to update the key in key vault to ensure it has the required size. diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java index 257b79b48c50..e14021075190 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java @@ -3,7 +3,8 @@ package com.azure.security.keyvault.keys; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.core.http.rest.Response; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.keys.models.Key; import com.azure.security.keyvault.keys.models.RsaKeyCreateOptions; @@ -27,22 +28,24 @@ public static void main(String[] args) throws InterruptedException { // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. KeyAsyncClient keyAsyncClient = new KeyClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); // Let's create Cloud Rsa key valid for 1 year. if the key // already exists in the key vault, then a new version of the key is created. - keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") - .expires(OffsetDateTime.now().plusYears(1)) - .keySize(2048)) - .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + Response createKeyResponse = keyAsyncClient.createRsaKeyWithResponse(new RsaKeyCreateOptions("CloudRsaKey") + .expires(OffsetDateTime.now().plusYears(1)) + .keySize(2048)).block(); + + // Let's validate create key operation succeeded using the status code information in the response. + System.out.printf("Create Key operation succeeded with status code %s \n", createKeyResponse.statusCode()); + System.out.printf("Key is created with name %s and type %s \n", createKeyResponse.value().name(), createKeyResponse.value().keyMaterial().kty()); Thread.sleep(2000); // Let's Get the Cloud Rsa Key from the key vault. keyAsyncClient.getKey("CloudRsaKey").subscribe(keyResponse -> - System.out.printf("Key returned with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key returned with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); @@ -50,11 +53,11 @@ public static void main(String[] args) throws InterruptedException { // After one year, the Cloud Rsa Key is still required, we need to update the expiry time of the key. // The update method can be used to update the expiry attribute of the key. keyAsyncClient.getKey("CloudRsaKey").subscribe(keyResponse -> { - Key key = keyResponse.value(); + Key key = keyResponse; //Update the expiry time of the key. key.expires(key.expires().plusYears(1)); keyAsyncClient.updateKey(key).subscribe(updatedKeyResponse -> - System.out.printf("Key's updated expiry time %s \n", updatedKeyResponse.value().expires().toString())); + System.out.printf("Key's updated expiry time %s \n", updatedKeyResponse.expires().toString())); }); Thread.sleep(2000); @@ -65,13 +68,13 @@ public static void main(String[] args) throws InterruptedException { .expires(OffsetDateTime.now().plusYears(1)) .keySize(4096)) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); // The Cloud Rsa Key is no longer needed, need to delete it from the key vault. keyAsyncClient.deleteKey("CloudRsaKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.value().recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); //To ensure key is deleted on server side. Thread.sleep(30000); diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyAsyncClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyAsyncClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..3b6bccdcbaa2 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,485 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys; + +import com.azure.core.credentials.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.test.models.RecordedData; +import com.azure.core.test.policy.RecordNetworkCallPolicy; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.keys.models.EcKeyCreateOptions; +import com.azure.security.keyvault.keys.models.KeyBase; +import com.azure.security.keyvault.keys.models.KeyCreateOptions; +import com.azure.security.keyvault.keys.models.RsaKeyCreateOptions; +import com.azure.security.keyvault.keys.models.webkey.KeyCurveName; +import com.azure.security.keyvault.keys.models.webkey.KeyOperation; +import com.azure.security.keyvault.keys.models.webkey.KeyType; +import reactor.util.context.Context; + +import java.time.OffsetDateTime; + +/** + * This class contains code samples for generating javadocs through doclets for {@link KeyAsyncClient} + */ +public final class KeyAsyncClientJavaDocCodeSnippets { + + private String key1 = "key1"; + private String key2 = "key2"; + private String value1 = "val1"; + private String value2 = "val2"; + + /** + * Generates code sample for creating a {@link KeyAsyncClient} + * @return An instance of {@link KeyAsyncClient} + */ + public KeyAsyncClient createAsyncClientWithHttpClient() { + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.withhttpclient.instantiation + RecordedData networkData = new RecordedData(); + KeyAsyncClient keyAsyncClient = new KeyClientBuilder() + .endpoint("https://myvault.azure.net/") + .credential(new DefaultAzureCredentialBuilder().build()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addPolicy(new RecordNetworkCallPolicy(networkData)) + .httpClient(HttpClient.createDefault()) + .buildAsyncClient(); + // END: com.azure.security.keyvault.keys.async.keyclient.withhttpclient.instantiation + return keyAsyncClient; + } + + /** + * Generates code sample for creating a {@link KeyAsyncClient} + * @return An instance of {@link KeyAsyncClient} + */ + public KeyAsyncClient createAsyncClient() { + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.instantiation + KeyAsyncClient keyAsyncClient = new KeyClientBuilder() + .endpoint("https://myvault.azure.net/") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAsyncClient(); + // END: com.azure.security.keyvault.keys.async.keyclient.instantiation + return keyAsyncClient; + } + + /** + * Generates code sample for creating a {@link KeyAsyncClient} + * @return An instance of {@link KeyAsyncClient} + */ + public KeyAsyncClient createAsyncClientWithPipeline() { + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.pipeline.instantiation + RecordedData networkData = new RecordedData(); + HttpPipeline pipeline = new HttpPipelineBuilder().policies(new RecordNetworkCallPolicy(networkData)).build(); + KeyAsyncClient keyAsyncClient = new KeyClientBuilder() + .pipeline(pipeline) + .endpoint("https://myvault.azure.net/") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAsyncClient(); + // END: com.azure.security.keyvault.keys.async.keyclient.pipeline.instantiation + return keyAsyncClient; + } + + + /** + * Generates a code sample for using {@link KeyAsyncClient#createKey(String, KeyType)} + */ + public void createKey() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createKey#string-keyType + keyAsyncClient.createKey("keyName", KeyType.EC) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createKey#string-keyType + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createKey#keyCreateOptions + KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + keyAsyncClient.createKey(keyCreateOptions) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createKey#keyCreateOptions + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createRsaKey#RsaKeyCreateOptions + RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName") + .keySize(2048) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + keyAsyncClient.createRsaKey(rsaKeyCreateOptions) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createRsaKey#RsaKeyCreateOptions + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createEcKey#EcKeyCreateOptions + EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName") + .curve(KeyCurveName.P_384) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + keyAsyncClient.createEcKey(ecKeyCreateOptions) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createEcKey#EcKeyCreateOptions + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#deleteKey(String)} + */ + public void deleteKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.deleteKey#string + keyAsyncClient.deleteKey("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Deleted Key's Recovery Id %s", keyResponse.recoveryId())); + // END: com.azure.security.keyvault.keys.async.keyclient.deleteKey#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#getDeletedKey(String)} + */ + public void getDeletedKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getDeletedKey#string + keyAsyncClient.getDeletedKey("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Deleted Key's Recovery Id %s", keyResponse.recoveryId())); + // END: com.azure.security.keyvault.keys.async.keyclient.getDeletedKey#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#createKeyWithResponse(KeyCreateOptions)} + */ + public void createKeyWithResponses() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createKeyWithResponse#keyCreateOptions + KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + keyAsyncClient.createKeyWithResponse(keyCreateOptions) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.value().name(), + keyResponse.value().id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createKeyWithResponse#keyCreateOptions + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createRsaKeyWithResponse#RsaKeyCreateOptions + RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName") + .keySize(2048) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + keyAsyncClient.createRsaKeyWithResponse(rsaKeyCreateOptions) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.value().name(), + keyResponse.value().id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createRsaKeyWithResponse#RsaKeyCreateOptions + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createEcKeyWithResponse#EcKeyCreateOptions + EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName") + .curve(KeyCurveName.P_384) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + keyAsyncClient.createEcKeyWithResponse(ecKeyCreateOptions) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.value().name(), + keyResponse.value().id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createEcKeyWithResponse#EcKeyCreateOptions + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#getKeyWithResponse(String, String)} + */ + public void getKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#string-string + String keyVersion = "6A385B124DEF4096AF1361A85B16C204"; + keyAsyncClient.getKeyWithResponse("keyName", keyVersion) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", + keyResponse.value().name(), keyResponse.value().id())); + // END: com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#string-string + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#KeyBase + keyAsyncClient.listKeys().subscribe(keyBase -> + keyAsyncClient.getKeyWithResponse(keyBase) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key with name %s and value %s \n", keyResponse.value().name(), + keyResponse.value().id()))); + // END: com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#KeyBase + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#getKey(String, String)} + */ + public void getKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getKey#string-string + String keyVersion = "6A385B124DEF4096AF1361A85B16C204"; + keyAsyncClient.getKey("keyName", keyVersion) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.getKey#string-string + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getKey#string + keyAsyncClient.getKey("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.getKey#string + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getKey#KeyBase + keyAsyncClient.listKeys().subscribe(keyBase -> + keyAsyncClient.getKey(keyBase) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key with name %s and value %s \n", keyResponse.name(), keyResponse.id()))); + // END: com.azure.security.keyvault.keys.async.keyclient.getKey#KeyBase + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#updateKeyWithResponse(KeyBase, KeyOperation...)} + */ + public void updateKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.updateKeyWithResponse#KeyBase-keyOperations + keyAsyncClient.getKey("keyName") + .subscribe(keyResponse -> { + //Update the not before time of the key. + keyResponse.notBefore(OffsetDateTime.now().plusDays(50)); + keyAsyncClient.updateKeyWithResponse(keyResponse, KeyOperation.ENCRYPT, KeyOperation.DECRYPT) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(updatedKeyResponse -> + System.out.printf("Key's updated not before time %s \n", + updatedKeyResponse.value().notBefore().toString())); + }); + // END: com.azure.security.keyvault.keys.async.keyclient.updateKeyWithResponse#KeyBase-keyOperations + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.updateKeyWithResponse#KeyBase + keyAsyncClient.getKey("keyName") + .subscribe(keyResponse -> { + //Update the not before time of the key. + keyResponse.notBefore(OffsetDateTime.now().plusDays(50)); + keyAsyncClient.updateKeyWithResponse(keyResponse) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(updatedKeyResponse -> + System.out.printf("Key's updated not before time %s \n", + updatedKeyResponse.value().notBefore().toString())); + }); + // END: com.azure.security.keyvault.keys.async.keyclient.updateKeyWithResponse#KeyBase + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#updateKey(KeyBase, KeyOperation...)} + */ + public void updateKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.updateKey#KeyBase-keyOperations + keyAsyncClient.getKey("keyName") + .subscribe(keyResponse -> { + //Update the not before time of the key. + keyResponse.notBefore(OffsetDateTime.now().plusDays(50)); + keyAsyncClient.updateKey(keyResponse, KeyOperation.ENCRYPT, KeyOperation.DECRYPT) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(updatedKeyResponse -> + System.out.printf("Key's updated not before time %s \n", + updatedKeyResponse.notBefore().toString())); + }); + // END: com.azure.security.keyvault.keys.async.keyclient.updateKey#KeyBase-keyOperations + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.updateKey#KeyBase + keyAsyncClient.getKey("keyName") + .subscribe(keyResponse -> { + //Update the not before time of the key. + keyResponse.notBefore(OffsetDateTime.now().plusDays(50)); + keyAsyncClient.updateKey(keyResponse) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(updatedKeyResponse -> + System.out.printf("Key's updated not before time %s \n", + updatedKeyResponse.notBefore().toString())); + }); + // END: com.azure.security.keyvault.keys.async.keyclient.updateKey#KeyBase + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#deleteKeyWithResponse(String)} + */ + public void deleteKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.deleteKeyWithResponse#string + keyAsyncClient.deleteKeyWithResponse("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedKeyResponse -> + System.out.printf("Deleted Key's Recovery Id %s", deletedKeyResponse.value().recoveryId())); + // END: com.azure.security.keyvault.keys.async.keyclient.deleteKeyWithResponse#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#getDeletedKeyWithResponse(String)} + */ + public void getDeleteKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getDeletedKeyWithResponse#string + keyAsyncClient.getDeletedKeyWithResponse("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedKeyResponse -> + System.out.printf("Deleted Key's Recovery Id %s", deletedKeyResponse.value().recoveryId())); + // END: com.azure.security.keyvault.keys.async.keyclient.getDeletedKeyWithResponse#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#purgeDeletedKey(String)} + */ + public void purgeDeletedKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.purgeDeletedKey#string + keyAsyncClient.purgeDeletedKey("deletedKeyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(purgeResponse -> + System.out.printf("Purge Status response %rsaPrivateExponent \n", purgeResponse.statusCode())); + // END: com.azure.security.keyvault.keys.async.keyclient.purgeDeletedKey#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#recoverDeletedKeyWithResponse(String)} + */ + public void recoverDeletedKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKeyWithResponse#string + keyAsyncClient.recoverDeletedKeyWithResponse("deletedKeyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(recoveredKeyResponse -> + System.out.printf("Recovered Key with name %s \n", recoveredKeyResponse.value().name())); + // END: com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKeyWithResponse#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#recoverDeletedKey(String)} + */ + public void recoverDeletedKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKey#string + keyAsyncClient.recoverDeletedKey("deletedKeyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(recoveredKeyResponse -> + System.out.printf("Recovered Key with name %s \n", recoveredKeyResponse.name())); + // END: com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKey#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#backupKey(String)} + */ + public void backupKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.backupKey#string + keyAsyncClient.backupKey("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyBackupResponse -> + System.out.printf("Key's Backup Byte array's length %s \n", keyBackupResponse.length)); + // END: com.azure.security.keyvault.keys.async.keyclient.backupKey#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#backupKeyWithResponse(String)} + */ + public void backupKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.backupKeyWithResponse#string + keyAsyncClient.backupKeyWithResponse("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyBackupResponse -> + System.out.printf("Key's Backup Byte array's length %s \n", keyBackupResponse.value().length)); + // END: com.azure.security.keyvault.keys.async.keyclient.backupKeyWithResponse#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#restoreKey} + */ + public void restoreKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.restoreKey#byte + byte[] keyBackupByteArray = {}; + keyAsyncClient.restoreKey(keyBackupByteArray) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Restored Key with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.restoreKey#byte + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#restoreKeyWithResponse(byte[])} + */ + public void restoreKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.restoreKeyWithResponse#byte + byte[] keyBackupByteArray = {}; + keyAsyncClient.restoreKeyWithResponse(keyBackupByteArray) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Restored Key with name %s and id %s \n", keyResponse.value().name(), + keyResponse.value().id())); + // END: com.azure.security.keyvault.keys.async.keyclient.restoreKeyWithResponse#byte + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#listKeys} + */ + public void listKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.listKeys + keyAsyncClient.listKeys() + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyBase -> keyAsyncClient.getKey(keyBase) + .subscribe(keyResponse -> System.out.printf("Received key with name %s and type %s", keyResponse.name(), + keyResponse.keyMaterial().kty()))); + // END: com.azure.security.keyvault.keys.async.keyclient.listKeys + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#listDeletedKeys} + */ + public void listDeletedKeysSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.listDeletedKeys + keyAsyncClient.listDeletedKeys() + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedKey -> System.out.printf("Deleted key's recovery Id %s", deletedKey.recoveryId())); + // END: com.azure.security.keyvault.keys.async.keyclient.listDeletedKeys + } + + /** + * Generates code sample for using {@link KeyAsyncClient#listKeyVersions(String)} + */ + public void listKeyVersions() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.listKeyVersions + keyAsyncClient.listKeyVersions("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyBase -> keyAsyncClient.getKey(keyBase) + .subscribe(keyResponse -> + System.out.printf("Received key's version with name %s, type %s and version %s", keyResponse.name(), + keyResponse.keyMaterial().kty(), keyResponse.version()))); + // END: com.azure.security.keyvault.keys.async.keyclient.listKeyVersions + } + + /** + * Implementation not provided for this method + * @return {@code null} + */ + private TokenCredential getKeyVaultCredential() { + return null; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java index 6f63be8f59b6..c87a85886aa2 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java @@ -4,38 +4,31 @@ package com.azure.security.keyvault.keys; import com.azure.core.credentials.TokenCredential; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.test.models.RecordedData; -import com.azure.core.test.policy.RecordNetworkCallPolicy; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.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.RsaKeyCreateOptions; +import com.azure.security.keyvault.keys.models.webkey.KeyCurveName; +import com.azure.security.keyvault.keys.models.webkey.KeyOperation; import com.azure.security.keyvault.keys.models.webkey.KeyType; +import java.time.OffsetDateTime; + /** * This class contains code samples for generating javadocs through doclets for {@link KeyClient} */ public final class KeyClientJavaDocCodeSnippets { - /** - * Generates code sample for creating a {@link KeyAsyncClient} - * @return An instance of {@link KeyAsyncClient} - */ - public KeyAsyncClient createAsyncClientWithHttpClient() { - // BEGIN: com.azure.security.keyvault.keys.async.keyclient.withhttpclient.instantiation - RecordedData networkData = new RecordedData(); - KeyAsyncClient keyClient = new KeyClientBuilder() - .endpoint("https://myvault.azure.net/") - .credential(new DefaultAzureCredential()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(new RecordNetworkCallPolicy(networkData)) - .httpClient(HttpClient.createDefault()) - .buildAsyncClient(); - // END: com.azure.security.keyvault.keys.async.keyclient.withhttpclient.instantiation - return keyClient; - } + private String key1 = "key1"; + private String key2 = "key2"; + private String value1 = "val1"; + private String value2 = "val2"; /** * Generates code sample for creating a {@link KeyClient} @@ -45,53 +38,338 @@ public KeyClient createClient() { // BEGIN: com.azure.security.keyvault.keys.keyclient.instantiation KeyClient keyClient = new KeyClientBuilder() .endpoint("https://myvault.azure.net/") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); // END: com.azure.security.keyvault.keys.keyclient.instantiation return keyClient; } /** - * Generates code sample for creating a {@link KeyAsyncClient} - * @return An instance of {@link KeyAsyncClient} + * Generates a code sample for using {@link KeyClient#createKey(String, KeyType)} */ - public KeyAsyncClient createAsyncClient() { - // BEGIN: com.azure.security.keyvault.keys.async.keyclient.instantiation - KeyAsyncClient keyClient = new KeyClientBuilder() - .endpoint("https://myvault.azure.net/") - .credential(new DefaultAzureCredential()) - .buildAsyncClient(); - // END: com.azure.security.keyvault.keys.async.keyclient.instantiation - return keyClient; + public void createKey() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.createKey#string-keyType + Key key = keyClient.createKey("keyName", KeyType.EC); + System.out.printf("Key is created with name %s and id %s %n", key.name(), key.id()); + // END: com.azure.keyvault.keys.keyclient.createKey#string-keyType + + // BEGIN: com.azure.keyvault.keys.keyclient.createKey#keyOptions + KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + Key optionsKey = keyClient.createKey(keyCreateOptions); + System.out.printf("Key is created with name %s and id %s \n", optionsKey.name(), optionsKey.id()); + // END: com.azure.keyvault.keys.keyclient.createKey#keyOptions + + // BEGIN: com.azure.keyvault.keys.keyclient.createRsaKey#keyOptions + RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName") + .keySize(2048) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + Key rsaKey = keyClient.createRsaKey(rsaKeyCreateOptions); + System.out.printf("Key is created with name %s and id %s \n", rsaKey.name(), rsaKey.id()); + // END: com.azure.keyvault.keys.keyclient.createRsaKey#keyOptions + + // BEGIN: com.azure.keyvault.keys.keyclient.createEcKey#keyOptions + EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName") + .curve(KeyCurveName.P_384) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + Key ecKey = keyClient.createEcKey(ecKeyCreateOptions); + System.out.printf("Key is created with name %s and id %s \n", ecKey.name(), ecKey.id()); + // END: com.azure.keyvault.keys.keyclient.createEcKey#keyOptions + + } /** - * Generates code sample for creating a {@link KeyAsyncClient} - * @return An instance of {@link KeyAsyncClient} + * Generates a code sample for using {@link KeyClient#deleteKey(String)} */ - public KeyAsyncClient createAsyncClientWithPipeline() { - // BEGIN: com.azure.security.keyvault.keys.async.keyclient.pipeline.instantiation - RecordedData networkData = new RecordedData(); - HttpPipeline pipeline = HttpPipeline.builder().policies(new RecordNetworkCallPolicy(networkData)).build(); - KeyAsyncClient keyClient = new KeyClientBuilder() - .pipeline(pipeline) - .endpoint("https://myvault.azure.net/") - .credential(new DefaultAzureCredential()) - .buildAsyncClient(); - // END: com.azure.security.keyvault.keys.async.keyclient.pipeline.instantiation - return keyClient; + public void deleteKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.deleteKey#string + Key key = keyClient.getKey("keyName"); + DeletedKey deletedKey = keyClient.deleteKey("keyName"); + System.out.printf("Deleted Key's Recovery Id %s", deletedKey.recoveryId()); + // END: com.azure.keyvault.keys.keyclient.deleteKey#string } + /** + * Generates a code sample for using {@link KeyClient#getDeletedKey(String)} + */ + public void getDeletedKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.getDeletedKey#string + DeletedKey deletedKey = keyClient.getDeletedKey("keyName"); + System.out.printf("Deleted Key's Recovery Id %s", deletedKey.recoveryId()); + // END: com.azure.keyvault.keys.keyclient.getDeletedKey#string + } /** - * Generates a code sample for using {@link KeyClient#createKey(String, KeyType)} + * Generates a code sample for using {@link KeyClient#createKeyWithResponse(KeyCreateOptions, Context)} */ - public void createKey() { + public void createKeyWithResponses() { KeyClient keyClient = createClient(); - // BEGIN: com.azure.keyvault.keys.keyclient.createKey#string-keyType - Key retKey = keyClient.createKey("keyName", KeyType.EC).value(); - System.out.printf("Key is created with name %s and id %s %n", retKey.name(), retKey.id()); - // END: com.azure.keyvault.keys.keyclient.createKey#string-keyType + // BEGIN: com.azure.keyvault.keys.keyclient.createKeyWithResponse#keyCreateOptions-Context + KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + Key optionsKey = keyClient.createKeyWithResponse(keyCreateOptions, new Context(key1, value1)).value(); + System.out.printf("Key is created with name %s and id %s \n", optionsKey.name(), optionsKey.id()); + // END: com.azure.keyvault.keys.keyclient.createKeyWithResponse#keyCreateOptions-Context + + // BEGIN: com.azure.keyvault.keys.keyclient.createRsaKeyWithResponse#keyOptions-Context + RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName") + .keySize(2048) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + Key rsaKey = keyClient.createRsaKeyWithResponse(rsaKeyCreateOptions, new Context(key1, value1)).value(); + System.out.printf("Key is created with name %s and id %s \n", rsaKey.name(), rsaKey.id()); + // END: com.azure.keyvault.keys.keyclient.createRsaKeyWithResponse#keyOptions-Context + + // BEGIN: com.azure.keyvault.keys.keyclient.createEcKeyWithResponse#keyOptions-Context + EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName") + .curve(KeyCurveName.P_384) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + Key ecKey = keyClient.createEcKeyWithResponse(ecKeyCreateOptions, new Context(key1, value1)).value(); + System.out.printf("Key is created with name %s and id %s \n", ecKey.name(), ecKey.id()); + // END: com.azure.keyvault.keys.keyclient.createEcKeyWithResponse#keyOptions-Context + } + + /** + * Generates a code sample for using {@link KeyClient#getKeyWithResponse(String, String, Context)} + */ + public void getKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.getKeyWithResponse#string-string-Context + String keyVersion = "6A385B124DEF4096AF1361A85B16C204"; + Key keyWithVersion = keyClient.getKeyWithResponse("keyName", keyVersion, + new Context(key1, value1)).value(); + System.out.printf("Key is returned with name %s and id %s \n", keyWithVersion.name(), keyWithVersion.id()); + // END: com.azure.keyvault.keys.keyclient.getKeyWithResponse#string-string-Context + + // BEGIN: com.azure.keyvault.keys.keyclient.getKeyWithResponse#KeyBase-Context + for (KeyBase key : keyClient.listKeys()) { + Key keyResponse = keyClient.getKeyWithResponse(key, new Context(key1, value1)).value(); + System.out.printf("Received key with name %s and type %s", keyResponse.name(), + keyResponse.keyMaterial().kty()); + } + // END: com.azure.keyvault.keys.keyclient.getKeyWithResponse#KeyBase-Context + } + + /** + * Generates a code sample for using {@link KeyClient#getKey(String, String)} + */ + public void getKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.getKey#string-string + String keyVersion = "6A385B124DEF4096AF1361A85B16C204"; + Key keyWithVersion = keyClient.getKey("keyName", keyVersion); + System.out.printf("Key is returned with name %s and id %s \n", keyWithVersion.name(), keyWithVersion.id()); + // END: com.azure.keyvault.keys.keyclient.getKey#string-string + + // BEGIN: com.azure.keyvault.keys.keyclient.getKey#string + Key keyWithVersionValue = keyClient.getKey("keyName"); + System.out.printf("Key is returned with name %s and id %s \n", keyWithVersionValue.name(), keyWithVersionValue.id()); + // END: com.azure.keyvault.keys.keyclient.getKey#string + + // BEGIN: com.azure.keyvault.keys.keyclient.getKey#KeyBase + for (KeyBase key : keyClient.listKeys()) { + Key keyResponse = keyClient.getKey(key); + System.out.printf("Received key with name %s and type %s", keyResponse.name(), + keyResponse.keyMaterial().kty()); + } + // END: com.azure.keyvault.keys.keyclient.getKey#KeyBase + } + + /** + * Generates a code sample for using {@link KeyClient#updateKeyWithResponse(KeyBase, Context, KeyOperation...)} + */ + public void updateKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + + // BEGIN: com.azure.keyvault.keys.keyclient.updateKeyWithResponse#KeyBase-keyOperations-Context + Key key = keyClient.getKey("keyName"); + key.expires(OffsetDateTime.now().plusDays(60)); + KeyBase updatedKeyBase = keyClient.updateKeyWithResponse(key, + new Context(key1, value1), KeyOperation.ENCRYPT, KeyOperation.DECRYPT).value(); + Key updatedKey = keyClient.getKey(updatedKeyBase.name()); + System.out.printf("Key is updated with name %s and id %s \n", updatedKey.name(), updatedKey.id()); + // END: com.azure.keyvault.keys.keyclient.updateKeyWithResponse#KeyBase-keyOperations-Context + } + + /** + * Generates a code sample for using {@link KeyClient#updateKey(KeyBase, KeyOperation...)} + */ + public void updateKeySnippets() { + KeyClient keyClient = createClient(); + + // BEGIN: com.azure.keyvault.keys.keyclient.updateKey#KeyBase-keyOperations + Key key = keyClient.getKey("keyName"); + key.expires(OffsetDateTime.now().plusDays(60)); + KeyBase updatedKeyBase = keyClient.updateKey(key, KeyOperation.ENCRYPT, KeyOperation.DECRYPT); + Key updatedKey = keyClient.getKey(updatedKeyBase.name()); + System.out.printf("Key is updated with name %s and id %s \n", updatedKey.name(), updatedKey.id()); + // END: com.azure.keyvault.keys.keyclient.updateKey#KeyBase-keyOperations + + // BEGIN: com.azure.keyvault.keys.keyclient.updateKey#KeyBase + Key updateKey = keyClient.getKey("keyName"); + key.expires(OffsetDateTime.now().plusDays(60)); + KeyBase updatedKeyBaseValue = keyClient.updateKey(updateKey); + Key updatedKeyValue = keyClient.getKey(updatedKeyBaseValue.name()); + System.out.printf("Key is updated with name %s and id %s \n", updatedKeyValue.name(), updatedKeyValue.id()); + // END: com.azure.keyvault.keys.keyclient.updateKey#KeyBase + } + + /** + * Generates a code sample for using {@link KeyClient#deleteKeyWithResponse(String, Context)} + */ + public void deleteKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.deleteKeyWithResponse#string-Context + Key key = keyClient.getKey("keyName"); + DeletedKey deletedKey = keyClient.deleteKeyWithResponse("keyName", new Context(key1, value1)).value(); + System.out.printf("Deleted Key's Recovery Id %s", deletedKey.recoveryId()); + // END: com.azure.keyvault.keys.keyclient.deleteKeyWithResponse#string-Context + } + + /** + * Generates a code sample for using {@link KeyClient#getDeletedKeyWithResponse(String, Context)} + */ + public void getDeleteKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.getDeletedKeyWithResponse#string-Context + DeletedKey deletedKey = keyClient.getDeletedKeyWithResponse("keyName", new Context(key1, value1)).value(); + System.out.printf("Deleted Key with recovery Id %s \n", deletedKey.recoveryId()); + // END: com.azure.keyvault.keys.keyclient.getDeletedKeyWithResponse#string-Context + } + + /** + * Generates a code sample for using {@link KeyClient#purgeDeletedKey(String)} + */ + public void purgeDeletedKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.purgeDeletedKey#string + VoidResponse purgeResponse = keyClient.purgeDeletedKey("deletedKeyName"); + System.out.printf("Purge Status Code: %rsaPrivateExponent", purgeResponse.statusCode()); + // END: com.azure.keyvault.keys.keyclient.purgeDeletedKey#string + + // BEGIN: com.azure.keyvault.keys.keyclient.purgeDeletedKey#string-Context + VoidResponse purgedResponse = keyClient.purgeDeletedKey("deletedKeyName", new Context(key2, value2)); + System.out.printf("Purge Status Code: %rsaPrivateExponent", purgedResponse.statusCode()); + // END: com.azure.keyvault.keys.keyclient.purgeDeletedKey#string-Context + } + + /** + * Generates a code sample for using {@link KeyClient#recoverDeletedKeyWithResponse(String, Context)} + */ + public void recoverDeletedKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.recoverDeletedKeyWithResponse#string-Context + Key recoveredKey = keyClient.recoverDeletedKeyWithResponse("deletedKeyName", + new Context(key2, value2)).value(); + System.out.printf("Recovered key with name %s", recoveredKey.name()); + // END: com.azure.keyvault.keys.keyclient.recoverDeletedKeyWithResponse#string-Context + } + + /** + * Generates a code sample for using {@link KeyClient#recoverDeletedKey(String)} + */ + public void recoverDeletedKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.recoverDeletedKey#string + Key recoveredKey = keyClient.recoverDeletedKey("deletedKeyName"); + System.out.printf("Recovered key with name %s", recoveredKey.name()); + // END: com.azure.keyvault.keys.keyclient.recoverDeletedKey#string + } + + /** + * Generates a code sample for using {@link KeyClient#backupKey(String)} + */ + public void backupKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.backupKey#string + byte[] keyBackup = keyClient.backupKey("keyName"); + System.out.printf("Key's Backup Byte array's length %s", keyBackup.length); + // END: com.azure.keyvault.keys.keyclient.backupKey#string + } + + /** + * Generates a code sample for using {@link KeyClient#backupKeyWithResponse(String, Context)} + */ + public void backupKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.backupKeyWithResponse#string-Context + byte[] keyBackup = keyClient.backupKeyWithResponse("keyName", new Context(key2, value2)).value(); + System.out.printf("Key's Backup Byte array's length %s", keyBackup.length); + // END: com.azure.keyvault.keys.keyclient.backupKeyWithResponse#string-Context + } + + /** + * Generates a code sample for using {@link KeyClient#restoreKey} + */ + public void restoreKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.restoreKey#byte + byte[] keyBackupByteArray = {}; + Key keyResponse = keyClient.restoreKey(keyBackupByteArray); + System.out.printf("Restored Key with name %s and id %s \n", keyResponse.name(), keyResponse.id()); + // END: com.azure.keyvault.keys.keyclient.restoreKey#byte + } + + /** + * Generates a code sample for using {@link KeyClient#restoreKeyWithResponse(byte[], Context)} + */ + public void restoreKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.restoreKeyWithResponse#byte-Context + byte[] keyBackupByteArray = {}; + Response keyResponse = keyClient.restoreKeyWithResponse(keyBackupByteArray, new Context(key1, value1)); + System.out.printf("Restored Key with name %s and id %s \n", + keyResponse.value().name(), keyResponse.value().id()); + // END: com.azure.keyvault.keys.keyclient.restoreKeyWithResponse#byte-Context + } + + /** + * Generates a code sample for using {@link KeyClient#listKeys} + */ + public void listKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.listKeys + for (KeyBase key : keyClient.listKeys()) { + Key keyWithMaterial = keyClient.getKey(key); + System.out.printf("Received key with name %s and type %s", keyWithMaterial.name(), + keyWithMaterial.keyMaterial().kty()); + } + // END: com.azure.keyvault.keys.keyclient.listKeys + + // BEGIN: com.azure.keyvault.keys.keyclient.listKeys#Context + for (KeyBase key : keyClient.listKeys(new Context(key2, value2))) { + Key keyWithMaterial = keyClient.getKey(key); + System.out.printf("Received key with name %s and type %s", keyWithMaterial.name(), + keyWithMaterial.keyMaterial().kty()); + } + // END: com.azure.keyvault.keys.keyclient.listKeys#Context + } + + /** + * Generates a code sample for using {@link KeyClient#listDeletedKeys} + */ + public void listDeletedKeysSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.listDeletedKeys + for (DeletedKey deletedKey : keyClient.listDeletedKeys()) { + System.out.printf("Deleted key's recovery Id %s", deletedKey.recoveryId()); + } + // END: com.azure.keyvault.keys.keyclient.listDeletedKeys + + // BEGIN: com.azure.keyvault.keys.keyclient.listDeletedKeys#Context + for (DeletedKey deletedKey : keyClient.listDeletedKeys(new Context(key2, value2))) { + System.out.printf("Deleted key's recovery Id %s", deletedKey.recoveryId()); + } + // END: com.azure.keyvault.keys.keyclient.listDeletedKeys#Context } /** @@ -101,11 +379,19 @@ public void listKeyVersions() { KeyClient keyClient = createClient(); // BEGIN: com.azure.keyvault.keys.keyclient.listKeyVersions for (KeyBase key : keyClient.listKeyVersions("keyName")) { - Key keyWithMaterial = keyClient.getKey(key).value(); + Key keyWithMaterial = keyClient.getKey(key); System.out.printf("Received key's version with name %s, type %s and version %s", keyWithMaterial.name(), keyWithMaterial.keyMaterial().kty(), keyWithMaterial.version()); } // END: com.azure.keyvault.keys.keyclient.listKeyVersions + + // BEGIN: com.azure.keyvault.keys.keyclient.listKeyVersions#Context + for (KeyBase key : keyClient.listKeyVersions("keyName", new Context(key2, value2))) { + Key keyWithMaterial = keyClient.getKey(key); + System.out.printf("Received key's version with name %s, type %s and version %s", keyWithMaterial.name(), + keyWithMaterial.keyMaterial().kty(), keyWithMaterial.version()); + } + // END: com.azure.keyvault.keys.keyclient.listKeyVersions#Context } /** diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperations.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperations.java index b719d6970856..292675dda9f8 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperations.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperations.java @@ -3,7 +3,7 @@ package com.azure.security.keyvault.keys; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.keys.models.EcKeyCreateOptions; import com.azure.security.keyvault.keys.models.Key; import com.azure.security.keyvault.keys.models.KeyBase; @@ -28,7 +28,7 @@ public static void main(String[] args) throws IllegalArgumentException { // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. KeyClient keyClient = new KeyClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); // Let's create Ec and Rsa keys valid for 1 year. if the key @@ -43,7 +43,7 @@ public static void main(String[] args) throws IllegalArgumentException { // You need to check te type of keys already exist in your key vault. Let's list the keys and print their types. // List operations don't return the keys with key material information. So, for each returned key we call getKey to get the key with its key material information. for (KeyBase key : keyClient.listKeys()) { - Key keyWithMaterial = keyClient.getKey(key).value(); + Key keyWithMaterial = keyClient.getKey(key); System.out.printf("Received key with name %s and type %s", keyWithMaterial.name(), keyWithMaterial.keyMaterial().kty()); } @@ -55,7 +55,7 @@ public static void main(String[] args) throws IllegalArgumentException { // You need to check all the different versions Cloud Rsa key had previously. Lets print all the versions of this key. for (KeyBase key : keyClient.listKeyVersions("CloudRsaKey")) { - Key keyWithMaterial = keyClient.getKey(key).value(); + Key keyWithMaterial = keyClient.getKey(key); System.out.printf("Received key's version with name %s, type %s and version %s", keyWithMaterial.name(), keyWithMaterial.keyMaterial().kty(), keyWithMaterial.version()); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java index f82d56284558..5af46e8cbdd0 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java @@ -3,7 +3,7 @@ package com.azure.security.keyvault.keys; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.keys.models.EcKeyCreateOptions; import com.azure.security.keyvault.keys.models.RsaKeyCreateOptions; @@ -27,7 +27,7 @@ public static void main(String[] args) throws InterruptedException { // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. KeyAsyncClient keyAsyncClient = new KeyClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); // Let's create Ec and Rsa keys valid for 1 year. if the key @@ -35,14 +35,14 @@ public static void main(String[] args) throws InterruptedException { keyAsyncClient.createEcKey(new EcKeyCreateOptions("CloudEcKey") .expires(OffsetDateTime.now().plusYears(1))) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") .expires(OffsetDateTime.now().plusYears(1))) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); @@ -51,7 +51,7 @@ public static void main(String[] args) throws InterruptedException { keyAsyncClient.listKeys() .subscribe(keyBase -> keyAsyncClient.getKey(keyBase).subscribe(keyResponse -> - System.out.printf("Received key with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty()))); + System.out.printf("Received key with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty()))); Thread.sleep(15000); @@ -60,15 +60,15 @@ public static void main(String[] args) throws InterruptedException { keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") .keySize(4096) .expires(OffsetDateTime.now().plusYears(1))).subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); // You need to check all the different versions Cloud Rsa key had previously. Lets print all the versions of this key. keyAsyncClient.listKeyVersions("CloudRsaKey").subscribe(keyBase -> keyAsyncClient.getKey(keyBase).subscribe(keyResponse -> - System.out.printf("Received key's version with name %s, type %s and version %s \n", keyResponse.value().name(), - keyResponse.value().keyMaterial().kty(), keyResponse.value().version()))); + System.out.printf("Received key's version with name %s, type %s and version %s \n", keyResponse.name(), + keyResponse.keyMaterial().kty(), keyResponse.version()))); Thread.sleep(15000); } diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeys.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeys.java index bf668578f15f..74909d00260d 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeys.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeys.java @@ -3,7 +3,7 @@ package com.azure.security.keyvault.keys; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.keys.models.DeletedKey; import com.azure.security.keyvault.keys.models.EcKeyCreateOptions; import com.azure.security.keyvault.keys.models.RsaKeyCreateOptions; @@ -32,7 +32,7 @@ public static void main(String[] args) throws IllegalArgumentException, Interrup // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. KeyClient keyClient = new KeyClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); // Let's create Ec and Rsa keys valid for 1 year. if the key diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java index a9a206453ba8..96cd120eeebc 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java @@ -3,7 +3,7 @@ package com.azure.security.keyvault.keys; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.keys.models.EcKeyCreateOptions; import com.azure.security.keyvault.keys.models.RsaKeyCreateOptions; @@ -31,7 +31,7 @@ public static void main(String[] args) throws InterruptedException { // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. KeyAsyncClient keyAsyncClient = new KeyClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); // Let's create Ec and Rsa keys valid for 1 year. if the key @@ -39,20 +39,20 @@ public static void main(String[] args) throws InterruptedException { keyAsyncClient.createEcKey(new EcKeyCreateOptions("CloudEcKey") .expires(OffsetDateTime.now().plusYears(1))) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") .expires(OffsetDateTime.now().plusYears(1))) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); // The Cloud Rsa Key is no longer needed, need to delete it from the key vault. keyAsyncClient.deleteKey("CloudEcKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.value().recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); //To ensure key is deleted on server side. Thread.sleep(30000); @@ -60,17 +60,17 @@ public static void main(String[] args) throws InterruptedException { // We accidentally deleted Cloud Ec key. Let's recover it. // A deleted key can only be recovered if the key vault is soft-delete enabled. keyAsyncClient.recoverDeletedKey("CloudEcKey").subscribe(recoveredKeyResponse -> - System.out.printf("Recovered Key with name %s \n", recoveredKeyResponse.value().name())); + System.out.printf("Recovered Key with name %s \n", recoveredKeyResponse.name())); //To ensure key is recovered on server side. Thread.sleep(10000); // The Cloud Ec and Rsa keys are no longer needed, need to delete them from the key vault. keyAsyncClient.deleteKey("CloudEcKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.value().recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); keyAsyncClient.deleteKey("CloudRsaKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.value().recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); // To ensure key is deleted on server side. Thread.sleep(30000); 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 new file mode 100644 index 000000000000..1d7141b1b621 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.credentials.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.test.models.RecordedData; +import com.azure.core.test.policy.RecordNetworkCallPolicy; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.keys.KeyAsyncClient; +import com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Random; + +/** + * This class contains code samples for generating javadocs through doclets for {@link KeyAsyncClient} + */ +public final class CryptographyAsyncClientJavaDocCodeSnippets { + + private String key1 = "key1"; + private String key2 = "key2"; + private String value1 = "val1"; + private String value2 = "val2"; + + /** + * Generates code sample for creating a {@link KeyAsyncClient} + * @return An instance of {@link KeyAsyncClient} + */ + public CryptographyAsyncClient createAsyncClientWithHttpClient() { + // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.withhttpclient.instantiation + RecordedData networkData = new RecordedData(); + CryptographyAsyncClient cryptographyAsyncClient = new CryptographyClientBuilder() + .keyIdentifier("") + .credential(new DefaultAzureCredentialBuilder().build()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addPolicy(new RecordNetworkCallPolicy(networkData)) + .httpClient(HttpClient.createDefault()) + .buildAsyncClient(); + // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.withhttpclient.instantiation + return cryptographyAsyncClient; + } + + /** + * Generates code sample for creating a {@link KeyAsyncClient} + * @return An instance of {@link KeyAsyncClient} + */ + public CryptographyAsyncClient createAsyncClient() { + // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.instantiation + CryptographyAsyncClient cryptographyAsyncClient = new CryptographyClientBuilder() + .keyIdentifier("") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAsyncClient(); + // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.instantiation + return cryptographyAsyncClient; + } + + /** + * Generates code sample for creating a {@link KeyAsyncClient} + * @return An instance of {@link KeyAsyncClient} + */ + public CryptographyAsyncClient createAsyncClientWithPipeline() { + // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.pipeline.instantiation + RecordedData networkData = new RecordedData(); + HttpPipeline pipeline = new HttpPipelineBuilder().policies(new RecordNetworkCallPolicy(networkData)).build(); + CryptographyAsyncClient cryptographyAsyncClient = new CryptographyClientBuilder() + .pipeline(pipeline) + .keyIdentifier(" System.out.printf("Key is returned with name %s and id %s \n", + keyResponse.value().name(), keyResponse.value().id())); + // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.getKeyWithResponse + } + + /** + * Generates a code sample for using {@link CryptographyAsyncClient#getKey()} + */ + public void getKeySnippets() { + CryptographyAsyncClient cryptographyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.getKey + cryptographyAsyncClient.getKey() + .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) + .subscribe(key -> System.out.printf("Key is returned with name %s and id %s \n", key.name(), key.id())); + // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.getKey + } + + + /** + * Generates a code sample for using {@link CryptographyAsyncClient#encrypt(EncryptionAlgorithm, byte[])} and + * {@link CryptographyAsyncClient#encrypt(EncryptionAlgorithm, byte[], byte[], byte[])} + */ + public void encrypt() { + CryptographyAsyncClient cryptographyAsyncClient = createAsyncClient(); + byte[] iv = {(byte) 0x1a, (byte) 0xf3, (byte) 0x8c, (byte) 0x2d, (byte) 0xc2, (byte) 0xb9, (byte) 0x6f, (byte) 0xfd, (byte) 0xd8, (byte) 0x66, (byte) 0x94, (byte) 0x09, (byte) 0x23, (byte) 0x41, (byte) 0xbc, (byte) 0x04}; + byte[] authData = { + (byte) 0x54, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x73, (byte) 0x65, (byte) 0x63, (byte) 0x6f, (byte) 0x6e, (byte) 0x64, (byte) 0x20, (byte) 0x70, (byte) 0x72, (byte) 0x69, (byte) 0x6e, (byte) 0x63, + (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 + byte[] plainText = new byte[100]; + new Random(0x1234567L).nextBytes(plainText); + cryptographyAsyncClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plainText) + .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) + .subscribe(encryptResult -> + System.out.printf("Received encrypted content of length %d with algorithm %s \n", + encryptResult.cipherText().length, encryptResult.algorithm().toString())); + // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#asymmetric-encrypt + + // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.encrypt#symmetric-encrypt + 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 + } + + /** + * Generates a code sample for using {@link CryptographyAsyncClient#decrypt(EncryptionAlgorithm, byte[])} and + * {@link CryptographyAsyncClient#decrypt(EncryptionAlgorithm, byte[], byte[], byte[], byte[])} + */ + public void decrypt() { + CryptographyAsyncClient cryptographyAsyncClient = createAsyncClient(); + byte[] iv = {(byte) 0x1a, (byte) 0xf3, (byte) 0x8c, (byte) 0x2d, (byte) 0xc2, (byte) 0xb9, (byte) 0x6f, (byte) 0xfd, (byte) 0xd8, (byte) 0x66, (byte) 0x94, (byte) 0x09, (byte) 0x23, (byte) 0x41, (byte) 0xbc, (byte) 0x04}; + byte[] authData = { + (byte) 0x54, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x73, (byte) 0x65, (byte) 0x63, (byte) 0x6f, (byte) 0x6e, (byte) 0x64, (byte) 0x20, (byte) 0x70, (byte) 0x72, (byte) 0x69, (byte) 0x6e, (byte) 0x63, + (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 + }; + 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 + 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 + + // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.decrypt#symmetric-decrypt + 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 + } + + /** + * Generates a code sample for using {@link CryptographyAsyncClient#sign(SignatureAlgorithm, byte[])} and + * {@link CryptographyAsyncClient#verify(SignatureAlgorithm, byte[], byte[])} + * + * @throws NoSuchAlgorithmException when the specified algorithm doesn't exist. + */ + public void signVerify() throws NoSuchAlgorithmException { + CryptographyAsyncClient cryptographyAsyncClient = createAsyncClient(); + byte[] signature = new byte[100]; + // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign + byte[] data = new byte[100]; + new Random(0x1234567L).nextBytes(data); + MessageDigest md = MessageDigest.getInstance("SHA-256"); + md.update(data); + byte[] digest = md.digest(); + cryptographyAsyncClient.sign(SignatureAlgorithm.ES256, digest) + .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) + .subscribe(signResult -> + System.out.printf("Received signature of length %d with algorithm %s", signResult.signature().length)); + // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign + + // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify + 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 + } + + + /** + * Generates a code sample for using {@link CryptographyAsyncClient#signData(SignatureAlgorithm, byte[])} and + * {@link CryptographyAsyncClient#verifyData(SignatureAlgorithm, byte[], byte[])} + * + * @throws NoSuchAlgorithmException when the specified algorithm doesn't exist. + */ + public void signDataVerifyData() throws NoSuchAlgorithmException { + CryptographyAsyncClient cryptographyAsyncClient = createAsyncClient(); + byte[] signature = new byte[100]; + // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.sign-data + 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 + + // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.verify-data + 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 + } + + /** + * Generates a code sample for using {@link CryptographyAsyncClient#wrapKey(KeyWrapAlgorithm, byte[])} and + * {@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 + byte[] key = new byte[100]; + new Random(0x1234567L).nextBytes(key); + cryptographyAsyncClient.wrapKey(KeyWrapAlgorithm.RSA_OAEP, key) + .subscriberContext(reactor.util.context.Context.of(key1, value1, key2, value2)) + .subscribe(keyWrapResult -> + System.out.printf("Received encypted key of length %d with algorithm %s", + keyWrapResult.encryptedKey().length, keyWrapResult.algorithm().toString())); + // END: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.wrap-key + + // BEGIN: com.azure.security.keyvault.keys.cryptography.async.cryptographyclient.unwrap-key + 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 + } + + /** + * Implementation not provided for this method + * @return {@code null} + */ + private TokenCredential getKeyVaultCredential() { + return null; + } +} 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 new file mode 100644 index 000000000000..086eee5c36f3 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientJavaDocCodeSnippets.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.credentials.TokenCredential; +import com.azure.core.util.Context; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.keys.KeyClient; +import com.azure.security.keyvault.keys.cryptography.models.EncryptResult; +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.KeyWrapAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyUnwrapResult; +import com.azure.security.keyvault.keys.cryptography.models.SignResult; +import com.azure.security.keyvault.keys.cryptography.models.VerifyResult; +import com.azure.security.keyvault.keys.models.Key; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Random; + +/** + * This class contains code samples for generating javadocs through doclets for {@link KeyClient} + */ +public final class CryptographyClientJavaDocCodeSnippets { + + private String key1 = "key1"; + private String key2 = "key2"; + private String value1 = "val1"; + private String value2 = "val2"; + + /** + * Generates code sample for creating a {@link CryptographyClient} + * @return An instance of {@link CryptographyClient} + */ + public CryptographyClient createClient() { + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.instantiation + CryptographyClient cryptographyClient = new CryptographyClientBuilder() + .keyIdentifier("") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildClient(); + // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.instantiation + return cryptographyClient; + } + + /** + * Generates a code sample for using {@link CryptographyClient#getKeyWithResponse(Context)} + */ + public void getKeyWithResponseSnippets() { + CryptographyClient cryptographyClient = createClient(); + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.getKeyWithResponse#Context + Key keyWithVersion = cryptographyClient.getKeyWithResponse(new Context(key1, value1)).value(); + System.out.printf("Key is returned with name %s and id %s \n", keyWithVersion.name(), keyWithVersion.id()); + // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.getKeyWithResponse#Context + } + + /** + * Generates a code sample for using {@link CryptographyClient#getKey()} + */ + public void getKeySnippets() { + CryptographyClient cryptographyClient = createClient(); + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.getKey + Key key = cryptographyClient.getKey(); + System.out.printf("Key is returned with name %s and id %s \n", key.name(), key.id()); + // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.getKey + } + + /** + * Generates a code sample for using {@link CryptographyClient#encrypt(EncryptionAlgorithm, byte[])} and + * {@link CryptographyClient#encrypt(EncryptionAlgorithm, byte[], byte[], byte[])} + */ + public void encrypt() { + CryptographyClient cryptographyClient = createClient(); + byte[] iv = {(byte) 0x1a, (byte) 0xf3, (byte) 0x8c, (byte) 0x2d, (byte) 0xc2, (byte) 0xb9, (byte) 0x6f, (byte) 0xfd, (byte) 0xd8, (byte) 0x66, (byte) 0x94, (byte) 0x09, (byte) 0x23, (byte) 0x41, (byte) 0xbc, (byte) 0x04}; + byte[] authData = { + (byte) 0x54, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x73, (byte) 0x65, (byte) 0x63, (byte) 0x6f, (byte) 0x6e, (byte) 0x64, (byte) 0x20, (byte) 0x70, (byte) 0x72, (byte) 0x69, (byte) 0x6e, (byte) 0x63, + (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 + 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 + + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt + 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 + + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.encrypt#symmetric-encrypt-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 + } + + /** + * Generates a code sample for using {@link CryptographyClient#decrypt(EncryptionAlgorithm, byte[])} and + * {@link CryptographyClient#decrypt(EncryptionAlgorithm, byte[], byte[], byte[], byte[])} + */ + public void decrypt() { + CryptographyClient cryptographyClient = createClient(); + byte[] iv = {(byte) 0x1a, (byte) 0xf3, (byte) 0x8c, (byte) 0x2d, (byte) 0xc2, (byte) 0xb9, (byte) 0x6f, (byte) 0xfd, (byte) 0xd8, (byte) 0x66, (byte) 0x94, (byte) 0x09, (byte) 0x23, (byte) 0x41, (byte) 0xbc, (byte) 0x04}; + byte[] authData = { + (byte) 0x54, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x73, (byte) 0x65, (byte) 0x63, (byte) 0x6f, (byte) 0x6e, (byte) 0x64, (byte) 0x20, (byte) 0x70, (byte) 0x72, (byte) 0x69, (byte) 0x6e, (byte) 0x63, + (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 + }; + 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 + 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 + + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt + 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 + + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.decrypt#symmetric-decrypt-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 + } + + /** + * Generates a code sample for using {@link CryptographyClient#sign(SignatureAlgorithm, byte[])} and + * {@link CryptographyClient#verify(SignatureAlgorithm, byte[], byte[])} + * + * @throws NoSuchAlgorithmException when the specified algorithm doesn't exist. + */ + public void signVerify() throws NoSuchAlgorithmException { + CryptographyClient cryptographyClient = createClient(); + byte[] signature = new byte[100]; + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign + byte[] data = new byte[100]; + new Random(0x1234567L).nextBytes(data); + MessageDigest md = MessageDigest.getInstance("SHA-256"); + md.update(data); + byte[] digest = md.digest(); + SignResult signResult = cryptographyClient.sign(SignatureAlgorithm.ES256, digest); + System.out.printf("Received signature of length %d with algorithm %s", signResult.signature().length, + signResult.algorithm().toString()); + // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign + + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-Context + byte[] plainTextData = new byte[100]; + new Random(0x1234567L).nextBytes(plainTextData); + MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); + messageDigest.update(data); + byte[] digetContent = messageDigest.digest(); + SignResult signResponse = cryptographyClient.sign(SignatureAlgorithm.ES256, digetContent); + System.out.printf("Received signature of length %d with algorithm %s", signResponse.signature().length, + signResponse.algorithm().toString(), new Context(key1, value1)); + // END: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-Context + + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify + 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 + + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-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 + } + + + /** + * Generates a code sample for using {@link CryptographyClient#signData(SignatureAlgorithm, byte[])} and + * {@link CryptographyClient#verifyData(SignatureAlgorithm, byte[], byte[])} + * + * @throws NoSuchAlgorithmException when the specified algorithm doesn't exist. + */ + public void signDataVerifyData() throws NoSuchAlgorithmException { + CryptographyClient cryptographyClient = createClient(); + byte[] signature = new byte[100]; + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data + 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 + + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.sign-data-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 + + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data + 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 + + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.verify-data-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 + } + + /** + * Generates a code sample for using {@link CryptographyClient#wrapKey(KeyWrapAlgorithm, byte[])} and + * {@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 + 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 + + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.wrap-key-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 + + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key + 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 + + // BEGIN: com.azure.security.keyvault.keys.cryptography.cryptographyclient.unwrap-key-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 + } + + /** + * Implementation not provided for this method + * @return {@code null} + */ + private TokenCredential getKeyVaultCredential() { + return null; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/EncryptDecryptOperations.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/EncryptDecryptOperations.java new file mode 100644 index 000000000000..b8a1b98d9fb3 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/EncryptDecryptOperations.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.EncryptResult; +import com.azure.security.keyvault.keys.cryptography.models.DecryptResult; +import com.azure.security.keyvault.keys.models.webkey.JsonWebKey; +import com.azure.security.keyvault.keys.models.webkey.KeyOperation; +import com.azure.security.keyvault.keys.models.webkey.KeyType; + +import javax.crypto.spec.SecretKeySpec; +import java.util.Arrays; +import java.util.Random; + +/** + * Sample demonstrates how to set, get, update and delete a key. + */ +public class EncryptDecryptOperations { + + /** + * Authenticates with the key vault and shows how to set, get, update and delete a key in the key vault. + * + * @param args Unused. Arguments to the program. + * @throws IllegalArgumentException when invalid key vault endpoint is passed. + * @throws InterruptedException when the thread is interrupted in sleep mode. + */ + public static void main(String[] args) throws InterruptedException, IllegalArgumentException { + + // Instantiate a key client that will be used to call the service. Notice that the client is using default Azure + // credentials. To make default credentials work, ensure that environment variables 'AZURE_CLIENT_ID', + // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .keyIdentifier("") + .buildAsyncClient(); + + byte[] plainText = new byte[100]; + new Random(0x1234567L).nextBytes(plainText); + + // Let's encrypt a simple plain text of size 100 bytes. + cryptoAsyncClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plainText) + .subscribe(encryptResult -> { + System.out.printf("Returned cipherText size is %d bytes with algorithm %s\n", encryptResult.cipherText().length, encryptResult.algorithm().toString()); + //Let's decrypt the encrypted response. + cryptoAsyncClient.decrypt(EncryptionAlgorithm.RSA_OAEP, encryptResult.cipherText()) + .subscribe(decryptResult -> System.out.printf("Returned plainText size is %d bytes\n", decryptResult.plainText().length)); + }); + + Thread.sleep(5000); + + // Let's do Encrypt and Decrypt operations with a symmetric key. + byte[] keyContent = { 0x06, (byte) 0xa9, 0x21, 0x40, 0x36, (byte) 0xb8, (byte) 0xa1, 0x5b, 0x51, 0x2e, 0x03, (byte) 0xd5, 0x34, 0x12, 0x00, 0x06 }; + byte[] plaintext = "Single block msg".getBytes(); + byte[] initializationVector = { 0x3d, (byte) 0xaf, (byte) 0xba, 0x42, (byte) 0x9d, (byte) 0x9e, (byte) 0xb4, 0x30, (byte) 0xb4, 0x22, (byte) 0xda, (byte) 0x80, 0x2c, (byte) 0x9f, (byte) 0xac, 0x41 }; + + // Convert the symmetric key encoded content to Json Web key. + JsonWebKey symmetricKey = JsonWebKey.fromAes(new SecretKeySpec(keyContent, "AES")) + .kty(KeyType.OCT) + .keyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT)); + + // Configure the symmetric key in a new crypto client. + CryptographyAsyncClient symmetricKeyCryptoAsyncClient = new CryptographyClientBuilder() + .jsonWebKey(symmetricKey) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAsyncClient(); + + // Note the implementation of A128CBC in this library uses PKCS7 padding. + symmetricKeyCryptoAsyncClient.encrypt(EncryptionAlgorithm.A128CBC, plaintext, initializationVector, null) + .subscribe(encryptResult -> { + System.out.printf("Returned cipherText size is %d bytes with algorithm %s\n", encryptResult.cipherText().length, encryptResult.algorithm().toString()); + //Let's decrypt the encrypted response. + symmetricKeyCryptoAsyncClient.decrypt(EncryptionAlgorithm.A128CBC, encryptResult.cipherText(), initializationVector, null, null) + .subscribe(decryptResult -> System.out.printf("Returned plainText size is %d bytes\n", decryptResult.plainText().length)); + }); + + //Block main thread to let async operations finish + Thread.sleep(5000); + } +} + diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperations.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperations.java new file mode 100644 index 000000000000..7658c7b65a9f --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/KeyWrapUnwrapOperations.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.keys.cryptography.models.KeyUnwrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapResult; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; +import com.azure.security.keyvault.keys.models.webkey.JsonWebKey; +import com.azure.security.keyvault.keys.models.webkey.KeyOperation; +import com.azure.security.keyvault.keys.models.webkey.KeyType; + +import javax.crypto.spec.SecretKeySpec; +import java.util.Arrays; +import java.util.Random; + + +/** + * Sample demonstrates how to set, get, update and delete a key. + */ +public class KeyWrapUnwrapOperations { + + /** + * Authenticates with the key vault and shows how to set, get, update and delete a key in the key vault. + * + * @param args Unused. Arguments to the program. + * @throws IllegalArgumentException when invalid key vault endpoint is passed. + * @throws InterruptedException when the thread is interrupted in sleep mode. + */ + public static void main(String[] args) throws InterruptedException, IllegalArgumentException { + + // Instantiate a key client that will be used to call the service. Notice that the client is using default Azure + // credentials. To make default credentials work, ensure that environment variables 'AZURE_CLIENT_ID', + // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .keyIdentifier("") + .buildAsyncClient(); + + byte[] plainText = new byte[100]; + new Random(0x1234567L).nextBytes(plainText); + + // Let's wrap a simple dummy key content. + cryptoAsyncClient.wrapKey(KeyWrapAlgorithm.RSA_OAEP, plainText) + .subscribe(keyWrapResult -> { + System.out.printf("Returned encrypted key size is %d bytes with algorithm %s\n", keyWrapResult.encryptedKey().length, keyWrapResult.algorithm().toString()); + //Let's decrypt the encrypted response. + cryptoAsyncClient.unwrapKey(KeyWrapAlgorithm.RSA_OAEP, keyWrapResult.encryptedKey()) + .subscribe(keyUnwrapResult -> System.out.printf("Returned unwrapped key size is %d bytes\n", keyUnwrapResult.key().length)); + }); + + Thread.sleep(5000); + + // Let's do Key Wrap and Unwrap operations with a symmetric key. + byte[] symmetrickeyContent = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; + byte[] keyContentToWrap = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, (byte) 0x88, (byte) 0x99, (byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF }; + + // Convert the symmetric key encoded content to Json Web key. + JsonWebKey symmetricKey = JsonWebKey.fromAes(new SecretKeySpec(symmetrickeyContent, "AES")) + .kty(KeyType.OCT) + .keyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY)); + + // Configure the symmetric key in a new crypto client. + CryptographyAsyncClient symmetricKeyCryptoAsyncClient = new CryptographyClientBuilder() + .jsonWebKey(symmetricKey) + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAsyncClient(); + + // Note the implementation of A128CBC in this library uses PKCS7 padding. + symmetricKeyCryptoAsyncClient.wrapKey(KeyWrapAlgorithm.A128KW, keyContentToWrap) + .subscribe(symKeyWrapResult -> { + System.out.printf("Returned encrypted key size is %d bytes with algorithm %s\n", symKeyWrapResult.encryptedKey().length, symKeyWrapResult.algorithm().toString()); + //Let's decrypt the encrypted response. + symmetricKeyCryptoAsyncClient.unwrapKey(KeyWrapAlgorithm.A128KW, symKeyWrapResult.encryptedKey()) + .subscribe(symKeyUnwrapResult -> System.out.printf("Returned unwrapped key size is %d bytes\n", symKeyUnwrapResult.key().length)); + }); + + //Block main thread to let async operations finish + Thread.sleep(5000); + } +} + diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperations.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperations.java new file mode 100644 index 000000000000..51a8b1e3b286 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/cryptography/SignVerifyOperations.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.keys.cryptography.models.SignResult; +import com.azure.security.keyvault.keys.cryptography.models.VerifyResult; +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Random; + +/** + * Sample demonstrates how to set, get, update and delete a key. + */ +public class SignVerifyOperations { + + /** + * Authenticates with the key vault and shows how to set, get, update and delete a key in the key vault. + * + * @param args Unused. Arguments to the program. + * @throws IllegalArgumentException when invalid key vault endpoint is passed. + * @throws InterruptedException when the thread is interrupted in sleep mode. + * @throws NoSuchAlgorithmException when the specified algorithm doesn't exist. + */ + public static void main(String[] args) throws InterruptedException, IllegalArgumentException, NoSuchAlgorithmException { + + // Instantiate a key client that will be used to call the service. Notice that the client is using default Azure + // credentials. To make default credentials work, ensure that environment variables 'AZURE_CLIENT_ID', + // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .keyIdentifier("") + .buildAsyncClient(); + + byte[] plainText = new byte[100]; + new Random(0x1234567L).nextBytes(plainText); + MessageDigest md = MessageDigest.getInstance("SHA-256"); + md.update(plainText); + byte[] digest = md.digest(); + + // Let's create a signature from a simple digest. + cryptoAsyncClient.sign(SignatureAlgorithm.RS256, digest) + .subscribe(signResult -> { + System.out.printf("Returned signature size is %d bytes with algorithm %s\n", signResult.signature().length, signResult.algorithm().toString()); + // Let's verify the signature against the digest. + cryptoAsyncClient.verify(SignatureAlgorithm.RS256, digest, signResult.signature()) + .subscribe(verifyResult -> System.out.printf("Signature verified : %s\n", verifyResult.isValid())); + }); + + Thread.sleep(4000); + + // We can sign the raw plain text data without having to create a digest + cryptoAsyncClient.sign(SignatureAlgorithm.RS256, digest) + .subscribe(signResult -> { + System.out.printf("Returned signature size is %d bytes with algorithm %s\n", signResult.signature().length, signResult.algorithm().toString()); + // Let's verify the signature against the raw plain text data. + cryptoAsyncClient.verify(SignatureAlgorithm.RS256, digest, signResult.signature()) + .subscribe(verifyDataResult -> System.out.printf("Signature verified : %s\n", verifyDataResult.isValid())); + }); + + //Block main thread to let async operations finish + Thread.sleep(4000); + } +} + 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 4e21a1d56a9d..639fb86f26f5 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 @@ -5,19 +5,16 @@ 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.security.keyvault.keys.models.DeletedKey; 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.webkey.KeyType; import io.netty.handler.codec.http.HttpResponseStatus; +import org.junit.Assert; import reactor.test.StepVerifier; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import static org.junit.Assert.assertEquals; @@ -33,21 +30,15 @@ protected void beforeTest() { beforeTestSetup(); if (interceptorManager.isPlaybackMode()) { - client = clientSetup(credentials -> new KeyClientBuilder() - .credential(credentials) - .endpoint(getEndpoint()) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient()); + client = clientSetup(pipeline -> new KeyClientBuilder() + .endpoint(getEndpoint()) + .pipeline(pipeline) + .buildAsyncClient()); } else { - client = clientSetup(credentials -> new KeyClientBuilder() - .credential(credentials) - .endpoint(getEndpoint()) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .addPolicy(new RetryPolicy()) - .buildAsyncClient()); + client = clientSetup(pipeline -> new KeyClientBuilder() + .pipeline(pipeline) + .endpoint(getEndpoint()) + .buildAsyncClient()); } } @@ -55,10 +46,9 @@ protected void beforeTest() { * Tests that a key can be created in the key vault. */ public void setKey() { - setKeyRunner((expected) -> StepVerifier.create(client.createKey(expected)) - .assertNext(response -> assertKeyEquals(expected, response)) - .verifyComplete()); + .assertNext(response -> assertKeyEquals(expected, response)) + .verifyComplete()); } /** @@ -66,19 +56,17 @@ 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, + HttpResponseStatus.BAD_REQUEST.code())); } /** * 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, + HttpResponseStatus.BAD_REQUEST.code()))); } /** @@ -94,19 +82,19 @@ public void setKeyNull() { public void updateKey() { updateKeyRunner((original, updated) -> { StepVerifier.create(client.createKey(original)) - .assertNext(response -> assertKeyEquals(original, response)) - .verifyComplete(); - Key keyToUpdate = client.getKey(original.name()).block().value(); + .assertNext(response -> assertKeyEquals(original, response)) + .verifyComplete(); + Key keyToUpdate = client.getKey(original.name()).block(); StepVerifier.create(client.updateKey(keyToUpdate.expires(updated.expires()))) - .assertNext(response -> { - assertNotNull(response.value()); - assertEquals(original.name(), response.value().name()); - }).verifyComplete(); + .assertNext(response -> { + assertNotNull(response); + assertEquals(original.name(), response.name()); + }).verifyComplete(); StepVerifier.create(client.getKey(original.name())) - .assertNext(updatedKeyResponse -> assertKeyEquals(updated, updatedKeyResponse)) - .verifyComplete(); + .assertNext(updatedKeyResponse -> assertKeyEquals(updated, updatedKeyResponse)) + .verifyComplete(); }); } @@ -116,19 +104,19 @@ public void updateKey() { public void updateDisabledKey() { updateDisabledKeyRunner((original, updated) -> { StepVerifier.create(client.createKey(original)) - .assertNext(response -> assertKeyEquals(original, response)) - .verifyComplete(); - Key keyToUpdate = client.getKey(original.name()).block().value(); + .assertNext(response -> assertKeyEquals(original, response)) + .verifyComplete(); + Key keyToUpdate = client.getKey(original.name()).block(); StepVerifier.create(client.updateKey(keyToUpdate.expires(updated.expires()))) - .assertNext(response -> { - assertNotNull(response.value()); - assertEquals(original.name(), response.value().name()); - }).verifyComplete(); + .assertNext(response -> { + assertNotNull(response); + assertEquals(original.name(), response.name()); + }).verifyComplete(); StepVerifier.create(client.getKey(original.name())) - .assertNext(updatedKeyResponse -> assertKeyEquals(updated, updatedKeyResponse)) - .verifyComplete(); + .assertNext(updatedKeyResponse -> assertKeyEquals(updated, updatedKeyResponse)) + .verifyComplete(); }); } @@ -140,8 +128,8 @@ public void getKey() { getKeyRunner((original) -> { client.createKey(original); StepVerifier.create(client.getKey(original.name())) - .assertNext(response -> assertKeyEquals(original, response)) - .verifyComplete(); + .assertNext(response -> assertKeyEquals(original, response)) + .verifyComplete(); }); } @@ -150,16 +138,16 @@ public void getKey() { */ public void getKeySpecificVersion() { getKeySpecificVersionRunner((key, keyWithNewVal) -> { - final Key keyVersionOne = client.createKey(key).block().value(); - final Key keyVersionTwo = client.createKey(keyWithNewVal).block().value(); + final Key keyVersionOne = client.createKey(key).block(); + final Key keyVersionTwo = client.createKey(keyWithNewVal).block(); StepVerifier.create(client.getKey(key.name(), keyVersionOne.version())) - .assertNext(response -> assertKeyEquals(key, response)) - .verifyComplete(); + .assertNext(response -> assertKeyEquals(key, response)) + .verifyComplete(); StepVerifier.create(client.getKey(keyWithNewVal.name(), keyVersionTwo.version())) - .assertNext(response -> assertKeyEquals(keyWithNewVal, response)) - .verifyComplete(); + .assertNext(response -> assertKeyEquals(keyWithNewVal, response)) + .verifyComplete(); }); } @@ -168,7 +156,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, HttpResponseStatus.NOT_FOUND.code())); } @@ -178,31 +166,27 @@ public void getKeyNotFound() { public void deleteKey() { deleteKeyRunner((keyToDelete) -> { StepVerifier.create(client.createKey(keyToDelete)) - .assertNext(keyResponse -> { - assertKeyEquals(keyToDelete, keyResponse.value()); - }).verifyComplete(); + .assertNext(keyResponse -> assertKeyEquals(keyToDelete, keyResponse)).verifyComplete(); StepVerifier.create(client.deleteKey(keyToDelete.name())) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey.deletedDate()); - assertNotNull(deletedKey.recoveryId()); - assertNotNull(deletedKey.scheduledPurgeDate()); - assertEquals(keyToDelete.name(), deletedKey.name()); - }).verifyComplete(); + .assertNext(deletedKeyResponse -> { + assertNotNull(deletedKeyResponse.deletedDate()); + assertNotNull(deletedKeyResponse.recoveryId()); + assertNotNull(deletedKeyResponse.scheduledPurgeDate()); + assertEquals(keyToDelete.name(), deletedKeyResponse.name()); + }).verifyComplete(); sleepInRecordMode(30000); StepVerifier.create(client.purgeDeletedKey(keyToDelete.name())) - .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); - }).verifyComplete(); + .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), + 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, HttpResponseStatus.NOT_FOUND.code())); } /** @@ -210,7 +194,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, HttpResponseStatus.NOT_FOUND.code())); } /** @@ -219,24 +203,18 @@ public void getDeletedKeyNotFound() { public void recoverDeletedKey() { recoverDeletedKeyRunner((keyToDeleteAndRecover) -> { StepVerifier.create(client.createKey(keyToDeleteAndRecover)) - .assertNext(keyResponse -> { - assertKeyEquals(keyToDeleteAndRecover, keyResponse.value()); - }).verifyComplete(); + .assertNext(keyResponse -> assertKeyEquals(keyToDeleteAndRecover, keyResponse)).verifyComplete(); StepVerifier.create(client.deleteKey(keyToDeleteAndRecover.name())) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); sleepInRecordMode(30000); StepVerifier.create(client.recoverDeletedKey(keyToDeleteAndRecover.name())) - .assertNext(keyResponse -> { - Key recoveredKey = keyResponse.value(); - assertEquals(keyToDeleteAndRecover.name(), recoveredKey.name()); - assertEquals(keyToDeleteAndRecover.notBefore(), recoveredKey.notBefore()); - assertEquals(keyToDeleteAndRecover.expires(), recoveredKey.expires()); - }).verifyComplete(); + .assertNext(keyResponse -> { + assertEquals(keyToDeleteAndRecover.name(), keyResponse.name()); + assertEquals(keyToDeleteAndRecover.notBefore(), keyResponse.notBefore()); + assertEquals(keyToDeleteAndRecover.expires(), keyResponse.expires()); + }).verifyComplete(); }); } @@ -245,7 +223,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, HttpResponseStatus.NOT_FOUND.code())); } /** @@ -254,16 +232,13 @@ public void recoverDeletedKeyNotFound() { public void backupKey() { backupKeyRunner((keyToBackup) -> { StepVerifier.create(client.createKey(keyToBackup)) - .assertNext(keyResponse -> { - assertKeyEquals(keyToBackup, keyResponse.value()); - }).verifyComplete(); + .assertNext(keyResponse -> assertKeyEquals(keyToBackup, keyResponse)).verifyComplete(); StepVerifier.create(client.backupKey(keyToBackup.name())) - .assertNext(response -> { - byte[] backupBytes = response.value(); - assertNotNull(backupBytes); - assertTrue(backupBytes.length > 0); - }).verifyComplete(); + .assertNext(response -> { + assertNotNull(response); + assertTrue(response.length > 0); + }).verifyComplete(); }); } @@ -272,7 +247,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, HttpResponseStatus.NOT_FOUND.code())); } /** @@ -281,33 +256,26 @@ public void backupKeyNotFound() { public void restoreKey() { restoreKeyRunner((keyToBackupAndRestore) -> { StepVerifier.create(client.createKey(keyToBackupAndRestore)) - .assertNext(keyResponse -> { - assertKeyEquals(keyToBackupAndRestore, keyResponse.value()); - }).verifyComplete(); - byte[] backup = client.backupKey(keyToBackupAndRestore.name()).block().value(); + .assertNext(keyResponse -> assertKeyEquals(keyToBackupAndRestore, keyResponse)).verifyComplete(); + byte[] backup = client.backupKey(keyToBackupAndRestore.name()).block(); StepVerifier.create(client.deleteKey(keyToBackupAndRestore.name())) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); pollOnKeyDeletion(keyToBackupAndRestore.name()); StepVerifier.create(client.purgeDeletedKey(keyToBackupAndRestore.name())) - .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); - }).verifyComplete(); + .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), + voidResponse.statusCode())).verifyComplete(); pollOnKeyPurge(keyToBackupAndRestore.name()); sleepInRecordMode(60000); StepVerifier.create(client.restoreKey(backup)) - .assertNext(response -> { - Key restoredKey = response.value(); - assertEquals(keyToBackupAndRestore.name(), restoredKey.name()); - assertEquals(keyToBackupAndRestore.notBefore(), restoredKey.notBefore()); - assertEquals(keyToBackupAndRestore.expires(), restoredKey.expires()); - }).verifyComplete(); + .assertNext(response -> { + assertEquals(keyToBackupAndRestore.name(), response.name()); + assertEquals(keyToBackupAndRestore.notBefore(), response.notBefore()); + assertEquals(keyToBackupAndRestore.expires(), response.expires()); + }).verifyComplete(); }); } @@ -317,7 +285,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, HttpResponseStatus.BAD_REQUEST.code())); } /** @@ -327,31 +295,24 @@ public void getDeletedKey() { getDeletedKeyRunner((keyToDeleteAndGet) -> { StepVerifier.create(client.createKey(keyToDeleteAndGet)) - .assertNext(keyResponse -> { - assertKeyEquals(keyToDeleteAndGet, keyResponse.value()); - }).verifyComplete(); + .assertNext(keyResponse -> assertKeyEquals(keyToDeleteAndGet, keyResponse)).verifyComplete(); StepVerifier.create(client.deleteKey(keyToDeleteAndGet.name())) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); pollOnKeyDeletion(keyToDeleteAndGet.name()); sleepInRecordMode(30000); StepVerifier.create(client.getDeletedKey(keyToDeleteAndGet.name())) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey.deletedDate()); - assertNotNull(deletedKey.recoveryId()); - assertNotNull(deletedKey.scheduledPurgeDate()); - assertEquals(keyToDeleteAndGet.name(), deletedKey.name()); - }).verifyComplete(); + .assertNext(deletedKeyResponse -> { + assertNotNull(deletedKeyResponse.deletedDate()); + assertNotNull(deletedKeyResponse.recoveryId()); + assertNotNull(deletedKeyResponse.scheduledPurgeDate()); + assertEquals(keyToDeleteAndGet.name(), deletedKeyResponse.name()); + }).verifyComplete(); StepVerifier.create(client.purgeDeletedKey(keyToDeleteAndGet.name())) - .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); - }).verifyComplete(); + .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), + voidResponse.statusCode())).verifyComplete(); pollOnKeyPurge(keyToDeleteAndGet.name()); sleepInRecordMode(15000); }); @@ -364,22 +325,16 @@ public void getDeletedKey() { public void listDeletedKeys() { listDeletedKeysRunner((keys) -> { - HashMap keysToDelete = keys; List deletedKeys = new ArrayList<>(); - for (KeyCreateOptions key : keysToDelete.values()) { + for (KeyCreateOptions key : keys.values()) { StepVerifier.create(client.createKey(key)) - .assertNext(keyResponse -> { - assertKeyEquals(key, keyResponse.value()); - }).verifyComplete(); + .assertNext(keyResponse -> assertKeyEquals(key, keyResponse)).verifyComplete(); } sleepInRecordMode(10000); - for (KeyCreateOptions key : keysToDelete.values()) { + for (KeyCreateOptions key : keys.values()) { StepVerifier.create(client.deleteKey(key.name())) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); pollOnKeyDeletion(key.name()); } @@ -388,20 +343,19 @@ public void listDeletedKeys() { sleepInRecordMode(30000); for (DeletedKey actualKey : deletedKeys) { - if (keysToDelete.containsKey(actualKey.name())) { + if (keys.containsKey(actualKey.name())) { assertNotNull(actualKey.deletedDate()); assertNotNull(actualKey.recoveryId()); - keysToDelete.remove(actualKey.name()); + keys.remove(actualKey.name()); } } - assertEquals(0, keysToDelete.size()); + assertEquals(0, keys.size()); for (DeletedKey deletedKey : deletedKeys) { StepVerifier.create(client.purgeDeletedKey(deletedKey.name())) - .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); - }).verifyComplete(); + .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), + voidResponse.statusCode())).verifyComplete(); pollOnKeyPurge(deletedKey.name()); } }); @@ -413,32 +367,27 @@ public void listDeletedKeys() { @Override public void listKeyVersions() { listKeyVersionsRunner((keys) -> { - List keyVersions = keys; List output = new ArrayList<>(); String keyName = null; - for (KeyCreateOptions key : keyVersions) { + for (KeyCreateOptions key : keys) { keyName = key.name(); - client.createKey(key).subscribe(keyResponse -> assertKeyEquals(key, keyResponse.value())); + client.createKey(key).subscribe(keyResponse -> assertKeyEquals(key, keyResponse)); sleepInRecordMode(1000); } sleepInRecordMode(30000); client.listKeyVersions(keyName).subscribe(output::add); sleepInRecordMode(30000); - assertEquals(keyVersions.size(), output.size()); + assertEquals(keys.size(), output.size()); StepVerifier.create(client.deleteKey(keyName)) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); pollOnKeyDeletion(keyName); StepVerifier.create(client.purgeDeletedKey(keyName)) - .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); - }).verifyComplete(); + .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), + voidResponse.statusCode())).verifyComplete(); pollOnKeyPurge(keyName); }); @@ -449,10 +398,9 @@ public void listKeyVersions() { */ public void listKeys() { listKeysRunner((keys) -> { - HashMap keysToList = keys; List output = new ArrayList<>(); - for (KeyCreateOptions key : keysToList.values()) { - client.createKey(key).subscribe(keyResponse -> assertKeyEquals(key, keyResponse.value())); + for (KeyCreateOptions key : keys.values()) { + client.createKey(key).subscribe(keyResponse -> assertKeyEquals(key, keyResponse)); sleepInRecordMode(1000); } sleepInRecordMode(30000); @@ -471,43 +419,40 @@ public void listKeys() { }); } - private DeletedKey pollOnKeyDeletion(String keyName) { + private void pollOnKeyDeletion(String keyName) { int pendingPollCount = 0; while (pendingPollCount < 30) { DeletedKey deletedKey = null; try { - deletedKey = client.getDeletedKey(keyName).block().value(); + deletedKey = client.getDeletedKeyWithResponse(keyName).block().value(); } catch (ResourceNotFoundException e) { } if (deletedKey == null) { sleepInRecordMode(2000); pendingPollCount += 1; - continue; } else { - return deletedKey; + return; } } System.err.printf("Deleted Key %s not found \n", keyName); - return null; } - private DeletedKey pollOnKeyPurge(String keyName) { + private void pollOnKeyPurge(String keyName) { int pendingPollCount = 0; while (pendingPollCount < 10) { DeletedKey deletedKey = null; try { - deletedKey = client.getDeletedKey(keyName).block().value(); + deletedKey = client.getDeletedKeyWithResponse(keyName).block().value(); } catch (ResourceNotFoundException e) { } if (deletedKey != null) { sleepInRecordMode(2000); pendingPollCount += 1; - continue; } else { - return deletedKey; + return; } } System.err.printf("Deleted Key %s was not purged \n", keyName); - return null; } } + diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java index a07fa17a52de..fb52b12a36ea 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 @@ -5,9 +5,6 @@ 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.security.keyvault.keys.models.DeletedKey; import com.azure.security.keyvault.keys.models.Key; import com.azure.security.keyvault.keys.models.KeyBase; @@ -32,20 +29,14 @@ protected void beforeTest() { beforeTestSetup(); if (interceptorManager.isPlaybackMode()) { - client = clientSetup(credentials -> new KeyClientBuilder() - .credential(credentials) + client = clientSetup(pipeline -> new KeyClientBuilder() .endpoint(getEndpoint()) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .pipeline(pipeline) .buildClient()); } else { - client = clientSetup(credentials -> new KeyClientBuilder() - .credential(credentials) + client = clientSetup(pipeline -> new KeyClientBuilder() .endpoint(getEndpoint()) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .addPolicy(new RetryPolicy()) + .pipeline(pipeline) .buildClient()); } } @@ -86,7 +77,7 @@ public void setKeyNull() { public void updateKey() { updateKeyRunner((original, updated) -> { assertKeyEquals(original, client.createKey(original)); - Key keyToUpdate = client.getKey(original.name()).value(); + Key keyToUpdate = client.getKey(original.name()); client.updateKey(keyToUpdate.expires(updated.expires())); assertKeyEquals(updated, client.getKey(original.name())); }); @@ -98,7 +89,7 @@ public void updateKey() { public void updateDisabledKey() { updateDisabledKeyRunner((original, updated) -> { assertKeyEquals(original, client.createKey(original)); - Key keyToUpdate = client.getKey(original.name()).value(); + Key keyToUpdate = client.getKey(original.name()); client.updateKey(keyToUpdate.expires(updated.expires())); assertKeyEquals(updated, client.getKey(original.name())); }); @@ -119,8 +110,8 @@ public void getKey() { */ public void getKeySpecificVersion() { getKeySpecificVersionRunner((key, keyWithNewVal) -> { - Key keyVersionOne = client.createKey(key).value(); - Key keyVersionTwo = client.createKey(keyWithNewVal).value(); + Key keyVersionOne = client.createKey(key); + Key keyVersionTwo = client.createKey(keyWithNewVal); assertKeyEquals(key, client.getKey(keyVersionOne.name(), keyVersionOne.version())); assertKeyEquals(keyWithNewVal, client.getKey(keyVersionTwo.name(), keyVersionTwo.version())); }); @@ -139,7 +130,7 @@ public void getKeyNotFound() { public void deleteKey() { deleteKeyRunner((keyToDelete) -> { assertKeyEquals(keyToDelete, client.createKey(keyToDelete)); - DeletedKey deletedKey = client.deleteKey(keyToDelete.name()).value(); + DeletedKey deletedKey = client.deleteKey(keyToDelete.name()); pollOnKeyDeletion(keyToDelete.name()); assertNotNull(deletedKey.deletedDate()); assertNotNull(deletedKey.recoveryId()); @@ -169,9 +160,9 @@ public void getDeletedKeyNotFound() { public void recoverDeletedKey() { recoverDeletedKeyRunner((keyToDeleteAndRecover) -> { assertKeyEquals(keyToDeleteAndRecover, client.createKey(keyToDeleteAndRecover)); - assertNotNull(client.deleteKey(keyToDeleteAndRecover.name()).value()); + assertNotNull(client.deleteKey(keyToDeleteAndRecover.name())); pollOnKeyDeletion(keyToDeleteAndRecover.name()); - Key recoveredKey = client.recoverDeletedKey(keyToDeleteAndRecover.name()).value(); + Key recoveredKey = client.recoverDeletedKey(keyToDeleteAndRecover.name()); assertEquals(keyToDeleteAndRecover.name(), recoveredKey.name()); assertEquals(keyToDeleteAndRecover.notBefore(), recoveredKey.notBefore()); assertEquals(keyToDeleteAndRecover.expires(), recoveredKey.expires()); @@ -191,7 +182,7 @@ public void recoverDeletedKeyNotFound() { public void backupKey() { backupKeyRunner((keyToBackup) -> { assertKeyEquals(keyToBackup, client.createKey(keyToBackup)); - byte[] backupBytes = (client.backupKey(keyToBackup.name()).value()); + byte[] backupBytes = (client.backupKey(keyToBackup.name())); assertNotNull(backupBytes); assertTrue(backupBytes.length > 0); }); @@ -210,7 +201,7 @@ public void backupKeyNotFound() { public void restoreKey() { restoreKeyRunner((keyToBackupAndRestore) -> { assertKeyEquals(keyToBackupAndRestore, client.createKey(keyToBackupAndRestore)); - byte[] backupBytes = (client.backupKey(keyToBackupAndRestore.name()).value()); + byte[] backupBytes = (client.backupKey(keyToBackupAndRestore.name())); assertNotNull(backupBytes); assertTrue(backupBytes.length > 0); client.deleteKey(keyToBackupAndRestore.name()); @@ -218,7 +209,7 @@ public void restoreKey() { client.purgeDeletedKey(keyToBackupAndRestore.name()); pollOnKeyPurge(keyToBackupAndRestore.name()); sleepInRecordMode(60000); - Key restoredKey = client.restoreKey(backupBytes).value(); + Key restoredKey = client.restoreKey(backupBytes); assertEquals(keyToBackupAndRestore.name(), restoredKey.name()); assertEquals(keyToBackupAndRestore.expires(), restoredKey.expires()); }); @@ -261,10 +252,10 @@ public void listKeys() { public void getDeletedKey() { getDeletedKeyRunner((keyToDeleteAndGet) -> { assertKeyEquals(keyToDeleteAndGet, client.createKey(keyToDeleteAndGet)); - assertNotNull(client.deleteKey(keyToDeleteAndGet.name()).value()); + assertNotNull(client.deleteKey(keyToDeleteAndGet.name())); pollOnKeyDeletion(keyToDeleteAndGet.name()); sleepInRecordMode(30000); - DeletedKey deletedKey = client.getDeletedKey(keyToDeleteAndGet.name()).value(); + DeletedKey deletedKey = client.getDeletedKey(keyToDeleteAndGet.name()); assertNotNull(deletedKey.deletedDate()); assertNotNull(deletedKey.recoveryId()); assertNotNull(deletedKey.scheduledPurgeDate()); @@ -343,7 +334,7 @@ private DeletedKey pollOnKeyDeletion(String keyName) { while (pendingPollCount < 30) { DeletedKey deletedKey = null; try { - deletedKey = client.getDeletedKey(keyName).value(); + deletedKey = client.getDeletedKey(keyName); } catch (ResourceNotFoundException e) { } if (deletedKey == null) { @@ -363,7 +354,7 @@ private DeletedKey pollOnKeyPurge(String keyName) { while (pendingPollCount < 10) { DeletedKey deletedKey = null; try { - deletedKey = client.getDeletedKey(keyName).value(); + deletedKey = client.getDeletedKey(keyName); } catch (ResourceNotFoundException e) { } if (deletedKey != null) { 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 157d2e58e48e..8f0e05d388ad 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 @@ -6,9 +6,16 @@ import com.azure.core.credentials.AccessToken; import com.azure.core.credentials.TokenCredential; import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.*; import com.azure.core.http.rest.Response; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.test.TestBase; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.security.keyvault.keys.implementation.AzureKeyVaultConfiguration; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.keys.models.Key; import com.azure.security.keyvault.keys.models.KeyCreateOptions; import com.azure.security.keyvault.keys.models.webkey.KeyType; @@ -29,9 +36,7 @@ import java.util.function.Consumer; import java.util.function.Function; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; public abstract class KeyClientTestBase extends TestBase { @@ -50,7 +55,7 @@ protected String testName() { void beforeTestSetup() { } - T clientSetup(Function clientBuilder) { + T clientSetup(Function clientBuilder) { final String endpoint = interceptorManager.isPlaybackMode() ? "http://localhost:8080" : System.getenv("AZURE_KEYVAULT_ENDPOINT"); @@ -60,11 +65,35 @@ T clientSetup(Function clientBuilder) { if (interceptorManager.isPlaybackMode()) { credential = resource -> Mono.just(new AccessToken("Some fake token", OffsetDateTime.now(ZoneOffset.UTC).plus(Duration.ofMinutes(30)))); } else { - credential = new DefaultAzureCredential(); + credential = new DefaultAzureCredentialBuilder().build(); } + HttpClient httpClient; + // 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, ConfigurationManager.getConfiguration().clone())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(new RetryPolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, KeyAsyncClient.KEY_VAULT_SCOPE)); + policies.addAll(policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(HttpLogDetailLevel.BODY_AND_HEADERS)); + + if (interceptorManager.isPlaybackMode()) { + httpClient = interceptorManager.getPlaybackClient(); + policies.add(interceptorManager.getRecordPolicy()); + } else { + httpClient = HttpClient.createDefault().wiretap(true); + policies.add(interceptorManager.getRecordPolicy()); + } + + HttpPipeline pipeline = new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); + T client; - client = clientBuilder.apply(credential); + client = clientBuilder.apply(pipeline); return Objects.requireNonNull(client); } diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java new file mode 100644 index 000000000000..4a8215394e18 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTest.java @@ -0,0 +1,528 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.exception.ResourceNotFoundException; +import com.azure.core.http.HttpPipeline; +import com.azure.core.util.Context; +import com.azure.security.keyvault.keys.KeyClient; +import com.azure.security.keyvault.keys.KeyClientBuilder; +import com.azure.security.keyvault.keys.cryptography.models.EncryptionAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.KeyWrapAlgorithm; +import com.azure.security.keyvault.keys.cryptography.models.SignatureAlgorithm; +import com.azure.security.keyvault.keys.models.DeletedKey; +import com.azure.security.keyvault.keys.models.Key; +import com.azure.security.keyvault.keys.models.webkey.JsonWebKey; +import com.azure.security.keyvault.keys.models.webkey.KeyCurveName; +import com.azure.security.keyvault.keys.models.webkey.KeyOperation; +import com.azure.security.keyvault.keys.models.webkey.KeyType; + +import javax.crypto.spec.SecretKeySpec; +import java.security.*; +import java.security.spec.ECGenParameterSpec; +import java.util.*; + +import static org.junit.Assert.*; + +public class CryptographyClientTest extends CryptographyClientTestBase { + + private KeyClient client; + private HttpPipeline pipeline; + + @Override + protected void beforeTest() { + beforeTestSetup(); + if (interceptorManager.isPlaybackMode()) { + client = clientSetup(pipeline -> { + this.pipeline = pipeline; + return new KeyClientBuilder() + .pipeline(pipeline) + .endpoint(getEndpoint()) + .buildClient(); + }); + } else { + client = clientSetup(pipeline -> { + this.pipeline = pipeline; + return new KeyClientBuilder() + .pipeline(pipeline) + .endpoint(getEndpoint()) + .buildClient(); + }); + } + } + + @Override + public void encryptDecryptRsa() throws Exception { + encryptDecryptRsaRunner(keyPair -> { + JsonWebKey key = JsonWebKey.fromRSA(keyPair); + String keyName = "testRsaKey"; + Key importedKey = client.importKey(keyName, key); + key.kid(importedKey.id()); + key.keyOps(importedKey.keyMaterial().keyOps()); + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .pipeline(pipeline) + .jsonWebKey(key) + .buildClient(); + CryptographyServiceClient serviceClient = cryptoClient.getServiceClient(); + + List algorithms = Arrays.asList(EncryptionAlgorithm.RSA1_5, EncryptionAlgorithm.RSA_OAEP, EncryptionAlgorithm.RSA_OAEP_256); + + for (EncryptionAlgorithm algorithm : algorithms) { + // Test variables + byte[] plainText = new byte[100]; + new Random(0x1234567L).nextBytes(plainText); + byte[] cipherText = cryptoClient.encrypt(algorithm, plainText).cipherText(); + byte[] decryptedText = serviceClient.decrypt(algorithm, cipherText, Context.NONE).block().plainText(); + + assertArrayEquals(decryptedText, plainText); + + cipherText = serviceClient.encrypt(algorithm, plainText, Context.NONE).block().cipherText(); + decryptedText = cryptoClient.decrypt(algorithm, cipherText).plainText(); + + assertArrayEquals(decryptedText, plainText); + } + + client.deleteKey(keyName); + pollOnKeyDeletion(keyName); + client.purgeDeletedKey(keyName); + pollOnKeyPurge(keyName); + }); + } + + @Override + public void wrapUnwraptRsa() throws Exception { + encryptDecryptRsaRunner(keyPair -> { + JsonWebKey key = JsonWebKey.fromRSA(keyPair); + String keyName = "testRsaKeyWrapUnwrap"; + Key importedKey = client.importKey(keyName, key); + key.kid(importedKey.id()); + key.keyOps(importedKey.keyMaterial().keyOps()); + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .pipeline(pipeline) + .jsonWebKey(key) + .buildClient(); + CryptographyServiceClient serviceClient = cryptoClient.getServiceClient(); + + List algorithms = Arrays.asList(KeyWrapAlgorithm.RSA1_5, KeyWrapAlgorithm.RSA_OAEP, KeyWrapAlgorithm.RSA_OAEP_256); + + for (KeyWrapAlgorithm algorithm : algorithms) { + // Test variables + byte[] plainText = new byte[100]; + new Random(0x1234567L).nextBytes(plainText); + byte[] encryptedKey = cryptoClient.wrapKey(algorithm, plainText).encryptedKey(); + byte[] decryptedKey = serviceClient.unwrapKey(algorithm, encryptedKey, Context.NONE).block().key(); + + assertArrayEquals(decryptedKey, plainText); + + encryptedKey = serviceClient.wrapKey(algorithm, plainText, Context.NONE).block().encryptedKey(); + decryptedKey = cryptoClient.unwrapKey(algorithm, encryptedKey).key(); + + assertArrayEquals(decryptedKey, plainText); + } + + client.deleteKey(keyName); + pollOnKeyDeletion(keyName); + client.purgeDeletedKey(keyName); + pollOnKeyPurge(keyName); + }); + } + + + @Override + public void signVerifyRsa() throws Exception { + encryptDecryptRsaRunner(keyPair -> { + JsonWebKey key = JsonWebKey.fromRSA(keyPair); + String keyName = "testRsaKeySignVerify"; + Key importedKey = client.importKey(keyName, key); + key.kid(importedKey.id()); + key.keyOps(importedKey.keyMaterial().keyOps()); + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .pipeline(pipeline) + .jsonWebKey(key) + .buildClient(); + CryptographyServiceClient serviceClient = cryptoClient.getServiceClient(); + + List algorithms = Arrays.asList(SignatureAlgorithm.RS256, SignatureAlgorithm.RS384, SignatureAlgorithm.RS512); + + for (SignatureAlgorithm algorithm : algorithms) { + // Test variables + byte[] plainText = new byte[100]; + new Random(0x1234567L).nextBytes(plainText); + byte[] signature = cryptoClient.signData(algorithm, plainText).signature(); + Boolean verifyStatus = serviceClient.verifyData(algorithm, plainText, signature, Context.NONE).block().isValid(); + + assertTrue(verifyStatus); + + signature = serviceClient.signData(algorithm, plainText, Context.NONE).block().signature(); + verifyStatus = cryptoClient.verifyData(algorithm, plainText, signature).isValid(); + + assertTrue(verifyStatus); + } + + client.deleteKey(keyName); + pollOnKeyDeletion(keyName); + client.purgeDeletedKey(keyName); + pollOnKeyPurge(keyName); + }); + } + + @Override + public void signVerifyEc() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException { + Map curveToSignature = new HashMap<>(); + curveToSignature.put(KeyCurveName.P_256, SignatureAlgorithm.ES256); + curveToSignature.put(KeyCurveName.P_384, SignatureAlgorithm.ES384); + curveToSignature.put(KeyCurveName.P_521, SignatureAlgorithm.ES512); + curveToSignature.put(KeyCurveName.P_256K, SignatureAlgorithm.ES256K); + + Map curveToSpec = new HashMap<>(); + curveToSpec.put(KeyCurveName.P_256, "secp256r1"); + curveToSpec.put(KeyCurveName.P_384, "secp384r1"); + curveToSpec.put(KeyCurveName.P_521, "secp521r1"); + curveToSpec.put(KeyCurveName.P_256K, "secp256k1"); + + List curveList = Arrays.asList(KeyCurveName.P_256, KeyCurveName.P_384, KeyCurveName.P_521, KeyCurveName.P_256K); + Provider provider = Security.getProvider("SunEC"); + for (KeyCurveName crv : curveList) { + + final KeyPairGenerator generator = KeyPairGenerator.getInstance("EC", provider); + ECGenParameterSpec gps = new ECGenParameterSpec(curveToSpec.get(crv)); + generator.initialize(gps); + KeyPair keyPair = generator.generateKeyPair(); + + JsonWebKey key = JsonWebKey.fromEC(keyPair, provider); + String keyName = "testEcKey" + crv.toString(); + Key imported = client.importKey(keyName, key); + key.kid(imported.id()); + key.keyOps(imported.keyMaterial().keyOps()); + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .pipeline(pipeline) + .jsonWebKey(key) + .buildClient(); + CryptographyServiceClient serviceClient = cryptoClient.getServiceClient(); + + byte[] plainText = new byte[100]; + new Random(0x1234567L).nextBytes(plainText); + + byte[] signature = cryptoClient.signData(curveToSignature.get(crv), plainText).signature(); + + Boolean verifyStatus = serviceClient.verifyData(curveToSignature.get(crv), plainText, signature, Context.NONE).block().isValid(); + assertTrue(verifyStatus); + + signature = serviceClient.signData(curveToSignature.get(crv), plainText, Context.NONE).block().signature(); + verifyStatus = cryptoClient.verifyData(curveToSignature.get(crv), plainText, signature).isValid(); + if (!interceptorManager.isPlaybackMode()) { + assertTrue(verifyStatus); + } + + client.deleteKey(keyName); + pollOnKeyDeletion(keyName); + client.purgeDeletedKey(keyName); + pollOnKeyPurge(keyName); + } + + } + + @Override + public void wrapUnwrapSymmetricKeyAES128Kw() { + // Arrange + byte[] kek = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}; + byte[] cek = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, (byte) 0x88, (byte) 0x99, (byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF}; + byte[] ek = {0x1F, (byte) 0xA6, (byte) 0x8B, 0x0A, (byte) 0x81, 0x12, (byte) 0xB4, 0x47, (byte) 0xAE, (byte) 0xF3, 0x4B, (byte) 0xD8, (byte) 0xFB, 0x5A, 0x7B, (byte) 0x82, (byte) 0x9D, 0x3E, (byte) 0x86, 0x23, 0x71, (byte) 0xD2, (byte) 0xCF, (byte) 0xE5}; + + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .pipeline(pipeline) + .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(kek, "AES")) + .kty(KeyType.OCT) + .keyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY))) + .buildClient(); + + byte[] encrypted = cryptoClient.wrapKey(KeyWrapAlgorithm.A128KW, cek).encryptedKey(); + + assertArrayEquals(ek, encrypted); + + byte[] decrypted = cryptoClient.unwrapKey(KeyWrapAlgorithm.A128KW, encrypted).key(); + + assertArrayEquals(cek, decrypted); + } + + @Override + public void wrapUnwrapSymmetricKeyAES192Kw() { + // Arrange + byte[] kek = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17 }; + byte[] cek = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, (byte) 0x88, (byte) 0x99, (byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF }; + byte[] ek = { (byte) 0x96, 0x77, (byte) 0x8B, 0x25, (byte) 0xAE, 0x6C, (byte) 0xA4, 0x35, (byte) 0xF9, 0x2B, 0x5B, (byte) 0x97, (byte) 0xC0, 0x50, (byte) 0xAE, (byte) 0xD2, 0x46, (byte) 0x8A, (byte) 0xB8, (byte) 0xA1, 0x7A, (byte) 0xD8, 0x4E, 0x5D }; + + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .pipeline(pipeline) + .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(kek, "AES")) + .kty(KeyType.OCT) + .keyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY))) + .buildClient(); + + byte[] encrypted = cryptoClient.wrapKey(KeyWrapAlgorithm.A192KW, cek).encryptedKey(); + + assertArrayEquals(ek, encrypted); + + byte[] decrypted = cryptoClient.unwrapKey(KeyWrapAlgorithm.A192KW, encrypted).key(); + + assertArrayEquals(cek, decrypted); + } + + @Override + public void wrapUnwrapSymmetricKeyAES256Kw() { + // Arrange + byte[] kek = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F }; + byte[] cek = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, (byte) 0x88, (byte) 0x99, (byte) 0xAA, (byte) 0xBB, (byte) 0xCC, (byte) 0xDD, (byte) 0xEE, (byte) 0xFF }; + byte[] ek = { 0x64, (byte) 0xE8, (byte) 0xC3, (byte) 0xF9, (byte) 0xCE, 0x0F, 0x5B, (byte) 0xA2, 0x63, (byte) 0xE9, 0x77, 0x79, 0x05, (byte) 0x81, (byte) 0x8A, 0x2A, (byte) 0x93, (byte) 0xC8, 0x19, 0x1E, 0x7D, 0x6E, (byte) 0x8A, (byte) 0xE7 }; + + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .pipeline(pipeline) + .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(kek, "AES")) + .kty(KeyType.OCT) + .keyOps(Arrays.asList(KeyOperation.WRAP_KEY, KeyOperation.UNWRAP_KEY))) + .buildClient(); + + byte[] encrypted = cryptoClient.wrapKey(KeyWrapAlgorithm.A256KW, cek).encryptedKey(); + + assertArrayEquals(ek, encrypted); + + byte[] decrypted = cryptoClient.unwrapKey(KeyWrapAlgorithm.A256KW, encrypted).key(); + + assertArrayEquals(cek, decrypted); + } + + @Override + public void encryptDecryptSymmetricKeyAes128CbcHmacSha256() { + byte[] key = { + (byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08, (byte) 0x09, (byte) 0x0a, (byte) 0x0b, (byte) 0x0c, (byte) 0x0d, (byte) 0x0e, (byte) 0x0f, + (byte) 0x10, (byte) 0x11, (byte) 0x12, (byte) 0x13, (byte) 0x14, (byte) 0x15, (byte) 0x16, (byte) 0x17, (byte) 0x18, (byte) 0x19, (byte) 0x1a, (byte) 0x1b, (byte) 0x1c, (byte) 0x1d, (byte) 0x1e, (byte) 0x1f + }; + byte[] plaintext = {(byte) 0x41, (byte) 0x20, (byte) 0x63, (byte) 0x69, (byte) 0x70, (byte) 0x68, (byte) 0x65, (byte) 0x72, (byte) 0x20, (byte) 0x73, (byte) 0x79, (byte) 0x73, (byte) 0x74, (byte) 0x65, (byte) 0x6d, (byte) 0x20, + (byte) 0x6d, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x6e, (byte) 0x6f, (byte) 0x74, (byte) 0x20, (byte) 0x62, (byte) 0x65, (byte) 0x20, (byte) 0x72, (byte) 0x65, (byte) 0x71, (byte) 0x75, + (byte) 0x69, (byte) 0x72, (byte) 0x65, (byte) 0x64, (byte) 0x20, (byte) 0x74, (byte) 0x6f, (byte) 0x20, (byte) 0x62, (byte) 0x65, (byte) 0x20, (byte) 0x73, (byte) 0x65, (byte) 0x63, (byte) 0x72, (byte) 0x65, + (byte) 0x74, (byte) 0x2c, (byte) 0x20, (byte) 0x61, (byte) 0x6e, (byte) 0x64, (byte) 0x20, (byte) 0x69, (byte) 0x74, (byte) 0x20, (byte) 0x6d, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x62, + (byte) 0x65, (byte) 0x20, (byte) 0x61, (byte) 0x62, (byte) 0x6c, (byte) 0x65, (byte) 0x20, (byte) 0x74, (byte) 0x6f, (byte) 0x20, (byte) 0x66, (byte) 0x61, (byte) 0x6c, (byte) 0x6c, (byte) 0x20, (byte) 0x69, + (byte) 0x6e, (byte) 0x74, (byte) 0x6f, (byte) 0x20, (byte) 0x74, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x68, (byte) 0x61, (byte) 0x6e, (byte) 0x64, (byte) 0x73, (byte) 0x20, (byte) 0x6f, (byte) 0x66, + (byte) 0x20, (byte) 0x74, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x65, (byte) 0x6e, (byte) 0x65, (byte) 0x6d, (byte) 0x79, (byte) 0x20, (byte) 0x77, (byte) 0x69, (byte) 0x74, (byte) 0x68, (byte) 0x6f, + (byte) 0x75, (byte) 0x74, (byte) 0x20, (byte) 0x69, (byte) 0x6e, (byte) 0x63, (byte) 0x6f, (byte) 0x6e, (byte) 0x76, (byte) 0x65, (byte) 0x6e, (byte) 0x69, (byte) 0x65, (byte) 0x6e, (byte) 0x63, (byte) 0x65 + }; + byte[] iv = {(byte) 0x1a, (byte) 0xf3, (byte) 0x8c, (byte) 0x2d, (byte) 0xc2, (byte) 0xb9, (byte) 0x6f, (byte) 0xfd, (byte) 0xd8, (byte) 0x66, (byte) 0x94, (byte) 0x09, (byte) 0x23, (byte) 0x41, (byte) 0xbc, (byte) 0x04}; + byte[] authData = { + (byte) 0x54, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x73, (byte) 0x65, (byte) 0x63, (byte) 0x6f, (byte) 0x6e, (byte) 0x64, (byte) 0x20, (byte) 0x70, (byte) 0x72, (byte) 0x69, (byte) 0x6e, (byte) 0x63, + (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 + }; + byte[] expected = { + (byte) 0xc8, (byte) 0x0e, (byte) 0xdf, (byte) 0xa3, (byte) 0x2d, (byte) 0xdf, (byte) 0x39, (byte) 0xd5, (byte) 0xef, (byte) 0x00, (byte) 0xc0, (byte) 0xb4, (byte) 0x68, (byte) 0x83, (byte) 0x42, (byte) 0x79, + (byte) 0xa2, (byte) 0xe4, (byte) 0x6a, (byte) 0x1b, (byte) 0x80, (byte) 0x49, (byte) 0xf7, (byte) 0x92, (byte) 0xf7, (byte) 0x6b, (byte) 0xfe, (byte) 0x54, (byte) 0xb9, (byte) 0x03, (byte) 0xa9, (byte) 0xc9, + (byte) 0xa9, (byte) 0x4a, (byte) 0xc9, (byte) 0xb4, (byte) 0x7a, (byte) 0xd2, (byte) 0x65, (byte) 0x5c, (byte) 0x5f, (byte) 0x10, (byte) 0xf9, (byte) 0xae, (byte) 0xf7, (byte) 0x14, (byte) 0x27, (byte) 0xe2, + (byte) 0xfc, (byte) 0x6f, (byte) 0x9b, (byte) 0x3f, (byte) 0x39, (byte) 0x9a, (byte) 0x22, (byte) 0x14, (byte) 0x89, (byte) 0xf1, (byte) 0x63, (byte) 0x62, (byte) 0xc7, (byte) 0x03, (byte) 0x23, (byte) 0x36, + (byte) 0x09, (byte) 0xd4, (byte) 0x5a, (byte) 0xc6, (byte) 0x98, (byte) 0x64, (byte) 0xe3, (byte) 0x32, (byte) 0x1c, (byte) 0xf8, (byte) 0x29, (byte) 0x35, (byte) 0xac, (byte) 0x40, (byte) 0x96, (byte) 0xc8, + (byte) 0x6e, (byte) 0x13, (byte) 0x33, (byte) 0x14, (byte) 0xc5, (byte) 0x40, (byte) 0x19, (byte) 0xe8, (byte) 0xca, (byte) 0x79, (byte) 0x80, (byte) 0xdf, (byte) 0xa4, (byte) 0xb9, (byte) 0xcf, (byte) 0x1b, + (byte) 0x38, (byte) 0x4c, (byte) 0x48, (byte) 0x6f, (byte) 0x3a, (byte) 0x54, (byte) 0xc5, (byte) 0x10, (byte) 0x78, (byte) 0x15, (byte) 0x8e, (byte) 0xe5, (byte) 0xd7, (byte) 0x9d, (byte) 0xe5, (byte) 0x9f, + (byte) 0xbd, (byte) 0x34, (byte) 0xd8, (byte) 0x48, (byte) 0xb3, (byte) 0xd6, (byte) 0x95, (byte) 0x50, (byte) 0xa6, (byte) 0x76, (byte) 0x46, (byte) 0x34, (byte) 0x44, (byte) 0x27, (byte) 0xad, (byte) 0xe5, + (byte) 0x4b, (byte) 0x88, (byte) 0x51, (byte) 0xff, (byte) 0xb5, (byte) 0x98, (byte) 0xf7, (byte) 0xf8, (byte) 0x00, (byte) 0x74, (byte) 0xb9, (byte) 0x47, (byte) 0x3c, (byte) 0x82, (byte) 0xe2, (byte) 0xdb + }; + 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}; + + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .pipeline(pipeline) + .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(key, "AES")) + .kty(KeyType.OCT) + .keyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) + .buildClient(); + + byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A128CBC_HS256, plaintext, iv, authData).cipherText(); + + assertArrayEquals(expected, encrypted); + + byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A128CBC_HS256, encrypted, iv, authData, authTag).plainText(); + + assertArrayEquals(plaintext, decrypted); + } + + @Override + public void encryptDecryptSymmetricKeyAes128CbcHmacSha384() { + // Arrange: These values are taken from Appendix B of the JWE specification at + // https://tools.ietf.org/html/draft-ietf-jose-json-web-encryption-40#appendix-B + byte[] key = {(byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08, (byte) 0x09, (byte) 0x0a, (byte) 0x0b, (byte) 0x0c, (byte) 0x0d, (byte) 0x0e, (byte) 0x0f, + (byte) 0x10, (byte) 0x11, (byte) 0x12, (byte) 0x13, (byte) 0x14, (byte) 0x15, (byte) 0x16, (byte) 0x17, (byte) 0x18, (byte) 0x19, (byte) 0x1a, (byte) 0x1b, (byte) 0x1c, (byte) 0x1d, (byte) 0x1e, (byte) 0x1f, + (byte) 0x20, (byte) 0x21, (byte) 0x22, (byte) 0x23, (byte) 0x24, (byte) 0x25, (byte) 0x26, (byte) 0x27, (byte) 0x28, (byte) 0x29, (byte) 0x2a, (byte) 0x2b, (byte) 0x2c, (byte) 0x2d, (byte) 0x2e, (byte) 0x2f}; + byte[] plaintext = {(byte) 0x41, (byte) 0x20, (byte) 0x63, (byte) 0x69, (byte) 0x70, (byte) 0x68, (byte) 0x65, (byte) 0x72, (byte) 0x20, (byte) 0x73, (byte) 0x79, (byte) 0x73, (byte) 0x74, (byte) 0x65, (byte) 0x6d, (byte) 0x20, + (byte) 0x6d, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x6e, (byte) 0x6f, (byte) 0x74, (byte) 0x20, (byte) 0x62, (byte) 0x65, (byte) 0x20, (byte) 0x72, (byte) 0x65, (byte) 0x71, (byte) 0x75, + (byte) 0x69, (byte) 0x72, (byte) 0x65, (byte) 0x64, (byte) 0x20, (byte) 0x74, (byte) 0x6f, (byte) 0x20, (byte) 0x62, (byte) 0x65, (byte) 0x20, (byte) 0x73, (byte) 0x65, (byte) 0x63, (byte) 0x72, (byte) 0x65, + (byte) 0x74, (byte) 0x2c, (byte) 0x20, (byte) 0x61, (byte) 0x6e, (byte) 0x64, (byte) 0x20, (byte) 0x69, (byte) 0x74, (byte) 0x20, (byte) 0x6d, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x62, + (byte) 0x65, (byte) 0x20, (byte) 0x61, (byte) 0x62, (byte) 0x6c, (byte) 0x65, (byte) 0x20, (byte) 0x74, (byte) 0x6f, (byte) 0x20, (byte) 0x66, (byte) 0x61, (byte) 0x6c, (byte) 0x6c, (byte) 0x20, (byte) 0x69, + (byte) 0x6e, (byte) 0x74, (byte) 0x6f, (byte) 0x20, (byte) 0x74, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x68, (byte) 0x61, (byte) 0x6e, (byte) 0x64, (byte) 0x73, (byte) 0x20, (byte) 0x6f, (byte) 0x66, + (byte) 0x20, (byte) 0x74, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x65, (byte) 0x6e, (byte) 0x65, (byte) 0x6d, (byte) 0x79, (byte) 0x20, (byte) 0x77, (byte) 0x69, (byte) 0x74, (byte) 0x68, (byte) 0x6f, + (byte) 0x75, (byte) 0x74, (byte) 0x20, (byte) 0x69, (byte) 0x6e, (byte) 0x63, (byte) 0x6f, (byte) 0x6e, (byte) 0x76, (byte) 0x65, (byte) 0x6e, (byte) 0x69, (byte) 0x65, (byte) 0x6e, (byte) 0x63, (byte) 0x65}; + byte[] iv = {(byte) 0x1a, (byte) 0xf3, (byte) 0x8c, (byte) 0x2d, (byte) 0xc2, (byte) 0xb9, (byte) 0x6f, (byte) 0xfd, (byte) 0xd8, (byte) 0x66, (byte) 0x94, (byte) 0x09, (byte) 0x23, (byte) 0x41, (byte) 0xbc, (byte) 0x04}; + byte[] authData = {(byte) 0x54, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x73, (byte) 0x65, (byte) 0x63, (byte) 0x6f, (byte) 0x6e, (byte) 0x64, (byte) 0x20, (byte) 0x70, (byte) 0x72, (byte) 0x69, (byte) 0x6e, (byte) 0x63, + (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}; + byte[] expected = {(byte) 0xea, (byte) 0x65, (byte) 0xda, (byte) 0x6b, (byte) 0x59, (byte) 0xe6, (byte) 0x1e, (byte) 0xdb, (byte) 0x41, (byte) 0x9b, (byte) 0xe6, (byte) 0x2d, (byte) 0x19, (byte) 0x71, (byte) 0x2a, (byte) 0xe5, + (byte) 0xd3, (byte) 0x03, (byte) 0xee, (byte) 0xb5, (byte) 0x00, (byte) 0x52, (byte) 0xd0, (byte) 0xdf, (byte) 0xd6, (byte) 0x69, (byte) 0x7f, (byte) 0x77, (byte) 0x22, (byte) 0x4c, (byte) 0x8e, (byte) 0xdb, + (byte) 0x00, (byte) 0x0d, (byte) 0x27, (byte) 0x9b, (byte) 0xdc, (byte) 0x14, (byte) 0xc1, (byte) 0x07, (byte) 0x26, (byte) 0x54, (byte) 0xbd, (byte) 0x30, (byte) 0x94, (byte) 0x42, (byte) 0x30, (byte) 0xc6, + (byte) 0x57, (byte) 0xbe, (byte) 0xd4, (byte) 0xca, (byte) 0x0c, (byte) 0x9f, (byte) 0x4a, (byte) 0x84, (byte) 0x66, (byte) 0xf2, (byte) 0x2b, (byte) 0x22, (byte) 0x6d, (byte) 0x17, (byte) 0x46, (byte) 0x21, + (byte) 0x4b, (byte) 0xf8, (byte) 0xcf, (byte) 0xc2, (byte) 0x40, (byte) 0x0a, (byte) 0xdd, (byte) 0x9f, (byte) 0x51, (byte) 0x26, (byte) 0xe4, (byte) 0x79, (byte) 0x66, (byte) 0x3f, (byte) 0xc9, (byte) 0x0b, + (byte) 0x3b, (byte) 0xed, (byte) 0x78, (byte) 0x7a, (byte) 0x2f, (byte) 0x0f, (byte) 0xfc, (byte) 0xbf, (byte) 0x39, (byte) 0x04, (byte) 0xbe, (byte) 0x2a, (byte) 0x64, (byte) 0x1d, (byte) 0x5c, (byte) 0x21, + (byte) 0x05, (byte) 0xbf, (byte) 0xe5, (byte) 0x91, (byte) 0xba, (byte) 0xe2, (byte) 0x3b, (byte) 0x1d, (byte) 0x74, (byte) 0x49, (byte) 0xe5, (byte) 0x32, (byte) 0xee, (byte) 0xf6, (byte) 0x0a, (byte) 0x9a, + (byte) 0xc8, (byte) 0xbb, (byte) 0x6c, (byte) 0x6b, (byte) 0x01, (byte) 0xd3, (byte) 0x5d, (byte) 0x49, (byte) 0x78, (byte) 0x7b, (byte) 0xcd, (byte) 0x57, (byte) 0xef, (byte) 0x48, (byte) 0x49, (byte) 0x27, + (byte) 0xf2, (byte) 0x80, (byte) 0xad, (byte) 0xc9, (byte) 0x1a, (byte) 0xc0, (byte) 0xc4, (byte) 0xe7, (byte) 0x9c, (byte) 0x7b, (byte) 0x11, (byte) 0xef, (byte) 0xc6, (byte) 0x00, (byte) 0x54, (byte) 0xe3}; + byte[] authTags = {(byte) 0x84, (byte) 0x90, (byte) 0xac, (byte) 0x0e, (byte) 0x58, (byte) 0x94, (byte) 0x9b, (byte) 0xfe, (byte) 0x51, (byte) 0x87, (byte) 0x5d, (byte) 0x73, (byte) 0x3f, (byte) 0x93, (byte) 0xac, (byte) 0x20, + (byte) 0x75, (byte) 0x16, (byte) 0x80, (byte) 0x39, (byte) 0xcc, (byte) 0xc7, (byte) 0x33, (byte) 0xd7}; + + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .pipeline(pipeline) + .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(key, "AES")) + .kty(KeyType.OCT) + .keyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) + .buildClient(); + + byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A192CBC_HS384, plaintext, iv, authData).cipherText(); + + assertArrayEquals(expected, encrypted); + + byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A192CBC_HS384, encrypted, iv, authData, authTags).plainText(); + + assertArrayEquals(plaintext, decrypted); + } + + @Override + public void encryptDecryptSymmetricKeyAes128CbcHmacSha512() { + // Arrange: These values are taken from Appendix B of the JWE specification at + // https://tools.ietf.org/html/draft-ietf-jose-json-web-encryption-40#appendix-B + byte[] key = {(byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08, (byte) 0x09, (byte) 0x0a, (byte) 0x0b, (byte) 0x0c, (byte) 0x0d, (byte) 0x0e, (byte) 0x0f, + (byte) 0x10, (byte) 0x11, (byte) 0x12, (byte) 0x13, (byte) 0x14, (byte) 0x15, (byte) 0x16, (byte) 0x17, (byte) 0x18, (byte) 0x19, (byte) 0x1a, (byte) 0x1b, (byte) 0x1c, (byte) 0x1d, (byte) 0x1e, (byte) 0x1f, + (byte) 0x20, (byte) 0x21, (byte) 0x22, (byte) 0x23, (byte) 0x24, (byte) 0x25, (byte) 0x26, (byte) 0x27, (byte) 0x28, (byte) 0x29, (byte) 0x2a, (byte) 0x2b, (byte) 0x2c, (byte) 0x2d, (byte) 0x2e, (byte) 0x2f, + (byte) 0x30, (byte) 0x31, (byte) 0x32, (byte) 0x33, (byte) 0x34, (byte) 0x35, (byte) 0x36, (byte) 0x37, (byte) 0x38, (byte) 0x39, (byte) 0x3a, (byte) 0x3b, (byte) 0x3c, (byte) 0x3d, (byte) 0x3e, (byte) 0x3f}; + byte[] plaintext = {(byte) 0x41, (byte) 0x20, (byte) 0x63, (byte) 0x69, (byte) 0x70, (byte) 0x68, (byte) 0x65, (byte) 0x72, (byte) 0x20, (byte) 0x73, (byte) 0x79, (byte) 0x73, (byte) 0x74, (byte) 0x65, (byte) 0x6d, (byte) 0x20, + (byte) 0x6d, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x6e, (byte) 0x6f, (byte) 0x74, (byte) 0x20, (byte) 0x62, (byte) 0x65, (byte) 0x20, (byte) 0x72, (byte) 0x65, (byte) 0x71, (byte) 0x75, + (byte) 0x69, (byte) 0x72, (byte) 0x65, (byte) 0x64, (byte) 0x20, (byte) 0x74, (byte) 0x6f, (byte) 0x20, (byte) 0x62, (byte) 0x65, (byte) 0x20, (byte) 0x73, (byte) 0x65, (byte) 0x63, (byte) 0x72, (byte) 0x65, + (byte) 0x74, (byte) 0x2c, (byte) 0x20, (byte) 0x61, (byte) 0x6e, (byte) 0x64, (byte) 0x20, (byte) 0x69, (byte) 0x74, (byte) 0x20, (byte) 0x6d, (byte) 0x75, (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x62, + (byte) 0x65, (byte) 0x20, (byte) 0x61, (byte) 0x62, (byte) 0x6c, (byte) 0x65, (byte) 0x20, (byte) 0x74, (byte) 0x6f, (byte) 0x20, (byte) 0x66, (byte) 0x61, (byte) 0x6c, (byte) 0x6c, (byte) 0x20, (byte) 0x69, + (byte) 0x6e, (byte) 0x74, (byte) 0x6f, (byte) 0x20, (byte) 0x74, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x68, (byte) 0x61, (byte) 0x6e, (byte) 0x64, (byte) 0x73, (byte) 0x20, (byte) 0x6f, (byte) 0x66, + (byte) 0x20, (byte) 0x74, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x65, (byte) 0x6e, (byte) 0x65, (byte) 0x6d, (byte) 0x79, (byte) 0x20, (byte) 0x77, (byte) 0x69, (byte) 0x74, (byte) 0x68, (byte) 0x6f, + (byte) 0x75, (byte) 0x74, (byte) 0x20, (byte) 0x69, (byte) 0x6e, (byte) 0x63, (byte) 0x6f, (byte) 0x6e, (byte) 0x76, (byte) 0x65, (byte) 0x6e, (byte) 0x69, (byte) 0x65, (byte) 0x6e, (byte) 0x63, (byte) 0x65}; + byte[] iv = {(byte) 0x1a, (byte) 0xf3, (byte) 0x8c, (byte) 0x2d, (byte) 0xc2, (byte) 0xb9, (byte) 0x6f, (byte) 0xfd, (byte) 0xd8, (byte) 0x66, (byte) 0x94, (byte) 0x09, (byte) 0x23, (byte) 0x41, (byte) 0xbc, (byte) 0x04}; + byte[] authData = {(byte) 0x54, (byte) 0x68, (byte) 0x65, (byte) 0x20, (byte) 0x73, (byte) 0x65, (byte) 0x63, (byte) 0x6f, (byte) 0x6e, (byte) 0x64, (byte) 0x20, (byte) 0x70, (byte) 0x72, (byte) 0x69, (byte) 0x6e, (byte) 0x63, + (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}; + byte[] expected = {(byte) 0x4a, (byte) 0xff, (byte) 0xaa, (byte) 0xad, (byte) 0xb7, (byte) 0x8c, (byte) 0x31, (byte) 0xc5, (byte) 0xda, (byte) 0x4b, (byte) 0x1b, (byte) 0x59, (byte) 0x0d, (byte) 0x10, (byte) 0xff, (byte) 0xbd, + (byte) 0x3d, (byte) 0xd8, (byte) 0xd5, (byte) 0xd3, (byte) 0x02, (byte) 0x42, (byte) 0x35, (byte) 0x26, (byte) 0x91, (byte) 0x2d, (byte) 0xa0, (byte) 0x37, (byte) 0xec, (byte) 0xbc, (byte) 0xc7, (byte) 0xbd, + (byte) 0x82, (byte) 0x2c, (byte) 0x30, (byte) 0x1d, (byte) 0xd6, (byte) 0x7c, (byte) 0x37, (byte) 0x3b, (byte) 0xcc, (byte) 0xb5, (byte) 0x84, (byte) 0xad, (byte) 0x3e, (byte) 0x92, (byte) 0x79, (byte) 0xc2, + (byte) 0xe6, (byte) 0xd1, (byte) 0x2a, (byte) 0x13, (byte) 0x74, (byte) 0xb7, (byte) 0x7f, (byte) 0x07, (byte) 0x75, (byte) 0x53, (byte) 0xdf, (byte) 0x82, (byte) 0x94, (byte) 0x10, (byte) 0x44, (byte) 0x6b, + (byte) 0x36, (byte) 0xeb, (byte) 0xd9, (byte) 0x70, (byte) 0x66, (byte) 0x29, (byte) 0x6a, (byte) 0xe6, (byte) 0x42, (byte) 0x7e, (byte) 0xa7, (byte) 0x5c, (byte) 0x2e, (byte) 0x08, (byte) 0x46, (byte) 0xa1, + (byte) 0x1a, (byte) 0x09, (byte) 0xcc, (byte) 0xf5, (byte) 0x37, (byte) 0x0d, (byte) 0xc8, (byte) 0x0b, (byte) 0xfe, (byte) 0xcb, (byte) 0xad, (byte) 0x28, (byte) 0xc7, (byte) 0x3f, (byte) 0x09, (byte) 0xb3, + (byte) 0xa3, (byte) 0xb7, (byte) 0x5e, (byte) 0x66, (byte) 0x2a, (byte) 0x25, (byte) 0x94, (byte) 0x41, (byte) 0x0a, (byte) 0xe4, (byte) 0x96, (byte) 0xb2, (byte) 0xe2, (byte) 0xe6, (byte) 0x60, (byte) 0x9e, + (byte) 0x31, (byte) 0xe6, (byte) 0xe0, (byte) 0x2c, (byte) 0xc8, (byte) 0x37, (byte) 0xf0, (byte) 0x53, (byte) 0xd2, (byte) 0x1f, (byte) 0x37, (byte) 0xff, (byte) 0x4f, (byte) 0x51, (byte) 0x95, (byte) 0x0b, + (byte) 0xbe, (byte) 0x26, (byte) 0x38, (byte) 0xd0, (byte) 0x9d, (byte) 0xd7, (byte) 0xa4, (byte) 0x93, (byte) 0x09, (byte) 0x30, (byte) 0x80, (byte) 0x6d, (byte) 0x07, (byte) 0x03, (byte) 0xb1, (byte) 0xf6}; + byte[] authTags = {(byte) 0x4d, (byte) 0xd3, (byte) 0xb4, (byte) 0xc0, (byte) 0x88, (byte) 0xa7, (byte) 0xf4, (byte) 0x5c, (byte) 0x21, (byte) 0x68, (byte) 0x39, (byte) 0x64, (byte) 0x5b, (byte) 0x20, (byte) 0x12, (byte) 0xbf, + (byte) 0x2e, (byte) 0x62, (byte) 0x69, (byte) 0xa8, (byte) 0xc5, (byte) 0x6a, (byte) 0x81, (byte) 0x6d, (byte) 0xbc, (byte) 0x1b, (byte) 0x26, (byte) 0x77, (byte) 0x61, (byte) 0x95, (byte) 0x5b, (byte) 0xc5}; + + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .pipeline(pipeline) + .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(key, "AES")) + .kty(KeyType.OCT) + .keyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) + .buildClient(); + + byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A256CBC_HS512, plaintext, iv, authData).cipherText(); + + assertArrayEquals(expected, encrypted); + + byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A256CBC_HS512, encrypted, iv, authData, authTags).plainText(); + + assertArrayEquals(plaintext, decrypted); + } + + @Override + public void encryptDecryptSymmetricKeyaes128CbcOneBlock() { + // Note that AES128CBC as implemented in this library uses PKCS7 padding mode where the test + // vectors from RFC3602 do not use padding. + byte[] keyContent = { 0x06, (byte) 0xa9, 0x21, 0x40, 0x36, (byte) 0xb8, (byte) 0xa1, 0x5b, 0x51, 0x2e, 0x03, (byte) 0xd5, 0x34, 0x12, 0x00, 0x06 }; + byte[] plaintext = "Single block msg".getBytes(); + byte[] initializationVector = { 0x3d, (byte) 0xaf, (byte) 0xba, 0x42, (byte) 0x9d, (byte) 0x9e, (byte) 0xb4, 0x30, (byte) 0xb4, 0x22, (byte) 0xda, (byte) 0x80, 0x2c, (byte) 0x9f, (byte) 0xac, 0x41 }; + byte[] expected = { (byte) 0xe3, 0x53, 0x77, (byte) 0x9c, 0x10, 0x79, (byte) 0xae, (byte) 0xb8, 0x27, 0x08, (byte) 0x94, 0x2d, (byte) 0xbe, 0x77, 0x18, 0x1a }; + + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .pipeline(pipeline) + .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(keyContent, "AES")) + .kty(KeyType.OCT) + .keyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) + .buildClient(); + + byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A128CBC, plaintext, initializationVector, null).cipherText(); + + assertArrayEquals(Arrays.copyOfRange(encrypted, 0, 16), expected); + + byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A128CBC, encrypted, initializationVector, null, null).plainText(); + + assertArrayEquals(Arrays.copyOfRange(decrypted, 0, 16), plaintext); + } + + @Override + public void encryptDecryptSymmetricKeyaes128CbcTwoBlock() { + // Note that AES128CBC as implemented in this library uses PKCS7 padding mode where the test + // vectors do not use padding. + byte[] keyContent = { (byte) 0xc2, (byte) 0x86, 0x69, 0x6d, (byte) 0x88, 0x7c, (byte) 0x9a, (byte) 0xa0, 0x61, 0x1b, (byte) 0xbb, 0x3e, 0x20, 0x25, (byte) 0xa4, 0x5a }; + byte[] plaintext = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f }; + byte[] initializationVector = { 0x56, 0x2e, 0x17, (byte) 0x99, 0x6d, 0x09, 0x3d, 0x28, (byte) 0xdd, (byte) 0xb3, (byte) 0xba, 0x69, 0x5a, 0x2e, 0x6f, 0x58 }; + byte[] expected = { (byte) 0xd2, (byte) 0x96, (byte) 0xcd, (byte) 0x94, (byte) 0xc2, (byte) 0xcc, (byte) 0xcf, (byte) 0x8a, 0x3a, (byte) 0x86, 0x30, 0x28, (byte) 0xb5, (byte) 0xe1, (byte) 0xdc, 0x0a, 0x75, (byte) 0x86, 0x60, 0x2d, 0x25, 0x3c, (byte) 0xff, (byte) 0xf9, 0x1b, (byte) 0x82, 0x66, (byte) 0xbe, (byte) 0xa6, (byte) 0xd6, 0x1a, (byte) 0xb1 }; + + CryptographyClient cryptoClient = new CryptographyClientBuilder() + .pipeline(pipeline) + .jsonWebKey(JsonWebKey.fromAes(new SecretKeySpec(keyContent, "AES")) + .kty(KeyType.OCT) + .keyOps(Arrays.asList(KeyOperation.ENCRYPT, KeyOperation.DECRYPT))) + .buildClient(); + + byte[] encrypted = cryptoClient.encrypt(EncryptionAlgorithm.A128CBC, plaintext, initializationVector, null).cipherText(); + + assertArrayEquals(Arrays.copyOfRange(encrypted, 0, 32), expected); + + byte[] decrypted = cryptoClient.decrypt(EncryptionAlgorithm.A128CBC, encrypted, initializationVector, null, null).plainText(); + + assertArrayEquals(Arrays.copyOfRange(decrypted, 0, 32), plaintext); + } + + + private void pollOnKeyDeletion(String keyName) { + int pendingPollCount = 0; + while (pendingPollCount < 30) { + DeletedKey deletedKey = null; + try { + deletedKey = client.getDeletedKey(keyName); + } catch (ResourceNotFoundException e) { + } + if (deletedKey == null) { + sleepInRecordMode(2000); + pendingPollCount += 1; + continue; + } else { + return; + } + } + System.err.printf("Deleted Key %s not found \n", keyName); + } + + private void pollOnKeyPurge(String keyName) { + int pendingPollCount = 0; + while (pendingPollCount < 10) { + DeletedKey deletedKey = null; + try { + deletedKey = client.getDeletedKey(keyName); + } catch (ResourceNotFoundException e) { + } + if (deletedKey != null) { + sleepInRecordMode(2000); + pendingPollCount += 1; + continue; + } else { + return; + } + } + System.err.printf("Deleted Key %s was not purged \n", keyName); + } +} 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 new file mode 100644 index 000000000000..12791804f406 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/cryptography/CryptographyClientTestBase.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys.cryptography; + +import com.azure.core.credentials.AccessToken; +import com.azure.core.credentials.TokenCredential; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.*; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; +import com.azure.core.test.TestBase; +import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.keys.implementation.AzureKeyVaultConfiguration; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; +import reactor.core.publisher.Mono; + +import java.math.BigInteger; +import java.security.InvalidAlgorithmParameterException; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.NoSuchAlgorithmException; +import java.security.spec.KeySpec; +import java.security.spec.RSAPrivateCrtKeySpec; +import java.security.spec.RSAPublicKeySpec; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.*; +import java.util.function.Consumer; +import java.util.function.Function; + +import static org.junit.Assert.*; + +public abstract class CryptographyClientTestBase extends TestBase { + @Rule + public TestName testName = new TestName(); + + @Override + protected String testName() { + return testName.getMethodName(); + } + + void beforeTestSetup() { + } + + T clientSetup(Function clientBuilder) { + final String endpoint = interceptorManager.isPlaybackMode() + ? "http://localhost:8080" + : System.getenv("AZURE_KEYVAULT_ENDPOINT"); + + TokenCredential credential; + HttpClient httpClient; + + String tenantId = System.getenv("AZURE_TENANT_ID"); + String clientId = System.getenv("AZURE_CLIENT_ID"); + String clientSecret = System.getenv("AZURE_CLIENT_SECRET"); + if (!interceptorManager.isPlaybackMode()) { + assertNotNull(tenantId); + assertNotNull(clientId); + assertNotNull(clientSecret); + } + + if (interceptorManager.isPlaybackMode()) { + credential = resource -> Mono.just(new AccessToken("Some fake token", OffsetDateTime.now(ZoneOffset.UTC).plus(Duration.ofMinutes(30)))); + } else { + credential = new DefaultAzureCredentialBuilder().build(); + } + + // 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, ConfigurationManager.getConfiguration().clone())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(new RetryPolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, CryptographyAsyncClient.KEY_VAULT_SCOPE)); + policies.addAll(policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(HttpLogDetailLevel.BODY_AND_HEADERS)); + + if (interceptorManager.isPlaybackMode()) { + httpClient = interceptorManager.getPlaybackClient(); + policies.add(interceptorManager.getRecordPolicy()); + } else { + httpClient = HttpClient.createDefault().wiretap(true); + policies.add(interceptorManager.getRecordPolicy()); + } + + HttpPipeline pipeline = new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); + + T client; + client = clientBuilder.apply(pipeline); + + return Objects.requireNonNull(client); + } + + @Test + public abstract void encryptDecryptRsa() throws Exception; + + void encryptDecryptRsaRunner(Consumer testRunner) throws Exception { + final Map tags = new HashMap<>(); + + testRunner.accept(getWellKnownKey()); + } + + @Test + public abstract void signVerifyEc() throws NoSuchAlgorithmException, InvalidAlgorithmParameterException; + + @Test + public abstract void wrapUnwraptRsa() throws Exception; + + @Test + public abstract void signVerifyRsa() throws Exception; + + @Test + public abstract void wrapUnwrapSymmetricKeyAES128Kw(); + + @Test + public abstract void wrapUnwrapSymmetricKeyAES192Kw(); + + @Test + public abstract void wrapUnwrapSymmetricKeyAES256Kw(); + + @Test + public abstract void encryptDecryptSymmetricKeyAes128CbcHmacSha256(); + + @Test + public abstract void encryptDecryptSymmetricKeyAes128CbcHmacSha384(); + + @Test + public abstract void encryptDecryptSymmetricKeyAes128CbcHmacSha512(); + + @Test + public abstract void encryptDecryptSymmetricKeyaes128CbcOneBlock(); + + @Test + public abstract void encryptDecryptSymmetricKeyaes128CbcTwoBlock(); + + private static KeyPair getWellKnownKey() throws Exception { + BigInteger modulus = new BigInteger("27266783713040163753473734334021230592631652450892850648620119914958066181400432364213298181846462385257448168605902438305568194683691563208578540343969522651422088760509452879461613852042845039552547834002168737350264189810815735922734447830725099163869215360401162450008673869707774119785881115044406101346450911054819448375712432746968301739007624952483347278954755460152795801894283389540036131881712321193750961817346255102052653789197325341350920441746054233522546543768770643593655942246891652634114922277138937273034902434321431672058220631825053788262810480543541597284376261438324665363067125951152574540779"); + BigInteger publicExponent = new BigInteger("65537"); + BigInteger privateExponent = new BigInteger("10466613941269075477152428927796086150095892102279802916937552172064636326433780566497000814207416485739683286961848843255766652023400959086290344987308562817062506476465756840999981989957456897020361717197805192876094362315496459535960304928171129585813477132331538577519084006595335055487028872410579127692209642938724850603554885478763205394868103298473476811627231543504190652483290944218004086457805431824328448422034887148115990501701345535825110962804471270499590234116100216841170344686381902328362376624405803648588830575558058257742073963036264273582756620469659464278207233345784355220317478103481872995809"); + BigInteger primeP = new BigInteger("175002941104568842715096339107566771592009112128184231961529953978142750732317724951747797764638217287618769007295505214923187971350518217670604044004381362495186864051394404165602744235299100790551775147322153206730562450301874236875459336154569893255570576967036237661594595803204808064127845257496057219227"); + BigInteger primeQ = new BigInteger("155807574095269324897144428622185380283967159190626345335083690114147315509962698765044950001909553861571493035240542031420213144237033208612132704562174772894369053916729901982420535940939821673277140180113593951522522222348910536202664252481405241042414183668723338300649954708432681241621374644926879028977"); + BigInteger primeExponentP = new BigInteger("79745606804504995938838168837578376593737280079895233277372027184693457251170125851946171360348440134236338520742068873132216695552312068793428432338173016914968041076503997528137698610601222912385953171485249299873377130717231063522112968474603281996190849604705284061306758152904594168593526874435238915345"); + BigInteger primeExponentQ = new BigInteger("80619964983821018303966686284189517841976445905569830731617605558094658227540855971763115484608005874540349730961777634427740786642996065386667564038755340092176159839025706183161615488856833433976243963682074011475658804676349317075370362785860401437192843468423594688700132964854367053490737073471709030801"); + BigInteger crtCoefficient = new BigInteger("2157818511040667226980891229484210846757728661751992467240662009652654684725325675037512595031058612950802328971801913498711880111052682274056041470625863586779333188842602381844572406517251106159327934511268610438516820278066686225397795046020275055545005189953702783748235257613991379770525910232674719428"); + + KeySpec publicKeySpec = new RSAPublicKeySpec(modulus, publicExponent); + KeySpec privateKeySpec = new RSAPrivateCrtKeySpec(modulus, publicExponent, privateExponent, primeP, primeQ, primeExponentP, primeExponentQ, crtCoefficient); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + + return new KeyPair(keyFactory.generatePublic(publicKeySpec), keyFactory.generatePrivate(privateKeySpec)); + } + + + public String getEndpoint() { + final String endpoint = interceptorManager.isPlaybackMode() + ? "http://localhost:8080" + : "https://cameravault.vault.azure.net"; + // : System.getenv("AZURE_KEYVAULT_ENDPOINT"); + Objects.requireNonNull(endpoint); + return endpoint; + } + + static void assertRestException(Runnable exceptionThrower, int expectedStatusCode) { + assertRestException(exceptionThrower, HttpResponseException.class, expectedStatusCode); + } + + static void assertRestException(Runnable exceptionThrower, Class expectedExceptionType, int expectedStatusCode) { + try { + exceptionThrower.run(); + fail(); + } catch (Throwable ex) { + assertRestException(ex, expectedExceptionType, expectedStatusCode); + } + } + + /** + * Helper method to verify the error was a HttpRequestException and it has a specific HTTP response code. + * + * @param exception Expected error thrown during the test + * @param expectedStatusCode Expected HTTP status code contained in the error response + */ + static void assertRestException(Throwable exception, int expectedStatusCode) { + assertRestException(exception, HttpResponseException.class, expectedStatusCode); + } + + static void assertRestException(Throwable exception, Class expectedExceptionType, int expectedStatusCode) { + assertEquals(expectedExceptionType, exception.getClass()); + assertEquals(expectedStatusCode, ((HttpResponseException) exception).response().statusCode()); + } + + /** + * Helper method to verify that a command throws an IllegalArgumentException. + * + * @param exceptionThrower Command that should throw the exception + */ + static void assertRunnableThrowsException(Runnable exceptionThrower, Class exception) { + try { + exceptionThrower.run(); + fail(); + } catch (Exception ex) { + assertEquals(exception, ex.getClass()); + } + } + + public void sleepInRecordMode(long millis) { + if (interceptorManager.isPlaybackMode()) { + return; + } + try { + Thread.sleep(millis); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + public void sleep(long millis) { + try { + Thread.sleep(millis); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptRsa.json b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptRsa.json new file mode 100644 index 000000000000..cb9d004aae4d --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptRsa.json @@ -0,0 +1,514 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:04:51 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "656", + "x-ms-request-id" : "e19f71c3-5d28-4aa8-8d60-f621691f2baa", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188\",\"kty\":\"RSA\",\"key_ops\":[\"encrypt\",\"decrypt\",\"sign\",\"verify\",\"wrapKey\",\"unwrapKey\"],\"n\":\"1_6ZtP288hEkKML-L6nFyZh1PD1rmAgwbbwjEvTSDK_008BYWhjp_6ULy9BhWtRIytNkPkm9gzaBTrCpp-vyDXPGa836Htp-w8u5JmxoUZchJh576m3m-8ZYWTmZSAp5SpruyKAmLSxPJHEWPXQntnmuTMjb9HBT9Ltrwc0ZDk-jsMLYunDJrNmrRUxQgb0zQ_Tl5fJjj8j-0KVx2RXtbfWFvf5fRdBYyP3m0aUpoopQPwtXszD2LcSKMJ_TnmnvMWr8MOA5aRlBaGdBk7zBgRafvDPam3Q2AvFA9mfcAVncpfZ3JFm73VARw6MofXtRqOHtZ7y4oNbY95xXwU2r6w\",\"e\":\"AQAB\"},\"attributes\":{\"enabled\":true,\"created\":1565067891,\"updated\":1565067891,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188/decrypt?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:04:51 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "239", + "x-ms-request-id" : "b56bd43f-a534-4321-80b0-f894e45983d6", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188\",\"value\":\"G9GT23aoJ9lUS5WtxwlS9igODCiTObv_Z7U9HhTbk99t_24WdBcngS2ycvtJ7_VQ6ESEKt1QdoI8UMRwh2UOMalPrw1leEgbwgpOtCPjmzCk2fhuxCHyinA3x0iGnD2jyYaXiw\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188/encrypt?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:04:51 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "447", + "x-ms-request-id" : "d709251f-8da3-40c4-8b7a-f4fd814ea096", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188\",\"value\":\"cILD_WRyl5tkQGcOJOiyyhVziBTFlcl25NXvaZ20lkKdQ8C8qwnMQuywE72F657Pb3r7fjWr0HBQ-GdFQUL0zdSKukqfQeJRTi4oFkNTzG2dVvi33_I8TZgEt_AdoM2Gf8jjp29-R8BdI-QnkR6A7cukzKus5sNWn9gIp2B5bCCyPKK_2ybdC0mTATq7jOLv-6x6LIhTI3MAuhC2Ik1M97Y6RlRO-PlS96TLqrGN4M5ZSHekX95iqi6WOIQvRJN06FTQq7dNq_cXG1QGfBxN0rZY9rcwthqKKRE4XCT8Kx9af8Pb68WpiHBwC0AFVZAjqdmMg-N-lbJZ-fbg06ZHAg\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188/decrypt?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:04:51 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "239", + "x-ms-request-id" : "623e1eec-3e07-4783-8913-e1ade90f04a0", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188\",\"value\":\"G9GT23aoJ9lUS5WtxwlS9igODCiTObv_Z7U9HhTbk99t_24WdBcngS2ycvtJ7_VQ6ESEKt1QdoI8UMRwh2UOMalPrw1leEgbwgpOtCPjmzCk2fhuxCHyinA3x0iGnD2jyYaXiw\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188/encrypt?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:04:51 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "447", + "x-ms-request-id" : "58492b26-9c11-4063-9555-c9f9e352ae69", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188\",\"value\":\"GjLhGNBcnHFHV1GB-xyhGPfCLppg1ZlCF_ecYQkiLaTbGcX64bxIOZIQzlMcL14mKh34Un715q162hgCEIdiBpwwvpNIOJ7Rba3uotjoyHKJFsJ74Gmy4uLa7EbOkrLp6lv1hDLLLRc-JH6cAKpcrAxYrhWqpJSobq_NoFbdBrizUwx9l7ei-eDeJhk5zb3y4SO5mLlkcfn_ae_yOlTEkSMGFiYcRKXa2nS4V3Ogqc_yogOCQskdhUcR8v7XL9wJVrZMoPRbsagpVFRvWMo44tRitJKIUFNeI6LI_0JKIkCFCZO27iZm-2MYLCVLI5NNicsnzgdjNejsk3FqtlC-ug\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188/encrypt?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:04:51 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "447", + "x-ms-request-id" : "518fdea8-5d04-4669-a0fd-7b15edad3b64", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188\",\"value\":\"e5XNN_HK5AvtaGgLQi8_cFm5_zRUKueBJe9N-GDKzDVFdA27iSWdiRLAzzouFtsqCLIxXQV-y1J68RjlQNR90R-XEX1QhEt7lCxWyqkmlRrk_aCl44eqga1aEBsz1nUyvz6uYdTO33d2wNexKUmcZCvNWIHeL8zg6M9NLs8ncpXAH5LFbVH1YDz73WvaTr1wYUFg2Srl0MHQyHwA0bnnQRP3Gcg55RTCSGzA_ONzXpxKPG2iGukZ9tWA6EBIahaIXBZSsa-_ZK__0Am8zwb2rBRxYLAb3DCSb-xOpZqXpWevJbQDIoYog1byjUJUx1hO5GMhCpqMubhsyCjxO51UJA\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188/decrypt?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:04:51 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "239", + "x-ms-request-id" : "20d351c8-aedb-44d1-95b8-404f21e0cfd0", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188\",\"value\":\"G9GT23aoJ9lUS5WtxwlS9igODCiTObv_Z7U9HhTbk99t_24WdBcngS2ycvtJ7_VQ6ESEKt1QdoI8UMRwh2UOMalPrw1leEgbwgpOtCPjmzCk2fhuxCHyinA3x0iGnD2jyYaXiw\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188/encrypt?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:04:52 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "447", + "x-ms-request-id" : "1ed2f433-43bd-4488-8120-e4dbd5237ffb", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188\",\"value\":\"fi6752qevRN_Dr9zphO2C4vlHB3UIdzjCHrH5Wo0pBWyhpiPgqBbPL4h2U4JjBaIf-BBiRQpw2pIsIJE-F05LxYPixryvLhZBWQWBq02Hu1lAN0Rjndq5j6Fwgyg_7IWwJS-U75W82FEvnYQF-T0rqEpTOVlEvXsRjfVlyHCcvEbU6vQurPEJ2nia1i8cVA4I5xvjN6-v2vh9v1NVJMxlQGhnAcm3LR9tWwYiqZEcBOXj1CpsmyCKiXDJks9NAj5yJ1vBLzmbqc2q2Kz__CwpVmgPUyZK_bKejbMITi4BM7cAnMGvRrwkhjp18ZWNPR6W2r9WmW7sov1JksrIwT4cA\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188/decrypt?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:04:52 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "239", + "x-ms-request-id" : "611efd29-0789-42b5-94e6-8929d9a3f8cc", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188\",\"value\":\"G9GT23aoJ9lUS5WtxwlS9igODCiTObv_Z7U9HhTbk99t_24WdBcngS2ycvtJ7_VQ6ESEKt1QdoI8UMRwh2UOMalPrw1leEgbwgpOtCPjmzCk2fhuxCHyinA3x0iGnD2jyYaXiw\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:04:52 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "787", + "x-ms-request-id" : "1cc66170-576b-4708-942a-e80f6ec457db", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testRsaKey\",\"deletedDate\":1565067892,\"scheduledPurgeDate\":1572843892,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188\",\"kty\":\"RSA\",\"key_ops\":[\"encrypt\",\"decrypt\",\"sign\",\"verify\",\"wrapKey\",\"unwrapKey\"],\"n\":\"1_6ZtP288hEkKML-L6nFyZh1PD1rmAgwbbwjEvTSDK_008BYWhjp_6ULy9BhWtRIytNkPkm9gzaBTrCpp-vyDXPGa836Htp-w8u5JmxoUZchJh576m3m-8ZYWTmZSAp5SpruyKAmLSxPJHEWPXQntnmuTMjb9HBT9Ltrwc0ZDk-jsMLYunDJrNmrRUxQgb0zQ_Tl5fJjj8j-0KVx2RXtbfWFvf5fRdBYyP3m0aUpoopQPwtXszD2LcSKMJ_TnmnvMWr8MOA5aRlBaGdBk7zBgRafvDPam3Q2AvFA9mfcAVncpfZ3JFm73VARw6MofXtRqOHtZ7y4oNbY95xXwU2r6w\",\"e\":\"AQAB\"},\"attributes\":{\"enabled\":true,\"created\":1565067891,\"updated\":1565067891,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:04:52 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "78", + "x-ms-request-id" : "dff91a12-b89a-41db-af08-be3fcbeb5781", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKey\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:04:54 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "78", + "x-ms-request-id" : "d2614df2-46e0-4f1b-82bd-8cc9ec07fc51", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKey\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:04:56 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "78", + "x-ms-request-id" : "ce9ec89f-e743-4340-ac08-fd5c4f850bb2", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKey\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:04:58 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "78", + "x-ms-request-id" : "30af27df-ebe5-47eb-b9e7-b46bba2cfa61", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKey\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:00 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "78", + "x-ms-request-id" : "9377448e-83b5-4d5f-b097-6eae1d15d043", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKey\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:02 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "78", + "x-ms-request-id" : "36cbe3e4-8e83-449f-938d-c3bcb5a8890a", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKey\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:04 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "787", + "x-ms-request-id" : "b8613a85-8c62-43c5-804e-f40409c13e50", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testRsaKey\",\"deletedDate\":1565067892,\"scheduledPurgeDate\":1572843892,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKey/239aa15e13fe42739dc8e7153c84e188\",\"kty\":\"RSA\",\"key_ops\":[\"encrypt\",\"decrypt\",\"sign\",\"verify\",\"wrapKey\",\"unwrapKey\"],\"n\":\"1_6ZtP288hEkKML-L6nFyZh1PD1rmAgwbbwjEvTSDK_008BYWhjp_6ULy9BhWtRIytNkPkm9gzaBTrCpp-vyDXPGa836Htp-w8u5JmxoUZchJh576m3m-8ZYWTmZSAp5SpruyKAmLSxPJHEWPXQntnmuTMjb9HBT9Ltrwc0ZDk-jsMLYunDJrNmrRUxQgb0zQ_Tl5fJjj8j-0KVx2RXtbfWFvf5fRdBYyP3m0aUpoopQPwtXszD2LcSKMJ_TnmnvMWr8MOA5aRlBaGdBk7zBgRafvDPam3Q2AvFA9mfcAVncpfZ3JFm73VARw6MofXtRqOHtZ7y4oNbY95xXwU2r6w\",\"e\":\"AQAB\"},\"attributes\":{\"enabled\":true,\"created\":1565067891,\"updated\":1565067891,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 06 Aug 2019 05:05:04 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "x-ms-request-id" : "74456005-1861-417d-92b0-e1cd11719a21", + "x-ms-keyvault-service-version" : "1.1.0.875", + "X-Powered-By" : "ASP.NET" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:04 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "78", + "x-ms-request-id" : "8b3b3e08-1fce-4eaf-875c-72cc11c179fd", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKey\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyAes128CbcHmacSha256.json b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyAes128CbcHmacSha256.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyAes128CbcHmacSha256.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyAes128CbcHmacSha384.json b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyAes128CbcHmacSha384.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyAes128CbcHmacSha384.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyAes128CbcHmacSha512.json b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyAes128CbcHmacSha512.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyAes128CbcHmacSha512.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyaes128CbcOneBlock.json b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyaes128CbcOneBlock.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyaes128CbcOneBlock.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyaes128CbcTwoBlock.json b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyaes128CbcTwoBlock.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/encryptDecryptSymmetricKeyaes128CbcTwoBlock.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/signVerifyEc.json b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/signVerifyEc.json new file mode 100644 index 000000000000..5ce9f1050ce4 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/signVerifyEc.json @@ -0,0 +1,1504 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-256?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "372", + "x-ms-request-id" : "bcabbb43-4932-4dea-a94f-43b543611c2b", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-256/4fafc9bd7b474c75b3fea6bcb424995f\",\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-256\",\"x\":\"Hj-u2Ql1512cmLN4ee4jI7m72tKkct_yCGSxM8FijVA\",\"y\":\"ALmmYPv6wBLVak_7C2k40DqlXZfndGhH4-XoGx4g10Ul\"},\"attributes\":{\"enabled\":true,\"created\":1565067919,\"updated\":1565067919,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-256/4fafc9bd7b474c75b3fea6bcb424995f/verify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "14", + "x-ms-request-id" : "75464d93-c0c4-447f-914c-2a0384900513", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"value\":true}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-256/4fafc9bd7b474c75b3fea6bcb424995f/sign?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "195", + "x-ms-request-id" : "7c9af7b5-e5b4-440e-999a-8f0cac326075", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-256/4fafc9bd7b474c75b3fea6bcb424995f\",\"value\":\"cNs1HtHfjw3UYclDXdNyzpBQtWRIqzK25tXe7DZ3VuB375Y3IVQi4T-kGdBzF6ME_Ul6PBpjHOwvuKD-UIdwPg\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-256?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "507", + "x-ms-request-id" : "63beadb2-b75c-409c-8255-2f59fca65b36", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256\",\"deletedDate\":1565067919,\"scheduledPurgeDate\":1572843919,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-256/4fafc9bd7b474c75b3fea6bcb424995f\",\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-256\",\"x\":\"Hj-u2Ql1512cmLN4ee4jI7m72tKkct_yCGSxM8FijVA\",\"y\":\"ALmmYPv6wBLVak_7C2k40DqlXZfndGhH4-XoGx4g10Ul\"},\"attributes\":{\"enabled\":true,\"created\":1565067919,\"updated\":1565067919,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "dcafce8c-93aa-4727-a148-df902f0f22b3", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:20 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "faf5c5a5-9db1-494c-bbb2-b4515534245d", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:22 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "60427f33-8f3e-4928-a15d-722d46f099ef", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:24 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "f69438d5-69b9-48a9-b69a-69907442b871", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:26 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "3feb899a-d73a-4299-983e-fabd089aeb5d", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:29 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "c1e04a8d-d867-442f-a54c-dc069b213be5", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:31 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "83f0cd3e-9d8a-439e-a5d7-fc628d6c50cf", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:33 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "507", + "x-ms-request-id" : "1c2f28b4-1652-4bf9-95ce-5de06b9e81c2", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256\",\"deletedDate\":1565067919,\"scheduledPurgeDate\":1572843919,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-256/4fafc9bd7b474c75b3fea6bcb424995f\",\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-256\",\"x\":\"Hj-u2Ql1512cmLN4ee4jI7m72tKkct_yCGSxM8FijVA\",\"y\":\"ALmmYPv6wBLVak_7C2k40DqlXZfndGhH4-XoGx4g10Ul\"},\"attributes\":{\"enabled\":true,\"created\":1565067919,\"updated\":1565067919,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 06 Aug 2019 05:05:33 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "x-ms-request-id" : "7c118b87-1d3b-418a-9e12-a460cd8fa0e2", + "x-ms-keyvault-service-version" : "1.1.0.875", + "X-Powered-By" : "ASP.NET" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:33 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "05271b98-0dcc-4369-aac3-be21a4137fb0", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-384?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:33 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "417", + "x-ms-request-id" : "9f6cd0ca-008b-44bd-bb49-7f4c2a4d5ee4", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-384/030c64353e4042159c25a02855d3a5d9\",\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-384\",\"x\":\"ALLpJ-Ws5nMeDupEooytQOAifZcUV1i67-DJSfxGR-9er-0N1eL0yxiwQuARWraZ1Q\",\"y\":\"AIwn4DpsJc7bSACXB7JoWqlI5-GOKlU7nLDhdlWb83JgLjDos3BWTqC1Hp8U5yN9ug\"},\"attributes\":{\"enabled\":true,\"created\":1565067934,\"updated\":1565067934,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-384/030c64353e4042159c25a02855d3a5d9/verify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:33 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "14", + "x-ms-request-id" : "f942b7cf-e079-4d90-ab55-91c72c75a373", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"value\":true}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-384/030c64353e4042159c25a02855d3a5d9/sign?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:33 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "237", + "x-ms-request-id" : "8d9d6a9a-788a-4b57-9a7b-4b68ab152f25", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-384/030c64353e4042159c25a02855d3a5d9\",\"value\":\"lIbUJVURGNQmQoxspY9zBOgABryS3mZCLNI9ri-T4Y7iWDVQoNa0AQqEcLLLaU-Bi2JZE9u3FM0Js5XpugKTWT6xt8j2tBYA5OWLdN6IqkItLnhCUfo4tN7uDgSGJVhb\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-384?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:34 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "552", + "x-ms-request-id" : "a036f2f3-0e25-40dc-a073-5f604a091b3c", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-384\",\"deletedDate\":1565067934,\"scheduledPurgeDate\":1572843934,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-384/030c64353e4042159c25a02855d3a5d9\",\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-384\",\"x\":\"ALLpJ-Ws5nMeDupEooytQOAifZcUV1i67-DJSfxGR-9er-0N1eL0yxiwQuARWraZ1Q\",\"y\":\"AIwn4DpsJc7bSACXB7JoWqlI5-GOKlU7nLDhdlWb83JgLjDos3BWTqC1Hp8U5yN9ug\"},\"attributes\":{\"enabled\":true,\"created\":1565067934,\"updated\":1565067934,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-384?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:34 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "689200f1-eb13-4f52-a38b-65610e7e93f0", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-384\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-384?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:36 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "f31a624d-90af-4c0a-a01e-d148f29763a0", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-384\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-384?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:38 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "fc16c56b-206d-4f38-8d77-c3bb1442c2d4", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-384\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-384?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:40 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "d8b86129-a0ba-49a3-a16b-d031914ea51d", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-384\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-384?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:42 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "2c9bbdfe-dcfa-472b-8d82-212b516f3a2d", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-384\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-384?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:44 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "a86de40c-9b8f-4a5e-b5f6-3e4f9a57cf6e", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-384\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-384?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:47 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "a4292cb8-dc2f-4a7d-a540-66d8a30ac77f", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-384\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-384?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:48 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "552", + "x-ms-request-id" : "b45357fb-07b0-4adb-8a43-a1940af86d40", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-384\",\"deletedDate\":1565067934,\"scheduledPurgeDate\":1572843934,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-384/030c64353e4042159c25a02855d3a5d9\",\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-384\",\"x\":\"ALLpJ-Ws5nMeDupEooytQOAifZcUV1i67-DJSfxGR-9er-0N1eL0yxiwQuARWraZ1Q\",\"y\":\"AIwn4DpsJc7bSACXB7JoWqlI5-GOKlU7nLDhdlWb83JgLjDos3BWTqC1Hp8U5yN9ug\"},\"attributes\":{\"enabled\":true,\"created\":1565067934,\"updated\":1565067934,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-384?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 06 Aug 2019 05:05:49 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "x-ms-request-id" : "9832d106-b476-49f0-bd32-f5baa4aca2cc", + "x-ms-keyvault-service-version" : "1.1.0.875", + "X-Powered-By" : "ASP.NET" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-384?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:49 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "0cc9231d-fdb0-4170-bce0-c4f83f5357e4", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-384\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-521?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:49 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "460", + "x-ms-request-id" : "f341a939-8517-4125-8b5c-8ee16790e73a", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-521/ac62d5af24774f8eade5ec1ebba680ed\",\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-521\",\"x\":\"AJb1yjC1egLlYeiI35DdIHQEJNx9Y9r7XQ-XobIetL_FrdnA1AYlAlYA432lXO2Iw452kbSTc-JdN-cUMJ97TvfM\",\"y\":\"c0kPQhIuDOFWCOOxSUR1oCjZMM_-bknl9B55HPc7wlge291AaZtPNHmqemWs6NJdQyrnzLVa95HWQCu9xLcLysI\"},\"attributes\":{\"enabled\":true,\"created\":1565067949,\"updated\":1565067949,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-521/ac62d5af24774f8eade5ec1ebba680ed/verify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:49 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "14", + "x-ms-request-id" : "d0efe0d1-9af7-4d0d-98e4-a7f303769acd", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"value\":true}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-521/ac62d5af24774f8eade5ec1ebba680ed/sign?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:49 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "285", + "x-ms-request-id" : "7731b6f5-eff8-4e15-a4a8-fa074b9c7a0d", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-521/ac62d5af24774f8eade5ec1ebba680ed\",\"value\":\"AeXq-Ej2xzmdR11P0gPXeBP1vQwkXYwuQpmhwC9v53sH75r7b_paDSxd7g1h8t5Gp4vA2vfKlWVxomfRxzM35-XLAN1BKyNowY-k6ZnxVNEv_OSFHZDdzF7yCnjbVY9l_JGTZx9djjC0kaE3nhds2bgQN2kZZK0A6xTXmO6daRGL4DZg\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-521?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:49 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "595", + "x-ms-request-id" : "9d10f17b-db6f-4e45-a641-beae86678f54", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-521\",\"deletedDate\":1565067949,\"scheduledPurgeDate\":1572843949,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-521/ac62d5af24774f8eade5ec1ebba680ed\",\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-521\",\"x\":\"AJb1yjC1egLlYeiI35DdIHQEJNx9Y9r7XQ-XobIetL_FrdnA1AYlAlYA432lXO2Iw452kbSTc-JdN-cUMJ97TvfM\",\"y\":\"c0kPQhIuDOFWCOOxSUR1oCjZMM_-bknl9B55HPc7wlge291AaZtPNHmqemWs6NJdQyrnzLVa95HWQCu9xLcLysI\"},\"attributes\":{\"enabled\":true,\"created\":1565067949,\"updated\":1565067949,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-521?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:49 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "8de8734d-e2aa-43d7-985d-fe72b4baac1e", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-521\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-521?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:51 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "2cee9a66-4155-4fda-93d4-69f0d48e1cf1", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-521\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-521?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:53 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "26837117-99c6-40ce-9014-bc3b84df10e4", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-521\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-521?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:55 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "47b172fe-32ea-429a-97f2-bb7d77a33ef1", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-521\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-521?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:57 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "5fd4da2e-5267-44bf-a278-60ccb9ae82eb", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-521\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-521?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:59 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "25d49dcb-e2bc-421c-8704-042d81917f3e", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-521\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-521?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:06:01 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "5aeeddd5-6f5d-463c-b7cf-9461b8cb43ff", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-521\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-521?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:06:03 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "595", + "x-ms-request-id" : "969be4ec-ec4b-49bf-9312-509658d9f705", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-521\",\"deletedDate\":1565067949,\"scheduledPurgeDate\":1572843949,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-521/ac62d5af24774f8eade5ec1ebba680ed\",\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-521\",\"x\":\"AJb1yjC1egLlYeiI35DdIHQEJNx9Y9r7XQ-XobIetL_FrdnA1AYlAlYA432lXO2Iw452kbSTc-JdN-cUMJ97TvfM\",\"y\":\"c0kPQhIuDOFWCOOxSUR1oCjZMM_-bknl9B55HPc7wlge291AaZtPNHmqemWs6NJdQyrnzLVa95HWQCu9xLcLysI\"},\"attributes\":{\"enabled\":true,\"created\":1565067949,\"updated\":1565067949,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-521?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 06 Aug 2019 05:06:03 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "x-ms-request-id" : "e3fa4507-4811-4a91-972b-2e789debaa2c", + "x-ms-keyvault-service-version" : "1.1.0.875", + "X-Powered-By" : "ASP.NET" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-521?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:06:03 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "82", + "x-ms-request-id" : "4b684eb9-d109-4f69-ad6a-9668d930e5d1", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-521\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "PUT", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-256K?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:06:03 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "373", + "x-ms-request-id" : "18a4c166-92d5-4089-9ee8-cb30ccb40fd1", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-256K/d6b01ac55f6941969636ed61e5f6b720\",\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-256K\",\"x\":\"Tgz0jB9SHUaEPuEnLXoZ9rrazgXHyO-aC0hRFt3vxH0\",\"y\":\"bCgJMpFjwLVKSTCgeVt2gc_d34ELNud4jRJ1rwFbbYo\"},\"attributes\":{\"enabled\":true,\"created\":1565067964,\"updated\":1565067964,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-256K/d6b01ac55f6941969636ed61e5f6b720/verify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:06:03 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "14", + "x-ms-request-id" : "e86a4ec1-799f-495e-955f-027adb1ff0ef", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"value\":true}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-256K/d6b01ac55f6941969636ed61e5f6b720/sign?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:06:03 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "196", + "x-ms-request-id" : "1bf894fe-b2ab-4c22-ada9-3d326f6b12b1", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-256K/d6b01ac55f6941969636ed61e5f6b720\",\"value\":\"5wdtsUIpnWfiuPTnT0B4zcMJx33s2h7a0kDIxzzaee7mzuG7XkGvGA3Fv7fMXpB4QsJcIA0DqhmR_6cWvh-6Ew\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/keys/testEcKeyP-256K?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:06:03 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "509", + "x-ms-request-id" : "e3d45690-b96b-4084-9cba-c588ed2a8927", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256K\",\"deletedDate\":1565067964,\"scheduledPurgeDate\":1572843964,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-256K/d6b01ac55f6941969636ed61e5f6b720\",\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-256K\",\"x\":\"Tgz0jB9SHUaEPuEnLXoZ9rrazgXHyO-aC0hRFt3vxH0\",\"y\":\"bCgJMpFjwLVKSTCgeVt2gc_d34ELNud4jRJ1rwFbbYo\"},\"attributes\":{\"enabled\":true,\"created\":1565067964,\"updated\":1565067964,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256K?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:06:03 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "83", + "x-ms-request-id" : "41874a22-1f7d-42cd-ad6b-dfdf10b3310a", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256K\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256K?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:06:06 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "83", + "x-ms-request-id" : "98b2cda6-92b9-4dd3-993e-b836c611859c", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256K\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256K?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:06:08 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "83", + "x-ms-request-id" : "a7dfd138-9972-4bb5-8cc1-03f8cab2b538", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256K\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256K?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:06:10 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "83", + "x-ms-request-id" : "2d95bcd0-1962-437c-9bc1-565a2862b8b2", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256K\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256K?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:06:12 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "83", + "x-ms-request-id" : "c36e5004-4b1c-48ea-8686-d4c92d05cb6d", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256K\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256K?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:06:14 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "83", + "x-ms-request-id" : "d0c732a1-706d-4b8b-afea-866688ec06f1", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256K\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256K?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:06:16 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "83", + "x-ms-request-id" : "a14606ff-c2cf-44e5-adb8-cc6b4e7d5869", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256K\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256K?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:06:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "509", + "x-ms-request-id" : "5b022123-102f-49e4-b766-64ddf5064f62", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256K\",\"deletedDate\":1565067964,\"scheduledPurgeDate\":1572843964,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testEcKeyP-256K/d6b01ac55f6941969636ed61e5f6b720\",\"kty\":\"EC\",\"key_ops\":[\"sign\",\"verify\"],\"crv\":\"P-256K\",\"x\":\"Tgz0jB9SHUaEPuEnLXoZ9rrazgXHyO-aC0hRFt3vxH0\",\"y\":\"bCgJMpFjwLVKSTCgeVt2gc_d34ELNud4jRJ1rwFbbYo\"},\"attributes\":{\"enabled\":true,\"created\":1565067964,\"updated\":1565067964,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256K?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 06 Aug 2019 05:06:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "x-ms-request-id" : "6743ad35-948a-4736-888c-b3b6cbef5792", + "x-ms-keyvault-service-version" : "1.1.0.875", + "X-Powered-By" : "ASP.NET" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testEcKeyP-256K?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:06:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "83", + "x-ms-request-id" : "1ad41b84-54b0-4618-82dc-78605230f7dc", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testEcKeyP-256K\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/signVerifyRsa.json b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/signVerifyRsa.json new file mode 100644 index 000000000000..d39d561e045d --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/signVerifyRsa.json @@ -0,0 +1,514 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:12 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "666", + "x-ms-request-id" : "298b2b1d-70a0-48e9-a60c-a608b34b66b2", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646\",\"kty\":\"RSA\",\"key_ops\":[\"encrypt\",\"decrypt\",\"sign\",\"verify\",\"wrapKey\",\"unwrapKey\"],\"n\":\"1_6ZtP288hEkKML-L6nFyZh1PD1rmAgwbbwjEvTSDK_008BYWhjp_6ULy9BhWtRIytNkPkm9gzaBTrCpp-vyDXPGa836Htp-w8u5JmxoUZchJh576m3m-8ZYWTmZSAp5SpruyKAmLSxPJHEWPXQntnmuTMjb9HBT9Ltrwc0ZDk-jsMLYunDJrNmrRUxQgb0zQ_Tl5fJjj8j-0KVx2RXtbfWFvf5fRdBYyP3m0aUpoopQPwtXszD2LcSKMJ_TnmnvMWr8MOA5aRlBaGdBk7zBgRafvDPam3Q2AvFA9mfcAVncpfZ3JFm73VARw6MofXtRqOHtZ7y4oNbY95xXwU2r6w\",\"e\":\"AQAB\"},\"attributes\":{\"enabled\":true,\"created\":1565078533,\"updated\":1565078533,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646/sign?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:12 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "457", + "x-ms-request-id" : "26cc1280-66b1-4143-bf6b-0837bd90d7e4", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646\",\"value\":\"VycNS2AleyY425cgT02DdqHgz0r95vm0UDEsnG8uQiT7IfxflrjKM_d8PvOeV6JA6kamk6lhvFKnJqXyNmFaPcI7RcibAW-e3-9k91TEegUNl4dZpPeuy6AY5-CkafXBBTHCCOAfGuyCeNnr8jJF7teQa_Z246wgoOiGACQx37C2m9jb2x-Q3-mxo8utyi3NFu8LCJs7C9h_AlcszRJ0l9a0dP97YnNFW75GtBpfjt7frZFUGdJNeWvZXBhCzhtYN9ynN6SHIKKVfZEe-Uqc3HvY63oEGvVGcPnWeV2wY8NfQn04gji3hdKKyRH0VLSkwHJpSA7V42EDaPbaQCriQA\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646/verify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:13 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "14", + "x-ms-request-id" : "6e39a0ae-cc98-4dbe-a583-cbcc3086e500", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"value\":true}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646/sign?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:13 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "457", + "x-ms-request-id" : "ce3593b5-af4c-409f-b9b6-b3173ad8c617", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646\",\"value\":\"VycNS2AleyY425cgT02DdqHgz0r95vm0UDEsnG8uQiT7IfxflrjKM_d8PvOeV6JA6kamk6lhvFKnJqXyNmFaPcI7RcibAW-e3-9k91TEegUNl4dZpPeuy6AY5-CkafXBBTHCCOAfGuyCeNnr8jJF7teQa_Z246wgoOiGACQx37C2m9jb2x-Q3-mxo8utyi3NFu8LCJs7C9h_AlcszRJ0l9a0dP97YnNFW75GtBpfjt7frZFUGdJNeWvZXBhCzhtYN9ynN6SHIKKVfZEe-Uqc3HvY63oEGvVGcPnWeV2wY8NfQn04gji3hdKKyRH0VLSkwHJpSA7V42EDaPbaQCriQA\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646/verify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:13 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "14", + "x-ms-request-id" : "e4c8bcac-7cc0-4f0d-960c-a8da2e11a29e", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"value\":true}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646/sign?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:13 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "457", + "x-ms-request-id" : "7e3463e0-ae30-498a-88ae-2f706dbeb24e", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646\",\"value\":\"pgnnttZnG0DrXoJdN4rv-GMtHEnAa7FFXfIKNlC0wXIlXhGHNy_5bq4CUZgd5RO-56gNYr1rJ44nQJoBqS33t4rLjguIkcBMGyJ02ymSpvCaexHEYPh6XiFWeK9ivPXGxc4Sbu08Y387c-xRRLb5e6uw4MOC1VnInyNRwrqFVHho7cEK-n9CXi__U7oSSAG3n98i8id-oX-sWnxuMu7-G601wPa7T42XIZz_cg-0crE3oFFRO467cuFSNSiOy6f6YDPEJK58KBN5i-BomYhwnNKc1Z4ATRvTtUKs2YT-8jHu4yIkN0-LGmd8tQdRWwaoqQiDueJVSAAzp-T7LERbmg\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646/verify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:13 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "14", + "x-ms-request-id" : "74ec3430-c81f-4f0e-95f0-30ff1ec17bc9", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"value\":true}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646/sign?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:13 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "457", + "x-ms-request-id" : "b8bd9551-96ff-469a-aef3-641035b74c10", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646\",\"value\":\"pgnnttZnG0DrXoJdN4rv-GMtHEnAa7FFXfIKNlC0wXIlXhGHNy_5bq4CUZgd5RO-56gNYr1rJ44nQJoBqS33t4rLjguIkcBMGyJ02ymSpvCaexHEYPh6XiFWeK9ivPXGxc4Sbu08Y387c-xRRLb5e6uw4MOC1VnInyNRwrqFVHho7cEK-n9CXi__U7oSSAG3n98i8id-oX-sWnxuMu7-G601wPa7T42XIZz_cg-0crE3oFFRO467cuFSNSiOy6f6YDPEJK58KBN5i-BomYhwnNKc1Z4ATRvTtUKs2YT-8jHu4yIkN0-LGmd8tQdRWwaoqQiDueJVSAAzp-T7LERbmg\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646/verify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:13 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "14", + "x-ms-request-id" : "5da9d647-61a9-43d7-8170-40a84dc71d48", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"value\":true}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646/sign?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:13 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "457", + "x-ms-request-id" : "d2baa6be-7a74-4183-809f-0850094a0918", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646\",\"value\":\"EhVnpxaFb6gJcMjT3CJ4P2cOCn45FZFFpfGe3xIXtAX7oDzOeqFxpLKuRoZrXz9B4f2YzP-YwNNwBPISceE6JsA_WZHgOBbn3mnl3U90Z3u9HG5zNLfLOyfcjQ5EcoZ3591By9KHGAy4L1YOVIKdm70XqHCY6Xkm00_LBIZRQEjhsrnOLJ84Yxij5gI6n-TrbCyNxubnpRrb1MMSNkziK5mWFulYMC9p_fppWTDKGcog4s4mS6pg4emCBStPiN2TG4WER_T0oV6aYf9GKrAhZEy_7PhQcRxVFb2oe885iM-GPNXbWfzu4lAc_O7TNAi3aZtcPvBFSkfzPk8e7kVkAA\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646/verify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:13 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "14", + "x-ms-request-id" : "7569e457-7919-40b0-b0f7-4d2548bcc43c", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"value\":true}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646/sign?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:13 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "457", + "x-ms-request-id" : "94f0d3c2-35e7-4c13-bc8b-7feec222c008", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646\",\"value\":\"EhVnpxaFb6gJcMjT3CJ4P2cOCn45FZFFpfGe3xIXtAX7oDzOeqFxpLKuRoZrXz9B4f2YzP-YwNNwBPISceE6JsA_WZHgOBbn3mnl3U90Z3u9HG5zNLfLOyfcjQ5EcoZ3591By9KHGAy4L1YOVIKdm70XqHCY6Xkm00_LBIZRQEjhsrnOLJ84Yxij5gI6n-TrbCyNxubnpRrb1MMSNkziK5mWFulYMC9p_fppWTDKGcog4s4mS6pg4emCBStPiN2TG4WER_T0oV6aYf9GKrAhZEy_7PhQcRxVFb2oe885iM-GPNXbWfzu4lAc_O7TNAi3aZtcPvBFSkfzPk8e7kVkAA\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646/verify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:13 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "14", + "x-ms-request-id" : "f7d437f8-9b0a-42d2-99b2-962b0d360f7b", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"value\":true}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeySignVerify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:13 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "807", + "x-ms-request-id" : "440da0c0-da98-49d3-92a5-d1589621264d", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testRsaKeySignVerify\",\"deletedDate\":1565078534,\"scheduledPurgeDate\":1572854534,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646\",\"kty\":\"RSA\",\"key_ops\":[\"encrypt\",\"decrypt\",\"sign\",\"verify\",\"wrapKey\",\"unwrapKey\"],\"n\":\"1_6ZtP288hEkKML-L6nFyZh1PD1rmAgwbbwjEvTSDK_008BYWhjp_6ULy9BhWtRIytNkPkm9gzaBTrCpp-vyDXPGa836Htp-w8u5JmxoUZchJh576m3m-8ZYWTmZSAp5SpruyKAmLSxPJHEWPXQntnmuTMjb9HBT9Ltrwc0ZDk-jsMLYunDJrNmrRUxQgb0zQ_Tl5fJjj8j-0KVx2RXtbfWFvf5fRdBYyP3m0aUpoopQPwtXszD2LcSKMJ_TnmnvMWr8MOA5aRlBaGdBk7zBgRafvDPam3Q2AvFA9mfcAVncpfZ3JFm73VARw6MofXtRqOHtZ7y4oNbY95xXwU2r6w\",\"e\":\"AQAB\"},\"attributes\":{\"enabled\":true,\"created\":1565078533,\"updated\":1565078533,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeySignVerify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 08:02:13 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "88", + "x-ms-request-id" : "ae165d65-667c-49fa-9f27-b0e82e1c61b4", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKeySignVerify\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeySignVerify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 08:02:16 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "88", + "x-ms-request-id" : "5072e633-11c5-4c9f-8244-43f003ac97a6", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKeySignVerify\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeySignVerify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 08:02:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "807", + "x-ms-request-id" : "88293fc6-ee52-44c7-80dd-80517bf37e56", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testRsaKeySignVerify\",\"deletedDate\":1565078534,\"scheduledPurgeDate\":1572854534,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeySignVerify/dcd6a6e47f504485a450b38f83bcc646\",\"kty\":\"RSA\",\"key_ops\":[\"encrypt\",\"decrypt\",\"sign\",\"verify\",\"wrapKey\",\"unwrapKey\"],\"n\":\"1_6ZtP288hEkKML-L6nFyZh1PD1rmAgwbbwjEvTSDK_008BYWhjp_6ULy9BhWtRIytNkPkm9gzaBTrCpp-vyDXPGa836Htp-w8u5JmxoUZchJh576m3m-8ZYWTmZSAp5SpruyKAmLSxPJHEWPXQntnmuTMjb9HBT9Ltrwc0ZDk-jsMLYunDJrNmrRUxQgb0zQ_Tl5fJjj8j-0KVx2RXtbfWFvf5fRdBYyP3m0aUpoopQPwtXszD2LcSKMJ_TnmnvMWr8MOA5aRlBaGdBk7zBgRafvDPam3Q2AvFA9mfcAVncpfZ3JFm73VARw6MofXtRqOHtZ7y4oNbY95xXwU2r6w\",\"e\":\"AQAB\"},\"attributes\":{\"enabled\":true,\"created\":1565078533,\"updated\":1565078533,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeySignVerify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 06 Aug 2019 08:02:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "x-ms-request-id" : "ce3a8d54-36aa-45ba-b3fa-234e1d8044f2", + "x-ms-keyvault-service-version" : "1.1.0.875", + "X-Powered-By" : "ASP.NET" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeySignVerify?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 08:02:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "88", + "x-ms-request-id" : "91d79062-fcf2-4570-8793-dd96d7cda986", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKeySignVerify\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/wrapUnwrapSymmetricKeyAES128Kw.json b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/wrapUnwrapSymmetricKeyAES128Kw.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/wrapUnwrapSymmetricKeyAES128Kw.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/wrapUnwrapSymmetricKeyAES192Kw.json b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/wrapUnwrapSymmetricKeyAES192Kw.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/wrapUnwrapSymmetricKeyAES192Kw.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/wrapUnwrapSymmetricKeyAES256Kw.json b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/wrapUnwrapSymmetricKeyAES256Kw.json new file mode 100644 index 000000000000..ba5f37f8f855 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/wrapUnwrapSymmetricKeyAES256Kw.json @@ -0,0 +1,4 @@ +{ + "networkCallRecords" : [ ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/wrapUnwraptRsa.json b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/wrapUnwraptRsa.json new file mode 100644 index 000000000000..d2857b01d3cd --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/test/resources/session-records/wrapUnwraptRsa.json @@ -0,0 +1,514 @@ +{ + "networkCallRecords" : [ { + "Method" : "PUT", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:04 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "666", + "x-ms-request-id" : "19807c34-9fed-4593-9fac-a064ad42f2c7", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596\",\"kty\":\"RSA\",\"key_ops\":[\"encrypt\",\"decrypt\",\"sign\",\"verify\",\"wrapKey\",\"unwrapKey\"],\"n\":\"1_6ZtP288hEkKML-L6nFyZh1PD1rmAgwbbwjEvTSDK_008BYWhjp_6ULy9BhWtRIytNkPkm9gzaBTrCpp-vyDXPGa836Htp-w8u5JmxoUZchJh576m3m-8ZYWTmZSAp5SpruyKAmLSxPJHEWPXQntnmuTMjb9HBT9Ltrwc0ZDk-jsMLYunDJrNmrRUxQgb0zQ_Tl5fJjj8j-0KVx2RXtbfWFvf5fRdBYyP3m0aUpoopQPwtXszD2LcSKMJ_TnmnvMWr8MOA5aRlBaGdBk7zBgRafvDPam3Q2AvFA9mfcAVncpfZ3JFm73VARw6MofXtRqOHtZ7y4oNbY95xXwU2r6w\",\"e\":\"AQAB\"},\"attributes\":{\"enabled\":true,\"created\":1565067905,\"updated\":1565067905,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596/unwrapkey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:04 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "249", + "x-ms-request-id" : "7db9af63-b9f4-461f-a840-b65300a01133", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596\",\"value\":\"G9GT23aoJ9lUS5WtxwlS9igODCiTObv_Z7U9HhTbk99t_24WdBcngS2ycvtJ7_VQ6ESEKt1QdoI8UMRwh2UOMalPrw1leEgbwgpOtCPjmzCk2fhuxCHyinA3x0iGnD2jyYaXiw\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596/wrapkey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:04 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "457", + "x-ms-request-id" : "3c4972ad-35be-4067-93ff-b47bfa996080", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596\",\"value\":\"o3r6EuT5M8me6TdyhkkB0TnHxs_T3HJm-ucQ2hJgCZ7d6dt5CgN9v2trxBqjbsB79kyRpPbDgvdbgIhVOuLoYYdQLIw-HmJOd2OA8kj10WmHwYe-_Tr0vq9uOh1g--mbA4gtoKddsAXOHSvrfLUfUTS_O3hMmvj4qlEVGIdb5yOn1avG7XAu64apN4jzHONP3oj3eA4gUTcTEVDFUk18Sw3j3RQuNZQqd9FAOjg-uGLHeoHwXKkIQ30V0cBaW5yWhi_M5jndYbee7COBtsauvrVvq0V9Q7jaGTL-kIM5tiKxr--UTIxcQpN-u_b9MUt94a9ep6pccMeK3iaxLRa-Sg\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596/unwrapkey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:04 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "249", + "x-ms-request-id" : "bf42e341-6dab-4588-b980-92449a4a5af2", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596\",\"value\":\"G9GT23aoJ9lUS5WtxwlS9igODCiTObv_Z7U9HhTbk99t_24WdBcngS2ycvtJ7_VQ6ESEKt1QdoI8UMRwh2UOMalPrw1leEgbwgpOtCPjmzCk2fhuxCHyinA3x0iGnD2jyYaXiw\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596/wrapkey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:04 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "457", + "x-ms-request-id" : "b1c165f7-a98a-4880-b4f5-c03ce19c6004", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596\",\"value\":\"U2Sg-6qTuk3du7PcYBHA9AbxvMDGTFKRsmYMbLNE8OZDyKlJTcqBGjhEJXXZsRnNcpo8hu1X8haVEUvoDFv5Cmg1t4PISjUz5Sa-18FDmh4S2DgSalKImonLHpWawHhsU0w-MMFitTu9zhhI7v5sHUqI_at9mUv8_AKK3DWTUV4dLnuGYS1m2nK8KSVr9ece2CciRHmMMvqMLDFhQoq2bp65oJ1PkPmUQj6gBzauW77vlcJQQDX7tXIM8Az1YQG1yxwEvYwVGq-FqT5O5PWtfQgbHK3gGBgQ0AGx1MttCP-1wMmmSTiTT1-kbPSgcx77XFrJ_SY_HGKP171j991LdA\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596/wrapkey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:05 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "457", + "x-ms-request-id" : "afcf9de4-a06a-49b2-8146-e13ee22efacc", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596\",\"value\":\"VoXFr1CMmPS-nODyeHLbckO21Yvs2izzC6ro6tB3rGPcQ8lHpEY2ZF4JbI8xuoCUdB6PJjMkWMo1O2h8HPVHGznfV-W6ce051W_p9nsstAs8ahP5Vc6PkxOwkIebYUjZWt6L-suzzLd_Uvb2T5P_xQPrL_kUJkGuxQsQgwGd8smy5k7YuV96sZ5v7szcB8OiYXiUpYZjI5prBNuEnGFYvVF0QPgILgDWDRL3qHPl1RSWn0iiGHkFFu9bivhjmKO2m49ScqRuO5FCW4-RgxYRnvFxNWjQChG0wfY-2gtLd8xKsziA4z7yiLn2_dGvC9kuA_list_R_LmFrpRjypf12g\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596/unwrapkey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:05 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "249", + "x-ms-request-id" : "73b9e0c3-33ca-4d1e-89f1-8f79d15deae0", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596\",\"value\":\"G9GT23aoJ9lUS5WtxwlS9igODCiTObv_Z7U9HhTbk99t_24WdBcngS2ycvtJ7_VQ6ESEKt1QdoI8UMRwh2UOMalPrw1leEgbwgpOtCPjmzCk2fhuxCHyinA3x0iGnD2jyYaXiw\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596/wrapkey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:05 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "457", + "x-ms-request-id" : "79f862a1-cf69-4639-a94b-67a4f6af07ac", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596\",\"value\":\"LmUdngYH9D84bzKRwyTiVDoYr9R_3UjH-A2YjJEJGqfZ6TgK6ghZXxQAEgL3Aij_EQ0U2b9fBwFcxkSTk5Ge6GrI7Ztrr-G5-DB30CkAHyVmlTkf55ccjmZ-vFSuPXyorYPWn92bv8pXk95mpfJS2cmaRScYpG-FZ_0QDTeFCoAWCWM39kjwSvevPyx6syTGL3IE8xLqtQzeTBAA4kz03jtCDvPdqJYYvPFBMjSQhDDNsVW5JleypKMAm0lPXf1NK2QLn5-BzUCV8jtHMcm_tKQi1S6vg7OEvGE_uADOLEIxsemZrtvxO7d6mlds31qMuaQyumQt5dVSoMvIB9CNtQ\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "POST", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596/unwrapkey?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:05 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "249", + "x-ms-request-id" : "9cdc90aa-4aca-4696-8d6e-a1820df5e131", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596\",\"value\":\"G9GT23aoJ9lUS5WtxwlS9igODCiTObv_Z7U9HhTbk99t_24WdBcngS2ycvtJ7_VQ6ESEKt1QdoI8UMRwh2UOMalPrw1leEgbwgpOtCPjmzCk2fhuxCHyinA3x0iGnD2jyYaXiw\"}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:05 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "807", + "x-ms-request-id" : "80c907cc-0b80-440a-ba57-890f4505827f", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testRsaKeyWrapUnwrap\",\"deletedDate\":1565067906,\"scheduledPurgeDate\":1572843906,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596\",\"kty\":\"RSA\",\"key_ops\":[\"encrypt\",\"decrypt\",\"sign\",\"verify\",\"wrapKey\",\"unwrapKey\"],\"n\":\"1_6ZtP288hEkKML-L6nFyZh1PD1rmAgwbbwjEvTSDK_008BYWhjp_6ULy9BhWtRIytNkPkm9gzaBTrCpp-vyDXPGa836Htp-w8u5JmxoUZchJh576m3m-8ZYWTmZSAp5SpruyKAmLSxPJHEWPXQntnmuTMjb9HBT9Ltrwc0ZDk-jsMLYunDJrNmrRUxQgb0zQ_Tl5fJjj8j-0KVx2RXtbfWFvf5fRdBYyP3m0aUpoopQPwtXszD2LcSKMJ_TnmnvMWr8MOA5aRlBaGdBk7zBgRafvDPam3Q2AvFA9mfcAVncpfZ3JFm73VARw6MofXtRqOHtZ7y4oNbY95xXwU2r6w\",\"e\":\"AQAB\"},\"attributes\":{\"enabled\":true,\"created\":1565067905,\"updated\":1565067905,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeyWrapUnwrap?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:05 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "88", + "x-ms-request-id" : "f2eb4e92-4def-4565-abe0-d4912f591a20", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKeyWrapUnwrap\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeyWrapUnwrap?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:08 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "88", + "x-ms-request-id" : "88fe746d-d5ec-405a-92cb-0a0fb0393f33", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKeyWrapUnwrap\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeyWrapUnwrap?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:10 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "88", + "x-ms-request-id" : "de43892e-92cc-4492-8557-de3f75203f8d", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKeyWrapUnwrap\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeyWrapUnwrap?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:12 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "88", + "x-ms-request-id" : "783f3db8-44dd-409f-b296-b910784a3b07", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKeyWrapUnwrap\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeyWrapUnwrap?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:14 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "88", + "x-ms-request-id" : "f8b77156-60ab-427c-b853-2f350080b0cc", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKeyWrapUnwrap\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeyWrapUnwrap?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:16 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "88", + "x-ms-request-id" : "a83346a8-8915-4965-98d5-ca2c6f4fb249", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKeyWrapUnwrap\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeyWrapUnwrap?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "200", + "Date" : "Tue, 06 Aug 2019 05:05:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "807", + "x-ms-request-id" : "900d0469-9ffa-4d57-8496-15e691d0b835", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"recoveryId\":\"https://cameravault.vault.azure.net/deletedkeys/testRsaKeyWrapUnwrap\",\"deletedDate\":1565067906,\"scheduledPurgeDate\":1572843906,\"key\":{\"kid\":\"https://cameravault.vault.azure.net/keys/testRsaKeyWrapUnwrap/3fe4a2a45118463aae244c367f736596\",\"kty\":\"RSA\",\"key_ops\":[\"encrypt\",\"decrypt\",\"sign\",\"verify\",\"wrapKey\",\"unwrapKey\"],\"n\":\"1_6ZtP288hEkKML-L6nFyZh1PD1rmAgwbbwjEvTSDK_008BYWhjp_6ULy9BhWtRIytNkPkm9gzaBTrCpp-vyDXPGa836Htp-w8u5JmxoUZchJh576m3m-8ZYWTmZSAp5SpruyKAmLSxPJHEWPXQntnmuTMjb9HBT9Ltrwc0ZDk-jsMLYunDJrNmrRUxQgb0zQ_Tl5fJjj8j-0KVx2RXtbfWFvf5fRdBYyP3m0aUpoopQPwtXszD2LcSKMJ_TnmnvMWr8MOA5aRlBaGdBk7zBgRafvDPam3Q2AvFA9mfcAVncpfZ3JFm73VARw6MofXtRqOHtZ7y4oNbY95xXwU2r6w\",\"e\":\"AQAB\"},\"attributes\":{\"enabled\":true,\"created\":1565067905,\"updated\":1565067905,\"recoveryLevel\":\"Recoverable+Purgeable\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + }, { + "Method" : "DELETE", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeyWrapUnwrap?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "204", + "Date" : "Tue, 06 Aug 2019 05:05:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "x-ms-request-id" : "ff513db1-2278-442a-b7bd-c17f1f5e5325", + "x-ms-keyvault-service-version" : "1.1.0.875", + "X-Powered-By" : "ASP.NET" + } + }, { + "Method" : "GET", + "Uri" : "https://cameravault.vault.azure.net/deletedkeys/testRsaKeyWrapUnwrap?api-version=7.0", + "Headers" : { + "User-Agent" : "azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0 azsdk-java-Azure-Keyvault/4.0.0-preview.2 1.8.0_211; Windows 10 10.0", + "Content-Type" : "application/json" + }, + "Response" : { + "Server" : "Microsoft-IIS/10.0", + "X-Content-Type-Options" : "nosniff", + "Pragma" : "no-cache", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Tue, 06 Aug 2019 05:05:18 GMT", + "Strict-Transport-Security" : "max-age=31536000;includeSubDomains", + "Cache-Control" : "no-cache", + "X-AspNet-Version" : "4.0.30319", + "x-ms-keyvault-region" : "centralus", + "x-ms-keyvault-network-info" : "addr=51.143.0.73;act_addr_fam=InterNetwork;", + "Expires" : "-1", + "Content-Length" : "88", + "x-ms-request-id" : "f4c689f1-e38e-4ef6-bf65-3cf3b643b54f", + "x-ms-keyvault-service-version" : "1.1.0.875", + "Body" : "{\"error\":{\"code\":\"KeyNotFound\",\"message\":\"Deleted Key not found: testRsaKeyWrapUnwrap\"}}", + "X-Powered-By" : "ASP.NET", + "Content-Type" : "application/json; charset=utf-8" + } + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-secrets/CHANGELOG.md b/sdk/keyvault/azure-keyvault-secrets/CHANGELOG.md index c8fb10caf152..21b18ac246d8 100644 --- a/sdk/keyvault/azure-keyvault-secrets/CHANGELOG.md +++ b/sdk/keyvault/azure-keyvault-secrets/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 4.0.0-preview.2 (2019-08-06) +For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). + +- Added support for HTTP challenge based authentication, allowing clients to interact with vaults in sovereign clouds. +- Combined SecretClientBuilder, SecretAsyncClientBuilder into SecretClientBuilder. Methods to create both sync and async clients type were added. +- Removed static builder method from clients. Builders are now instantiable. + ## 4.0.0-preview.1 (2019-06-28) Version 4.0.0-preview.1 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html). diff --git a/sdk/keyvault/azure-keyvault-secrets/README.md b/sdk/keyvault/azure-keyvault-secrets/README.md index 70a2c89a0c2a..dcbdbe7974bf 100644 --- a/sdk/keyvault/azure-keyvault-secrets/README.md +++ b/sdk/keyvault/azure-keyvault-secrets/README.md @@ -15,7 +15,7 @@ Maven dependency for Azure Secret Client library. Add it to your project's pom f com.azure azure-keyvault-secrets - 4.0.0-preview.1 + 4.0.0-preview.2 ``` @@ -76,15 +76,15 @@ Here is [Azure Cloud Shell](https://shell.azure.com/bash) snippet below to Once you've populated the **AZURE_CLIENT_ID**, **AZURE_CLIENT_SECRET** and **AZURE_TENANT_ID** environment variables and replaced **your-vault-url** with the above returned URI, you can create the SecretClient: ```Java -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.secrets.SecretClient; SecretClient client = new SecretClientBuilder() .endpoint() - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); ``` -> NOTE: For using Asynchronous client use SecretAsyncClient instead of SecretClient +> NOTE: For using Asynchronous client use SecretAsyncClient instead of SecretClient and call buildAsyncClient() ## Key concepts @@ -113,13 +113,13 @@ The following sections provide several code snippets covering some of the most c Create a Secret to be stored in the Azure Key Vault. - `setSecret` creates a new secret in the key vault. if the secret with name already exists then a new version of the secret is created. ```Java -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.secrets.SecretClient; import com.azure.security.keyvault.secrets.models.Secret; SecretClient secretClient = new SecretClientBuilder() .endpoint() - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); Secret secret = secretClient.setSecret("secret_name", "secret_value").value(); @@ -178,13 +178,13 @@ The following sections provide several code snippets covering some of the most c Create a Secret to be stored in the Azure Key Vault. - `setSecret` creates a new secret in the key vault. if the secret with name already exists then a new version of the secret is created. ```Java -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.secrets.SecretAsyncClient; import com.azure.security.keyvault.secrets.models.Secret; SecretAsyncClient secretAsyncClient = new SecretClientBuilder() .endpoint() - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); secretAsyncClient.setSecret("secret_name", "secret_value").subscribe(secretResponse -> @@ -286,25 +286,25 @@ When you submit a pull request, a CLA-bot will automatically determine whether y This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. -[source_code]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-secrets/src +[source_code]: src [api_documentation]: https://azure.github.io/azure-sdk-for-java/track2reports/index.html [azure_identity]: https://github.com/Azure/azure-sdk-for-java/tree/master/identity/client -[azkeyvault_docs]: https://docs.microsoft.com/en-us/azure/key-vault/ +[azkeyvault_docs]: https://docs.microsoft.com/azure/key-vault/ [maven]: https://maven.apache.org/ [azure_subscription]: https://azure.microsoft.com/ -[azure_keyvault]: https://docs.microsoft.com/en-us/azure/key-vault/quick-create-portal +[azure_keyvault]: https://docs.microsoft.com/azure/key-vault/quick-create-portal [azure_cli]: https://docs.microsoft.com/cli/azure -[rest_api]: https://docs.microsoft.com/en-us/rest/api/keyvault/ -[azkeyvault_rest]: https://docs.microsoft.com/en-us/rest/api/keyvault/ -[azure_create_application_in_portal]:https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal -[azure_keyvault_cli]:https://docs.microsoft.com/en-us/azure/key-vault/quick-create-cli -[azure_keyvault_cli_full]:https://docs.microsoft.com/en-us/cli/azure/keyvault?view=azure-cli-latest -[secrets_samples]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets -[sample_helloWorld]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java -[sample_helloWorldAsync]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorldAsync.java -[sample_list]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperations.java -[sample_listAsync]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperationsAsync.java -[sample_BackupRestore]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperations.java -[sample_BackupRestoreAsync]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperationsAsync.java -[sample_ManageDeleted]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecrets.java -[sample_ManageDeletedAsync]:https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecretsAsync.java +[rest_api]: https://docs.microsoft.com/rest/api/keyvault/ +[azkeyvault_rest]: https://docs.microsoft.com/rest/api/keyvault/ +[azure_create_application_in_portal]:https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +[azure_keyvault_cli]:https://docs.microsoft.com/azure/key-vault/quick-create-cli +[azure_keyvault_cli_full]:https://docs.microsoft.com/cli/azure/keyvault?view=azure-cli-latest +[secrets_samples]: src/samples/java/com/azure/security/keyvault/secrets +[sample_helloWorld]: src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java +[sample_helloWorldAsync]: src/samples/java/com/azure/security/keyvault/secrets/HelloWorldAsync.java +[sample_list]: src/samples/java/com/azure/security/keyvault/secrets/ListOperations.java +[sample_listAsync]: src/samples/java/com/azure/security/keyvault/secrets/ListOperationsAsync.java +[sample_BackupRestore]: src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperations.java +[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 diff --git a/sdk/keyvault/azure-keyvault-secrets/pom.xml b/sdk/keyvault/azure-keyvault-secrets/pom.xml index 7f86407dd1df..bfd368449cc3 100644 --- a/sdk/keyvault/azure-keyvault-secrets/pom.xml +++ b/sdk/keyvault/azure-keyvault-secrets/pom.xml @@ -5,13 +5,13 @@ com.azure azure-keyvault-parent - 4.0.0-preview.1 + 4.0.0-preview.2 ../pom.client.xml com.azure azure-keyvault-secrets - 4.0.0-preview.1 + 4.0.0-preview.2 azure-keyvault-secrets https://github.com/Azure/azure-sdk-for-java @@ -64,7 +64,7 @@ com.azure azure-identity - 1.0.0-preview.1 + 1.0.0-preview.2 test 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 new file mode 100644 index 000000000000..0ef9d4544c03 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/KeyVaultCredentialPolicy.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.secrets; + +import com.azure.core.credentials.TokenCredential; +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.implementation.util.ImplUtils; +import reactor.core.publisher.Mono; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; + +/** + * A policy that authenticates requests with Azure Key Vault service. The content added by this policy + * is leveraged in {@link TokenCredential} to get and set the correct "Authorization" header value. + * + * @see TokenCredential + */ +public final class KeyVaultCredentialPolicy implements HttpPipelinePolicy { + private static final String WWW_AUTHENTICATE = "WWW-Authenticate"; + private static final String BEARER_TOKEN_PREFIX = "Bearer "; + private static final String AUTHORIZATION = "Authorization"; + private final ScopeTokenCache cache; + + /** + * Creates KeyVaultCredentialPolicy. + * + * @param credential the token credential to authenticate the request + */ + public KeyVaultCredentialPolicy(TokenCredential credential) { + Objects.requireNonNull(credential); + this.cache = new ScopeTokenCache((scopes) -> credential.getToken(scopes)); + } + + /** + * Adds the required header to authenticate a request to Azure Key Vault service. + * + * @param context The request context + * @param next The next HTTP pipeline policy to process the {@code context's} request after this policy completes. + * @return A {@link Mono} representing the HTTP response that will arrive asynchronously. + */ + @Override + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + return next.clone().process() + // Ignore body + .doOnNext(HttpResponse::close) + .map(res -> res.headerValue(WWW_AUTHENTICATE)) + .map(header -> extractChallenge(header, BEARER_TOKEN_PREFIX)) + .flatMap(map -> { + cache.scopes(map.get("resource") + "/.default"); + return cache.getToken(); + }) + .flatMap(token -> { + context.httpRequest().header(AUTHORIZATION, BEARER_TOKEN_PREFIX + token.token()); + return next.process(); + }); + } + + /** + * Extracts the challenge off the authentication header. + * + * @param authenticateHeader The authentication header containing all the challenges. + * @param authChallengePrefix The authentication challenge name. + * @return a challenge map. + */ + private static Map extractChallenge(String authenticateHeader, String authChallengePrefix) { + if (!isValidChallenge(authenticateHeader, authChallengePrefix)) { + return null; + } + authenticateHeader = authenticateHeader.toLowerCase(Locale.ROOT).replace(authChallengePrefix.toLowerCase(Locale.ROOT), ""); + + String[] challenges = authenticateHeader.split(", "); + Map challengeMap = new HashMap<>(); + for (String pair : challenges) { + String[] keyValue = pair.split("="); + challengeMap.put(keyValue[0].replaceAll("\"", ""), keyValue[1].replaceAll("\"", "")); + } + return challengeMap; + } + + /** + * Verifies whether a challenge is bearer or not. + * + * @param authenticateHeader The authentication header containing all the challenges. + * @param authChallengePrefix The authentication challenge name. + * @return A boolean indicating tha challenge is valid or not. + */ + private static boolean isValidChallenge(String authenticateHeader, String authChallengePrefix) { + return (!ImplUtils.isNullOrEmpty(authenticateHeader) + && authenticateHeader.toLowerCase(Locale.ROOT).startsWith(authChallengePrefix.toLowerCase(Locale.ROOT))); + } +} diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/ScopeTokenCache.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/ScopeTokenCache.java new file mode 100644 index 000000000000..96ac53d7c7a9 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/ScopeTokenCache.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.secrets; + +import com.azure.core.credentials.AccessToken; +import reactor.core.publisher.FluxSink; +import reactor.core.publisher.Mono; +import reactor.core.publisher.ReplayProcessor; + +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Function; + +/** + * A token cache that supports caching a token and refreshing it. + */ +class ScopeTokenCache { + private final AtomicBoolean wip; + private AccessToken cache; + private final ReplayProcessor emitterProcessor = ReplayProcessor.create(1); + private final FluxSink sink = emitterProcessor.sink(FluxSink.OverflowStrategy.BUFFER); + private final Function> getNew; + private String[] scopes; + + + /** + * Creates an instance of RefreshableTokenCredential with default scheme "Bearer". + * + * @param getNew a method to get a new token + */ + ScopeTokenCache(Function> getNew) { + this.wip = new AtomicBoolean(false); + this.getNew = getNew; + } + + public void scopes(String... scopes) { + this.scopes = scopes; + } + + /** + * Asynchronously get a token from either the cache or replenish the cache with a new token. + * @return a Publisher that emits an AccessToken + */ + public Mono getToken() { + if (cache != null && !cache.isExpired()) { + return Mono.just(cache); + } + return Mono.defer(() -> { + if (!wip.getAndSet(true)) { + return getNew.apply(scopes).doOnNext(ac -> cache = ac) + .doOnNext(sink::next) + .doOnError(sink::error) + .doOnTerminate(() -> wip.set(false)); + } else { + return emitterProcessor.next(); + } + }); + } +} diff --git a/sdk/keyvault/azure-keyvault-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 836e32d0ebfc..af394d45d880 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 @@ -13,6 +13,7 @@ import com.azure.core.implementation.annotation.ReturnType; import com.azure.core.implementation.annotation.ServiceClient; import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.security.keyvault.secrets.models.DeletedSecret; @@ -36,7 +37,7 @@ * 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.secretclient.async.construct} + * {@codesnippet com.azure.security.keyvault.secrets.async.secretclient.construct} * * @see SecretClientBuilder * @see PagedFlux @@ -76,14 +77,31 @@ public final class SecretAsyncClient { *

    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.

    - *
    -     * Secret secret = new Secret("secretName", "secretValue")
    -     *   .notBefore(OffsetDateTime.now().plusDays(1))
    -     *   .expires(OffsetDateTime.now().plusDays(365));
    +     * {@codesnippet com.azure.keyvault.secrets.secretclient.setSecret#secret}
          *
    -     * secretAsyncClient.setSecret(secret).subscribe(secretResponse ->
    -     *   System.out.printf("Secret is created with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value()));
    -     * 
    + * @param secret The Secret object containing information about the secret and its properties. The properties secret.name and secret.value must be non null. + * @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) { + return setSecretWithResponse(secret).flatMap(FluxUtil::toMono); + } + + /** + * 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.

    + * + *

    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.

    + * {@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. * @throws NullPointerException if {@code secret} is {@code null}. @@ -92,11 +110,11 @@ public final class SecretAsyncClient { * @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> setSecret(Secret secret) { - return withContext(context -> setSecret(secret, context)); + public Mono> setSecretWithResponse(Secret secret) { + return withContext(context -> setSecretWithResponse(secret, context)); } - Mono> setSecret(Secret secret, Context context) { + Mono> setSecretWithResponse(Secret secret, Context context) { Objects.requireNonNull(secret, "The Secret input parameter cannot be null."); SecretRequestParameters parameters = new SecretRequestParameters() .value(secret.value()) @@ -118,24 +136,20 @@ Mono> setSecret(Secret secret, Context context) { *

    Code Samples

    *

    Creates a new secret in the key vault. Subscribes to the call asynchronously and prints out * the newly created secret details when a response is received.

    - *
    -     * secretAsyncClient.setSecret("secretName", "secretValue").subscribe(secretResponse ->
    -     *   System.out.printf("Secret is created with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value()));
    -     * 
    + * {@codesnippet com.azure.keyvault.secrets.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 A {@link Mono} containing a {@link Response} whose {@link Response#value() value} - * contains the {@link Secret created secret}. + * @return A {@link Mono} containing the {@link Secret created secret}. * @throws ResourceModifiedException if invalid {@code name} or {@code value} are specified. * @throws HttpRequestException if {@code name} or {@code value} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setSecret(String name, String value) { - return withContext(context -> setSecret(name, value, context)); + public Mono setSecret(String name, String value) { + return withContext(context -> setSecretWithResponse(name, value, context)).flatMap(FluxUtil::toMono); } - Mono> setSecret(String name, String value, Context context) { + 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) .doOnRequest(ignored -> logger.info("Setting secret - {}", name)) @@ -152,12 +166,33 @@ Mono> setSecret(String name, String value, Context context) { *

    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.

    - *
    -     * String secretVersion = "6A385B124DEF4096AF1361A85B16C204";
    -     * secretAsyncClient.getSecret("secretName", secretVersion).subscribe(secretResponse ->
    -     *   System.out.printf("Secret with name %s, value %s and version %s", secretResponse.value().name(),
    -     *   secretResponse.value().value(), secretResponse.value().version()));
    -     * 
    + * {@codesnippet com.azure.keyvault.secrets.secretclient.getSecret#string-string} + * + * @param name The name of the secret, cannot be null + * @param version The version of the secret to retrieve. If this is an empty String or null, this + * call is equivalent to calling {@link #getSecret(String)}, with the latest version being + * retrieved. + * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} + * contains the requested {@link Secret secret}. + * @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) + public Mono getSecret(String name, String version) { + return getSecretWithResponse(name, version).flatMap(FluxUtil::toMono); + } + + /** + * 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.

    + * {@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 @@ -170,19 +205,40 @@ Mono> setSecret(String name, String value, Context context) { * @throws HttpRequestException if {@code name} name} or {@code version} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getSecret(String name, String version) { - return withContext(context -> getSecret(name, version, context)); + public Mono> getSecretWithResponse(String name, String version) { + return withContext(context -> getSecretWithResponse(name, version, context)); } - Mono> getSecret(String name, String version, Context context) { - if (version == null) { - return getSecret(name); - } + 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) + .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)); + } - return service.getSecret(endpoint, name, 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)); + /** + * 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 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}.

    + *

    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. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getSecret(SecretBase secretBase) { + return getSecretWithResponse(secretBase).flatMap(FluxUtil::toMono); } /** @@ -195,11 +251,7 @@ Mono> getSecret(String name, String version, Context context) { * 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

    - *
    -     * secretAsyncClient.listSecrets().subscribe(secretBase ->
    -     *     client.getSecret(secretBase).subscribe(secretResponse ->
    -     *       System.out.printf("Secret with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value())));
    -     * 
    + * {@codesnippet com.azure.keyvault.secrets.secretclient.getSecretWithResponse#secretBase} * * @param secretBase The {@link SecretBase base secret} secret base holding attributes of the * secret being requested. @@ -211,21 +263,15 @@ Mono> getSecret(String name, String version, Context context) { * version} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getSecret(SecretBase secretBase) { - Objects.requireNonNull(secretBase, "The Secret Base parameter cannot be null."); - if (secretBase.version() == null) { - return getSecret(secretBase.name()); - } - return getSecret(secretBase.name(), secretBase.version()); + public Mono> getSecretWithResponse(SecretBase secretBase) { + return withContext(context -> getSecretWithResponse(secretBase, context)); } - Mono> getSecret(SecretBase secretBase, Context context) { + Mono> getSecretWithResponse(SecretBase secretBase, Context context) { Objects.requireNonNull(secretBase, "The Secret Base parameter cannot be null."); - if (secretBase.version() == null) { - return getSecret(secretBase.name(), context); - } - return getSecret(secretBase.name(), 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. * This operation requires the {@code secrets/get} permission. @@ -233,24 +279,39 @@ Mono> getSecret(SecretBase secretBase, Context context) { *

    Code Samples

    *

    Gets latest 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.

    - *
    -     * secretAsyncClient.getSecret("secretName").subscribe(secretResponse ->
    -     *   System.out.printf("Secret with name %s , value %s \n", secretResponse.value().name(),
    -     *   secretResponse.value().value()));
    -     * 
    + * {@codesnippet com.azure.keyvault.secrets.secretclient.getSecret#string} * * @param name The name of the 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 a {@link Response} whose {@link Response#value() value} contains the requested {@link Secret secret}. + * @return A {@link Mono} containing the requested {@link Secret secret}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getSecret(String name) { - return getSecret(name, ""); + public Mono getSecret(String name) { + return getSecretWithResponse(name, "").flatMap(FluxUtil::toMono); } - Mono> getSecret(String name, Context context) { - return getSecret(name, "", context); + /** + * 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.

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

    + * + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateSecret(SecretBase secret) { + return updateSecretWithResponse(secret).flatMap(FluxUtil::toMono); } /** @@ -261,15 +322,8 @@ Mono> getSecret(String name, Context context) { *

    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.

    - *
    -     * secretAsyncClient.getSecret("secretName").subscribe(secretResponse -> {
    -     *     Secret secret = secretResponse.value();
    -     *     //Update the not before time of the secret.
    -     *     secret.notBefore(OffsetDateTime.now().plusDays(50));
    -     *     secretAsyncClient.updateSecret(secret).subscribe(secretResponse ->
    -     *         System.out.printf("Secret's updated not before time %s \n", secretResponse.value().notBefore().toString()));
    -     *   });
    -     * 
    + * {@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.

    * * @param secret The {@link SecretBase base secret} object with updated properties. @@ -279,11 +333,11 @@ Mono> getSecret(String name, Context context) { * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link SecretBase updated secret}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateSecret(SecretBase secret) { - return withContext(context -> updateSecret(secret, context)); + public Mono> updateSecretWithResponse(SecretBase secret) { + return withContext(context -> updateSecretWithResponse(secret, context)); } - Mono> updateSecret(SecretBase secret, Context context) { + Mono> updateSecretWithResponse(SecretBase secret, Context context) { Objects.requireNonNull(secret, "The secret input parameter cannot be null."); SecretRequestParameters parameters = new SecretRequestParameters() .tags(secret.tags()) @@ -304,10 +358,27 @@ Mono> updateSecret(SecretBase secret, Context context) { *

    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.

    - *
    -     * secretAsyncClient.deleteSecret("secretName").subscribe(deletedSecretResponse ->
    -     *   System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.value().recoveryId()));
    -     * 
    + * {@codesnippet com.azure.keyvault.secrets.secretclient.deleteSecret#string} + * + * @param name The name of the secret to be deleted. + * @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) { + return deleteSecretWithResponse(name).flatMap(FluxUtil::toMono); + } + + /** + * 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.

    + * {@codesnippet com.azure.keyvault.secrets.secretclient.deleteSecretWithResponse#string} * * @param name The name of the secret to be deleted. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. @@ -315,11 +386,11 @@ Mono> updateSecret(SecretBase secret, Context context) { * @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> deleteSecret(String name) { - return withContext(context -> deleteSecret(name, context)); + public Mono> deleteSecretWithResponse(String name) { + return withContext(context -> deleteSecretWithResponse(name, context)); } - Mono> deleteSecret(String name, Context context) { + 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())) @@ -336,9 +407,30 @@ Mono> deleteSecret(String name, Context context) { * deleted secret details when a response is received.

    *
          * //Assuming secret is deleted on a soft-delete enabled vault.
    -     * secretAsyncClient.getDeletedSecret("secretName").subscribe(deletedSecretResponse ->
    -     *   System.out.printf("Deleted Secret with recovery Id %s \n", deletedSecretResponse.value().recoveryId()));
    -     * 
    + * {@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 HttpRequestException when a secret with {@code name} is empty string. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDeletedSecret(String name) { + return getDeletedSecretWithResponse(name).flatMap(FluxUtil::toMono); + } + + /** + * The get deleted secret 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

    + *

    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.

    + *
    +     * //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}
    @@ -348,11 +440,11 @@ Mono> deleteSecret(String name, Context context) {
          * @throws HttpRequestException when a secret with {@code name} is empty string.
          */
         @ServiceMethod(returns = ReturnType.SINGLE)
    -    public Mono> getDeletedSecret(String name) {
    -        return withContext(context -> getDeletedSecret(name, context));
    +    public Mono> getDeletedSecretWithResponse(String name) {
    +        return withContext(context -> getDeletedSecretWithResponse(name, context));
         }
     
    -    Mono> getDeletedSecret(String name, Context context) {
    +    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()))
    @@ -370,9 +462,7 @@ Mono> getDeletedSecret(String name, Context context) {
          * status code from the server response when a response is received.

    *
          * //Assuming secret is deleted on a soft-delete enabled vault.
    -     * secretAsyncClient.purgeDeletedSecret("deletedSecretName").subscribe(purgeResponse ->
    -     *   System.out.printf("Purge Status response %d \n", purgeResponse.statusCode()));
    -     * 
    + * {@codesnippet com.azure.keyvault.secrets.secretclient.purgeDeletedSecret#string} * * @param name The name of the secret. * @return A {@link Mono} containing a {@link VoidResponse}. @@ -401,9 +491,28 @@ Mono purgeDeletedSecret(String name, Context context) { * recovered secret details when a response is received.

    *
          * //Assuming secret is deleted on a soft-delete enabled vault.
    -     * secretAsyncClient.recoverDeletedSecret("deletedSecretName").subscribe(recoveredSecretResponse ->
    -     *   System.out.printf("Recovered Secret with name %s \n", recoveredSecretResponse.value().name()));
    -     * 
    + * {@codesnippet com.azure.keyvault.secrets.secretclient.recoverDeletedSecret#string} + * + * @param name The name of the deleted secret to be recovered. + * @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) { + return recoverDeletedSecretWithResponse(name).flatMap(FluxUtil::toMono); + } + + /** + * 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.

    + *
    +     * //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.
          * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault.
    @@ -411,11 +520,11 @@ Mono purgeDeletedSecret(String name, Context context) {
          * @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> recoverDeletedSecret(String name) {
    -        return withContext(context -> recoverDeletedSecret(name, context));
    +    public Mono> recoverDeletedSecretWithResponse(String name) {
    +        return withContext(context -> recoverDeletedSecretWithResponse(name, context));
         }
     
    -    Mono> recoverDeletedSecret(String name, Context context) {
    +    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()))
    @@ -431,9 +540,28 @@ Mono> recoverDeletedSecret(String name, Context context) {
          * the
          * length of the secret's backup byte array returned in the response.

    *
    -     * secretAsyncClient.backupSecret("secretName").subscribe(secretBackupResponse ->
    -     *   System.out.printf("Secret's Backup Byte array's length %s \n", secretBackupResponse.value().length));
    -     * 
    + * {@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 HttpRequestException when a secret with {@code name} is empty string. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono backupSecret(String name) { + return backupSecretWithResponse(name).flatMap(FluxUtil::toMono); + } + + /** + * 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. Subscribes to the call asynchronously and prints out + * 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} @@ -443,11 +571,11 @@ Mono> recoverDeletedSecret(String name, Context context) { * @throws HttpRequestException when a secret with {@code name} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> backupSecret(String name) { - return withContext(context -> backupSecret(name, context)); + public Mono> backupSecretWithResponse(String name) { + return withContext(context -> backupSecretWithResponse(name, context)); } - Mono> backupSecret(String name, Context context) { + 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)) @@ -466,9 +594,28 @@ Mono> backupSecret(String name, Context context) { * restored secret details when a response is received.

    *
          * //Pass the Secret Backup Byte array to the restore operation.
    -     * secretAsyncClient.restoreSecret(secretBackupByteArray).subscribe(secretResponse ->
    -     *   System.out.printf("Restored Secret with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value()));
    -     * 
    + * {@codesnippet com.azure.keyvault.secrets.secretclient.restoreSecret#byte} + * + * @param backup The backup blob associated with the secret. + * @return A {@link Mono} containing the {@link Secret restored secret}. + * @throws ResourceModifiedException when {@code backup} blob is malformed. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono restoreSecret(byte[] backup) { + return restoreSecretWithResponse(backup).flatMap(FluxUtil::toMono); + } + + /** + * Restores a backed up secret, and all its versions, to a vault. This operation requires the + * {@code secrets/restore} permission. + * + *

    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.

    + *
    +     * //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}
    @@ -476,11 +623,11 @@ Mono> backupSecret(String name, Context context) {
          * @throws ResourceModifiedException when {@code backup} blob is malformed.
          */
         @ServiceMethod(returns = ReturnType.SINGLE)
    -    public Mono> restoreSecret(byte[] backup) {
    -        return withContext(context -> restoreSecret(backup, context));
    +    public Mono> restoreSecretWithResponse(byte[] backup) {
    +        return withContext(context -> restoreSecretWithResponse(backup, context));
         }
     
    -    Mono> restoreSecret(byte[] backup, Context context) {
    +    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"))
    @@ -496,11 +643,7 @@ Mono> restoreSecret(byte[] backup, Context context) {
          * 

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

    - *
    -     * Flux<Secret> secrets = secretAsyncClient.listSecrets()
    -     *   .flatMap(secretAsyncClient::getSecret)
    -     *   .map(Response::value);
    -     * 
    + * {@codesnippet com.azure.keyvault.secrets.secretclient.listSecrets} * * @return A {@link PagedFlux} containing {@link SecretBase secret} of all the secrets in the vault. */ @@ -548,10 +691,7 @@ private Mono> listSecretsFirstPage(Context context) { *

    Code Samples

    *

    Lists the deleted secrets in the key vault. Subscribes to the call asynchronously and prints out the * recovery id of each deleted secret when a response is received.

    - *
    -     * secretAsyncClient.listDeletedSecrets().subscribe(deletedSecret ->
    -     *   System.out.printf("Deleted secret's recovery Id %s \n", deletedSecret.recoveryId()));
    -     * 
    + * {@codesnippet com.azure.keyvault.secrets.secretclient.listDeletedSecrets} * * @return A {@link Flux} containing all of the {@link DeletedSecret deleted secrets} in the vault. */ @@ -601,11 +741,7 @@ private Mono> listDeletedSecretsFirstPage(Context c *

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

    - *
    -     * Flux<Secret> secrets = secretAsyncClient.listSecretVersions("secretName")
    -     *   .flatMap(secretAsyncClient::getSecret)
    -     *   .map(Response::value);
    -     * 
    + * {@codesnippet com.azure.keyvault.secrets.secretclient.listSecretVersions#string} * * @param name The name of the secret. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. @@ -630,7 +766,7 @@ PagedFlux listSecretVersions(String name, Context context) { * {@link SecretAsyncClient#listSecretVersions()}. * * @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) { 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 dab070eda156..590800600dfb 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 @@ -9,6 +9,7 @@ import com.azure.core.http.rest.Response; 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.secrets.models.DeletedSecret; import com.azure.security.keyvault.secrets.models.Secret; import com.azure.security.keyvault.secrets.models.SecretBase; @@ -48,24 +49,16 @@ public final class SecretClient { * set to true by key vault, if not specified.

    * *

    Code Samples

    - *

    Creates a new secret which expires in 60 days in the key vault. Prints out the details of the - * newly created secret returned in the response.

    - *
    -     * Secret secret = new Secret("secretName", "secretValue")
    -     *   .expires(OffsetDateTime.now.plusDays(60));
    -     *
    -     * Secret retSecret = secretClient.setSecret(keySecret).value();
    -     * System.out.printf("Secret is created with name %s and value %s \n", retSecret.name(), retSecret.value());
    -     * 
    + * {@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. * @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 Response} whose {@link Response#value() value} contains the {@link Secret created secret}. + * @return The {@link Secret created secret}. */ - public Response setSecret(Secret secret) { - return client.setSecret(secret).block(); + public Secret setSecret(Secret secret) { + return setSecretWithResponse(secret, Context.NONE).value(); } /** @@ -74,19 +67,34 @@ public Response setSecret(Secret secret) { * *

    Code Samples

    *

    Creates a new secret in the key vault. Prints out the details of the newly created secret returned in the response.

    - *
    -     * Secret secret = secretClient.setSecret("secretName", "secretValue").value();
    -     * System.out.printf("Secret is created with name %s and value %s \n", secret.name(), secret.value());
    -     * 
    + * {@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. * @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. + * 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.

    + * {@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 context Additional context that is passed through the Http pipeline during the service call. + * @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 setSecret(String name, String value) { - return client.setSecret(name, value).block(); + public Response setSecretWithResponse(Secret secret, Context context) { + return client.setSecretWithResponse(secret, context).block(); } /** @@ -95,20 +103,36 @@ public Response setSecret(String name, String value) { * *

    Code Samples

    *

    Gets a specific version of the secret in the key vault. Prints out the details of the returned secret.

    - *
    -     * String secretVersion = "6A385B124DEF4096AF1361A85B16C204";
    -     * Secret secretWithVersion = secretClient.getSecret("secretName", secretVersion).value();
    -     * System.out.printf("Secret is returned with name %s and value %s \n", secretWithVersion.name(), secretWithVersion.value());
    -     * 
    + * {@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. + * @return The requested {@link Secret secret}. + */ + 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. + * + *

    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}. */ - public Response getSecret(String name, String version) { - return client.getSecret(name, version).block(); + public Response getSecretWithResponse(SecretBase secretBase, Context context) { + return client.getSecretWithResponse(secretBase, context).block(); } /** @@ -118,15 +142,16 @@ public Response getSecret(String name, String version) { *

    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 A {@link Response} whose {@link Response#value() value} contains the requested {@link Secret secret}. + * @return The requested {@link Secret secret}. */ - public Response getSecret(SecretBase secretBase) { - return client.getSecret(secretBase).block(); + public Secret getSecret(SecretBase secretBase) { + return getSecretWithResponse(secretBase, Context.NONE).value(); } /** @@ -135,18 +160,41 @@ public Response getSecret(SecretBase secretBase) { * *

    Code Samples

    *

    Gets the latest version of the secret in the key vault. Prints out the details of the returned secret.

    - *
    -     * Secret secret = secretClient.getSecret("secretName").value();
    -     * System.out.printf("Secret is returned with name %s and value %s \n", secret.name(), secret.value());
    -     * 
    + * {@codesnippet com.azure.security.keyvault.secretclient.getSecret#string} * * @param name The name of the 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 Response} whose {@link Response#value()} contains the requested {@link Secret}. + * @return The requested {@link Secret}. */ - public Response getSecret(String name) { - return getSecret(name, ""); + public Secret getSecret(String name) { + return getSecretWithResponse(name, "", Context.NONE).value(); + } + + /** + * 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.

    + * {@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 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 HttpRequestException if {@code name} name} or {@code version} is empty string. + */ + public Response getSecretWithResponse(String name, String version, Context context) { + return client.getSecretWithResponse(name, version, context).block(); } /** @@ -158,21 +206,38 @@ public Response getSecret(String name) { * *

    Code Samples

    *

    Gets the latest version of the secret, changes its expiry time and the updates the secret in the key vault.

    - *
    -     * Secret secret = secretClient.getSecret("secretName").value();
    -     * secret.expires(OffsetDateTime.now().plusDays(60));
    -     * SecretBase updatedSecretBase = secretClient.updateSecret(secret).value();
    -     * Secret updatedSecret = secretClient.getSecret(updatedSecretBase.name()).value();
    -     * 
    + * {@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}. */ - public Response updateSecret(SecretBase secret) { - return client.updateSecret(secret).block(); + 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. + * + *

    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.

    + * {@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}. + */ + public SecretBase updateSecret(SecretBase secret) { + return updateSecretWithResponse(secret, Context.NONE).value(); } /** @@ -182,18 +247,53 @@ public Response updateSecret(SecretBase secret) { * *

    Code Samples

    *

    Deletes the secret from the keyvault. Prints out the recovery id of the deleted secret returned in the response.

    - *
    -     * DeletedSecret deletedSecret = secretClient.deleteSecret("secretName").value();
    -     * System.out.printf("Deleted Secret's Recovery Id %s", deletedSecret.recoveryId()));
    -     * 
    + * {@codesnippet com.azure.security.keyvault.secretclient.deleteSecret#string} * * @param name The name of the secret to be deleted. * @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 deleteSecret(String name) { - return client.deleteSecret(name).block(); + 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. + * + *

    Code Samples

    + *

    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. + * @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(); + } + + /** + * The get deleted secret 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

    + *

    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. + * @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(); } /** @@ -203,19 +303,17 @@ public Response deleteSecret(String name) { *

    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.

    - *
          * //Assuming secret is deleted on a soft-delete enabled key vault.
    -     * DeletedSecret deletedSecret = secretClient.getDeletedSecret("secretName").value();
    -     * System.out.printf("Deleted Secret with recovery Id %s \n", deletedSecret.recoveryId());
    -     * 
    + * {@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. * @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 getDeletedSecret(String name) { - return client.getDeletedSecret(name).block(); + public Response getDeletedSecretWithResponse(String name, Context context) { + return client.getDeletedSecretWithResponse(name, context).block(); } /** @@ -224,11 +322,8 @@ public Response getDeletedSecret(String name) { * *

    Code Samples

    *

    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.
    -     * VoidResponse purgeResponse = secretClient.purgeDeletedSecret("deletedSecretName");
    -     * System.out.printf("Purge Status Code: %d", purgeResponse.statusCode());
    -     * 
    + * {@codesnippet com.azure.security.keyvault.secretclient.purgeDeletedSecret#string} * * @param name The name of the secret. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. @@ -236,7 +331,45 @@ public Response getDeletedSecret(String name) { * @return A {@link VoidResponse}. */ public VoidResponse purgeDeletedSecret(String name) { - return client.purgeDeletedSecret(name).block(); + return purgeDeletedSecret(name, Context.NONE); + } + + /** + * 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. + * + *

    Code Samples

    + *

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

    + * //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. + * @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(); } /** @@ -246,19 +379,17 @@ public VoidResponse purgeDeletedSecret(String name) { *

    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.

    - *
          * //Assuming secret is deleted on a soft-delete enabled key vault.
    -     * Secret recoveredSecret =  secretClient.recoverDeletedSecret("deletedSecretName").value();
    -     * System.out.printf("Recovered Secret with name %s", recoveredSecret.name());
    -     * 
    + * {@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. * @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 recoverDeletedSecret(String name) { - return client.recoverDeletedSecret(name).block(); + public Response recoverDeletedSecretWithResponse(String name, Context context) { + return client.recoverDeletedSecretWithResponse(name, context).block(); } /** @@ -267,18 +398,33 @@ public Response recoverDeletedSecret(String name) { * *

    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

    - *
    -     * byte[] secretBackup = secretClient.backupSecret("secretName").value();
    -     * System.out.printf("Secret's Backup Byte array's length %s", secretBackup.length);
    -     * 
    + * {@codesnippet com.azure.security.keyvault.secretclient.backupSecret#string} * * @param name The name of the 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 backed up secret blob. */ - public Response backupSecret(String name) { - return client.backupSecret(name).block(); + 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. + * 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

    + * {@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. + * @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(); } /** @@ -288,18 +434,34 @@ public Response backupSecret(String name) { *

    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.

    - *
          * //Pass the secret backup byte array of the secret to be restored.
    -     * Secret restoredSecret = secretClient.restoreSecret(secretBackupByteArray).value();
    -     * System.out.printf("Restored Secret with name %s and value %s", restoredSecret.name(), restoredSecret.value());
    -     * 
    + * {@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}. */ - public Response restoreSecret(byte[] backup) { - return client.restoreSecret(backup).block(); + public Secret restoreSecret(byte[] backup) { + return restoreSecretWithResponse(backup, Context.NONE).value(); + } + + /** + * Restores a backed up secret, and all its versions, to a vault. + * 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.

    + * //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}. + */ + public Response restoreSecretWithResponse(byte[] backup, Context context) { + return client.restoreSecretWithResponse(backup, context).block(); } /** @@ -309,17 +471,28 @@ public Response restoreSecret(byte[] backup) { * *

    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.

    - *
    -     * for (SecretBase secret : secretClient.listSecrets()) {
    -     *   Secret secretWithValue  = secretClient.getSecret(secret).value();
    -     *   System.out.printf("Received secret with name %s and value %s", secretWithValue.name(), secretWithValue.value());
    -     * }
    -     * 
    + * {@codesnippet com.azure.security.keyvault.secretclient.listSecrets} * * @return A {@link List} containing {@link SecretBase} of all the secrets in the vault. The {@link SecretBase} contains all the information about the secret, except its value. */ public Iterable listSecrets() { - return client.listSecrets().toIterable(); + 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. + * + *

    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 A {@link List} containing {@link SecretBase} of all the secrets in the vault. The {@link SecretBase} contains all the information about the secret, except its value. + */ + public Iterable listSecrets(Context context) { + return client.listSecrets(context).toIterable(); } /** @@ -328,16 +501,27 @@ public Iterable listSecrets() { * *

    Code Samples

    *

    Lists the deleted secrets in the key vault and for each deleted secret prints out its recovery id.

    - *
    -     * for (DeletedSecret deletedSecret : secretClient.listDeletedSecrets()) {
    -     *   System.out.printf("Deleted secret's recovery Id %s", deletedSecret.recoveryId());
    -     * }
    -     * 
    + * {@codesnippet com.azure.security.keyvault.secretclient.listDeletedSecrets#Context} + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link List} containing all of the {@link DeletedSecret deleted secrets} in the vault. + */ + public Iterable listDeletedSecrets(Context context) { + return client.listDeletedSecrets(context).toIterable(); + } + + /** + * 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} * * @return A {@link List} containing all of the {@link DeletedSecret deleted secrets} in the vault. */ public Iterable listDeletedSecrets() { - return client.listDeletedSecrets().toIterable(); + return listDeletedSecrets(Context.NONE); } /** @@ -347,12 +531,7 @@ public Iterable listDeletedSecrets() { * *

    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.

    - *
    -     * for (SecretBase secret : secretClient.listSecretVersions("secretName")) {
    -     *   Secret secretWithValue  = secretClient.getSecret(secret).value();
    -     *   System.out.printf("Received secret's version with name %s and value %s", secretWithValue.name(), secretWithValue.value());
    -     * }
    -     * 
    + * {@codesnippet com.azure.security.keyvault.secretclient.listSecretVersions#string} * * @param name The name of the secret. * @throws ResourceNotFoundException when a secret with {@code name} doesn't exist in the key vault. @@ -360,6 +539,25 @@ public Iterable listDeletedSecrets() { * @return A {@link List} containing {@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 Iterable listSecretVersions(String name) { - return client.listSecretVersions(name).toIterable(); + 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. + * + *

    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} + * + * @param name The name of the secret. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @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 List} containing {@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 Iterable listSecretVersions(String name, Context context) { + return client.listSecretVersions(name, context).toIterable(); } } 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 5d51121fb007..ee0049745967 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 @@ -3,13 +3,14 @@ package com.azure.security.keyvault.secrets; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.implementation.annotation.ServiceClientBuilder; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.core.util.configuration.Configuration; import com.azure.core.credentials.TokenCredential; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; -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; @@ -31,7 +32,7 @@ *

    The minimal configuration options required by {@link SecretClientBuilder secretClientBuilder} to build * {@link SecretAsyncClient} are {@link String endpoint} and {@link TokenCredential credential}.

    * - * {@codesnippet com.azure.security.keyvault.secretclient.async.construct} + * {@codesnippet com.azure.security.keyvault.secrets.async.secretclient.construct} * *

    Samples to construct the sync client

    * {@codesnippet com.azure.security.keyvault.secretclient.sync.construct} @@ -39,12 +40,12 @@ *

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

    * - * {@codesnippet com.azure.security.keyvault.keys.async.secretclient.withhttpclient.instantiation} + * {@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} * can be specified. It provides finer control over the construction of {@link SecretAsyncClient client}

    - * {@codesnippet com.azure.security.keyvault.keys.async.secretclient.pipeline.instantiation} + * {@codesnippet com.azure.security.keyvault.secrets.async.secretclient.pipeline.instantiation} * * @see SecretClient * @see SecretAsyncClient @@ -121,12 +122,14 @@ public SecretAsyncClient buildAsyncClient() { // Closest to API goes first, closest to wire goes last. final List policies = new ArrayList<>(); policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, buildConfiguration)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); - policies.add(new BearerTokenAuthenticationPolicy(credential, SecretAsyncClient.KEY_VAULT_SCOPE)); + policies.add(new KeyVaultCredentialPolicy(credential)); policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperations.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperations.java index f905fd0cbc38..918ca4fafa4c 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperations.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperations.java @@ -3,8 +3,9 @@ package com.azure.security.keyvault.secrets; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.secrets.models.Secret; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -31,7 +32,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. SecretClient client = new SecretClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); // Let's create secrets holding storage account credentials valid for 1 year. if the secret @@ -42,7 +43,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // Backups are good to have, if in case secrets get accidentally deleted by you. // For long term storage, it is ideal to write the backup to a file. String backupFilePath = "YOUR_BACKUP_FILE_PATH"; - byte[] secretBackup = client.backupSecret("StorageAccountPassword").value(); + byte[] secretBackup = client.backupSecret("StorageAccountPassword"); writeBackupToFile(secretBackup, backupFilePath); // The storage account secret is no longer in use, so you delete it. @@ -59,7 +60,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // After sometime, the secret is required again. We can use the backup value to restore it in the key vault. byte[] backupFromFile = Files.readAllBytes(new File(backupFilePath).toPath()); - Secret restoredSecret = client.restoreSecret(backupFromFile).value(); + Secret restoredSecret = client.restoreSecret(backupFromFile); } private static void writeBackupToFile(byte[] bytes, String filePath) { diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperationsAsync.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperationsAsync.java index 7b4bebaf5224..8ed5fcf4e9ac 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperationsAsync.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/BackupAndRestoreOperationsAsync.java @@ -3,8 +3,9 @@ package com.azure.security.keyvault.secrets; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.secrets.models.Secret; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -31,7 +32,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. SecretAsyncClient secretAsyncClient = new SecretClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); // Let's create secrets holding storage account credentials valid for 1 year. if the secret @@ -39,7 +40,7 @@ public static void main(String[] args) throws IOException, InterruptedException, secretAsyncClient.setSecret(new Secret("StorageAccountPassword", "f4G34fMh8v-fdsgjsk2323=-asdsdfsdf") .expires(OffsetDateTime.now().plusYears(1))) .subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value())); + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); Thread.sleep(2000); @@ -47,7 +48,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // For long term storage, it is ideal to write the backup to a file. String backupFilePath = "YOUR_BACKUP_FILE_PATH"; secretAsyncClient.backupSecret("StorageAccountPassword").subscribe(backupResponse -> { - byte[] backupBytes = backupResponse.value(); + byte[] backupBytes = backupResponse; writeBackupToFile(backupBytes, backupFilePath); }); @@ -55,7 +56,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // The storage account secret is no longer in use, so you delete it. secretAsyncClient.deleteSecret("StorageAccountPassword").subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.value().recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); //To ensure file is deleted on server side. Thread.sleep(30000); @@ -70,7 +71,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // After sometime, the secret is required again. We can use the backup value to restore it in the key vault. byte[] backupFromFile = Files.readAllBytes(new File(backupFilePath).toPath()); secretAsyncClient.restoreSecret(backupFromFile).subscribe(secretResponse -> - System.out.printf("Restored Secret with name %s \n", secretResponse.value().name())); + System.out.printf("Restored Secret with name %s \n", secretResponse.name())); //To ensure secret is restored on server side. Thread.sleep(15000); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java index 94f50ed062d1..0efd27004e96 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorld.java @@ -3,9 +3,10 @@ package com.azure.security.keyvault.secrets; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.secrets.models.Secret; import com.azure.security.keyvault.secrets.models.SecretBase; + import java.time.OffsetDateTime; /** @@ -27,7 +28,7 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. SecretClient secretClient = new SecretClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); // Let's create a secret holding bank account credentials valid for 1 year. if the secret @@ -36,14 +37,14 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum .expires(OffsetDateTime.now().plusYears(1))); // Let's Get the bank secret from the key vault. - Secret bankSecret = secretClient.getSecret("BankAccountPassword").value(); + Secret bankSecret = secretClient.getSecret("BankAccountPassword"); System.out.printf("Secret is returned with name %s and value %s \n", bankSecret.name(), bankSecret.value()); // After one year, the bank account is still active, we need to update the expiry time of the secret. // The update method can be used to update the expiry attribute of the secret. It cannot be used to update // the value of the secret. bankSecret.expires(bankSecret.expires().plusYears(1)); - SecretBase updatedSecret = secretClient.updateSecret(bankSecret).value(); + SecretBase updatedSecret = secretClient.updateSecret(bankSecret); System.out.printf("Secret's updated expiry time %s \n", updatedSecret.expires()); // Bank forced a password update for security purposes. Let's change the value of the secret in the key vault. diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorldAsync.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorldAsync.java index 9f368c85c576..9c96a45d46ca 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorldAsync.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/HelloWorldAsync.java @@ -3,8 +3,9 @@ package com.azure.security.keyvault.secrets; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.secrets.models.Secret; + import java.time.OffsetDateTime; /** @@ -25,20 +26,20 @@ public static void main(String[] args) throws InterruptedException { // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. SecretAsyncClient secretAsyncClient = new SecretClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); // Let's create a secret holding bank account credentials valid for 1 year. if the secret // already exists in the key vault, then a new version of the secret is created. secretAsyncClient.setSecret(new Secret("BankAccountPassword", "f4G34fMh8v") .expires(OffsetDateTime.now().plusYears(1))).subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value())); + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); Thread.sleep(2000); // Let's Get the bank secret from the key vault. secretAsyncClient.getSecret("BankAccountPassword").subscribe(secretResponse -> - System.out.printf("Secret returned with name %s , value %s \n", secretResponse.value().name(), secretResponse.value().value())); + System.out.printf("Secret returned with name %s , value %s \n", secretResponse.name(), secretResponse.value())); Thread.sleep(2000); @@ -46,11 +47,11 @@ public static void main(String[] args) throws InterruptedException { // The update method can be used to update the expiry attribute of the secret. It cannot be used to update // the value of the secret. secretAsyncClient.getSecret("BankAccountPassword").subscribe(secretResponse -> { - Secret secret = secretResponse.value(); + Secret secret = secretResponse; //Update the expiry time of the secret. secret.expires(secret.expires().plusYears(1)); secretAsyncClient.updateSecret(secret).subscribe(updatedSecretResponse -> - System.out.printf("Secret's updated expiry time %s \n", updatedSecretResponse.value().expires().toString())); + System.out.printf("Secret's updated expiry time %s \n", updatedSecretResponse.expires().toString())); }); Thread.sleep(2000); @@ -59,13 +60,13 @@ public static void main(String[] args) throws InterruptedException { // To achieve this, we need to create a new version of the secret in the key vault. The update operation cannot // change the value of the secret. secretAsyncClient.setSecret("BankAccountPassword", "bhjd4DDgsa").subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value())); + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); Thread.sleep(2000); // The bank account was closed, need to delete its credentials from the key vault. secretAsyncClient.deleteSecret("BankAccountPassword").subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.value().recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); //To ensure secret is deleted on server side. Thread.sleep(30000); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperations.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperations.java index f45e97af158f..be76ea7b2de8 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperations.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperations.java @@ -3,7 +3,7 @@ package com.azure.security.keyvault.secrets; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.secrets.models.Secret; import com.azure.security.keyvault.secrets.models.SecretBase; @@ -26,7 +26,7 @@ public static void main(String[] args) throws IllegalArgumentException { // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. SecretClient client = new SecretClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); // Let's create secrets holding storage and bank accounts credentials valid for 1 year. if the secret @@ -40,7 +40,7 @@ public static void main(String[] args) throws IllegalArgumentException { // You need to check if any of the secrets are sharing same values. Let's list the secrets and print their values. // List operations don't return the secrets with value information. So, for each returned secret we call getSecret to get the secret with its value information. for (SecretBase secret : client.listSecrets()) { - Secret secretWithValue = client.getSecret(secret).value(); + Secret secretWithValue = client.getSecret(secret); System.out.printf("Received secret with name %s and value %s \n", secretWithValue.name(), secretWithValue.value()); } @@ -50,7 +50,7 @@ public static void main(String[] args) throws IllegalArgumentException { // You need to check all the different values your bank account password secret had previously. Lets print all the versions of this secret. for (SecretBase secret : client.listSecretVersions("BankAccountPassword")) { - Secret secretWithValue = client.getSecret(secret).value(); + Secret secretWithValue = client.getSecret(secret); System.out.printf("Received secret's version with name %s and value %s", secretWithValue.name(), secretWithValue.value()); } } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperationsAsync.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperationsAsync.java index af085d95627b..771a63554950 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperationsAsync.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ListOperationsAsync.java @@ -3,8 +3,9 @@ package com.azure.security.keyvault.secrets; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.secrets.models.Secret; + import java.time.OffsetDateTime; /** @@ -25,7 +26,7 @@ public static void main(String[] args) throws InterruptedException { // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. SecretAsyncClient secretAsyncClient = new SecretClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); // Let's create secrets holding storage and bank accounts credentials valid for 1 year. if the secret @@ -33,14 +34,14 @@ public static void main(String[] args) throws InterruptedException { secretAsyncClient.setSecret(new Secret("BankAccountPassword", "f4G34fMh8v") .expires(OffsetDateTime.now().plusYears(1))) .subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value())); + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); Thread.sleep(2000); secretAsyncClient.setSecret(new Secret("StorageAccountPassword", "f4G34fMh8v-fdsgjsk2323=-asdsdfsdf") .expires(OffsetDateTime.now().plusYears(1))) .subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value())); + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); Thread.sleep(2000); @@ -49,7 +50,7 @@ public static void main(String[] args) throws InterruptedException { secretAsyncClient.listSecrets() .subscribe(secretBase -> secretAsyncClient.getSecret(secretBase).subscribe(secretResponse -> - System.out.printf("Received secret with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value()))); + System.out.printf("Received secret with name %s and value %s \n", secretResponse.name(), secretResponse.value()))); Thread.sleep(15000); @@ -57,14 +58,14 @@ public static void main(String[] args) throws InterruptedException { // Calling setSecret on an existing secret creates a new version of the secret in the key vault with the new value. secretAsyncClient.setSecret(new Secret("BankAccountPassword", "sskdjfsdasdjsd") .expires(OffsetDateTime.now().plusYears(1))).subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value())); + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); Thread.sleep(2000); // You need to check all the different values your bank account password secret had previously. Lets print all the versions of this secret. secretAsyncClient.listSecretVersions("BankAccountPassword").subscribe(secretBase -> secretAsyncClient.getSecret(secretBase).subscribe(secretResponse -> - System.out.printf("Received secret's version with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value()))); + System.out.printf("Received secret's version with name %s and value %s \n", secretResponse.name(), secretResponse.value()))); Thread.sleep(15000); } diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecrets.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecrets.java index b42b3f0c3870..d58434af745e 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecrets.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecrets.java @@ -3,9 +3,10 @@ package com.azure.security.keyvault.secrets; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.secrets.models.DeletedSecret; import com.azure.security.keyvault.secrets.models.Secret; + import java.time.OffsetDateTime; /** @@ -30,7 +31,7 @@ public static void main(String[] args) throws IllegalArgumentException, Interrup // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. SecretClient client = new SecretClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildClient(); // Let's create secrets holding storage and bank accounts credentials valid for 1 year. if the secret diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecretsAsync.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecretsAsync.java index fa9e5a0915fb..72f32d5ab548 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecretsAsync.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/ManagingDeletedSecretsAsync.java @@ -3,8 +3,9 @@ package com.azure.security.keyvault.secrets; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.secrets.models.Secret; + import java.time.OffsetDateTime; /** @@ -29,26 +30,26 @@ public static void main(String[] args) throws InterruptedException { // 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials. SecretAsyncClient secretAsyncClient = new SecretClientBuilder() .endpoint("https://{YOUR_VAULT_NAME}.vault.azure.net") - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient(); // Let's create secrets holding storage and bank accounts credentials valid for 1 year. if the secret // already exists in the key vault, then a new version of the secret is created. secretAsyncClient.setSecret(new Secret("BankAccountPassword", "f4G34fMh8v") .expires(OffsetDateTime.now().plusYears(1))).subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value())); + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); Thread.sleep(2000); secretAsyncClient.setSecret(new Secret("StorageAccountPassword", "f4G34fMh8v-fdsgjsk2323=-asdsdfsdf") .expires(OffsetDateTime.now().plusYears(1))).subscribe(secretResponse -> - System.out.printf("Secret is created with name %s and value %s \n", secretResponse.value().name(), secretResponse.value().value())); + System.out.printf("Secret is created with name %s and value %s \n", secretResponse.name(), secretResponse.value())); Thread.sleep(2000); // The storage account was closed, need to delete its credentials from the key vault. secretAsyncClient.deleteSecret("BankAccountPassword").subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.value().recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); //To ensure secret is deleted on server side. Thread.sleep(30000); @@ -56,7 +57,7 @@ public static void main(String[] args) throws InterruptedException { // We accidentally deleted bank account secret. Let's recover it. // A deleted secret can only be recovered if the key vault is soft-delete enabled. secretAsyncClient.recoverDeletedSecret("BankAccountPassword").subscribe(recoveredSecretResponse -> - System.out.printf("Recovered Secret with name %s \n", recoveredSecretResponse.value().name())); + System.out.printf("Recovered Secret with name %s \n", recoveredSecretResponse.name())); //To ensure secret is recovered on server side. Thread.sleep(10000); @@ -64,10 +65,10 @@ public static void main(String[] args) throws InterruptedException { // The bank acoount and storage accounts got closed. // Let's delete bank and storage accounts secrets. secretAsyncClient.deleteSecret("BankAccountPassword").subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.value().recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); secretAsyncClient.deleteSecret("StorageAccountPassword").subscribe(deletedSecretResponse -> - System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.value().recoveryId())); + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); // To ensure secret is deleted on server side. Thread.sleep(30000); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretAsyncClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretAsyncClientJavaDocCodeSnippets.java new file mode 100644 index 000000000000..66fe46998ead --- /dev/null +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.secrets; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.test.models.RecordedData; +import com.azure.core.test.policy.RecordNetworkCallPolicy; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +import com.azure.security.keyvault.secrets.models.Secret; +import com.azure.security.keyvault.secrets.models.SecretBase; +import reactor.util.context.Context; + +import java.time.OffsetDateTime; + +/** + * This class contains code samples for generating javadocs through doclets for {@link SecretClient} + */ +public final class SecretAsyncClientJavaDocCodeSnippets { + + private String key1 = "key1"; + private String key2 = "key2"; + private String value1 = "val1"; + private String value2 = "val2"; + + /** + * Generates code sample for creating a {@link SecretAsyncClient} + * @return An instance of {@link SecretAsyncClient} + */ + public SecretAsyncClient createAsyncClientWithHttpclient() { + // BEGIN: com.azure.security.keyvault.secrets.async.secretclient.withhttpclient.instantiation + RecordedData networkData = new RecordedData(); + HttpPipeline pipeline = new HttpPipelineBuilder().policies(new RecordNetworkCallPolicy(networkData)).build(); + SecretAsyncClient keyClient = new SecretClientBuilder() + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .endpoint("https://myvault.azure.net/") + .credential(new DefaultAzureCredentialBuilder().build()) + .addPolicy(new RecordNetworkCallPolicy(networkData)) + .httpClient(HttpClient.createDefault()) + .buildAsyncClient(); + // END: com.azure.security.keyvault.secrets.async.secretclient.withhttpclient.instantiation + return keyClient; + } + + /** + * Implementation for async SecretAsyncClient + * @return sync SecretAsyncClient + */ + private SecretAsyncClient getAsyncSecretClient() { + + // BEGIN: com.azure.security.keyvault.secrets.async.secretclient.construct + SecretAsyncClient secretAsyncClient = new SecretClientBuilder() + .credential(new DefaultAzureCredentialBuilder().build()) + .endpoint("https://myvault.vault.azure.net/") + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .buildAsyncClient(); + // END: com.azure.security.keyvault.secrets.async.secretclient.construct + return secretAsyncClient; + } + + /** + * Generates code sample for creating a {@link SecretAsyncClient} + * @return An instance of {@link SecretAsyncClient} + */ + public SecretAsyncClient createAsyncClientWithPipeline() { + // BEGIN: com.azure.security.keyvault.secrets.async.secretclient.pipeline.instantiation + RecordedData networkData = new RecordedData(); + HttpPipeline pipeline = new HttpPipelineBuilder().policies(new RecordNetworkCallPolicy(networkData)).build(); + SecretAsyncClient secretAsyncClient = new SecretClientBuilder() + .pipeline(pipeline) + .endpoint("https://myvault.azure.net/") + .credential(new DefaultAzureCredentialBuilder().build()) + .buildAsyncClient(); + // END: com.azure.security.keyvault.secrets.async.secretclient.pipeline.instantiation + return secretAsyncClient; + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#getSecret(SecretBase)} + */ + public void getSecretCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.getSecret#secretBase + secretAsyncClient.listSecrets() + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretBase -> secretAsyncClient.getSecret(secretBase) + .subscribe(secretResponse -> + System.out.printf("Secret is returned with name %s and value %s %n", secretResponse.name(), + secretResponse.value()))); + // END: com.azure.keyvault.secrets.secretclient.getSecret#secretBase + + // BEGIN: com.azure.keyvault.secrets.secretclient.getSecret#string-string + String secretVersion = "6A385B124DEF4096AF1361A85B16C204"; + secretAsyncClient.getSecret("secretName", secretVersion) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretWithVersion -> + System.out.printf("Secret is returned with name %s and value %s \n", + secretWithVersion.name(), secretWithVersion.value())); + // END: com.azure.keyvault.secrets.secretclient.getSecret#string-string + + // BEGIN: com.azure.keyvault.secrets.secretclient.getSecret#string + secretAsyncClient.getSecret("secretName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretWithVersion -> + System.out.printf("Secret is returned with name %s and value %s \n", + secretWithVersion.name(), secretWithVersion.value())); + // END: com.azure.keyvault.secrets.secretclient.getSecret#string + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#getSecretWithResponse(SecretBase)} + */ + public void getSecretWithResponseCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.getSecretWithResponse#secretBase + secretAsyncClient.listSecrets() + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretBase -> secretAsyncClient.getSecretWithResponse(secretBase) + .subscribe(secretResponse -> + System.out.printf("Secret is returned with name %s and value %s %n", secretResponse.value().name(), + secretResponse.value().value()))); + // END: com.azure.keyvault.secrets.secretclient.getSecretWithResponse#secretBase + + // BEGIN: com.azure.keyvault.secrets.secretclient.getSecretWithResponse#string-string + String secretVersion = "6A385B124DEF4096AF1361A85B16C204"; + secretAsyncClient.getSecretWithResponse("secretName", secretVersion) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretWithVersion -> + System.out.printf("Secret is returned with name %s and value %s \n", + secretWithVersion.value().name(), secretWithVersion.value().value())); + // END: com.azure.keyvault.secrets.secretclient.getSecretWithResponse#string-string + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#setSecret(Secret)} + */ + public void setSecretCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.setSecret#secret + Secret newSecret = new Secret("secretName", "secretValue"). + expires(OffsetDateTime.now().plusDays(60)); + secretAsyncClient.setSecret(newSecret) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretResponse -> + System.out.printf("Secret is created with name %s and value %s \n", + secretResponse.name(), secretResponse.value())); + // END: com.azure.keyvault.secrets.secretclient.setSecret#secret + + // BEGIN: com.azure.keyvault.secrets.secretclient.setSecret#string-string + secretAsyncClient.setSecret("secretName", "secretValue") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretResponse -> + System.out.printf("Secret is created with name %s and value %s \n", + secretResponse.name(), secretResponse.value())); + // END: com.azure.keyvault.secrets.secretclient.setSecret#string-string + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#setSecretWithResponse(Secret)} + */ + public void setSecretWithResponseCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.setSecretWithResponse#secret + Secret newSecret = new Secret("secretName", "secretValue"). + expires(OffsetDateTime.now().plusDays(60)); + secretAsyncClient.setSecretWithResponse(newSecret) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretResponse -> + System.out.printf("Secret is created with name %s and value %s \n", + secretResponse.value().name(), secretResponse.value().value())); + // END: com.azure.keyvault.secrets.secretclient.setSecretWithResponse#secret + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#updateSecret(SecretBase)} + */ + public void updateSecretCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.updateSecret#secretBase + secretAsyncClient.getSecret("secretName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretResponseValue -> { + Secret secret = secretResponseValue; + //Update the not before time of the secret. + secret.notBefore(OffsetDateTime.now().plusDays(50)); + secretAsyncClient.updateSecret(secret) + .subscribe(secretResponse -> + System.out.printf("Secret's updated not before time %s \n", + secretResponse.notBefore().toString())); + }); + // END: com.azure.keyvault.secrets.secretclient.updateSecret#secretBase + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#updateSecretWithResponse(SecretBase)} + */ + public void updateSecretWithResponseCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.updateSecretWithResponse#secretBase + secretAsyncClient.getSecret("secretName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretResponseValue -> { + Secret secret = secretResponseValue; + //Update the not before time of the secret. + secret.notBefore(OffsetDateTime.now().plusDays(50)); + secretAsyncClient.updateSecretWithResponse(secret) + .subscribe(secretResponse -> + System.out.printf("Secret's updated not before time %s \n", + secretResponse.value().notBefore().toString())); + }); + // END: com.azure.keyvault.secrets.secretclient.updateSecretWithResponse#secretBase + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#deleteSecret(String)} + */ + public void deleteSecretCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.deleteSecret#string + secretAsyncClient.deleteSecret("secretName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + // END: com.azure.keyvault.secrets.secretclient.deleteSecret#string + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#deleteSecretWithResponse(String)} + */ + public void deleteSecretWithResponseCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.deleteSecretWithResponse#string + secretAsyncClient.deleteSecretWithResponse("secretName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.value().recoveryId())); + // END: com.azure.keyvault.secrets.secretclient.deleteSecretWithResponse#string + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#deleteSecret(String)} + */ + public void getDeletedSecretCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.getDeletedSecret#string + secretAsyncClient.getDeletedSecret("secretName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.recoveryId())); + // END: com.azure.keyvault.secrets.secretclient.getDeletedSecret#string + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#getDeletedSecretWithResponse(String)} + */ + public void getDeletedSecretWithResponseCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.getDeletedSecretWithResponse#string + secretAsyncClient.getDeletedSecretWithResponse("secretName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedSecretResponse -> + System.out.printf("Deleted Secret's Recovery Id %s \n", deletedSecretResponse.value().recoveryId())); + // END: com.azure.keyvault.secrets.secretclient.getDeletedSecretWithResponse#string + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#purgeDeletedSecret(String)} + */ + public void purgeDeletedSecretCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.purgeDeletedSecret#string + secretAsyncClient.purgeDeletedSecret("deletedSecretName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(purgeResponse -> + System.out.printf("Purge Status response %d \n", purgeResponse.statusCode())); + // END: com.azure.keyvault.secrets.secretclient.purgeDeletedSecret#string + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#recoverDeletedSecret(String)} + */ + public void recoverDeletedSecretCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.recoverDeletedSecret#string + secretAsyncClient.recoverDeletedSecret("deletedSecretName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(recoveredSecretResponse -> + System.out.printf("Recovered Secret with name %s \n", recoveredSecretResponse.name())); + // END: com.azure.keyvault.secrets.secretclient.recoverDeletedSecret#string + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#recoverDeletedSecretWithResponse(String)} + */ + public void recoverDeletedSecretWithResponseCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.recoverDeletedSecretWithResponse#string + secretAsyncClient.recoverDeletedSecretWithResponse("deletedSecretName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(recoveredSecretResponse -> + System.out.printf("Recovered Secret with name %s \n", recoveredSecretResponse.value().name())); + // END: com.azure.keyvault.secrets.secretclient.recoverDeletedSecretWithResponse#string + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#backupSecret(String)} + */ + public void backupSecretCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.backupSecret#string + secretAsyncClient.backupSecret("secretName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretBackupResponse -> + System.out.printf("Secret's Backup Byte array's length %s \n", secretBackupResponse.length)); + // END: com.azure.keyvault.secrets.secretclient.backupSecret#string + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#backupSecretWithResponse(String)} + */ + public void backupSecretWithResponseCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.backupSecretWithResponse#string + secretAsyncClient.backupSecretWithResponse("secretName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretBackupResponse -> + System.out.printf("Secret's Backup Byte array's length %s \n", secretBackupResponse.value().length)); + // END: com.azure.keyvault.secrets.secretclient.backupSecretWithResponse#string + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#restoreSecret(byte[])} + */ + public void restoreSecretCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.restoreSecret#byte + byte[] secretBackupByteArray = {}; + secretAsyncClient.restoreSecret(secretBackupByteArray) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretResponse -> System.out.printf("Restored Secret with name %s and value %s \n", + secretResponse.name(), secretResponse.value())); + // END: com.azure.keyvault.secrets.secretclient.restoreSecret#byte + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#restoreSecretWithResponse(byte[])} + */ + public void restoreSecretWithResponseCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.restoreSecretWithResponse#byte + byte[] secretBackupByteArray = {}; + secretAsyncClient.restoreSecretWithResponse(secretBackupByteArray) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretResponse -> System.out.printf("Restored Secret with name %s and value %s \n", + secretResponse.value().name(), secretResponse.value().value())); + // END: com.azure.keyvault.secrets.secretclient.restoreSecretWithResponse#byte + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#listSecrets()} + */ + public void listSecretsCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.listSecrets + secretAsyncClient.listSecrets() + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretBase -> secretAsyncClient.getSecret(secretBase) + .subscribe(secretResponse -> System.out.printf("Received secret with name %s and type %s", + secretResponse.name(), secretResponse.value()))); + // END: com.azure.keyvault.secrets.secretclient.listSecrets + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#listDeletedSecrets()} + */ + public void listDeletedSecretsCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.listDeletedSecrets + secretAsyncClient.listDeletedSecrets() + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedSecretResponse -> System.out.printf("Deleted Secret's Recovery Id %s \n", + deletedSecretResponse.recoveryId())); + // END: com.azure.keyvault.secrets.secretclient.listDeletedSecrets + } + + /** + * Method to insert code snippets for {@link SecretAsyncClient#listSecretVersions(String)} + */ + public void listSecretVersionsCodeSnippets() { + SecretAsyncClient secretAsyncClient = getAsyncSecretClient(); + // BEGIN: com.azure.keyvault.secrets.secretclient.listSecretVersions#string + secretAsyncClient.listSecretVersions("secretName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(secretBase -> secretAsyncClient.getSecret(secretBase) + .subscribe(secretResponse -> System.out.printf("Received secret with name %s and type %s", + secretResponse.name(), secretResponse.value()))); + // END: com.azure.keyvault.secrets.secretclient.listSecretVersions#string + } +} diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java index 3b71f4e882cc..b1a37e92b28e 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java @@ -3,78 +3,338 @@ package com.azure.security.keyvault.secrets; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.test.models.RecordedData; -import com.azure.core.test.policy.RecordNetworkCallPolicy; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; +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 java.time.OffsetDateTime; + /** * This class contains code samples for generating javadocs through doclets for {@link SecretClient} */ public final class SecretClientJavaDocCodeSnippets { - /** - * Generates code sample for creating a {@link SecretAsyncClient} - * @return An instance of {@link SecretAsyncClient} - */ - public SecretAsyncClient createAsyncClientWithHttpclient() { - // BEGIN: com.azure.security.keyvault.keys.async.secretclient.withhttpclient.instantiation - RecordedData networkData = new RecordedData(); - HttpPipeline pipeline = HttpPipeline.builder().policies(new RecordNetworkCallPolicy(networkData)).build(); - SecretAsyncClient keyClient = new SecretClientBuilder() - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .endpoint("https://myvault.azure.net/") - .credential(new DefaultAzureCredential()) - .addPolicy(new RecordNetworkCallPolicy(networkData)) - .httpClient(HttpClient.createDefault()) - .buildAsyncClient(); - // END: com.azure.security.keyvault.keys.async.secretclient.withhttpclient.instantiation - return keyClient; - } + private String key1 = "key1"; + private String key2 = "key2"; + private String value1 = "val1"; + private String value2 = "val2"; /** * Method to insert code snippets for {@link SecretClient#getSecret(SecretBase)} */ - public void getSecret() { + public void getSecretCodeSnippets() { SecretClient secretClient = getSecretClient(); // BEGIN: com.azure.security.keyvault.secretclient.getSecret#secretBase for (SecretBase secret : secretClient.listSecrets()) { - Secret secretWithValue = secretClient.getSecret(secret).value(); + Secret secretWithValue = secretClient.getSecret(secret); System.out.printf("Secret is returned with name %s and value %s %n", secretWithValue.name(), secretWithValue.value()); } // END: com.azure.security.keyvault.secretclient.getSecret#secretBase + + // BEGIN: com.azure.security.keyvault.secretclient.getSecret#string-string + String secretVersion = "6A385B124DEF4096AF1361A85B16C204"; + Secret secretWithVersion = secretClient.getSecret("secretName", secretVersion); + System.out.printf("Secret is returned with name %s and value %s \n", + secretWithVersion.name(), secretWithVersion.value()); + // END: com.azure.security.keyvault.secretclient.getSecret#string-string + + // BEGIN: com.azure.security.keyvault.secretclient.getSecret#string + Secret secretWithoutVersion = secretClient.getSecret("secretName", secretVersion); + System.out.printf("Secret is returned with name %s and value %s \n", + secretWithoutVersion.name(), secretWithoutVersion.value()); + // END: com.azure.security.keyvault.secretclient.getSecret#string } /** - * Implementation for async SecretAsyncClient - * @return sync SecretAsyncClient + * Method to insert code snippets for {@link SecretClient#getSecretWithResponse(String, String, Context)} */ - private SecretAsyncClient getAsyncSecretClient() { + public void getSecretWithResponseCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.getSecretWithResponse#secretBase + for (SecretBase secret : secretClient.listSecrets()) { + Secret secretWithValue = secretClient.getSecretWithResponse(secret, new Context(key2, value2)).value(); + System.out.printf("Secret is returned with name %s and value %s %n", secretWithValue.name(), + secretWithValue.value()); + } + // END: com.azure.security.keyvault.secretclient.getSecretWithResponse#secretBase - // BEGIN: com.azure.security.keyvault.secretclient.async.construct - SecretAsyncClient secretClient = new SecretClientBuilder() - .credential(new DefaultAzureCredential()) - .endpoint("https://myvault.vault.azure.net/") - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient(); - // END: com.azure.security.keyvault.secretclient.async.construct - return secretClient; + // BEGIN: com.azure.security.keyvault.secretclient.getSecretWithResponse#string-string-Context + String secretVersion = "6A385B124DEF4096AF1361A85B16C204"; + Secret secretWithVersion = secretClient.getSecretWithResponse("secretName", secretVersion, + new Context(key2, value2)).value(); + System.out.printf("Secret is returned with name %s and value %s \n", + secretWithVersion.name(), secretWithVersion.value()); + // END: com.azure.security.keyvault.secretclient.getSecretWithResponse#string-string-Context + } + + /** + * Method to insert code snippets for {@link SecretClient#setSecret(Secret)} + */ + public void setSecretCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.setSecret#secret + Secret newSecret = new Secret("secretName", "secretValue").expires(OffsetDateTime.now().plusDays(60)); + Secret returnedSecret = secretClient.setSecret(newSecret); + System.out.printf("Secret is created with name %s and value %s \n", returnedSecret.name(), returnedSecret.value()); + // END: com.azure.security.keyvault.secretclient.setSecret#secret + + // BEGIN: com.azure.security.keyvault.secretclient.setSecret#string-string + Secret secret = secretClient.setSecret("secretName", "secretValue"); + System.out.printf("Secret is created with name %s and value %s \n", secret.name(), secret.value()); + // END: com.azure.security.keyvault.secretclient.setSecret#string-string + } + + /** + * Method to insert code snippets for {@link SecretClient#setSecretWithResponse(Secret, Context)} + */ + public void setSecretWithResponseCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.setSecretWithResponse#secret-Context + Secret newSecret = new Secret("secretName", "secretValue").expires(OffsetDateTime.now().plusDays(60)); + Secret secret = secretClient.setSecretWithResponse(newSecret, new Context(key1, value1)).value(); + System.out.printf("Secret is created with name %s and value %s \n", secret.name(), secret.value()); + // END: com.azure.security.keyvault.secretclient.setSecretWithResponse#secret-Context + } + + /** + * Method to insert code snippets for {@link SecretClient#updateSecret(SecretBase)} + */ + public void updateSecretCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.updateSecret#secretBase + Secret secret = secretClient.getSecret("secretName"); + secret.expires(OffsetDateTime.now().plusDays(60)); + SecretBase updatedSecretBase = secretClient.updateSecret(secret); + Secret updatedSecret = secretClient.getSecret(updatedSecretBase.name()); + System.out.printf("Updated Secret is returned with name %s, value %s and expires %s \n", + updatedSecret.name(), updatedSecret.value(), updatedSecret.expires()); + // END: com.azure.security.keyvault.secretclient.updateSecret#secretBase + } + + /** + * Method to insert code snippets for {@link SecretClient#updateSecretWithResponse(SecretBase, Context)} + */ + public void updateSecretWithResponseCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.updateSecretWithResponse#secretBase-Context + Secret secret = secretClient.getSecret("secretName"); + secret.expires(OffsetDateTime.now().plusDays(60)); + SecretBase updatedSecretBase = secretClient.updateSecretWithResponse(secret, new Context(key2, value2)).value(); + Secret updatedSecret = secretClient.getSecret(updatedSecretBase.name()); + System.out.printf("Updated Secret is returned with name %s, value %s and expires %s \n", + updatedSecret.name(), updatedSecret.value(), updatedSecret.expires()); + // END: com.azure.security.keyvault.secretclient.updateSecretWithResponse#secretBase-Context + } + + /** + * Method to insert code snippets for {@link SecretClient#deleteSecret(String)} + */ + public void deleteSecretCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.deleteSecret#string + DeletedSecret deletedSecret = secretClient.deleteSecret("secretName"); + System.out.printf("Deleted Secret's Recovery Id %s", deletedSecret.recoveryId()); + // END: com.azure.security.keyvault.secretclient.deleteSecret#string + } + + /** + * Method to insert code snippets for {@link SecretClient#deleteSecretWithResponse(String, Context)} + */ + public void deleteSecretWithResponseCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.deleteSecretWithResponse#string-Context + DeletedSecret deletedSecret = secretClient.deleteSecretWithResponse("secretName", + new Context(key2, value2)).value(); + System.out.printf("Deleted Secret's Recovery Id %s", deletedSecret.recoveryId()); + // END: com.azure.security.keyvault.secretclient.deleteSecretWithResponse#string-Context + } + + /** + * Method to insert code snippets for {@link SecretClient#deleteSecret(String)} + */ + public void getDeletedSecretCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.getDeletedSecret#string + DeletedSecret deletedSecret = secretClient.getDeletedSecret("secretName"); + System.out.printf("Deleted Secret's Recovery Id %s", deletedSecret.recoveryId()); + // END: com.azure.security.keyvault.secretclient.getDeletedSecret#string + } + + /** + * Method to insert code snippets for {@link SecretClient#getDeletedSecretWithResponse(String, Context)} + */ + public void getDeletedSecretWithResponseCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.getDeletedSecretWithResponse#string-Context + DeletedSecret deletedSecret = secretClient.getDeletedSecretWithResponse("secretName", + new Context(key2, value2)).value(); + System.out.printf("Deleted Secret's Recovery Id %s", deletedSecret.recoveryId()); + // END: com.azure.security.keyvault.secretclient.getDeletedSecretWithResponse#string-Context + } + + /** + * Method to insert code snippets for {@link SecretClient#purgeDeletedSecret(String)} + */ + public void purgeDeletedSecretCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.purgeDeletedSecret#string + VoidResponse purgeResponse = secretClient.purgeDeletedSecret("secretName"); + System.out.printf("Purge Status Code: %d", purgeResponse.statusCode()); + // END: com.azure.security.keyvault.secretclient.purgeDeletedSecret#string + + // BEGIN: com.azure.security.keyvault.secretclient.purgeDeletedSecret#string-Context + VoidResponse purgedResponse = secretClient.purgeDeletedSecret("secretName", new Context(key2, value2)); + System.out.printf("Purge Status Code: %d", purgedResponse.statusCode()); + // END: com.azure.security.keyvault.secretclient.purgeDeletedSecret#string-Context + } + + /** + * Method to insert code snippets for {@link SecretClient#recoverDeletedSecret(String)} + */ + public void recoverDeletedSecretCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.recoverDeletedSecret#string + Secret recoveredSecret = secretClient.recoverDeletedSecret("secretName"); + System.out.printf("Recovered Secret with name %s", recoveredSecret.name()); + // END: com.azure.security.keyvault.secretclient.recoverDeletedSecret#string + } + + /** + * Method to insert code snippets for {@link SecretClient#recoverDeletedSecretWithResponse(String, Context)} + */ + public void recoverDeletedSecretWithResponseCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.recoverDeletedSecretWithResponse#string-Context + Secret recoveredSecret = secretClient.recoverDeletedSecretWithResponse("secretName", + new Context(key1, value1)).value(); + System.out.printf("Recovered Secret with name %s", recoveredSecret.name()); + // END: com.azure.security.keyvault.secretclient.recoverDeletedSecretWithResponse#string-Context + } + + /** + * Method to insert code snippets for {@link SecretClient#backupSecret(String)} + */ + public void backupSecretCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.backupSecret#string + byte[] secretBackup = secretClient.backupSecret("secretName"); + System.out.printf("Secret's Backup Byte array's length %s", secretBackup.length); + // END: com.azure.security.keyvault.secretclient.backupSecret#string + } + + /** + * Method to insert code snippets for {@link SecretClient#backupSecretWithResponse(String, Context)} + */ + public void backupSecretWithResponseCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.backupSecretWithResponse#string-Context + byte[] secretBackup = secretClient.backupSecretWithResponse("secretName", + new Context(key1, value1)).value(); + System.out.printf("Secret's Backup Byte array's length %s", secretBackup.length); + // END: com.azure.security.keyvault.secretclient.backupSecretWithResponse#string-Context + } + + /** + * Method to insert code snippets for {@link SecretClient#restoreSecret(byte[])} + */ + public void restoreSecretCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.restoreSecret#byte + byte[] secretBackupByteArray = {}; + Secret restoredSecret = secretClient.restoreSecret(secretBackupByteArray); + System.out.printf("Restored Secret with name %s and value %s", restoredSecret.name(), restoredSecret.value()); + // END: com.azure.security.keyvault.secretclient.restoreSecret#byte + } + + /** + * Method to insert code snippets for {@link SecretClient#restoreSecretWithResponse(byte[], Context)} + */ + public void restoreSecretWithResponseCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.restoreSecretWithResponse#byte-Context + byte[] secretBackupByteArray = {}; + Secret restoredSecret = secretClient.restoreSecretWithResponse(secretBackupByteArray, + new Context(key2, value2)).value(); + System.out.printf("Restored Secret with name %s and value %s", restoredSecret.name(), restoredSecret.value()); + // END: com.azure.security.keyvault.secretclient.restoreSecretWithResponse#byte-Context + } + + /** + * Method to insert code snippets for {@link SecretClient#listSecrets()} + */ + public void listSecretsCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.listSecrets + for (SecretBase secret : secretClient.listSecrets()) { + Secret secretWithValue = secretClient.getSecret(secret); + System.out.printf("Received secret with name %s and value %s", + secretWithValue.name(), secretWithValue.value()); + } + // END: com.azure.security.keyvault.secretclient.listSecrets + + // BEGIN: com.azure.security.keyvault.secretclient.listSecrets#Context + for (SecretBase secret : secretClient.listSecrets(new Context(key1, value2))) { + Secret secretWithValue = secretClient.getSecret(secret); + System.out.printf("Received secret with name %s and value %s", + secretWithValue.name(), secretWithValue.value()); + } + // END: com.azure.security.keyvault.secretclient.listSecrets#Context + } + + /** + * Method to insert code snippets for {@link SecretClient#listDeletedSecrets()} + */ + public void listDeletedSecretsCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.listDeletedSecrets + for (DeletedSecret deletedSecret : secretClient.listDeletedSecrets()) { + System.out.printf("Deleted secret's recovery Id %s", deletedSecret.recoveryId()); + } + // END: com.azure.security.keyvault.secretclient.listDeletedSecrets + + // BEGIN: com.azure.security.keyvault.secretclient.listDeletedSecrets#Context + for (DeletedSecret deletedSecret : secretClient.listDeletedSecrets(new Context(key1, value2))) { + System.out.printf("Deleted secret's recovery Id %s", deletedSecret.recoveryId()); + } + // END: com.azure.security.keyvault.secretclient.listDeletedSecrets#Context + } + + /** + * Method to insert code snippets for {@link SecretClient#listSecretVersions(String)} + */ + public void listSecretVersionsCodeSnippets() { + SecretClient secretClient = getSecretClient(); + // BEGIN: com.azure.security.keyvault.secretclient.listSecretVersions#string + for (SecretBase secret : secretClient.listSecretVersions("secretName")) { + Secret secretWithValue = secretClient.getSecret(secret); + System.out.printf("Received secret's version with name %s and value %s", + secretWithValue.name(), secretWithValue.value()); + } + // END: com.azure.security.keyvault.secretclient.listSecretVersions#string + + // BEGIN: com.azure.security.keyvault.secretclient.listSecretVersions#string-Context + for (SecretBase secret : secretClient.listSecretVersions("secretName", new Context(key1, value2))) { + Secret secretWithValue = secretClient.getSecret(secret); + System.out.printf("Received secret's version with name %s and value %s", + secretWithValue.name(), secretWithValue.value()); + } + // END: com.azure.security.keyvault.secretclient.listSecretVersions#string-Context } /** * Implementation for sync SecretClient * @return sync SecretClient */ - private SecretClient getSyncSecretClient() { + private SecretClient getSyncSecretClientCodeSnippets() { // BEGIN: com.azure.security.keyvault.secretclient.sync.construct SecretClient secretClient = new SecretClientBuilder() - .credential(new DefaultAzureCredential()) + .credential(new DefaultAzureCredentialBuilder().build()) .endpoint("https://myvault.vault.azure.net/") .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .buildClient(); @@ -82,23 +342,6 @@ private SecretClient getSyncSecretClient() { return secretClient; } - /** - * Generates code sample for creating a {@link SecretAsyncClient} - * @return An instance of {@link SecretAsyncClient} - */ - public SecretAsyncClient createAsyncClientWithPipeline() { - // BEGIN: com.azure.security.keyvault.keys.async.secretclient.pipeline.instantiation - RecordedData networkData = new RecordedData(); - HttpPipeline pipeline = HttpPipeline.builder().policies(new RecordNetworkCallPolicy(networkData)).build(); - SecretAsyncClient keyClient = new SecretClientBuilder() - .pipeline(pipeline) - .endpoint("https://myvault.azure.net/") - .credential(new DefaultAzureCredential()) - .buildAsyncClient(); - // END: com.azure.security.keyvault.keys.async.secretclient.pipeline.instantiation - return keyClient; - } - /** * Implementation not provided for this method * @return {@code null} 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 1f47223f0b40..e06023231cb8 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 @@ -6,9 +6,6 @@ import com.azure.core.exception.HttpResponseException; 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.security.keyvault.secrets.models.DeletedSecret; import com.azure.security.keyvault.secrets.models.Secret; import com.azure.security.keyvault.secrets.models.SecretBase; @@ -33,20 +30,14 @@ protected void beforeTest() { beforeTestSetup(); if (interceptorManager.isPlaybackMode()) { - client = clientSetup(credentials -> new SecretClientBuilder() - .credential(credentials) + client = clientSetup(pipeline -> new SecretClientBuilder() + .pipeline(pipeline) .endpoint(getEndpoint()) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .buildAsyncClient()); } else { - client = clientSetup(credentials -> new SecretClientBuilder() - .credential(credentials) + client = clientSetup(pipeline -> new SecretClientBuilder() + .pipeline(pipeline) .endpoint(getEndpoint()) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .addPolicy(new RetryPolicy()) .buildAsyncClient()); } } @@ -100,12 +91,12 @@ public void updateSecret() { StepVerifier.create(client.setSecret(original)) .assertNext(response -> assertSecretEquals(original, response)) .verifyComplete(); - Secret secretToUpdate = client.getSecret(original.name()).block().value(); + Secret secretToUpdate = client.getSecret(original.name()).block(); StepVerifier.create(client.updateSecret(secretToUpdate.expires(updated.expires()))) .assertNext(response -> { - assertNotNull(response.value()); - Assert.assertEquals(original.name(), response.value().name()); + assertNotNull(response); + Assert.assertEquals(original.name(), response.name()); }).verifyComplete(); StepVerifier.create(client.getSecret(original.name())) @@ -146,8 +137,8 @@ public void getSecret() { */ public void getSecretSpecificVersion() { getSecretSpecificVersionRunner((secret, secretWithNewVal) -> { - final Secret secretVersionOne = client.setSecret(secret).block().value(); - final Secret secretVersionTwo = client.setSecret(secretWithNewVal).block().value(); + final Secret secretVersionOne = client.setSecret(secret).block(); + final Secret secretVersionTwo = client.setSecret(secretWithNewVal).block(); StepVerifier.create(client.getSecret(secret.name(), secretVersionOne.version())) .assertNext(response -> assertSecretEquals(secret, response)) @@ -175,16 +166,15 @@ public void deleteSecret() { deleteSecretRunner((secretToDelete) -> { StepVerifier.create(client.setSecret(secretToDelete)) .assertNext(secretResponse -> { - assertSecretEquals(secretToDelete, secretResponse.value()); + assertSecretEquals(secretToDelete, secretResponse); }).verifyComplete(); StepVerifier.create(client.deleteSecret(secretToDelete.name())) .assertNext(deletedSecretResponse -> { - DeletedSecret deletedSecret = deletedSecretResponse.value(); - assertNotNull(deletedSecret.deletedDate()); - assertNotNull(deletedSecret.recoveryId()); - assertNotNull(deletedSecret.scheduledPurgeDate()); - Assert.assertEquals(secretToDelete.name(), deletedSecret.name()); + assertNotNull(deletedSecretResponse.deletedDate()); + assertNotNull(deletedSecretResponse.recoveryId()); + assertNotNull(deletedSecretResponse.scheduledPurgeDate()); + Assert.assertEquals(secretToDelete.name(), deletedSecretResponse.name()); }).verifyComplete(); sleepInRecordMode(30000); @@ -208,24 +198,22 @@ public void getDeletedSecret() { getDeletedSecretRunner((secretToDeleteAndGet) -> { StepVerifier.create(client.setSecret(secretToDeleteAndGet)) .assertNext(secretResponse -> { - assertSecretEquals(secretToDeleteAndGet, secretResponse.value()); + assertSecretEquals(secretToDeleteAndGet, secretResponse); }).verifyComplete(); StepVerifier.create(client.deleteSecret(secretToDeleteAndGet.name())) .assertNext(deletedSecretResponse -> { - DeletedSecret deletedSecret = deletedSecretResponse.value(); - assertNotNull(deletedSecret); + assertNotNull(deletedSecretResponse); }).verifyComplete(); pollOnSecretDeletion(secretToDeleteAndGet.name()); sleepInRecordMode(30000); StepVerifier.create(client.getDeletedSecret(secretToDeleteAndGet.name())) .assertNext(deletedSecretResponse -> { - DeletedSecret deletedSecret = deletedSecretResponse.value(); - assertNotNull(deletedSecret.deletedDate()); - assertNotNull(deletedSecret.recoveryId()); - assertNotNull(deletedSecret.scheduledPurgeDate()); - Assert.assertEquals(secretToDeleteAndGet.name(), deletedSecret.name()); + assertNotNull(deletedSecretResponse.deletedDate()); + assertNotNull(deletedSecretResponse.recoveryId()); + assertNotNull(deletedSecretResponse.scheduledPurgeDate()); + Assert.assertEquals(secretToDeleteAndGet.name(), deletedSecretResponse.name()); }).verifyComplete(); StepVerifier.create(client.purgeDeletedSecret(secretToDeleteAndGet.name())) @@ -252,22 +240,18 @@ public void recoverDeletedSecret() { recoverDeletedSecretRunner((secretToDeleteAndRecover) -> { StepVerifier.create(client.setSecret(secretToDeleteAndRecover)) .assertNext(secretResponse -> { - assertSecretEquals(secretToDeleteAndRecover, secretResponse.value()); + assertSecretEquals(secretToDeleteAndRecover, secretResponse); }).verifyComplete(); StepVerifier.create(client.deleteSecret(secretToDeleteAndRecover.name())) - .assertNext(deletedSecretResponse -> { - DeletedSecret deletedSecret = deletedSecretResponse.value(); - assertNotNull(deletedSecret); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); sleepInRecordMode(30000); StepVerifier.create(client.recoverDeletedSecret(secretToDeleteAndRecover.name())) .assertNext(secretResponse -> { - Secret recoveredSecret = secretResponse.value(); - Assert.assertEquals(secretToDeleteAndRecover.name(), recoveredSecret.name()); - Assert.assertEquals(secretToDeleteAndRecover.notBefore(), recoveredSecret.notBefore()); - Assert.assertEquals(secretToDeleteAndRecover.expires(), recoveredSecret.expires()); + Assert.assertEquals(secretToDeleteAndRecover.name(), secretResponse.name()); + Assert.assertEquals(secretToDeleteAndRecover.notBefore(), secretResponse.notBefore()); + Assert.assertEquals(secretToDeleteAndRecover.expires(), secretResponse.expires()); }).verifyComplete(); }); } @@ -287,12 +271,12 @@ public void backupSecret() { backupSecretRunner((secretToBackup) -> { StepVerifier.create(client.setSecret(secretToBackup)) .assertNext(secretResponse -> { - assertSecretEquals(secretToBackup, secretResponse.value()); + assertSecretEquals(secretToBackup, secretResponse); }).verifyComplete(); StepVerifier.create(client.backupSecret(secretToBackup.name())) .assertNext(response -> { - byte[] backupBytes = response.value(); + byte[] backupBytes = response; assertNotNull(backupBytes); assertTrue(backupBytes.length > 0); }).verifyComplete(); @@ -314,15 +298,12 @@ public void restoreSecret() { restoreSecretRunner((secretToBackupAndRestore) -> { StepVerifier.create(client.setSecret(secretToBackupAndRestore)) .assertNext(secretResponse -> { - assertSecretEquals(secretToBackupAndRestore, secretResponse.value()); + assertSecretEquals(secretToBackupAndRestore, secretResponse); }).verifyComplete(); - byte[] backup = client.backupSecret(secretToBackupAndRestore.name()).block().value(); + byte[] backup = client.backupSecret(secretToBackupAndRestore.name()).block(); StepVerifier.create(client.deleteSecret(secretToBackupAndRestore.name())) - .assertNext(deletedSecretResponse -> { - DeletedSecret deletedSecret = deletedSecretResponse.value(); - assertNotNull(deletedSecret); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); pollOnSecretDeletion(secretToBackupAndRestore.name()); StepVerifier.create(client.purgeDeletedSecret(secretToBackupAndRestore.name())) @@ -335,10 +316,9 @@ public void restoreSecret() { StepVerifier.create(client.restoreSecret(backup)) .assertNext(response -> { - Secret restoredSecret = response.value(); - Assert.assertEquals(secretToBackupAndRestore.name(), restoredSecret.name()); - Assert.assertEquals(secretToBackupAndRestore.notBefore(), restoredSecret.notBefore()); - Assert.assertEquals(secretToBackupAndRestore.expires(), restoredSecret.expires()); + Assert.assertEquals(secretToBackupAndRestore.name(), response.name()); + Assert.assertEquals(secretToBackupAndRestore.notBefore(), response.notBefore()); + Assert.assertEquals(secretToBackupAndRestore.expires(), response.expires()); }).verifyComplete(); }); } @@ -358,23 +338,19 @@ public void restoreSecretFromMalformedBackup() { @Override public void listDeletedSecrets() { listDeletedSecretsRunner((secrets) -> { - HashMap secretsToDelete = secrets; List deletedSecrets = new ArrayList<>(); - for (Secret secret : secretsToDelete.values()) { + for (Secret secret : secrets.values()) { StepVerifier.create(client.setSecret(secret)) .assertNext(secretResponse -> { - assertSecretEquals(secret, secretResponse.value()); + assertSecretEquals(secret, secretResponse); }).verifyComplete(); } sleepInRecordMode(10000); - for (Secret secret : secretsToDelete.values()) { + for (Secret secret : secrets.values()) { StepVerifier.create(client.deleteSecret(secret.name())) - .assertNext(deletedSecretResponse -> { - DeletedSecret deletedSecret = deletedSecretResponse.value(); - assertNotNull(deletedSecret); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); pollOnSecretDeletion(secret.name()); } @@ -383,14 +359,14 @@ public void listDeletedSecrets() { sleepInRecordMode(30000); for (DeletedSecret actualSecret : deletedSecrets) { - if (secretsToDelete.containsKey(actualSecret.name())) { + if (secrets.containsKey(actualSecret.name())) { assertNotNull(actualSecret.deletedDate()); assertNotNull(actualSecret.recoveryId()); - secretsToDelete.remove(actualSecret.name()); + secrets.remove(actualSecret.name()); } } - assertEquals(0, secretsToDelete.size()); + assertEquals(0, secrets.size()); for (DeletedSecret deletedSecret : deletedSecrets) { StepVerifier.create(client.purgeDeletedSecret(deletedSecret.name())) @@ -408,25 +384,21 @@ public void listDeletedSecrets() { @Override public void listSecretVersions() { listSecretVersionsRunner((secrets) -> { - List secretVersions = secrets; List output = new ArrayList<>(); String secretName = null; - for (Secret secret : secretVersions) { + for (Secret secret : secrets) { secretName = secret.name(); - client.setSecret(secret).subscribe(secretResponse -> assertSecretEquals(secret, secretResponse.value())); + client.setSecret(secret).subscribe(secretResponse -> assertSecretEquals(secret, secretResponse)); sleepInRecordMode(1000); } sleepInRecordMode(30000); client.listSecretVersions(secretName).subscribe(output::add); sleepInRecordMode(30000); - assertEquals(secretVersions.size(), output.size()); + assertEquals(secrets.size(), output.size()); StepVerifier.create(client.deleteSecret(secretName)) - .assertNext(deletedSecretResponse -> { - DeletedSecret deletedSecret = deletedSecretResponse.value(); - assertNotNull(deletedSecret); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); pollOnSecretDeletion(secretName); @@ -447,7 +419,7 @@ public void listSecrets() { HashMap secretsToList = secrets; List output = new ArrayList<>(); for (Secret secret : secretsToList.values()) { - client.setSecret(secret).subscribe(secretResponse -> assertSecretEquals(secret, secretResponse.value())); + client.setSecret(secret).subscribe(secretResponse -> assertSecretEquals(secret, secretResponse)); sleepInRecordMode(1000); } sleepInRecordMode(30000); @@ -466,43 +438,39 @@ public void listSecrets() { }); } - private DeletedSecret pollOnSecretDeletion(String secretName) { + private void pollOnSecretDeletion(String secretName) { int pendingPollCount = 0; while (pendingPollCount < 30) { DeletedSecret deletedSecret = null; try { - deletedSecret = client.getDeletedSecret(secretName).block().value(); + deletedSecret = client.getDeletedSecret(secretName).block(); } catch (ResourceNotFoundException e) { } if (deletedSecret == null) { sleepInRecordMode(2000); pendingPollCount += 1; - continue; } else { - return deletedSecret; + return; } } System.err.printf("Deleted Secret %s not found \n", secretName); - return null; } - private DeletedSecret pollOnSecretPurge(String secretName) { + private void pollOnSecretPurge(String secretName) { int pendingPollCount = 0; while (pendingPollCount < 10) { DeletedSecret deletedSecret = null; try { - deletedSecret = client.getDeletedSecret(secretName).block().value(); + deletedSecret = client.getDeletedSecret(secretName).block(); } catch (ResourceNotFoundException e) { } if (deletedSecret != null) { sleepInRecordMode(2000); pendingPollCount += 1; - continue; } else { - return deletedSecret; + return; } } System.err.printf("Deleted Secret %s was not purged \n", secretName); - return null; } } 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 3500c5dec3c7..44aae7498858 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 @@ -5,16 +5,12 @@ 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.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.util.ArrayList; -import java.util.HashMap; import java.util.List; import static org.junit.Assert.assertEquals; @@ -30,20 +26,14 @@ protected void beforeTest() { beforeTestSetup(); if (interceptorManager.isPlaybackMode()) { - client = clientSetup(credentials -> new SecretClientBuilder() - .credential(credentials) + client = clientSetup(pipeline -> new SecretClientBuilder() + .pipeline(pipeline) .endpoint(getEndpoint()) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .buildClient()); } else { - client = clientSetup(credentials -> new SecretClientBuilder() - .credential(credentials) + client = clientSetup(pipeline -> new SecretClientBuilder() + .pipeline(pipeline) .endpoint(getEndpoint()) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .addPolicy(new RetryPolicy()) .buildClient()); } } @@ -85,7 +75,7 @@ public void setSecretNull() { public void updateSecret() { updateSecretRunner((original, updated) -> { assertSecretEquals(original, client.setSecret(original)); - Secret secretToUpdate = client.getSecret(original.name()).value(); + Secret secretToUpdate = client.getSecret(original.name()); client.updateSecret(secretToUpdate.expires(updated.expires())); assertSecretEquals(updated, client.getSecret(original.name())); }); @@ -116,8 +106,8 @@ public void getSecret() { */ public void getSecretSpecificVersion() { getSecretSpecificVersionRunner((secret, secretWithNewVal) -> { - Secret secretVersionOne = client.setSecret(secret).value(); - Secret secretVersionTwo = client.setSecret(secretWithNewVal).value(); + Secret secretVersionOne = client.setSecret(secret); + Secret secretVersionTwo = client.setSecret(secretWithNewVal); assertSecretEquals(secret, client.getSecret(secretVersionOne.name(), secretVersionOne.version())); assertSecretEquals(secretWithNewVal, client.getSecret(secretVersionTwo.name(), secretVersionTwo.version())); }); @@ -136,7 +126,7 @@ public void getSecretNotFound() { public void deleteSecret() { deleteSecretRunner((secretToDelete) -> { assertSecretEquals(secretToDelete, client.setSecret(secretToDelete)); - DeletedSecret deletedSecret = client.deleteSecret(secretToDelete.name()).value(); + DeletedSecret deletedSecret = client.deleteSecret(secretToDelete.name()); pollOnSecretDeletion(secretToDelete.name()); assertNotNull(deletedSecret.deletedDate()); assertNotNull(deletedSecret.recoveryId()); @@ -157,10 +147,10 @@ public void deleteSecretNotFound() { public void getDeletedSecret() { getDeletedSecretRunner((secretToDeleteAndGet) -> { assertSecretEquals(secretToDeleteAndGet, client.setSecret(secretToDeleteAndGet)); - assertNotNull(client.deleteSecret(secretToDeleteAndGet.name()).value()); + assertNotNull(client.deleteSecret(secretToDeleteAndGet.name())); pollOnSecretDeletion(secretToDeleteAndGet.name()); sleepInRecordMode(30000); - DeletedSecret deletedSecret = client.getDeletedSecret(secretToDeleteAndGet.name()).value(); + DeletedSecret deletedSecret = client.getDeletedSecret(secretToDeleteAndGet.name()); assertNotNull(deletedSecret.deletedDate()); assertNotNull(deletedSecret.recoveryId()); assertNotNull(deletedSecret.scheduledPurgeDate()); @@ -185,9 +175,9 @@ public void getDeletedSecretNotFound() { public void recoverDeletedSecret() { recoverDeletedSecretRunner((secretToDeleteAndRecover) -> { assertSecretEquals(secretToDeleteAndRecover, client.setSecret(secretToDeleteAndRecover)); - assertNotNull(client.deleteSecret(secretToDeleteAndRecover.name()).value()); + assertNotNull(client.deleteSecret(secretToDeleteAndRecover.name())); pollOnSecretDeletion(secretToDeleteAndRecover.name()); - Secret recoveredSecret = client.recoverDeletedSecret(secretToDeleteAndRecover.name()).value(); + Secret recoveredSecret = client.recoverDeletedSecret(secretToDeleteAndRecover.name()); assertEquals(secretToDeleteAndRecover.name(), recoveredSecret.name()); assertEquals(secretToDeleteAndRecover.notBefore(), recoveredSecret.notBefore()); assertEquals(secretToDeleteAndRecover.expires(), recoveredSecret.expires()); @@ -207,7 +197,7 @@ public void recoverDeletedSecretNotFound() { public void backupSecret() { backupSecretRunner((secretToBackup) -> { assertSecretEquals(secretToBackup, client.setSecret(secretToBackup)); - byte[] backupBytes = (client.backupSecret(secretToBackup.name()).value()); + byte[] backupBytes = (client.backupSecret(secretToBackup.name())); assertNotNull(backupBytes); assertTrue(backupBytes.length > 0); }); @@ -226,7 +216,7 @@ public void backupSecretNotFound() { public synchronized void restoreSecret() { restoreSecretRunner((secretToBackupAndRestore) -> { assertSecretEquals(secretToBackupAndRestore, client.setSecret(secretToBackupAndRestore)); - byte[] backupBytes = (client.backupSecret(secretToBackupAndRestore.name()).value()); + byte[] backupBytes = (client.backupSecret(secretToBackupAndRestore.name())); assertNotNull(backupBytes); assertTrue(backupBytes.length > 0); client.deleteSecret(secretToBackupAndRestore.name()); @@ -234,7 +224,7 @@ public synchronized void restoreSecret() { client.purgeDeletedSecret(secretToBackupAndRestore.name()); pollOnSecretPurge(secretToBackupAndRestore.name()); sleepInRecordMode(60000); - Secret restoredSecret = client.restoreSecret(backupBytes).value(); + Secret restoredSecret = client.restoreSecret(backupBytes); assertEquals(secretToBackupAndRestore.name(), restoredSecret.name()); assertEquals(secretToBackupAndRestore.expires(), restoredSecret.expires()); }); @@ -253,13 +243,12 @@ public void restoreSecretFromMalformedBackup() { */ public void listSecrets() { listSecretsRunner((secrets) -> { - HashMap secretsToList = secrets; - for (Secret secret : secretsToList.values()) { + for (Secret secret : secrets.values()) { assertSecretEquals(secret, client.setSecret(secret)); } for (SecretBase actualSecret : client.listSecrets()) { - if (secretsToList.containsKey(actualSecret.name())) { + if (secrets.containsKey(actualSecret.name())) { Secret expectedSecret = secrets.get(actualSecret.name()); assertEquals(expectedSecret.expires(), actualSecret.expires()); assertEquals(expectedSecret.notBefore(), actualSecret.notBefore()); @@ -277,12 +266,11 @@ public void listSecrets() { public void listDeletedSecrets() { listDeletedSecretsRunner((secrets) -> { - HashMap secretsToDelete = secrets; - for (Secret secret : secretsToDelete.values()) { + for (Secret secret : secrets.values()) { assertSecretEquals(secret, client.setSecret(secret)); } - for (Secret secret : secretsToDelete.values()) { + for (Secret secret : secrets.values()) { client.deleteSecret(secret.name()); pollOnSecretDeletion(secret.name()); } @@ -290,14 +278,14 @@ public void listDeletedSecrets() { sleepInRecordMode(60000); Iterable deletedSecrets = client.listDeletedSecrets(); for (DeletedSecret actualSecret : deletedSecrets) { - if (secretsToDelete.containsKey(actualSecret.name())) { + if (secrets.containsKey(actualSecret.name())) { assertNotNull(actualSecret.deletedDate()); assertNotNull(actualSecret.recoveryId()); - secretsToDelete.remove(actualSecret.name()); + secrets.remove(actualSecret.name()); } } - assertEquals(0, secretsToDelete.size()); + assertEquals(0, secrets.size()); for (DeletedSecret deletedSecret : deletedSecrets) { client.purgeDeletedSecret(deletedSecret.name()); @@ -334,43 +322,39 @@ public void listSecretVersions() { } - private DeletedSecret pollOnSecretDeletion(String secretName) { + private void pollOnSecretDeletion(String secretName) { int pendingPollCount = 0; while (pendingPollCount < 30) { DeletedSecret deletedSecret = null; try { - deletedSecret = client.getDeletedSecret(secretName).value(); + deletedSecret = client.getDeletedSecret(secretName); } catch (ResourceNotFoundException e) { } if (deletedSecret == null) { sleepInRecordMode(2000); pendingPollCount += 1; - continue; } else { - return deletedSecret; + return; } } System.err.printf("Deleted Secret %s not found \n", secretName); - return null; } - private DeletedSecret pollOnSecretPurge(String secretName) { + private void pollOnSecretPurge(String secretName) { int pendingPollCount = 0; while (pendingPollCount < 10) { DeletedSecret deletedSecret = null; try { - deletedSecret = client.getDeletedSecret(secretName).value(); + deletedSecret = client.getDeletedSecret(secretName); } catch (ResourceNotFoundException e) { } if (deletedSecret != null) { sleepInRecordMode(2000); pendingPollCount += 1; - continue; } else { - return deletedSecret; + return; } } System.err.printf("Deleted Secret %s was not purged \n", secretName); - return null; } } 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 029ec2e509b9..9c1095bb5426 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 @@ -6,9 +6,15 @@ import com.azure.core.credentials.AccessToken; import com.azure.core.credentials.TokenCredential; import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.*; import com.azure.core.http.rest.Response; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.test.TestBase; -import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.identity.credential.DefaultAzureCredentialBuilder; import com.azure.security.keyvault.secrets.models.Secret; import org.junit.Rule; import org.junit.Test; @@ -27,9 +33,7 @@ import java.util.function.Consumer; import java.util.function.Function; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; public abstract class SecretClientTestBase extends TestBase { @@ -47,21 +51,41 @@ protected String testName() { void beforeTestSetup() { } - T clientSetup(Function clientBuilder) { - final String endpoint = interceptorManager.isPlaybackMode() - ? "http://localhost:8080" - : System.getenv("AZURE_KEYVAULT_ENDPOINT"); - + T clientSetup(Function clientBuilder) { TokenCredential credential; if (interceptorManager.isPlaybackMode()) { credential = resource -> Mono.just(new AccessToken("Some fake token", OffsetDateTime.now(ZoneOffset.UTC).plus(Duration.ofMinutes(30)))); } else { - credential = new DefaultAzureCredential(); + credential = new DefaultAzureCredentialBuilder().build(); + } + + HttpClient httpClient; + // 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, ConfigurationManager.getConfiguration().clone())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(new RetryPolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, SecretAsyncClient.KEY_VAULT_SCOPE)); + policies.addAll(policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(HttpLogDetailLevel.BODY_AND_HEADERS)); + + if (interceptorManager.isPlaybackMode()) { + httpClient = interceptorManager.getPlaybackClient(); + policies.add(interceptorManager.getRecordPolicy()); + } else { + httpClient = HttpClient.createDefault().wiretap(true); + policies.add(interceptorManager.getRecordPolicy()); } + HttpPipeline pipeline = new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); + T client; - client = clientBuilder.apply(credential); + client = clientBuilder.apply(pipeline); return Objects.requireNonNull(client); } diff --git a/sdk/keyvault/ci.yml b/sdk/keyvault/ci.yml index 66e91280bbcd..717c64343987 100644 --- a/sdk/keyvault/ci.yml +++ b/sdk/keyvault/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/keyvault/ @@ -13,11 +22,19 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/keyvault/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: keyvault \ No newline at end of file + ServiceDirectory: keyvault + Artifacts: + - name: azure-keyvault-keys + safeName: azurekeyvaultkeys + - name: azure-keyvault-secrets + safeName: azurekeyvaultsecrets \ No newline at end of file diff --git a/sdk/keyvault/pom.client.xml b/sdk/keyvault/pom.client.xml index 56af4e99df0b..83b557faa313 100644 --- a/sdk/keyvault/pom.client.xml +++ b/sdk/keyvault/pom.client.xml @@ -6,13 +6,13 @@ com.azure azure-client-sdk-parent - 1.1.0 + 1.2.0 ../../pom.client.xml com.azure azure-keyvault-parent - 4.0.0-preview.1 + 4.0.0-preview.2 pom azure-keyvault diff --git a/sdk/keyvault/pom.service.xml b/sdk/keyvault/pom.service.xml index 98d1b31a7867..956a21dfe3d7 100644 --- a/sdk/keyvault/pom.service.xml +++ b/sdk/keyvault/pom.service.xml @@ -19,7 +19,8 @@ microsoft-azure-keyvault-complete - ../core + ../core/azure-core + ../core/azure-core-test ../identity/azure-identity azure-keyvault-keys azure-keyvault-secrets diff --git a/storage/client/blob/CHANGELOG.md b/sdk/storage/azure-storage-blob/CHANGELOG.md similarity index 86% rename from storage/client/blob/CHANGELOG.md rename to sdk/storage/azure-storage-blob/CHANGELOG.md index 32e9b8a3e4a4..0ab8c37f2a12 100644 --- a/storage/client/blob/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob/CHANGELOG.md @@ -1,5 +1,20 @@ # Change Log azure-storage-blob +## Version 12.0.0-preview.2: + +For details on the Azure SDK for Java (August 2019 Preview) release refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). + +- Renamed `StorageClient`, `StorageAsyncClient`, and `StorageClientBuilder` to `BlobServiceClient`, `BlobServiceAsyncClient`, and `BlobServiceClientBuilder`. +- Combined `AppendBlobClientBuilder`, `BlockBlobClientBuilder`, and `PageBlobClientBuilder` into `BlobClientBuilder`. Methods to create each client type were added. +- Removed static builder method from clients. Builders are now instantiable. +- Changed return type of `createSnapshot` in `BlobClient` to return a client associated to the blob snapshot instead of the snapshot ID. Use `getSnapshotId` to get snapshot ID and `isSnapshot` to indicate if the client is associated to a blob snapshot. +- Added `getSnapshotClient` to clients that returns a new client associated to the snapshot. +- Added SAS token generation to clients. +- Added `deleteContainer` to `BlobServiceClient` and `BlobServiceAsyncClient`. +- Added `getAppendBlobClient` with snapshot overload to `ContainerClient`. +- Removed `AnonymousClientCredential` class. +- Changed parameter ordering of `BlobClient` and `BlobAsyncClient` `download` and `downloadToFile`. + ## Version 12.0.0-preview.1: Version 12.0.0-preview.1 is the first preview of our efforts to create a user-friendly and Java client library for Azure Storage Blobs. For more information about this, and preview releases of other Azure SDK libraries, please visit @@ -7,7 +22,7 @@ https://aka.ms/azure-sdk-preview1-java. **Breaking changes: New API design** - Operations are now scoped to a particular client: - - `StorageClient`: StorageURL's functionality was migrated to StorageClient. This client handles account-level operations. This includes managing service properties and listing the containers within an account. + - `BlobServiceClient`: StorageURL's functionality was migrated to BlobServiceClient. This client handles account-level operations. This includes managing service properties and listing the containers within an account. - `ContainerClient`: ContainerURL's functionality was migrated to ContainerClient. The client handles operations for a particular container. This includes creating or deleting that container, as well as listing the blobs within that container. - `BlobClient`: BlobURL's functionality was migrated to BlobClient, TransferManager download functionality was migrated to BlobClient and TransferManager upload functionality was migrated to BlockBlobClient. The client handles most operations, excluding upload, for an individual blob, including downloading data and working with blob properties. There are subclients (BlockBlobClient, PageBlobClient, AppendBlobClient) available for their respective blob types on the service. diff --git a/storage/client/blob/README.md b/sdk/storage/azure-storage-blob/README.md similarity index 63% rename from storage/client/blob/README.md rename to sdk/storage/azure-storage-blob/README.md index 5a90220c5ed7..0adb58b51fe5 100644 --- a/storage/client/blob/README.md +++ b/sdk/storage/azure-storage-blob/README.md @@ -7,7 +7,7 @@ storage is optimized for storing massive amounts of unstructured data. Unstructured data is data that does not adhere to a particular data model or definition, such as text or binary data. -[Source code][source] | [Package (Maven)][package] | [API reference documentation][docs] | [REST API documentation][rest_docs] | [Product documentation][product_docs] +[Source code][source] | [API reference documentation][docs] | [REST API documentation][rest_docs] | [Product documentation][product_docs] | [Samples][samples] ## Getting started @@ -23,7 +23,7 @@ definition, such as text or binary data. com.azure azure-storage-blob - 12.0.0-preview.1 + 12.0.0-preview.2 ``` @@ -38,13 +38,13 @@ az group create \ ### 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 @@ -97,9 +97,9 @@ Blob storage is designed for: The following sections provide several code snippets covering some of the most common Azure Storage Blob tasks, including: -- [Create storage client](#create-storage-client) -- [Create container client](#create-container-client) -- [Create blob client](#create-blob-client) +- [Create BlobServiceClient](#create-blobserviceclient) +- [Create ContainerClient](#create-containerclient) +- [Create BlobClient](#create-blobclient) - [Create a container](#create-a-container) - [Upload a blob from InputStream](#uploading-a-blob-from-a-stream) - [Upload a blob from File](#uploading-a-blob-from-file) @@ -108,70 +108,70 @@ The following sections provide several code snippets covering some of the most c - [Enumerating blobs](#enumerating-blobs) - [Authenticate with Azure.Identity](#authenticate-with-azureidentity) -### Create storage client +### Create BlobServiceClient -Create a storage client using the [`sasToken`](#get-credentials) generated above. +Create a BlobServiceClient using the [`sasToken`](#get-credentials) generated above. ```java -StorageClient storageClient = StorageClient.builder() +BlobServiceClient blobServiceClient = new BlobServiceClientBuilder() .endpoint("") .credential("") - .build(); + .buildClient(); ``` -### Create container client +### Create ContainerClient -Create a container client if storage client exists. +Create a ContainerClient if a BlobServiceClient exists. ```java -ContainerClient containerClient = storageClient.getContainerClient("mycontainer"); +ContainerClient containerClient = blobServiceClient.getContainerClient("mycontainer"); ``` -or +or -Create the container client from the builder [`sasToken`](#get-credentials) generated above. +Create the ContainerClient from the builder [`sasToken`](#get-credentials) generated above. ```java -ContainerClient containerClient = ContainerClient.builder() +ContainerClient containerClient = new ContainerClientBuilder() .endpoint("") .credential("") .containerName("mycontainer") - .build(); + .buildClient(); ``` -### Create blob client +### Create BlobClient -Create a blob client if container client exists. +Create a BlobClient if container client exists. ```java BlobClient blobClient = containerClient.getBlobClient("myblob"); ``` -or +or -Create the blob client from the builder [`sasToken`](#get-credentials) generated above. +Create the BlobClient from the builder [`sasToken`](#get-credentials) generated above. ```java -BlobClient blobClient = BlobClient.builder() +BlobClient blobClient = new BlobClientBuilder() .endpoint("") .credential("") .containerName("mycontainer") .blobName("myblob") - .build(); + .buildBlobClient(); ``` ### Create a container -Create a container from storage client. +Create a container from a BlobServiceClient. ```java -storageClient.createContainer("mycontainer"); +blobServiceClient.createContainer("mycontainer"); ``` -or +or -Create a container using container client. +Create a container using ContainerClient. ```java containerClient.create(); ``` ### Uploading a blob from a stream -Upload data stream to a blob using blockBlobClient generated from containerClient. +Upload data stream to a blob using BlockBlobClient generated from a ContainerClient. ```java BlockBlobClient blockBlobClient = containerClient.getBlockBlobClient("myblockblob"); @@ -183,7 +183,7 @@ try (ByteArrayInputStream dataStream = new ByteArrayInputStream(dataSample.getBy ### Uploading a blob from `File` -Upload a file to a blob using blockBlobClient generated from containerClient. +Upload a file to a blob using BlockBlobClient generated from ContainerClient. ```java BlockBlobClient blockBlobClient = containerClient.getBlockBlobClient("myblockblob"); @@ -192,7 +192,7 @@ blobClient.uploadFromFile("local-file.jpg"); ### Downloading a blob to output stream -Download blob to output stream using blobClient. +Download blob to output stream using BlobClient. ```java try(ByteArrayOutputStream outputStream = new ByteArrayOutputStream("downloaded-file.jpg")) { @@ -202,14 +202,14 @@ try(ByteArrayOutputStream outputStream = new ByteArrayOutputStream("downloaded-f ### Downloading a blob to local path -Download blob to local file using blobClient. +Download blob to local file using BlobClient. ```java blobClient.downloadToFile("downloaded-file.jpg"); ``` ### Enumerating blobs -Enumerating all blobs using `ContainerClient` +Enumerating all blobs using ContainerClient ```java containerClient.listBlobsFlat() .forEach( @@ -222,7 +222,7 @@ containerClient.listBlobsFlat() The [Azure Identity library][identity] provides Azure Active Directory support for authenticating with Azure Storage. ```java -StorageClient storageClient = StorageClient.storageClientBuilder() +BlobServiceClient storageClient = BlobServiceClient.storageClientBuilder() .endpoint(endpoint) .credential(new DefaultAzureCredential()) .buildClient(); @@ -230,7 +230,7 @@ StorageClient storageClient = StorageClient.storageClientBuilder() ## Troubleshooting -When interacts with blobs using this Java client library, errors returned by the service correspond to the same HTTP +When interacts with blobs using this Java client library, errors returned by the service correspond to the same HTTP status codes returned for [REST API][error_codes] requests. For example, if you try to retrieve a container or blob that doesn't exist in your Storage Account, a `404` error is returned, indicating `Not Found`. @@ -238,12 +238,12 @@ doesn't exist in your Storage Account, a `404` error is returned, indicating `No Get started with our [Blob samples][samples]: -1. [Basic Examples](src/samples/java/BasicExample.java): Create storage, container, blob clients, Upload, download, and list blobs. -1. [File Transfer Examples](src/samples/java/FileTransferExample.java): Upload and download a large file through blobs. -1. [Storage Error Examples](src/samples/java/StorageErrorHandlingExample.java): Handle the exceptions from storage blob service side. -1. [List Container Examples](src/samples/java/ListContainersExample.java): Create, list and delete containers. -1. [Set metadata and HTTPHeaders Examples](src/samples/java/SetMetadataAndHTTPHeadersExample.java): Set metadata for container and blob, and set HTTPHeaders for blob. -1. [Azure Identity Examples](src/samples/java/AzureIdentityExample.java): Use DefaultAzureCredential to do the authentication. +1. [Basic Examples][samples_basic]: Create storage, container, blob clients, Upload, download, and list blobs. +1. [File Transfer Examples][samples_file_transfer]: Upload and download a large file through blobs. +1. [Storage Error Examples][samples_storage_error]: Handle the exceptions from storage blob service side. +1. [List Container Examples][samples_list_containers]: Create, list and delete containers. +1. [Set metadata and HTTPHeaders Examples][samples_metadata]: Set metadata for container and blob, and set HTTPHeaders for blob. +1. [Azure Identity Examples][samples_identity]: Use DefaultAzureCredential to do the authentication. ## Contributing @@ -256,24 +256,29 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope ![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fstorage%2FAzure.Storage.Blobs%2FREADME.png) -[source]: https://github.com/Azure/azure-sdk-for-java/tree/master/storage/client/blob/src -[package]: https://repo1.maven.org/maven2/com/azure/azure-storage-blob/12.0.0-preview.1/ +[source]: src [docs]: http://azure.github.io/azure-sdk-for-java/ -[rest_docs]: https://docs.microsoft.com/en-us/rest/api/storageservices/blob-service-rest-api -[product_docs]: https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blobs-overview -[sas_token]: https://docs.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1 -[jdk]: https://docs.microsoft.com/en-us/java/azure/java-supported-jdk-runtime?view=azure-java-stable +[rest_docs]: https://docs.microsoft.com/rest/api/storageservices/blob-service-rest-api +[product_docs]: https://docs.microsoft.com/azure/storage/blobs/storage-blobs-overview +[sas_token]: https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1 +[jdk]: https://docs.microsoft.com/java/azure/java-supported-jdk-runtime?view=azure-java-stable [maven]: https://maven.apache.org/ -[azure_subscription]: https://azure.microsoft.com/en-us/free/ -[storage_account]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal -[storage_account_create_ps]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=azure-powershell -[storage_account_create_cli]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=azure-cli -[storage_account_create_portal]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal +[azure_subscription]: https://azure.microsoft.com/free/ +[storage_account]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal +[storage_account_create_ps]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-powershell +[storage_account_create_cli]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-cli +[storage_account_create_portal]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal [azure_cli]: https://docs.microsoft.com/cli/azure [azure_sub]: https://azure.microsoft.com/free/ [identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity/README.md -[error_codes]: https://docs.microsoft.com/en-us/rest/api/storageservices/blob-service-error-codes -[samples]: ./src/samples/ +[error_codes]: https://docs.microsoft.com/rest/api/storageservices/blob-service-error-codes +[samples]: src/samples +[samples_basic]: src/samples/java/com/azure/storage/blob/BasicExample.java +[samples_file_transfer]: src/samples/java/com/azure/storage/blob/FileTransferExample.java +[samples_storage_error]: src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java +[samples_list_containers]: src/samples/java/com/azure/storage/blob/ListContainersExample.java +[samples_metadata]: src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java +[samples_identity]: src/samples/java/com/azure/storage/blob/AzureIdentityExample.java [cla]: https://cla.microsoft.com [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/storage/client/blob/pom.xml b/sdk/storage/azure-storage-blob/pom.xml similarity index 96% rename from storage/client/blob/pom.xml rename to sdk/storage/azure-storage-blob/pom.xml index b661ff0ad7e2..596079a6d480 100644 --- a/storage/client/blob/pom.xml +++ b/sdk/storage/azure-storage-blob/pom.xml @@ -5,7 +5,7 @@ com.azure azure-client-sdk-parent - 1.1.0 + 1.2.0 ../../../pom.client.xml @@ -13,7 +13,7 @@ com.azure azure-storage-blob - 12.0.0-preview.1 + 12.0.0-preview.2 azure-storage-blob https://github.com/Azure/azure-sdk-for-java @@ -49,7 +49,7 @@ com.azure azure-core - 1.0.0-preview.2 + 1.0.0-preview.3 org.slf4j @@ -69,7 +69,7 @@ com.azure azure-core-test - 1.0.0-preview.2 + 1.0.0-preview.3 test diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/AccountSASPermission.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASPermission.java similarity index 73% rename from storage/client/blob/src/main/java/com/azure/storage/blob/AccountSASPermission.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASPermission.java index 11369aabed0d..4af9f970ff64 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/AccountSASPermission.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASPermission.java @@ -12,7 +12,7 @@ * {@link AccountSASSignatureValues} object. It is possible to construct the permissions string without this class, but * the order of the permissions is particular and this class guarantees correctness. */ -final class AccountSASPermission { +public final class AccountSASPermission { private boolean read; @@ -33,7 +33,7 @@ final class AccountSASPermission { /** * Initializes an {@code AccountSASPermission} object with all fields set to false. */ - private AccountSASPermission() { + public AccountSASPermission() { } /** @@ -85,14 +85,17 @@ public static AccountSASPermission parse(String permString) { } /** - * Permission to read resources and list queues and tables granted. + * @return the read permission status */ public boolean read() { return read; } /** - * Permission to read resources and list queues and tables granted. + * Sets the read permission status. + * + * @param read Permission status to set + * @return the updated AccountSASPermission object */ public AccountSASPermission read(boolean read) { this.read = read; @@ -100,14 +103,17 @@ public AccountSASPermission read(boolean read) { } /** - * Permission to add messages, table entities, and append to blobs granted. + * @return the add permission status */ public boolean add() { return add; } /** - * Permission to add messages, table entities, and append to blobs granted. + * Sets the add permission status. + * + * @param add Permission status to set + * @return the updated AccountSASPermission object */ public AccountSASPermission add(boolean add) { this.add = add; @@ -115,14 +121,17 @@ public AccountSASPermission add(boolean add) { } /** - * Permission to create blobs and files granted. + * @return the create permission status */ public boolean create() { return create; } /** - * Permission to create blobs and files granted. + * Sets the create permission status. + * + * @param create Permission status to set + * @return the updated AccountSASPermission object */ public AccountSASPermission create(boolean create) { this.create = create; @@ -130,14 +139,17 @@ public AccountSASPermission create(boolean create) { } /** - * Permission to write resources granted. + * @return the write permission status */ public boolean write() { return write; } /** - * Permission to write resources granted. + * Sets the write permission status. + * + * @param write Permission status to set + * @return the updated AccountSASPermission object */ public AccountSASPermission write(boolean write) { this.write = write; @@ -145,14 +157,17 @@ public AccountSASPermission write(boolean write) { } /** - * Permission to delete resources granted. + * @return the delete permission status */ public boolean delete() { return delete; } /** - * Permission to delete resources granted. + * Sets the delete permission status. + * + * @param delete Permission status to set + * @return the updated AccountSASPermission object */ public AccountSASPermission delete(boolean delete) { this.delete = delete; @@ -160,14 +175,18 @@ public AccountSASPermission delete(boolean delete) { } /** - * Permission to list blob containers, blobs, shares, directories, and files granted. + * @return the list permission status */ public boolean list() { return list; } /** - * Permission to list blob containers, blobs, shares, directories, and files granted. + * Sets the list permission status. This permission grants the ability to list blob containers, blobs, shares, + * directories, and files. + * + * @param list Permission status to set + * @return the updated AccountSASPermission object */ public AccountSASPermission list(boolean list) { this.list = list; @@ -175,14 +194,19 @@ public AccountSASPermission list(boolean list) { } /** - * Permissions to update messages and table entities granted. + * Returns the update permission status, it allows the update of queue message and tables. + * + * @return the update permission status */ public boolean update() { return update; } /** - * Permissions to update messages and table entities granted. + * Sets the update permission status, it allows the update of queue messages and tables. + * + * @param update Permission status to set + * @return the updated AccountSASPermission object */ public AccountSASPermission update(boolean update) { this.update = update; @@ -190,14 +214,19 @@ public AccountSASPermission update(boolean update) { } /** - * Permission to get and delete messages granted. + * Returns the process messages permission, this allows the retrieval and deletion of queue messages. + * + * @return the process messages permission status. */ public boolean processMessages() { return processMessages; } /** - * Permission to get and delete messages granted. + * Sets the process messages permission, this allows the retrieval and deletion of queue messages. + * + * @param processMessages Permission status to set + * @return the updated AccountSASPermission object */ public AccountSASPermission processMessages(boolean processMessages) { this.processMessages = processMessages; diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/AccountSASResourceType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASResourceType.java similarity index 78% rename from storage/client/blob/src/main/java/com/azure/storage/blob/AccountSASResourceType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASResourceType.java index 6fc53c190293..a91abf917501 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/AccountSASResourceType.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASResourceType.java @@ -12,7 +12,7 @@ * {@link AccountSASSignatureValues} object. It is possible to construct the resources string without this class, but * the order of the resources is particular and this class guarantees correctness. */ -final class AccountSASResourceType { +public final class AccountSASResourceType { private boolean service; @@ -23,7 +23,7 @@ final class AccountSASResourceType { /** * Initializes an {@code AccountSASResourceType} object with all fields set to false. */ - private AccountSASResourceType() { + public AccountSASResourceType() { } /** @@ -61,14 +61,17 @@ public static AccountSASResourceType parse(String resourceTypesString) { } /** - * Permission to access service level APIs granted. + * @return the access status for service level APIs. */ public boolean service() { return service; } /** - * Permission to access service level APIs granted. + * Sets the access status for service level APIs. + * + * @param service Access status to set + * @return the updated AccountSASResourceType object. */ public AccountSASResourceType service(boolean service) { this.service = service; @@ -76,14 +79,18 @@ public AccountSASResourceType service(boolean service) { } /** - * Permission to access container level APIs (Blob Containers, Tables, Queues, File Shares) granted. + * @return the access status for container level APIs, this grants access to Blob Containers, Tables, Queues, + * and File Shares. */ public boolean container() { return container; } /** - * Permission to access container level APIs (Blob Containers, Tables, Queues, File Shares) granted. + * Sets the access status for container level APIs, this grants access to Blob Containers, Tables, Queues, and File Shares. + * + * @param container Access status to set + * @return the updated AccountSASResourceType object. */ public AccountSASResourceType container(boolean container) { this.container = container; @@ -91,14 +98,18 @@ public AccountSASResourceType container(boolean container) { } /** - * Permission to access object level APIs (Blobs, Table Entities, Queue Messages, Files) granted. + * @return the access status for object level APIs, this grants access to Blobs, Table Entities, Queue Messages, + * Files. */ public boolean object() { return object; } /** - * Permission to access object level APIs (Blobs, Table Entities, Queue Messages, Files) granted. + * Sets the access status for object level APIs, this grants access to Blobs, Table Entities, Queue Messages, Files. + * + * @param object Access status to set + * @return the updated AccountSASResourceType object. */ public AccountSASResourceType object(boolean object) { this.object = object; diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/AccountSASService.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASService.java similarity index 81% rename from storage/client/blob/src/main/java/com/azure/storage/blob/AccountSASService.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASService.java index 0f88ccb2203a..9fbb9137bcbd 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/AccountSASService.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASService.java @@ -12,7 +12,7 @@ * {@link AccountSASSignatureValues} object. It is possible to construct the services string without this class, but * the order of the services is particular and this class guarantees correctness. */ -final class AccountSASService { +public final class AccountSASService { private boolean blob; @@ -25,7 +25,7 @@ final class AccountSASService { /** * Initializes an {@code AccountSASService} object with all fields set to false. */ - private AccountSASService() { + public AccountSASService() { } /** @@ -66,14 +66,17 @@ public static AccountSASService parse(String servicesString) { } /** - * Permission to access blob resources granted. + * @return the access status for blob resources. */ public boolean blob() { return blob; } /** - * Permission to access blob resources granted. + * Sets the access status for blob resources. + * + * @param blob Access status to set + * @return the updated AccountSASService object. */ public AccountSASService blob(boolean blob) { this.blob = blob; @@ -81,14 +84,17 @@ public AccountSASService blob(boolean blob) { } /** - * Permission to access file resources granted. + * @return the access status for file resources. */ public boolean file() { return file; } /** - * Permission to access file resources granted. + * Sets the access status for file resources. + * + * @param file Access status to set + * @return the updated AccountSASService object. */ public AccountSASService file(boolean file) { this.file = file; @@ -96,14 +102,17 @@ public AccountSASService file(boolean file) { } /** - * Permission to access queue resources granted. + * @return the access status for queue resources. */ public boolean queue() { return queue; } /** - * Permission to access queue resources granted. + * Sets the access status for queue resources. + * + * @param queue Access status to set + * @return the updated AccountSASService object. */ public AccountSASService queue(boolean queue) { this.queue = queue; @@ -111,14 +120,17 @@ public AccountSASService queue(boolean queue) { } /** - * Permission to access table resources granted. + * @return the access status for table resources. */ public boolean table() { return table; } /** - * Permission to access table resources granted. + * Sets the access status for table resources. + * + * @param table Access status to set + * @return the updated AccountSASService object. */ public AccountSASService table(boolean table) { this.table = table; diff --git a/storage/client/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 similarity index 67% rename from storage/client/blob/src/main/java/com/azure/storage/blob/AccountSASSignatureValues.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AccountSASSignatureValues.java index d60118d87b12..5d770a8112e9 100644 --- a/storage/client/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 @@ -24,9 +24,9 @@ * here for further * descriptions of the parameters, including which are required: * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_sas "Sample code for AccountSASSignatureValues")] \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) + *

    Please see + * here + * for additional samples.

    */ final class AccountSASSignatureValues { @@ -54,14 +54,19 @@ final class AccountSASSignatureValues { } /** - * If null or empty, this defaults to the service version targeted by this version of the library. + * @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; } /** - * If null or empty, this defaults to the service version targeted by this version of the library. + * 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; @@ -69,14 +74,17 @@ public AccountSASSignatureValues version(String version) { } /** - * {@link SASProtocol} + * @return the {@link SASProtocol} which determines the HTTP protocol that will be used. */ public SASProtocol protocol() { return protocol; } /** - * {@link SASProtocol} + * 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; @@ -84,14 +92,17 @@ public AccountSASSignatureValues protocol(SASProtocol protocol) { } /** - * When the SAS will take effect. + * @return when the SAS will take effect. */ public OffsetDateTime startTime() { return startTime; } /** - * When the SAS will take effect. + * 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; @@ -99,14 +110,17 @@ public AccountSASSignatureValues startTime(OffsetDateTime startTime) { } /** - * The time after which the SAS will no longer work. + * @return the time after which the SAS will no longer work. */ public OffsetDateTime expiryTime() { return expiryTime; } /** - * The time after which the SAS will no longer work. + * 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; @@ -114,16 +128,19 @@ public AccountSASSignatureValues expiryTime(OffsetDateTime expiryTime) { } /** - * Specifies which operations the SAS user may perform. Please refer to {@link AccountSASPermission} for help - * constructing the permissions string. + * @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; } /** - * Specifies which operations the SAS user may perform. Please refer to {@link AccountSASPermission} for help - * constructing the permissions string. + * 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; @@ -131,14 +148,17 @@ public AccountSASSignatureValues permissions(String permissions) { } /** - * {@link IPRange} + * @return the {@link IPRange} which determines the IP ranges that are allowed to use the SAS. */ public IPRange ipRange() { return ipRange; } /** - * {@link 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; @@ -146,16 +166,18 @@ public AccountSASSignatureValues ipRange(IPRange ipRange) { } /** - * The values that indicate the services accessible with this SAS. Please refer to {@link AccountSASService} to - * construct this value. + * @return the services accessible with this SAS. Please refer to {@link AccountSASService} to help determine which + * services are accessible. */ public String services() { return services; } /** - * The values that indicate the services accessible with this SAS. Please refer to {@link AccountSASService} to - * construct this value. + * Sets the services accessible with this SAS. Please refer to {@link AccountSASService} to construct this value. + * + * @param services Allowed services string to set + * @return the updated AccountSASSignatureValues object. */ public AccountSASSignatureValues services(String services) { this.services = services; @@ -163,16 +185,19 @@ public AccountSASSignatureValues services(String services) { } /** - * The values that indicate the resource types accessible with this SAS. Please refer - * to {@link AccountSASResourceType} to construct this value. + * @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; } /** - * The values that indicate the resource types accessible with this SAS. Please refer - * to {@link AccountSASResourceType} to construct this value. + * 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; diff --git a/storage/client/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 similarity index 96% rename from storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java index 7275f0fb326f..4ddc1d9e4682 100644 --- a/storage/client/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 @@ -6,7 +6,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; +import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.blob.models.AppendBlobAccessConditions; import com.azure.storage.blob.models.AppendBlobItem; import com.azure.storage.blob.models.BlobAccessConditions; @@ -32,7 +32,7 @@ * *

    * This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, - * and operations on the service are available on {@link StorageAsyncClient}. + * and operations on the service are available on {@link BlobServiceAsyncClient}. * *

    * Please refer @@ -59,10 +59,10 @@ public final class AppendBlobAsyncClient extends BlobAsyncClient { /** * Package-private constructor for use by {@link BlobClientBuilder}. - * @param azureBlobStorageBuilder the API client builder for blob storage API + * @param azureBlobStorage the API client for blob storage */ - AppendBlobAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder, String snapshot) { - super(azureBlobStorageBuilder, snapshot); + AppendBlobAsyncClient(AzureBlobStorageImpl azureBlobStorage, String snapshot) { + super(azureBlobStorage, snapshot); } /** diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/AppendBlobClient.java index 246fe645af17..65468a2e42b5 100644 --- a/storage/client/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 @@ -31,7 +31,7 @@ * *

    * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, - * and operations on the service are available on {@link StorageClient}. + * and operations on the service are available on {@link BlobServiceClient}. * *

    * Please refer to the Azure Docs diff --git a/storage/client/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 similarity index 76% rename from storage/client/blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java index c8ceb3f311d3..8f5a863ad38c 100644 --- a/storage/client/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 @@ -59,7 +59,7 @@ * *

    * This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, - * and operations on the service are available on {@link StorageAsyncClient}. + * and operations on the service are available on {@link BlobServiceAsyncClient}. * *

    * Please refer to the Azure @@ -71,7 +71,6 @@ * operation, until {@code .subscribe()} is called on the reactive response. You can simply convert one of these * responses to a {@link java.util.concurrent.CompletableFuture} object through {@link Mono#toFuture()}. */ -@SuppressWarnings({"unused", "WeakerAccess"}) 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; @@ -82,10 +81,10 @@ public class BlobAsyncClient { /** * Package-private constructor for use by {@link BlobClientBuilder}. * - * @param azureBlobStorageBuilder the API client builder for blob storage API + * @param azureBlobStorage the API client for blob storage */ - BlobAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder, String snapshot) { - this.azureBlobStorage = azureBlobStorageBuilder.build(); + BlobAsyncClient(AzureBlobStorageImpl azureBlobStorage, String snapshot) { + this.azureBlobStorage = azureBlobStorage; this.snapshot = snapshot; } @@ -98,7 +97,8 @@ public class BlobAsyncClient { public BlockBlobAsyncClient asBlockBlobAsyncClient() { return new BlockBlobAsyncClient(new AzureBlobStorageBuilder() .url(getBlobUrl().toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()) + .build(), snapshot); } /** @@ -110,7 +110,8 @@ public BlockBlobAsyncClient asBlockBlobAsyncClient() { public AppendBlobAsyncClient asAppendBlobAsyncClient() { return new AppendBlobAsyncClient(new AzureBlobStorageBuilder() .url(getBlobUrl().toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()) + .build(), snapshot); } /** @@ -122,12 +123,26 @@ public AppendBlobAsyncClient asAppendBlobAsyncClient() { public PageBlobAsyncClient asPageBlobAsyncClient() { return new PageBlobAsyncClient(new AzureBlobStorageBuilder() .url(getBlobUrl().toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()) + .build(), snapshot); + } + + /** + * Creates a new {@link BlobAsyncClient} linked to the {@code snapshot} of this blob resource. + * + * @param snapshot the identifier for a specific snapshot of this blob + * @return a {@link BlobAsyncClient} used to interact with the specific snapshot. + */ + public BlobAsyncClient getSnapshotClient(String snapshot) { + return new BlobAsyncClient(new AzureBlobStorageBuilder() + .url(getBlobUrl().toString()) + .pipeline(azureBlobStorage.getHttpPipeline()) + .build(), snapshot); } /** * Initializes a {@link ContainerAsyncClient} object pointing to the container this blob is in. This method does not - * create a container. It simply constructs the URL to the container and offers access to methods relevant to + * create a container. It simply constructs the client to the container and offers access to methods relevant to * containers. * * @return A {@link ContainerAsyncClient} object pointing to the container containing the blob @@ -136,7 +151,8 @@ public ContainerAsyncClient getContainerAsyncClient() { BlobURLParts parts = URLParser.parse(getBlobUrl()); return new ContainerAsyncClient(new AzureBlobStorageBuilder() .url(String.format("%s://%s/%s", parts.scheme(), parts.host(), parts.containerName())) - .pipeline(azureBlobStorage.httpPipeline())); + .pipeline(azureBlobStorage.getHttpPipeline()) + .build()); } /** @@ -147,18 +163,22 @@ public ContainerAsyncClient getContainerAsyncClient() { */ public URL getBlobUrl() { try { - UrlBuilder urlBuilder = UrlBuilder.parse(azureBlobStorage.url()); + UrlBuilder urlBuilder = UrlBuilder.parse(azureBlobStorage.getUrl()); if (snapshot != null) { urlBuilder.query("snapshot=" + snapshot); } return urlBuilder.toURL(); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.url()), e); + throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e); } } /** - * Gets if the blob this client represents exists in the cloud. + * Determines if the blob this client represents exists in the cloud. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.exists} * * @return true if the blob exists, false if it doesn't */ @@ -172,8 +192,14 @@ public Mono> exists() { } /** - * Copies the data at the source URL to a blob. For more information, see the - * Azure Docs + * Copies the data at the source URL to a blob. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL} + * + *

    For more information, see the + * Azure Docs

    * * @param sourceURL The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @return A reactive response containing the copy ID for the long running operation. @@ -183,8 +209,14 @@ public Mono> startCopyFromURL(URL sourceURL) { } /** - * Copies the data at the source URL to a blob. For more information, see the - * Azure Docs + * Copies the data at the source URL to a blob. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions} + * + *

    For more information, see the + * Azure Docs

    * * @param sourceURL The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @param metadata {@link Metadata} @@ -217,6 +249,13 @@ public Mono> startCopyFromURL(URL sourceURL, Metadata metadata, /** * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String} + * + *

    For more information, see the + * Azure Docs

    + * * @param copyId The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link * BlobStartCopyFromURLHeaders} object. * @return A reactive response signalling completion. @@ -228,6 +267,13 @@ public Mono abortCopyFromURL(String copyId) { /** * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.abortCopyFromURL#String-LeaseAccessConditions} + * + *

    For more information, see the + * Azure Docs

    + * * @param copyId The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link * BlobStartCopyFromURLHeaders} object. * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does @@ -243,6 +289,13 @@ public Mono abortCopyFromURL(String copyId, LeaseAccessConditions /** * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL} + * + *

    For more information, see the + * Azure Docs

    + * * @param copySource The source URL to copy from. * @return A reactive response containing the copy ID for the long running operation. */ @@ -253,6 +306,13 @@ public Mono> copyFromURL(URL copySource) { /** * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions} + * + *

    For more information, see the + * Azure Docs

    + * * @param copySource The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @param metadata {@link Metadata} * @param sourceModifiedAccessConditions {@link ModifiedAccessConditions} against the source. Standard HTTP Access @@ -285,23 +345,37 @@ public Mono> copyFromURL(URL copySource, Metadata metadata, Mod * Reads the entire blob. Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or * {@link AppendBlobClient}. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.download} + * + *

    For more information, see the + * Azure Docs

    + * * @return A reactive response containing the blob data. */ public Mono>> download() { - return this.download(null, null, false, null); + return this.download(null, null, null, false); } /** * Reads a range of bytes from a blob. Uploading data must be done from the {@link BlockBlobClient}, {@link * PageBlobClient}, or {@link AppendBlobClient}. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.download#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean} + * + *

    For more information, see the + * Azure Docs

    + * * @param range {@link BlobRange} + * @param options {@link ReliableDownloadOptions} * @param accessConditions {@link BlobAccessConditions} * @param rangeGetContentMD5 Whether the contentMD5 for the specified blob range should be returned. - * @param options {@link ReliableDownloadOptions} * @return A reactive response containing the blob data. */ - public Mono>> download(BlobRange range, BlobAccessConditions accessConditions, boolean rangeGetContentMD5, ReliableDownloadOptions options) { + public Mono>> download(BlobRange range, ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5) { return this.download(range, accessConditions, rangeGetContentMD5) .map(response -> new SimpleResponse<>( response.rawResponse(), @@ -359,11 +433,18 @@ Mono download(BlobRange range, BlobAccessConditions acces * 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. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.downloadToFile#String} + * + *

    For more information, see the + * Azure Docs

    + * * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. * @return An empty response */ public Mono downloadToFile(String filePath) { - return this.downloadToFile(filePath, null, BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE, null, false, null); + return this.downloadToFile(filePath, null, BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE, null, null, false); } /** @@ -374,18 +455,25 @@ public Mono downloadToFile(String filePath) { * 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.BlobAsyncClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean} + * + *

    For more information, see the + * Azure Docs

    + * * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. * @param range {@link BlobRange} * @param blockSize the size of a chunk to download at a time, in bytes + * @param options {@link ReliableDownloadOptions} * @param accessConditions {@link BlobAccessConditions} * @param rangeGetContentMD5 Whether the contentMD5 for the specified blob range should be returned. - * @param options {@link ReliableDownloadOptions} * @return An empty response * @throws IllegalArgumentException If {@code blockSize} is less than 0 or greater than 100MB. * @throws UncheckedIOException If an I/O error occurs. */ - public Mono downloadToFile(String filePath, BlobRange range, Integer blockSize, BlobAccessConditions accessConditions, - boolean rangeGetContentMD5, ReliableDownloadOptions options) { + 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"); } @@ -440,6 +528,13 @@ private List sliceBlobRange(BlobRange blobRange, Integer blockSize) { /** * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.delete} + * + *

    For more information, see the + * Azure Docs

    + * * @return A reactive response signalling completion. */ public Mono delete() { @@ -449,6 +544,13 @@ public Mono delete() { /** * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions} + * + *

    For more information, see the + * Azure Docs

    + * * @param deleteBlobSnapshotOptions Specifies the behavior for deleting the snapshots on this blob. {@code Include} * will delete the base blob and all snapshots. {@code Only} will delete only the snapshots. If a snapshot is being * deleted, you must pass null. @@ -468,6 +570,13 @@ public Mono delete(DeleteSnapshotsOptionType deleteBlobSnapshotOpt /** * Returns the blob's metadata and properties. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.getProperties} + * + *

    For more information, see the + * Azure Docs

    + * * @return A reactive response containing the blob properties and metadata. */ public Mono> getProperties() { @@ -477,6 +586,13 @@ public Mono> getProperties() { /** * Returns the blob's metadata and properties. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.getProperties#BlobAccessConditions} + * + *

    For more information, see the + * Azure Docs

    + * * @param accessConditions {@link BlobAccessConditions} * @return A reactive response containing the blob properties and metadata. */ @@ -492,9 +608,14 @@ public Mono> getProperties(BlobAccessConditions accessC /** * Changes a blob's HTTP header properties. if only one HTTP header is updated, the others will all be erased. In - * order to preserve existing values, they must be passed alongside the header being changed. For more information, - * see the - * Azure Docs. + * order to preserve existing values, they must be passed alongside the header being changed. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders} + * + *

    For more information, see the + * Azure Docs

    * * @param headers {@link BlobHTTPHeaders} * @return A reactive response signalling completion. @@ -505,9 +626,14 @@ public Mono setHTTPHeaders(BlobHTTPHeaders headers) { /** * Changes a blob's HTTP header properties. if only one HTTP header is updated, the others will all be erased. In - * order to preserve existing values, they must be passed alongside the header being changed. For more information, - * see the - * Azure Docs. + * order to preserve existing values, they must be passed alongside the header being changed. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions} + * + *

    For more information, see the + * Azure Docs

    * * @param headers {@link BlobHTTPHeaders} * @param accessConditions {@link BlobAccessConditions} @@ -524,8 +650,14 @@ public Mono setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessCond /** * Changes a blob's metadata. The specified metadata in this method will replace existing metadata. If old values - * must be preserved, they must be downloaded and included in the call to this method. For more information, see the - * Azure Docs. + * must be preserved, they must be downloaded and included in the call to this method. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata} + * + *

    For more information, see the + * Azure Docs

    * * @param metadata {@link Metadata} * @return A reactive response signalling completion. @@ -536,8 +668,14 @@ public Mono setMetadata(Metadata metadata) { /** * Changes a blob's metadata. The specified metadata in this method will replace existing metadata. If old values - * must be preserved, they must be downloaded and included in the call to this method. For more information, see the - * Azure Docs. + * must be preserved, they must be downloaded and included in the call to this method. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.setMetadata#Metadata-BlobAccessConditions} + * + *

    For more information, see the + * Azure Docs

    * * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} @@ -555,22 +693,38 @@ public Mono setMetadata(Metadata metadata, BlobAccessConditions ac } /** - * Creates a read-only snapshot of a blob. + * Creates a read-only snapshot of the blob. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.createSnapshot} * - * @return A reactive response containing the ID of the new snapshot. + *

    For more information, see the + * Azure Docs

    + * + * @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() { + public Mono> createSnapshot() { return this.createSnapshot(null, null); } /** - * Creates a read-only snapshot of a blob. + * Creates a read-only snapshot of the blob. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.createSnapshot#Metadata-BlobAccessConditions} + * + *

    For more information, see the + * Azure Docs

    * * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} - * @return A reactive response containing the ID of the new snapshot. + * @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> createSnapshot(Metadata metadata, BlobAccessConditions accessConditions) { metadata = metadata == null ? new Metadata() : metadata; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; @@ -578,7 +732,7 @@ public Mono> createSnapshot(Metadata metadata, BlobAccessCondit null, null, null, metadata, null, null, null, null, accessConditions.modifiedAccessConditions(), accessConditions.leaseAccessConditions(), Context.NONE)) - .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().snapshot())); + .map(rb -> new SimpleResponse<>(rb, this.getSnapshotClient(rb.deserializedHeaders().snapshot()))); } /** @@ -587,6 +741,13 @@ public Mono> createSnapshot(Metadata metadata, BlobAccessCondit * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's * etag. * + *

    Code Samples

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

    For more information, see the + * Azure Docs

    + * * @param tier The new tier for the blob. * @return A reactive response signalling completion. */ @@ -600,6 +761,13 @@ public Mono setTier(AccessTier tier) { * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's * etag. * + *

    Code Samples

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

    For more information, see the + * Azure Docs

    + * * @param tier The new tier for the blob. * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does * not match the active lease on the blob. @@ -616,6 +784,13 @@ public Mono setTier(AccessTier tier, LeaseAccessConditions leaseAc /** * 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.undelete} + * + *

    For more information, see the + * Azure Docs

    + * * @return A reactive response signalling completion. */ public Mono undelete() { @@ -628,6 +803,13 @@ public Mono undelete() { * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int} + * + *

    For more information, see the + * Azure Docs

    + * * @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. @@ -641,7 +823,14 @@ public Mono> acquireLease(String proposedId, int duration) { * 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. + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions} + * + *

    For more information, see the + * Azure Docs

    + * + * @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. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and @@ -650,7 +839,7 @@ 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> acquireLease(String proposedId, int duration, ModifiedAccessConditions modifiedAccessConditions) { if (!(duration == -1 || (duration >= 15 && duration <= 60))) { // Throwing is preferred to Mono.error because this will error out immediately instead of waiting until // subscription. @@ -658,7 +847,7 @@ public Mono> acquireLease(String proposedID, int duration, Modi } return postProcessResponse(this.azureBlobStorage.blobs().acquireLeaseWithRestResponseAsync( - null, null, null, duration, proposedID, null, + null, null, null, duration, proposedId, null, modifiedAccessConditions, Context.NONE)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } @@ -666,50 +855,78 @@ public Mono> acquireLease(String proposedID, int duration, Modi /** * Renews the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.renewLease#String} + * + *

    For more information, see the + * Azure Docs

    + * + * @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 this.renewLease(leaseId, null); } /** * Renews the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions} + * + *

    For more information, see the + * Azure Docs

    + * + * @param leaseId The leaseId of the active lease on the blob. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the renewed lease ID. */ - public Mono> renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> renewLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions) { return postProcessResponse(this.azureBlobStorage.blobs().renewLeaseWithRestResponseAsync(null, - null, leaseID, null, null, modifiedAccessConditions, Context.NONE)) + null, leaseId, null, null, modifiedAccessConditions, Context.NONE)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } /** * Releases the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.releaseLease#String} + * + *

    For more information, see the + * Azure Docs

    + * + * @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 this.releaseLease(leaseId, null); } /** * Releases the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions} + * + *

    For more information, see the + * Azure Docs

    + * + * @param leaseId The leaseId of the active lease on the blob. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @return A reactive response signalling completion. */ - public Mono releaseLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions) { + public Mono releaseLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions) { return postProcessResponse(this.azureBlobStorage.blobs().releaseLeaseWithRestResponseAsync(null, - null, leaseID, null, null, modifiedAccessConditions, Context.NONE)) + null, leaseId, null, null, modifiedAccessConditions, Context.NONE)) .map(VoidResponse::new); } @@ -717,6 +934,13 @@ public Mono releaseLease(String leaseID, ModifiedAccessConditions * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.breakLease} + * + *

    For more information, see the + * Azure Docs

    + * * @return A reactive response containing the remaining time in the broken lease in seconds. */ public Mono> breakLease() { @@ -727,6 +951,13 @@ public Mono> breakLease() { * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions} + * + *

    For more information, see the + * Azure Docs

    + * * @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 @@ -746,38 +977,56 @@ public Mono> breakLease(Integer breakPeriodInSeconds, Modified /** * ChangeLease changes the blob's lease ID. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.changeLease#String-String} + * + *

    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 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 this.changeLease(leaseId, proposedId, null); } /** - * ChangeLease changes the blob's lease ID. For more information, see the Azure - * Docs. + * ChangeLease changes the blob's lease ID. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions} + * + *

    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 proposedId A {@code String} in any valid GUID format. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and * LastModifiedTime are used to construct conditions related to when the blob was changed relative to the given * request. The request will fail if the specified condition is not satisfied. * @return A reactive response containing the new lease ID. */ - public Mono> changeLease(String leaseId, String proposedID, ModifiedAccessConditions modifiedAccessConditions) { + public Mono> changeLease(String leaseId, String proposedId, ModifiedAccessConditions modifiedAccessConditions) { return postProcessResponse(this.azureBlobStorage.blobs().changeLeaseWithRestResponseAsync(null, - null, leaseId, proposedID, null, null, modifiedAccessConditions, Context.NONE)) + null, leaseId, proposedId, null, null, modifiedAccessConditions, Context.NONE)) .map(rb -> new SimpleResponse<>(rb, rb.deserializedHeaders().leaseId())); } /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. + * Returns the sku name and account kind for the account. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobAsyncClient.getAccountInfo} + * + *

    For more information, see the + * Azure Docs

    * * @return a reactor response containing the sku name and account kind. */ - // TODO (unknown): determine this return type public Mono> getAccountInfo() { return postProcessResponse( this.azureBlobStorage.blobs().getAccountInfoWithRestResponseAsync(null, null, Context.NONE)) @@ -925,7 +1174,7 @@ public String generateSAS(String identifier, BlobSASPermission permissions, Offs cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); SharedKeyCredential sharedKeyCredential = - Utility.getSharedKeyCredential(this.azureBlobStorage.httpPipeline()); + Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline()); Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential); @@ -944,7 +1193,7 @@ ServiceSASSignatureValues configureServiceSASSignatureValues(ServiceSASSignature String accountName) { // Set canonical name - serviceSASSignatureValues.canonicalName(this.azureBlobStorage.url(), accountName); + serviceSASSignatureValues.canonicalName(this.azureBlobStorage.getUrl(), accountName); // Set snapshotId serviceSASSignatureValues.snapshotId(getSnapshotId()); diff --git a/storage/client/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 similarity index 69% rename from storage/client/blob/src/main/java/com/azure/storage/blob/BlobClient.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClient.java index e2c6eab47a76..dfbadaa4ab79 100644 --- a/storage/client/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 @@ -4,6 +4,7 @@ package com.azure.storage.blob; 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.blob.models.AccessTier; import com.azure.storage.blob.models.BlobAccessConditions; @@ -39,13 +40,12 @@ * *

    * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, and - * operations on the service are available on {@link StorageClient}. + * operations on the service are available on {@link BlobServiceClient}. * *

    * Please refer to the Azure * Docs for more information. */ -@SuppressWarnings({"unused", "WeakerAccess"}) public class BlobClient { private final BlobAsyncClient blobAsyncClient; @@ -88,6 +88,16 @@ public PageBlobClient asPageBlobClient() { return new PageBlobClient(blobAsyncClient.asPageBlobAsyncClient()); } + /** + * Creates a new {@link BlobClient} linked to the {@code snapshot} of this blob resource. + * + * @param snapshot the identifier for a specific snapshot of this blob + * @return a {@link BlobClient} used to interact with the specific snapshot. + */ + public BlobClient getSnapshotClient(String snapshot) { + return new BlobClient(blobAsyncClient.getSnapshotClient(snapshot)); + } + /** * Initializes a {@link ContainerClient} object pointing to the container this blob is in. This method does not * create a container. It simply constructs the URL to the container and offers access to methods relevant to @@ -136,6 +146,10 @@ public final BlobInputStream openInputStream(BlobRange range, BlobAccessConditio /** * Gets if the container this client represents exists in the cloud. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.exists} + * * @return true if the container exists, false if it doesn't */ public Response exists() { @@ -145,6 +159,10 @@ public Response exists() { /** * Gets if the container this client represents exists in the cloud. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.exists#Duration} + * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return true if the container exists, false if it doesn't */ @@ -155,8 +173,14 @@ public Response exists(Duration timeout) { } /** - * Copies the data at the source URL to a blob. For more information, see the - * Azure Docs + * Copies the data at the source URL to a blob. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.startCopyFromURL#URL} + * + *

    For more information, see the + * Azure Docs

    * * @param sourceURL The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @return The copy ID for the long running operation. @@ -166,8 +190,14 @@ public Response startCopyFromURL(URL sourceURL) { } /** - * Copies the data at the source URL to a blob. For more information, see the - * Azure Docs + * Copies the data at the source URL to a blob. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.startCopyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration} + * + *

    For more information, see the + * Azure Docs

    * * @param sourceURL The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @param metadata {@link Metadata} @@ -179,9 +209,8 @@ public Response startCopyFromURL(URL sourceURL) { * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The copy ID for the long running operation. */ - public Response startCopyFromURL(URL sourceURL, Metadata metadata, - ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, - Duration timeout) { + public Response startCopyFromURL(URL sourceURL, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, + BlobAccessConditions destAccessConditions, Duration timeout) { Mono> response = blobAsyncClient .startCopyFromURL(sourceURL, metadata, sourceModifiedAccessConditions, destAccessConditions); @@ -191,6 +220,13 @@ public Response startCopyFromURL(URL sourceURL, Metadata metadata, /** * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.abortCopyFromURL#String} + * + *

    For more information, see the + * Azure Docs

    + * * @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. @@ -202,6 +238,13 @@ public VoidResponse abortCopyFromURL(String copyId) { /** * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.abortCopyFromURL#String-LeaseAccessConditions-Duration} + * + *

    For more information, see the + * Azure Docs

    + * * @param copyId The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link * BlobStartCopyFromURLHeaders} object. * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does @@ -219,6 +262,13 @@ public VoidResponse abortCopyFromURL(String copyId, LeaseAccessConditions leaseA /** * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.copyFromURL#URL} + * + *

    For more information, see the + * Azure Docs

    + * * @param copySource The source URL to copy from. * @return The copy ID for the long running operation. */ @@ -229,6 +279,13 @@ public Response copyFromURL(URL copySource) { /** * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.copyFromURL#URL-Metadata-ModifiedAccessConditions-BlobAccessConditions-Duration} + * + *

    For more information, see the + * Azure Docs

    + * * @param copySource The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @param metadata {@link Metadata} * @param sourceModifiedAccessConditions {@link ModifiedAccessConditions} against the source. Standard HTTP Access @@ -239,9 +296,8 @@ public Response copyFromURL(URL copySource) { * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The copy ID for the long running operation. */ - public Response copyFromURL(URL copySource, Metadata metadata, - ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, - Duration timeout) { + public Response copyFromURL(URL copySource, Metadata metadata, ModifiedAccessConditions sourceModifiedAccessConditions, + BlobAccessConditions destAccessConditions, Duration timeout) { Mono> response = blobAsyncClient .copyFromURL(copySource, metadata, sourceModifiedAccessConditions, destAccessConditions); @@ -252,6 +308,13 @@ public Response copyFromURL(URL copySource, Metadata metadata, * Downloads the entire blob into an output stream. Uploading data must be done from the {@link BlockBlobClient}, * {@link PageBlobClient}, or {@link AppendBlobClient}. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.download#OutputStream} + * + *

    For more information, see the + * 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. @@ -264,19 +327,26 @@ public VoidResponse download(OutputStream stream) { * Downloads a range of bytes from a blob into an output stream. Uploading data must be done from the {@link * BlockBlobClient}, {@link PageBlobClient}, or {@link AppendBlobClient}. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.download#OutputStream-BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration} + * + *

    For more information, see the + * Azure Docs

    + * * @param stream A non-null {@link OutputStream} instance where the downloaded data will be written. - * @param options {@link ReliableDownloadOptions} * @param range {@link BlobRange} + * @param options {@link ReliableDownloadOptions} * @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. * @return A response containing status code and HTTP headers. * @throws UncheckedIOException If an I/O error occurs. */ - public VoidResponse download(OutputStream stream, ReliableDownloadOptions options, BlobRange range, + public VoidResponse download(OutputStream stream, BlobRange range, ReliableDownloadOptions options, BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout) { Mono download = blobAsyncClient - .download(range, accessConditions, rangeGetContentMD5, options) + .download(range, options, accessConditions, rangeGetContentMD5) .flatMapMany(res -> res.value() .doOnNext(bf -> { try { @@ -296,10 +366,17 @@ public VoidResponse download(OutputStream stream, ReliableDownloadOptions option * Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link * AppendBlobClient}. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.downloadToFile#String} + * + *

    For more information, see the + * Azure Docs

    + * * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. - * @throws IOException If an I/O error occurs + * @throws UncheckedIOException If an I/O error occurs */ - public void downloadToFile(String filePath) throws IOException { + public void downloadToFile(String filePath) { blobAsyncClient.downloadToFile(filePath); } @@ -308,29 +385,39 @@ public void downloadToFile(String filePath) throws IOException { * Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link * AppendBlobClient}. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration} + * + *

    For more information, see the + * Azure Docs

    + * * @param filePath A non-null {@link OutputStream} instance where the downloaded data will be written. - * @param options {@link ReliableDownloadOptions} * @param range {@link BlobRange} * @param blockSize the size of a chunk to download at a time, in bytes + * @param options {@link ReliableDownloadOptions} * @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. - * @throws IOException If an I/O error occurs + * @throws UncheckedIOException If an I/O error occurs */ - public void downloadToFile(String filePath, ReliableDownloadOptions options, BlobRange range, Integer blockSize, - BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout) throws IOException { - Mono download = blobAsyncClient.downloadToFile(filePath, range, blockSize, accessConditions, rangeGetContentMD5, options); + 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); - try { - Utility.blockWithOptionalTimeout(download, timeout); - } catch (UncheckedIOException e) { - throw e.getCause(); - } + Utility.blockWithOptionalTimeout(download, timeout); } /** * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.delete} + * + *

    For more information, see the + * Azure Docs

    + * * @return A response containing status code and HTTP headers. */ public VoidResponse delete() { @@ -340,6 +427,13 @@ public VoidResponse delete() { /** * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.delete#DeleteSnapshotsOptionType-BlobAccessConditions-Duration} + * + *

    For more information, see the + * Azure Docs

    + * * @param deleteBlobSnapshotOptions Specifies the behavior for deleting the snapshots on this blob. {@code Include} * will delete the base blob and all snapshots. {@code Only} will delete only the snapshots. If a snapshot is being * deleted, you must pass null. @@ -358,6 +452,13 @@ public VoidResponse delete(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, /** * Returns the blob's metadata and properties. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.getProperties} + * + *

    For more information, see the + * Azure Docs

    + * * @return The blob properties and metadata. */ public Response getProperties() { @@ -367,6 +468,13 @@ public Response getProperties() { /** * Returns the blob's metadata and properties. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration} + * + *

    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. * @return The blob properties and metadata. @@ -380,9 +488,14 @@ public Response getProperties(BlobAccessConditions accessConditi /** * Changes a blob's HTTP header properties. if only one HTTP header is updated, the others will all be erased. In - * order to preserve existing values, they must be passed alongside the header being changed. For more information, - * see the - * Azure Docs. + * order to preserve existing values, they must be passed alongside the header being changed. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders} + * + *

    For more information, see the + * Azure Docs

    * * @param headers {@link BlobHTTPHeaders} * @return A response containing status code and HTTP headers. @@ -393,9 +506,14 @@ public VoidResponse setHTTPHeaders(BlobHTTPHeaders headers) { /** * Changes a blob's HTTP header properties. if only one HTTP header is updated, the others will all be erased. In - * order to preserve existing values, they must be passed alongside the header being changed. For more information, - * see the - * Azure Docs. + * order to preserve existing values, they must be passed alongside the header being changed. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration} + * + *

    For more information, see the + * Azure Docs

    * * @param headers {@link BlobHTTPHeaders} * @param accessConditions {@link BlobAccessConditions} @@ -412,8 +530,14 @@ public VoidResponse setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessConditions /** * Changes a blob's metadata. The specified metadata in this method will replace existing metadata. If old values - * must be preserved, they must be downloaded and included in the call to this method. For more information, see the - * Azure Docs. + * must be preserved, they must be downloaded and included in the call to this method. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.setMetadata#Metadata} + * + *

    For more information, see the + * Azure Docs

    * * @param metadata {@link Metadata} * @return A response containing status code and HTTP headers. @@ -424,8 +548,14 @@ public VoidResponse setMetadata(Metadata metadata) { /** * Changes a blob's metadata. The specified metadata in this method will replace existing metadata. If old values - * must be preserved, they must be downloaded and included in the call to this method. For more information, see the - * Azure Docs. + * must be preserved, they must be downloaded and included in the call to this method. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.setMetadata#Metadata-BlobAccessConditions-Duration} + * + *

    For more information, see the + * Azure Docs

    * * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} @@ -440,25 +570,42 @@ public VoidResponse setMetadata(Metadata metadata, BlobAccessConditions accessCo } /** - * Creates a read-only snapshot of a blob. + * Creates a read-only snapshot of the blob. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.createSnapshot} * - * @return The ID of the new snapshot. + *

    For more information, see the + * Azure Docs

    + * + * @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() { + public Response createSnapshot() { return this.createSnapshot(null, null, null); } /** - * Creates a read-only snapshot of a blob. + * Creates a read-only snapshot of the blob. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration} + * + *

    For more information, see the + * Azure Docs

    * * @param metadata {@link Metadata} * @param accessConditions {@link BlobAccessConditions} * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @return The ID of the new snapshot. + * @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) { - Mono> response = blobAsyncClient - .createSnapshot(metadata, accessConditions); + public Response createSnapshot(Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) { + Mono> response = blobAsyncClient + .createSnapshot(metadata, accessConditions) + .map(rb -> new SimpleResponse<>(rb, new BlobClient(rb.value()))); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -469,6 +616,13 @@ public Response createSnapshot(Metadata metadata, BlobAccessConditions a * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's * etag. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.setTier#AccessTier} + * + *

    For more information, see the + * Azure Docs

    + * * @param tier The new tier for the blob. * @return A response containing status code and HTTP headers. */ @@ -482,6 +636,13 @@ public VoidResponse setTier(AccessTier tier) { * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's * etag. * + *

    Code Samples

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

    For more information, see the + * Azure Docs

    + * * @param tier The new tier for the blob. * @param leaseAccessConditions By setting lease access conditions, requests will fail if the provided lease does * not match the active lease on the blob. @@ -498,6 +659,13 @@ public VoidResponse setTier(AccessTier tier, LeaseAccessConditions leaseAccessCo /** * 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.BlobClient.undelete} + * + *

    For more information, see the + * Azure Docs

    + * * @return A response containing status code and HTTP headers. */ public VoidResponse undelete() { @@ -507,6 +675,13 @@ public VoidResponse undelete() { /** * 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.BlobClient.undelete#Duration} + * + *

    For more information, see the + * Azure Docs

    + * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return A response containing status code and HTTP headers. */ @@ -521,6 +696,13 @@ public VoidResponse undelete(Duration timeout) { * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 * seconds, or infinite (-1). * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.acquireLease#String-int} + * + *

    For more information, see the + * Azure Docs

    + * * @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. @@ -534,7 +716,14 @@ public Response acquireLease(String proposedId, int duration) { * 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. + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration} + * + *

    For more information, see the + * Azure Docs

    + * + * @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. * @param modifiedAccessConditions Standard HTTP Access conditions related to the modification of data. ETag and @@ -543,10 +732,10 @@ public Response acquireLease(String proposedId, int duration) { * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The lease ID. */ - public Response acquireLease(String proposedID, int duration, + public Response acquireLease(String proposedId, int duration, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { Mono> response = blobAsyncClient - .acquireLease(proposedID, duration, modifiedAccessConditions); + .acquireLease(proposedId, duration, modifiedAccessConditions); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -554,27 +743,40 @@ public Response acquireLease(String proposedID, int duration, /** * Renews the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.renewLease#String} + * + *

    For more information, see the + * Azure Docs

    + * + * @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 Response renewLease(String leaseId) { + return this.renewLease(leaseId, null, null); } /** * Renews the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration} + * + *

    For more information, see the + * Azure Docs

    + * + * @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 Response renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, - Duration timeout) { + public Response renewLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { Mono> response = blobAsyncClient - .renewLease(leaseID, modifiedAccessConditions); + .renewLease(leaseId, modifiedAccessConditions); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -582,27 +784,39 @@ public Response renewLease(String leaseID, ModifiedAccessConditions modi /** * Releases the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.releaseLease#String} + * + *

    For more information, see the + * 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 VoidResponse releaseLease(String leaseId) { + return this.releaseLease(leaseId, null, null); } /** * Releases the blob's previously-acquired lease. * - * @param leaseID The leaseId of the active lease on the blob. + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration} + * + *

    For more information, see the + * Azure Docs

    + * + * @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 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 releaseLease(String leaseId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + Mono response = blobAsyncClient.releaseLease(leaseId, modifiedAccessConditions); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -611,6 +825,13 @@ public VoidResponse releaseLease(String leaseID, * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.breakLease} + * + *

    For more information, see the + * Azure Docs

    + * * @return The remaining time in the broken lease in seconds. */ public Response breakLease() { @@ -621,6 +842,13 @@ public Response breakLease() { * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant * to break a fixed-duration lease when it expires or an infinite lease immediately. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration} + * + *

    For more information, see the + * Azure Docs

    + * * @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 @@ -632,8 +860,7 @@ public Response breakLease() { * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The remaining time in the broken lease in seconds. */ - public Response breakLease(Integer breakPeriodInSeconds, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + public Response breakLease(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { Mono> response = blobAsyncClient .breakLease(breakPeriodInSeconds, modifiedAccessConditions); @@ -643,37 +870,54 @@ public Response breakLease(Integer breakPeriodInSeconds, /** * ChangeLease changes the blob's lease ID. * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.changeLease#String-String} + * + *

    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 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 Response changeLease(String leaseId, String proposedId) { + return this.changeLease(leaseId, proposedId, null, null); } /** - * ChangeLease changes the blob's lease ID. For more information, see the Azure - * Docs. + * ChangeLease changes the blob's lease ID. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration} + * + *

    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 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. * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @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 changeLease(String leaseId, String proposedId, ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { + Mono> response = blobAsyncClient.changeLease(leaseId, proposedId, modifiedAccessConditions); return Utility.blockWithOptionalTimeout(response, timeout); } /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. + * Returns the sku name and account kind for the account. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.getAccountInfo} + * + *

    For more information, see the + * Azure Docs

    * * @return The sku name and account kind. */ @@ -682,8 +926,14 @@ public Response getAccountInfo() { } /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. + * Returns the sku name and account kind for the account. + * + *

    Code Samples

    + * + * {@codesnippet com.azure.storage.blob.BlobClient.getAccountInfo#Duration} + * + *

    For more information, see the + * Azure Docs

    * * @param timeout An optional timeout value beyond which a {@link RuntimeException} will be raised. * @return The sku name and account kind. diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java index b0e3c98d8904..e58c5a7adeb8 100644 --- a/storage/client/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 @@ -6,6 +6,7 @@ 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; @@ -17,7 +18,7 @@ import com.azure.core.util.configuration.Configuration; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.models.PageRange; +import com.azure.storage.blob.implementation.AzureBlobStorageImpl; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.common.policy.RequestRetryOptions; @@ -90,7 +91,7 @@ public BlobClientBuilder() { policies = new ArrayList<>(); } - private AzureBlobStorageBuilder buildImpl() { + private AzureBlobStorageImpl buildImpl() { Objects.requireNonNull(endpoint); Objects.requireNonNull(containerName); Objects.requireNonNull(blobName); @@ -111,8 +112,6 @@ private AzureBlobStorageBuilder buildImpl() { policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, String.format("%s/.default", endpoint))); } else if (sasTokenCredential != null) { policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); - } else { - policies.add(new AnonymousCredentialPolicy()); } policies.add(new RequestRetryPolicy(retryOptions)); @@ -120,14 +119,15 @@ private AzureBlobStorageBuilder buildImpl() { policies.addAll(this.policies); policies.add(new HttpLoggingPolicy(logLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); return new AzureBlobStorageBuilder() .url(String.format("%s/%s/%s", endpoint, containerName, blobName)) - .pipeline(pipeline); + .pipeline(pipeline) + .build(); } /** diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobConfiguration.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobConfiguration.java similarity index 59% rename from storage/client/blob/src/main/java/com/azure/storage/blob/BlobConfiguration.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobConfiguration.java index ae1e422a24c0..cc53933f7930 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobConfiguration.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobConfiguration.java @@ -3,6 +3,6 @@ package com.azure.storage.blob; class BlobConfiguration { - static final String NAME = "storage-blob"; - static final String VERSION = "1.0.0-SNAPSHOT"; + static final String NAME = "azure-storage-blob"; + static final String VERSION = "12.0.0-preview.2"; } diff --git a/storage/client/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 similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/BlobInputStream.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobInputStream.java diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/BlobOutputStream.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobOutputStream.java index c733a580f250..668f7a2c2066 100644 --- a/storage/client/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 @@ -30,7 +30,7 @@ import java.util.concurrent.atomic.AtomicLongFieldUpdater; -public class BlobOutputStream extends OutputStream { +public final class BlobOutputStream extends OutputStream { /** * Holds the {@link BlobAccessConditions} object that represents the access conditions for the blob. */ diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobProperties.java similarity index 87% rename from storage/client/blob/src/main/java/com/azure/storage/blob/BlobProperties.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobProperties.java index 321a7c061f38..307ebbc140e4 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobProperties.java @@ -8,7 +8,9 @@ import com.azure.storage.blob.models.BlobType; import com.azure.storage.blob.models.Metadata; -public class BlobProperties { +import java.time.OffsetDateTime; + +public final class BlobProperties { private final BlobType blobType; @@ -26,7 +28,7 @@ public class BlobProperties { private final String cacheControl; - //todo decide datetime representation for last modified time + private final OffsetDateTime lastModified; BlobProperties(BlobGetPropertiesHeaders generatedHeaders) { @@ -38,6 +40,7 @@ public class BlobProperties { this.contentDisposition = generatedHeaders.contentDisposition(); this.contentLanguage = generatedHeaders.contentLanguage(); this.cacheControl = generatedHeaders.cacheControl(); + this.lastModified = generatedHeaders.lastModified(); } @@ -96,4 +99,11 @@ public String contentLanguage() { public String cacheControl() { return cacheControl; } + + /** + * @return the time this blob was last modified + */ + public OffsetDateTime lastModified() { + return lastModified; + } } diff --git a/storage/client/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 similarity index 81% rename from storage/client/blob/src/main/java/com/azure/storage/blob/BlobSASPermission.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobSASPermission.java index 6dd79f092ecd..24f4b0d0a96c 100644 --- a/storage/client/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 @@ -12,7 +12,7 @@ * {@link ServiceSASSignatureValues} object. It is possible to construct the permissions string without this class, but * the order of the permissions is particular and this class guarantees correctness. */ -final class BlobSASPermission { +public final class BlobSASPermission { private boolean read; @@ -27,7 +27,7 @@ final class BlobSASPermission { /** * Initializes a {@code BlobSASPermission} object with all fields set to false. */ - private BlobSASPermission() { + public BlobSASPermission() { } /** @@ -70,14 +70,17 @@ public static BlobSASPermission parse(String permString) { } /** - * Specifies Read access granted. + * @return the read permission status. */ public boolean read() { return read; } /** - * Specifies Read access granted. + * Sets the read permission status. + * + * @param read Permission status to set + * @return the updated BlobSASPermission object. */ public BlobSASPermission read(boolean read) { this.read = read; @@ -85,14 +88,17 @@ public BlobSASPermission read(boolean read) { } /** - * Specifies Add access granted. + * @return the add permission status. */ public boolean add() { return add; } /** - * Specifies Add access granted. + * Sets the add permission status. + * + * @param add Permission status to set + * @return the updated BlobSASPermission object. */ public BlobSASPermission add(boolean add) { this.add = add; @@ -100,14 +106,17 @@ public BlobSASPermission add(boolean add) { } /** - * Specifies Create access granted. + * @return the create permission status. */ public boolean create() { return create; } /** - * Specifies Create access granted. + * Sets the create permission status. + * + * @param create Permission status to set + * @return the updated BlobSASPermission object. */ public BlobSASPermission create(boolean create) { this.create = create; @@ -115,14 +124,17 @@ public BlobSASPermission create(boolean create) { } /** - * Specifies Write access granted. + * @return the write permission status. */ public boolean write() { return write; } /** - * Specifies Write access granted. + * Sets the write permission status. + * + * @param write Permission status to set + * @return the updated BlobSASPermission object. */ public BlobSASPermission write(boolean write) { this.write = write; @@ -130,14 +142,17 @@ public BlobSASPermission write(boolean write) { } /** - * Specifies Delete access granted. + * @return the delete permission status. */ public boolean delete() { return delete; } /** - * Specifies Delete access granted. + * Sets the delete permission status. + * + * @param delete Permission status to set + * @return the updated BlobSASPermission object. */ public BlobSASPermission delete(boolean delete) { this.delete = delete; diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageAsyncClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java similarity index 96% rename from storage/client/blob/src/main/java/com/azure/storage/blob/StorageAsyncClient.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java index 9e4d0fb2140f..a8aa7f7b2640 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageAsyncClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceAsyncClient.java @@ -32,7 +32,7 @@ import static com.azure.storage.blob.Utility.postProcessResponse; /** - * Client to a storage account. It may only be instantiated through a {@link StorageClientBuilder}. This class does not + * 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. * @@ -50,16 +50,16 @@ * operation, until {@code .subscribe()} is called on the reactive response. You can simply convert one of these * responses to a {@link java.util.concurrent.CompletableFuture} object through {@link Mono#toFuture()}. */ -public final class StorageAsyncClient { +public final class BlobServiceAsyncClient { private final AzureBlobStorageImpl azureBlobStorage; /** - * Package-private constructor for use by {@link StorageClientBuilder}. + * Package-private constructor for use by {@link BlobServiceClientBuilder}. * - * @param azureBlobStorageBuilder the API client builder for blob storage API + * @param azureBlobStorage the API client for blob storage */ - StorageAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder) { - this.azureBlobStorage = azureBlobStorageBuilder.build(); + BlobServiceAsyncClient(AzureBlobStorageImpl azureBlobStorage) { + this.azureBlobStorage = azureBlobStorage; } /** @@ -73,7 +73,8 @@ public final class StorageAsyncClient { public ContainerAsyncClient getContainerAsyncClient(String containerName) { return new ContainerAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getAccountUrl(), containerName).toString()) - .pipeline(azureBlobStorage.httpPipeline())); + .pipeline(azureBlobStorage.getHttpPipeline()) + .build()); } /** @@ -125,9 +126,9 @@ public Mono deleteContainer(String containerName) { */ public URL getAccountUrl() { try { - return new URL(azureBlobStorage.url()); + return new URL(azureBlobStorage.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.url()), e); + throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e); } } @@ -318,7 +319,7 @@ public String generateAccountSAS(AccountSASService accountSASService, AccountSAS accountSASSignatureValues.ipRange(ipRange); accountSASSignatureValues.protocol(sasProtocol); - SharedKeyCredential sharedKeyCredential = Utility.getSharedKeyCredential(this.azureBlobStorage.httpPipeline()); + SharedKeyCredential sharedKeyCredential = Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline()); SASQueryParameters sasQueryParameters = accountSASSignatureValues.generateSASQueryParameters(sharedKeyCredential); diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClient.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java similarity index 89% rename from storage/client/blob/src/main/java/com/azure/storage/blob/StorageClient.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java index 5749b1b3fe7d..782e766330ab 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClient.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClient.java @@ -24,7 +24,7 @@ import java.time.OffsetDateTime; /** - * Client to a storage account. It may only be instantiated through a {@link StorageClientBuilder}. This class does not + * 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. * @@ -36,16 +36,16 @@ * Please see here for more * information on containers. */ -public final class StorageClient { - private final StorageAsyncClient storageAsyncClient; +public final class BlobServiceClient { + private final BlobServiceAsyncClient blobServiceAsyncClient; /** - * Package-private constructor for use by {@link StorageClientBuilder}. + * Package-private constructor for use by {@link BlobServiceClientBuilder}. * - * @param storageAsyncClient the async storage account client + * @param blobServiceAsyncClient the async storage account client */ - StorageClient(StorageAsyncClient storageAsyncClient) { - this.storageAsyncClient = storageAsyncClient; + BlobServiceClient(BlobServiceAsyncClient blobServiceAsyncClient) { + this.blobServiceAsyncClient = blobServiceAsyncClient; } /** @@ -56,7 +56,7 @@ public final class StorageClient { * @return A {@link ContainerClient} object pointing to the specified container */ public ContainerClient getContainerClient(String containerName) { - return new ContainerClient(storageAsyncClient.getContainerAsyncClient(containerName)); + return new ContainerClient(blobServiceAsyncClient.getContainerAsyncClient(containerName)); } /** @@ -96,7 +96,7 @@ public Response createContainer(String containerName, Metadata * @return A response containing status code and HTTP headers */ public VoidResponse deleteContainer(String containerName) { - return storageAsyncClient.deleteContainer(containerName).block(); + return blobServiceAsyncClient.deleteContainer(containerName).block(); } /** @@ -105,7 +105,7 @@ public VoidResponse deleteContainer(String containerName) { * @return the URL. */ public URL getAccountUrl() { - return storageAsyncClient.getAccountUrl(); + return blobServiceAsyncClient.getAccountUrl(); } /** @@ -129,7 +129,7 @@ public Iterable listContainers() { * @return The list of containers. */ public Iterable listContainers(ListContainersOptions options, Duration timeout) { - Flux response = storageAsyncClient.listContainers(options); + Flux response = blobServiceAsyncClient.listContainers(options); return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); } @@ -153,7 +153,7 @@ public Response getProperties() { */ public Response getProperties(Duration timeout) { - Mono> response = storageAsyncClient.getProperties(); + Mono> response = blobServiceAsyncClient.getProperties(); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -182,7 +182,7 @@ public VoidResponse setProperties(StorageServiceProperties properties) { * @return The storage account properties. */ public VoidResponse setProperties(StorageServiceProperties properties, Duration timeout) { - Mono response = storageAsyncClient.setProperties(properties); + Mono response = blobServiceAsyncClient.setProperties(properties); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -210,7 +210,7 @@ public Response getUserDelegationKey(OffsetDateTime start, Of */ public Response getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry, Duration timeout) { - Mono> response = storageAsyncClient.getUserDelegationKey(start, expiry); + Mono> response = blobServiceAsyncClient.getUserDelegationKey(start, expiry); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -237,7 +237,7 @@ public Response getStatistics() { * @return The storage account statistics. */ public Response getStatistics(Duration timeout) { - Mono> response = storageAsyncClient.getStatistics(); + Mono> response = blobServiceAsyncClient.getStatistics(); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -260,7 +260,7 @@ public Response getAccountInfo() { * @return The storage account info. */ public Response getAccountInfo(Duration timeout) { - Mono> response = storageAsyncClient.getAccountInfo(); + Mono> response = blobServiceAsyncClient.getAccountInfo(); return Utility.blockWithOptionalTimeout(response, timeout); } @@ -276,7 +276,7 @@ public Response getAccountInfo(Duration timeout) { */ public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType, AccountSASPermission accountSASPermission, OffsetDateTime expiryTime) { - return this.storageAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime); + return this.blobServiceAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime); } /** @@ -295,6 +295,6 @@ public String generateAccountSAS(AccountSASService accountSASService, AccountSAS public String generateAccountSAS(AccountSASService accountSASService, AccountSASResourceType accountSASResourceType, AccountSASPermission accountSASPermission, OffsetDateTime expiryTime, OffsetDateTime startTime, String version, IPRange ipRange, SASProtocol sasProtocol) { - return this.storageAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime, startTime, version, ipRange, sasProtocol); + return this.blobServiceAsyncClient.generateAccountSAS(accountSASService, accountSASResourceType, accountSASPermission, expiryTime, startTime, version, ipRange, sasProtocol); } } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClientBuilder.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java similarity index 77% rename from storage/client/blob/src/main/java/com/azure/storage/blob/StorageClientBuilder.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java index fbbdc0f438ac..220d4331c64f 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClientBuilder.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobServiceClientBuilder.java @@ -6,6 +6,7 @@ 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; @@ -34,8 +35,8 @@ import java.util.Objects; /** - * Fluent StorageClientBuilder for instantiating a {@link StorageClient} or {@link StorageAsyncClient} - * using {@link StorageClientBuilder#buildClient()} or {@link StorageClientBuilder#buildAsyncClient()} respectively. + * Fluent BlobServiceClientBuilder for instantiating a {@link BlobServiceClient} or {@link BlobServiceAsyncClient} + * using {@link BlobServiceClientBuilder#buildClient()} or {@link BlobServiceClientBuilder#buildAsyncClient()} respectively. * *

    * The following information must be provided on this builder: @@ -47,9 +48,9 @@ * *

    * Once all the configurations are set on this builder, call {@code .buildClient()} to create a - * {@link StorageClient} or {@code .buildAsyncClient()} to create a {@link StorageAsyncClient}. + * {@link BlobServiceClient} or {@code .buildAsyncClient()} to create a {@link BlobServiceAsyncClient}. */ -public final class StorageClientBuilder { +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"; @@ -67,16 +68,26 @@ public final class StorageClientBuilder { private Configuration configuration; /** - * Creates a builder instance that is able to configure and construct {@link StorageClient StorageClients} - * and {@link StorageAsyncClient StorageAsyncClients}. + * Creates a builder instance that is able to configure and construct {@link BlobServiceClient BlobServiceClients} + * and {@link BlobServiceAsyncClient BlobServiceAsyncClients}. */ - public StorageClientBuilder() { + public BlobServiceClientBuilder() { retryOptions = new RequestRetryOptions(); logLevel = HttpLogDetailLevel.NONE; policies = new ArrayList<>(); } - private AzureBlobStorageBuilder buildImpl() { + /** + * @return a {@link BlobServiceClient} created from the configurations in this builder. + */ + public BlobServiceClient buildClient() { + return new BlobServiceClient(buildAsyncClient()); + } + + /** + * @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. @@ -95,8 +106,6 @@ private AzureBlobStorageBuilder buildImpl() { policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, String.format("%s/.default", endpoint))); } else if (sasTokenCredential != null) { policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); - } else { - policies.add(new AnonymousCredentialPolicy()); } policies.add(new RequestRetryPolicy(retryOptions)); @@ -104,43 +113,24 @@ private AzureBlobStorageBuilder buildImpl() { policies.addAll(this.policies); policies.add(new HttpLoggingPolicy(logLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); - return new AzureBlobStorageBuilder() + return new BlobServiceAsyncClient(new AzureBlobStorageBuilder() .url(endpoint) - .pipeline(pipeline); - } - - /** - * Creates a {@link StorageClient} based on options set in the Builder. - * - * @return a {@link StorageClient} created from the configurations in this builder. - * @throws NullPointerException If {@code endpoint} is {@code null}. - */ - public StorageClient buildClient() { - return new StorageClient(buildAsyncClient()); - } - - /** - * Creates a {@link StorageAsyncClient} based on options set in the Builder. - * - * @return a {@link StorageAsyncClient} created from the configurations in this builder. - * @throws NullPointerException If {@code endpoint} is {@code null}. - */ - public StorageAsyncClient buildAsyncClient() { - return new StorageAsyncClient(buildImpl()); + .pipeline(pipeline) + .build()); } /** * Sets the blob service endpoint, additionally parses it for information (SAS token, queue name) * @param endpoint URL of the service - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is a malformed URL. */ - public StorageClientBuilder endpoint(String endpoint) { + public BlobServiceClientBuilder endpoint(String endpoint) { try { URL url = new URL(endpoint); this.endpoint = url.getProtocol() + "://" + url.getAuthority(); @@ -167,7 +157,7 @@ String endpoint() { * @return the updated ContainerClientBuilder object * @throws NullPointerException If {@code credential} is {@code null}. */ - public StorageClientBuilder credential(SharedKeyCredential credential) { + public BlobServiceClientBuilder credential(SharedKeyCredential credential) { this.sharedKeyCredential = Objects.requireNonNull(credential); this.tokenCredential = null; this.sasTokenCredential = null; @@ -177,10 +167,10 @@ public StorageClientBuilder credential(SharedKeyCredential credential) { /** * Sets the credential used to authorize requests sent to the service * @param credential authorization credential - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code credential} is {@code null}. */ - public StorageClientBuilder credential(TokenCredential credential) { + public BlobServiceClientBuilder credential(TokenCredential credential) { this.tokenCredential = Objects.requireNonNull(credential); this.sharedKeyCredential = null; this.sasTokenCredential = null; @@ -190,10 +180,10 @@ public StorageClientBuilder credential(TokenCredential credential) { /** * Sets the credential used to authorize requests sent to the service * @param credential authorization credential - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code credential} is {@code null}. */ - public StorageClientBuilder credential(SASTokenCredential credential) { + public BlobServiceClientBuilder credential(SASTokenCredential credential) { this.sasTokenCredential = Objects.requireNonNull(credential); this.sharedKeyCredential = null; this.tokenCredential = null; @@ -202,9 +192,9 @@ public StorageClientBuilder credential(SASTokenCredential credential) { /** * Clears the credential used to authorize requests sent to the service - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object */ - public StorageClientBuilder anonymousCredential() { + public BlobServiceClientBuilder anonymousCredential() { this.sharedKeyCredential = null; this.tokenCredential = null; this.sasTokenCredential = null; @@ -214,10 +204,10 @@ public StorageClientBuilder anonymousCredential() { /** * 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 StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws IllegalArgumentException If {@code connectionString} doesn't contain AccountName or AccountKey. */ - public StorageClientBuilder connectionString(String connectionString) { + public BlobServiceClientBuilder connectionString(String connectionString) { Objects.requireNonNull(connectionString); Map connectionKVPs = new HashMap<>(); @@ -247,10 +237,10 @@ public StorageClientBuilder connectionString(String connectionString) { /** * Sets the http client used to send service requests * @param httpClient http client to send requests - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code httpClient} is {@code null}. */ - public StorageClientBuilder httpClient(HttpClient httpClient) { + public BlobServiceClientBuilder httpClient(HttpClient httpClient) { this.httpClient = Objects.requireNonNull(httpClient); return this; } @@ -258,10 +248,10 @@ public StorageClientBuilder httpClient(HttpClient httpClient) { /** * Adds a pipeline policy to apply on each request sent * @param pipelinePolicy a pipeline policy - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. */ - public StorageClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { + public BlobServiceClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { this.policies.add(Objects.requireNonNull(pipelinePolicy)); return this; } @@ -269,9 +259,9 @@ public StorageClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { /** * Sets the logging level for service requests * @param logLevel logging level - * @return the updated StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object */ - public StorageClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { + public BlobServiceClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { this.logLevel = logLevel; return this; } @@ -280,9 +270,9 @@ public StorageClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { * 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 StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object */ - public StorageClientBuilder configuration(Configuration configuration) { + public BlobServiceClientBuilder configuration(Configuration configuration) { this.configuration = configuration; return this; } @@ -290,10 +280,10 @@ public StorageClientBuilder configuration(Configuration 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 StorageClientBuilder object + * @return the updated BlobServiceClientBuilder object * @throws NullPointerException If {@code retryOptions} is {@code null}. */ - public StorageClientBuilder retryOptions(RequestRetryOptions retryOptions) { + public BlobServiceClientBuilder retryOptions(RequestRetryOptions retryOptions) { this.retryOptions = Objects.requireNonNull(retryOptions); return this; } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobURLParts.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobURLParts.java similarity index 93% rename from storage/client/blob/src/main/java/com/azure/storage/blob/BlobURLParts.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlobURLParts.java index 1200e960f750..5c629e719ca3 100644 --- a/storage/client/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 @@ -76,14 +76,14 @@ public BlobURLParts host(String host) { } /** - * The container name or {@code null} if a {@link StorageAsyncClient} was parsed. + * The container name or {@code null} if a {@link BlobServiceAsyncClient} was parsed. */ public String containerName() { return containerName; } /** - * The container name or {@code null} if a {@link StorageAsyncClient} was parsed. + * The container name or {@code null} if a {@link BlobServiceAsyncClient} was parsed. */ public BlobURLParts containerName(String containerName) { this.containerName = containerName; @@ -91,14 +91,14 @@ public BlobURLParts containerName(String containerName) { } /** - * The blob name or {@code null} if a {@link StorageAsyncClient} or {@link ContainerAsyncClient} was parsed. + * The blob name or {@code null} if a {@link BlobServiceAsyncClient} or {@link ContainerAsyncClient} was parsed. */ public String blobName() { return blobName; } /** - * The blob name or {@code null} if a {@link StorageAsyncClient} or {@link ContainerAsyncClient} was parsed. + * The blob name or {@code null} if a {@link BlobServiceAsyncClient} or {@link ContainerAsyncClient} was parsed. */ public BlobURLParts blobName(String blobName) { this.blobName = blobName; diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java index cdb0a06fa68e..1cc6e71232b1 100644 --- a/storage/client/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 @@ -9,7 +9,7 @@ import com.azure.core.http.rest.VoidResponse; import com.azure.core.implementation.util.FluxUtil; import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; +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; @@ -50,7 +50,7 @@ * *

    * This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, - * and operations on the service are available on {@link StorageAsyncClient}. + * and operations on the service are available on {@link BlobServiceAsyncClient}. * *

    * Please refer @@ -85,10 +85,10 @@ public final class BlockBlobAsyncClient extends BlobAsyncClient { /** * Package-private constructor for use by {@link BlobClientBuilder}. - * @param azureBlobStorageBuilder the API client builder for blob storage API + * @param azureBlobStorage the API client for blob storage */ - BlockBlobAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder, String snapshot) { - super(azureBlobStorageBuilder, snapshot); + BlockBlobAsyncClient(AzureBlobStorageImpl azureBlobStorage, String snapshot) { + super(azureBlobStorage, snapshot); } /** diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/BlockBlobClient.java index 6af92555c2b0..69bad81c7ff2 100644 --- a/storage/client/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 @@ -36,7 +36,7 @@ * *

    * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, - * and operations on the service are available on {@link StorageClient}. + * and operations on the service are available on {@link BlobServiceClient}. * *

    * Please refer to the Azure Docs diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/Constants.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/Constants.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/Constants.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/Constants.java diff --git a/storage/client/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 similarity index 97% rename from storage/client/blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java index 936bab693252..155c0498f49f 100644 --- a/storage/client/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 @@ -41,13 +41,13 @@ /** * Client to a container. It may only be instantiated through a {@link ContainerClientBuilder} or via the method {@link - * StorageAsyncClient#getContainerAsyncClient(String)}. This class does not hold any state about a particular blob but + * 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 - * {@link #getBlobAsyncClient(String)}, and operations on the service are available on {@link StorageAsyncClient}. + * {@link #getBlobAsyncClient(String)}, and operations on the service are available on {@link BlobServiceAsyncClient}. * *

    * Please refer to the Azure @@ -71,10 +71,10 @@ public final class ContainerAsyncClient { /** * Package-private constructor for use by {@link ContainerClientBuilder}. * - * @param azureBlobStorageBuilder the API client builder for blob storage API + * @param azureBlobStorage the API client for blob storage */ - ContainerAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder) { - this.azureBlobStorage = azureBlobStorageBuilder.build(); + ContainerAsyncClient(AzureBlobStorageImpl azureBlobStorage) { + this.azureBlobStorage = azureBlobStorage; } /** @@ -107,7 +107,8 @@ public BlockBlobAsyncClient getBlockBlobAsyncClient(String blobName) { public BlockBlobAsyncClient getBlockBlobAsyncClient(String blobName, String snapshot) { return new BlockBlobAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getContainerUrl(), blobName).toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()) + .build(), snapshot); } /** @@ -140,7 +141,8 @@ public PageBlobAsyncClient getPageBlobAsyncClient(String blobName) { public PageBlobAsyncClient getPageBlobAsyncClient(String blobName, String snapshot) { return new PageBlobAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getContainerUrl(), blobName).toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()) + .build(), snapshot); } /** @@ -173,7 +175,8 @@ public AppendBlobAsyncClient getAppendBlobAsyncClient(String blobName) { public AppendBlobAsyncClient getAppendBlobAsyncClient(String blobName, String snapshot) { return new AppendBlobAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getContainerUrl(), blobName).toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()) + .build(), snapshot); } /** @@ -202,18 +205,20 @@ public BlobAsyncClient getBlobAsyncClient(String blobName) { public BlobAsyncClient getBlobAsyncClient(String blobName, String snapshot) { return new BlobAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getContainerUrl(), blobName).toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()) + .build(), snapshot); } /** - * Initializes a {@link StorageAsyncClient} object pointing to the storage account this container is in. + * Initializes a {@link BlobServiceAsyncClient} object pointing to the storage account this container is in. * - * @return A {@link StorageAsyncClient} object pointing to the specified storage account + * @return A {@link BlobServiceAsyncClient} object pointing to the specified storage account */ - public StorageAsyncClient getStorageAsyncClient() { - return new StorageAsyncClient(new AzureBlobStorageBuilder() + public BlobServiceAsyncClient getBlobServiceAsyncClient() { + return new BlobServiceAsyncClient(new AzureBlobStorageBuilder() .url(Utility.stripLastPathSegment(getContainerUrl()).toString()) - .pipeline(azureBlobStorage.httpPipeline())); + .pipeline(azureBlobStorage.getHttpPipeline()) + .build()); } /** @@ -224,9 +229,9 @@ public StorageAsyncClient getStorageAsyncClient() { */ public URL getContainerUrl() { try { - return new URL(azureBlobStorage.url()); + return new URL(azureBlobStorage.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.url()), e); + throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e); } } @@ -681,7 +686,8 @@ private Flux listBlobsHierarchyHelper(String delimiter, ListBlobsOptio } else { prefixes = Flux.empty(); } - Flux result = blobs.concatWith(prefixes.map(prefix -> new BlobItem().name(prefix.name()).isPrefix(true))); + 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. @@ -1102,7 +1108,7 @@ public String generateSAS(String identifier, ContainerSASPermission permissions, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); SharedKeyCredential sharedKeyCredential = - Utility.getSharedKeyCredential(this.azureBlobStorage.httpPipeline()); + Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline()); Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential); @@ -1119,7 +1125,7 @@ public String generateSAS(String identifier, ContainerSASPermission permissions, */ private ServiceSASSignatureValues configureServiceSASSignatureValues(ServiceSASSignatureValues serviceSASSignatureValues, String accountName) { // Set canonical name - serviceSASSignatureValues.canonicalName(this.azureBlobStorage.url(), accountName); + serviceSASSignatureValues.canonicalName(this.azureBlobStorage.getUrl(), accountName); // Set snapshotId to null serviceSASSignatureValues.snapshotId(null); diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClient.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClient.java index 12d5844a696f..c66b9d8c2373 100644 --- a/storage/client/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 @@ -26,13 +26,13 @@ /** * Client to a container. It may only be instantiated through a {@link ContainerClientBuilder} or via the method {@link - * StorageClient#getContainerClient(String)}. This class does not hold any state about a particular container but is + * BlobServiceClient#getContainerClient(String)}. This class does not hold any state about a particular container 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 BlobClient} through - * {@link #getBlobClient(String)}, and operations on the service are available on {@link StorageClient}. + * {@link #getBlobClient(String)}, and operations on the service are available on {@link BlobServiceClient}. * *

    * Please refer to the Azure @@ -171,12 +171,12 @@ public BlobClient getBlobClient(String blobName, String snapshot) { } /** - * Initializes a {@link StorageClient} object pointing to the storage account this container is in. + * Initializes a {@link BlobServiceClient} object pointing to the storage account this container is in. * - * @return A {@link StorageClient} object pointing to the specified storage account + * @return A {@link BlobServiceClient} object pointing to the specified storage account */ - public StorageClient getStorageClient() { - return new StorageClient(containerAsyncClient.getStorageAsyncClient()); + public BlobServiceClient getBlobServiceClient() { + return new BlobServiceClient(containerAsyncClient.getBlobServiceAsyncClient()); } /** diff --git a/storage/client/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 similarity index 93% rename from storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java index 7c9e9543ffd9..7ef873aac1b3 100644 --- a/storage/client/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 @@ -6,6 +6,7 @@ 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; @@ -78,10 +79,16 @@ public ContainerClientBuilder() { } /** - * Constructs an instance of ContainerAsyncClient based on the configurations stored in the appendBlobClientBuilder. - * @return a new client instance + * @return a {@link ContainerClient} created from the configurations in this builder. */ - private AzureBlobStorageBuilder buildImpl() { + public ContainerClient buildClient() { + return new ContainerClient(buildAsyncClient()); + } + + /** + * @return a {@link ContainerAsyncClient} created from the configurations in this builder. + */ + public ContainerAsyncClient buildAsyncClient() { Objects.requireNonNull(endpoint); Objects.requireNonNull(containerName); @@ -101,8 +108,6 @@ private AzureBlobStorageBuilder buildImpl() { policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, String.format("%s/.default", endpoint))); } else if (sasTokenCredential != null) { policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); - } else { - policies.add(new AnonymousCredentialPolicy()); } policies.add(new RequestRetryPolicy(retryOptions)); @@ -110,34 +115,15 @@ private AzureBlobStorageBuilder buildImpl() { policies.addAll(this.policies); policies.add(new HttpLoggingPolicy(logLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); - return new AzureBlobStorageBuilder() + return new ContainerAsyncClient(new AzureBlobStorageBuilder() .url(String.format("%s/%s", endpoint, containerName)) - .pipeline(pipeline); - } - - /** - * Creates a {@link ContainerClient} based on options set in the Builder. - * - * @return a {@link ContainerClient} created from the configurations in this builder. - * @throws NullPointerException If {@code endpoint} is {@code null} or {@code containerName} is {@code null}. - */ - public ContainerClient buildClient() { - return new ContainerClient(buildAsyncClient()); - } - - /** - * Creates a {@link ContainerAsyncClient} based on options set in the Builder. - * - * @return a {@link ContainerAsyncClient} created from the configurations in this builder. - * @throws NullPointerException If {@code endpoint} is {@code null} or {@code containerName} is {@code null}. - */ - public ContainerAsyncClient buildAsyncClient() { - return new ContainerAsyncClient(buildImpl()); + .pipeline(pipeline) + .build()); } /** diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerProperties.java similarity index 68% rename from storage/client/blob/src/main/java/com/azure/storage/blob/ContainerProperties.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerProperties.java index 9cada777b623..9aae7ae17a8c 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerProperties.java @@ -6,20 +6,23 @@ import com.azure.storage.blob.models.ContainerGetPropertiesHeaders; import com.azure.storage.blob.models.PublicAccessType; -public class ContainerProperties { +import java.time.OffsetDateTime; - private PublicAccessType blobPublicAccess; +public final class ContainerProperties { - private boolean hasImmutabilityPolicy; + private final PublicAccessType blobPublicAccess; - private boolean hasLegalHold; + private final boolean hasImmutabilityPolicy; - //todo decide datetime representation for last modified time + private final boolean hasLegalHold; + + private final OffsetDateTime lastModified; ContainerProperties(ContainerGetPropertiesHeaders generatedResponseHeaders) { this.blobPublicAccess = generatedResponseHeaders.blobPublicAccess(); this.hasImmutabilityPolicy = generatedResponseHeaders.hasImmutabilityPolicy(); this.hasLegalHold = generatedResponseHeaders.hasLegalHold(); + this.lastModified = generatedResponseHeaders.lastModified(); } /** @@ -42,4 +45,11 @@ public boolean hasImmutabilityPolicy() { public boolean hasLegalHold() { return hasLegalHold; } + + /** + * @return the time the container was last modified + */ + public OffsetDateTime lastModified() { + return lastModified; + } } diff --git a/storage/client/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 similarity index 79% rename from storage/client/blob/src/main/java/com/azure/storage/blob/ContainerSASPermission.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ContainerSASPermission.java index 0ac5e0f6738a..c6031c9edd37 100644 --- a/storage/client/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 @@ -13,7 +13,7 @@ * {@link ServiceSASSignatureValues} object. It is possible to construct the permissions string without this class, but * the order of the permissions is particular and this class guarantees correctness. */ -final class ContainerSASPermission { +public final class ContainerSASPermission { private boolean read; private boolean add; @@ -29,7 +29,7 @@ final class ContainerSASPermission { /** * Initializes an {@code ContainerSASPermssion} object with all fields set to false. */ - private ContainerSASPermission() { + public ContainerSASPermission() { } /** @@ -75,14 +75,17 @@ public static ContainerSASPermission parse(String permString) { } /** - * Specifies Read access granted. + * @return the read permission status */ public boolean read() { return read; } /** - * Specifies Read access granted. + * Sets the read permission status. + * + * @param read Permission status to set + * @return the updated ContainerSASPermission object */ public ContainerSASPermission read(boolean read) { this.read = read; @@ -90,14 +93,17 @@ public ContainerSASPermission read(boolean read) { } /** - * Specifies Add access granted. + * @return the add permission status */ public boolean add() { return add; } /** - * Specifies Add access granted. + * Sets the add permission status. + * + * @param add Permission status to set + * @return the updated ContainerSASPermission object */ public ContainerSASPermission add(boolean add) { this.add = add; @@ -105,14 +111,17 @@ public ContainerSASPermission add(boolean add) { } /** - * Specifies Create access granted. + * @return the create permission status */ public boolean create() { return create; } /** - * Specifies Create access granted. + * Sets the create permission status. + * + * @param create Permission status to set + * @return the updated ContainerSASPermission object */ public ContainerSASPermission create(boolean create) { this.create = create; @@ -120,14 +129,17 @@ public ContainerSASPermission create(boolean create) { } /** - * Specifies Write access granted. + * @return the write permission status */ public boolean write() { return write; } /** - * Specifies Write access granted. + * Sets the write permission status. + * + * @param write Permission status to set + * @return the updated ContainerSASPermission object */ public ContainerSASPermission write(boolean write) { this.write = write; @@ -135,14 +147,17 @@ public ContainerSASPermission write(boolean write) { } /** - * Specifies Delete access granted. + * @return the delete permission status */ public boolean delete() { return delete; } /** - * Specifies Delete access granted. + * Sets the delete permission status. + * + * @param delete Permission status to set + * @return the updated ContainerSASPermission object */ public ContainerSASPermission delete(boolean delete) { this.delete = delete; @@ -150,14 +165,17 @@ public ContainerSASPermission delete(boolean delete) { } /** - * Specifies List access granted. + * @return the list permission status */ public boolean list() { return list; } /** - * Specifies List access granted. + * Sets the list permission status. + * + * @param list Permission status to set + * @return the updated ContainerSASPermission object */ public ContainerSASPermission list(boolean list) { this.list = list; diff --git a/storage/client/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 similarity index 74% rename from storage/client/blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java index e22a3fa72a16..819b85891b10 100644 --- a/storage/client/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 @@ -18,7 +18,7 @@ /** * {@code DownloadAsyncResponse} wraps the protocol-layer response from {@link BlobAsyncClient#download(BlobRange, - * BlobAccessConditions, boolean, ReliableDownloadOptions)} to automatically retry failed reads from the body as + * ReliableDownloadOptions, BlobAccessConditions, boolean)} to automatically retry failed reads from the body as * appropriate. If the download is interrupted, the {@code DownloadAsyncResponse} will make a request to resume the download * from where it left off, allowing the user to consume the data as one continuous stream, for any interruptions are * hidden. The retry behavior is defined by the options passed to the {@link #body(ReliableDownloadOptions)}. The @@ -39,9 +39,8 @@ public final class DownloadAsyncResponse { // The constructor is package-private because customers should not be creating their own responses. - // TODO (unknown): resolve comment vs code mismatch DownloadAsyncResponse(ResponseBase> response, - HTTPGetterInfo info, Function> getter) { + HTTPGetterInfo info, Function> getter) { Utility.assertNotNull("getter", getter); Utility.assertNotNull("info", info); Utility.assertNotNull("info.eTag", info.eTag()); @@ -55,10 +54,8 @@ public final class DownloadAsyncResponse { * {@code options.maxRetryRequests > 0}. If retries are enabled, if a connection fails while reading, the stream * will make additional requests to reestablish a connection and continue reading. * - * @param options - * {@link ReliableDownloadOptions} - * - * @return A {@code Flux} which emits the data as {@code ByteBuffer}s. + * @param options {@link ReliableDownloadOptions} + * @return A {@link Flux} which emits the data as {@link ByteBuf ByteBufs} */ public Flux body(ReliableDownloadOptions options) { ReliableDownloadOptions optionsReal = options == null ? new ReliableDownloadOptions() : options; @@ -86,14 +83,11 @@ possible the method call that returns a Single is what throws (like how our apis call time rather than at subscription time. */ try { - // Get a new response and try reading from it. - return getter.apply(this.info) - .flatMapMany(response -> - /* - Do not compound the number of retries by passing in another set of downloadOptions; just get - the raw body. - */ - this.applyReliableDownload(this.rawResponse.value(), retryCount, options)); + /*Get a new response and try reading from it. + Do not compound the number of retries by passing in another set of downloadOptions; just get + the raw body. + */ + return getter.apply(this.info).flatMapMany(response -> this.applyReliableDownload(this.rawResponse.value(), retryCount, options)); } catch (Exception e) { // If the getter fails, return the getter failure to the user. return Flux.error(e); @@ -101,23 +95,20 @@ possible the method call that returns a Single is what throws (like how our apis } } - private Flux applyReliableDownload(Flux data, - int currentRetryCount, ReliableDownloadOptions options) { - return data - .doOnNext(buffer -> { - /* - Update how much data we have received in case we need to retry and propagate to the user the data we - have received. - */ - this.info.offset(this.info.offset() + buffer.readableBytes()); // was `remaining()` in Rx world - if (this.info.count() != null) { - this.info.count(this.info.count() - buffer.readableBytes()); // was `remaining()` in Rx world - } - }) - .onErrorResume(t2 -> { - // Increment the retry count and try again with the new exception. - return tryContinueFlux(t2, currentRetryCount + 1, options); - }); + private Flux applyReliableDownload(Flux data, int currentRetryCount, ReliableDownloadOptions options) { + return data.doOnNext(buffer -> { + /* + Update how much data we have received in case we need to retry and propagate to the user the data we + have received. + */ + this.info.offset(this.info.offset() + buffer.readableBytes()); // was `remaining()` in Rx world + if (this.info.count() != null) { + this.info.count(this.info.count() - buffer.readableBytes()); // was `remaining()` in Rx world + } + }).onErrorResume(t2 -> { + // Increment the retry count and try again with the new exception. + return tryContinueFlux(t2, currentRetryCount + 1, options); + }); } /** diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/DownloadResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/DownloadResponse.java index 7acc6427dcf8..11e90ba09daf 100644 --- a/storage/client/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 @@ -33,7 +33,6 @@ public void body(OutputStream outputStream, ReliableDownloadOptions options) thr //TODO (unknown): determine signature(s) to use /*public InputStream body(ReliableDownloadOptions options) { return new InputStream() { - DownloadAsyncResponse response = asyncResponse; @Override public int read() throws IOException { 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 new file mode 100644 index 000000000000..6393d0a1ebbb --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.storage.blob.models.BlobAccessConditions; + +import java.time.Duration; + +/** + * HTTPGetterInfo is a passed to the getter function of a reliable download to specify parameters needed for the GET + * request. + */ +public final class HTTPGetterInfo { + private long offset = 0; + + private Long count = null; + + private String eTag = null; + + /** + * @return the start offset used when creating the Range header. Defaults to 0. + */ + public long offset() { + return offset; + } + + /** + * Sets the start offset that is used when creating the Range header. If unchanged this will default to 0. + * + * @param offset Start offset + * @return the updated HTTPGetterInfo object + */ + public HTTPGetterInfo offset(long offset) { + this.offset = offset; + return this; + } + + /** + * @return the count of bytes used to calculate the end offset when creating the Range header. {@code} null is the + * default and indicates that the entire rest of the blob should be retrieved. + */ + public Long count() { + return count; + } + + /** + * Sets the count of bytes used to calculate the end offset when creating the Range header. {@code} null is the + * default and indicates that the entire rest of the blob should be retrieved. + * + * @param count Count of bytes + * @return the updated HTTPGetterInfo object + */ + public HTTPGetterInfo count(Long count) { + if (count != null) { + Utility.assertInBounds("count", count, 0, Long.MAX_VALUE); + } + this.count = count; + return this; + } + + /** + * @return the eTag used when creating If-Match header. eTag is returned with any operation that modifies the + * resource and when retrieving {@link BlobClient#getProperties(BlobAccessConditions, Duration) properties}. + * Defaults to null. + */ + public String eTag() { + return eTag; + } + + /** + * Sets the eTag used when creating If-Match header. eTag is returned with any operation that modifies the + * resource and when retrieving {@link BlobClient#getProperties(BlobAccessConditions, Duration) properties}. + * Defaults to null. + * + * @param eTag Resource's eTag + * @return the updated HTTPGetterInfo object + */ + public HTTPGetterInfo eTag(String eTag) { + this.eTag = eTag; + return this; + } +} diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/IPRange.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/IPRange.java similarity index 79% rename from storage/client/blob/src/main/java/com/azure/storage/blob/IPRange.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/IPRange.java index 24665c7aaedd..9e66189fa904 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/IPRange.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/IPRange.java @@ -8,13 +8,16 @@ * set if it is not desired to confine the sas permissions to an IP range. Please refer to * {@link AccountSASSignatureValues} or {@link ServiceSASSignatureValues} for more information. */ -final class IPRange { +public final class IPRange { private String ipMin; private String ipMax; - IPRange() { + /** + * Constructs an empty IPRange. + */ + public IPRange() { } /** @@ -36,14 +39,17 @@ public static IPRange parse(String rangeStr) { } /** - * The minimum IP address of the range. + * @return the minimum IP address of the range. */ public String ipMin() { return ipMin; } /** - * The minimum IP address of the range. + * Sets the minimum IP address of the range. + * + * @param ipMin Minimum IP of the range + * @return the updated IPRange object */ public IPRange ipMin(String ipMin) { this.ipMin = ipMin; @@ -51,14 +57,18 @@ public IPRange ipMin(String ipMin) { } /** - * The maximum IP address of the range. + * + * @return the maximum IP address of the range. */ public String ipMax() { return ipMax; } /** - * The maximum IP address of the range. + * Sets the maximum IP address of the range. + * + * @param ipMax Maximum IP of the range + * @return the updated IPRange object */ public IPRange ipMax(String ipMax) { this.ipMax = ipMax; diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/IProgressReceiver.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/IProgressReceiver.java similarity index 66% rename from storage/client/blob/src/main/java/com/azure/storage/blob/IProgressReceiver.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/IProgressReceiver.java index ab336e186289..70d85fe58090 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/IProgressReceiver.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/IProgressReceiver.java @@ -3,20 +3,20 @@ package com.azure.storage.blob; +import reactor.core.publisher.Flux; + /** * An {@code IProgressReceiver} is an object that can be used to report progress on network transfers. When specified on * transfer operations, the {@code reportProgress} method will be called periodically with the total number of bytes - * transferred. The user may configure this method to report progress in whatever format desired. It is recommended - * that this type be used in conjunction with - * {@link ProgressReporter#addProgressReporting(reactor.core.publisher.Flux, IProgressReceiver)}. + * transferred. The user may configure this method to report progress in wha tever format desired. It is recommended + * that this type be used in conjunction with {@link ProgressReporter#addProgressReporting(Flux, IProgressReceiver)}. */ interface IProgressReceiver { /** * The callback function invoked as progress is reported. * - * @param bytesTransferred - * The total number of bytes transferred during this transaction. + * @param bytesTransferred The total number of bytes transferred during this transaction. */ void reportProgress(long bytesTransferred); } diff --git a/storage/client/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 similarity index 96% rename from storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java index 925f167b2ad9..8b1cbd0ca39d 100644 --- a/storage/client/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 @@ -7,7 +7,7 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.implementation.http.UrlBuilder; import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; +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; @@ -16,6 +16,7 @@ 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.PageList; import com.azure.storage.blob.models.PageRange; import com.azure.storage.blob.models.SequenceNumberActionType; import com.azure.storage.blob.models.SourceModifiedAccessConditions; @@ -37,7 +38,7 @@ * *

    * This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, - * and operations on the service are available on {@link StorageAsyncClient}. + * and operations on the service are available on {@link BlobServiceAsyncClient}. * *

    * Please refer @@ -64,10 +65,10 @@ public final class PageBlobAsyncClient extends BlobAsyncClient { /** * Package-private constructor for use by {@link BlobClientBuilder}. - * @param azureBlobStorageBuilder the API client builder for blob storage API + * @param azureBlobStorage the API client for blob storage */ - PageBlobAsyncClient(AzureBlobStorageBuilder azureBlobStorageBuilder, String snapshot) { - super(azureBlobStorageBuilder, snapshot); + PageBlobAsyncClient(AzureBlobStorageImpl azureBlobStorage, String snapshot) { + super(azureBlobStorage, snapshot); } /** @@ -336,7 +337,7 @@ public Mono> clearPages(PageRange pageRange, * @return * A reactive response containing the information of the cleared pages. */ - public Flux getPageRanges(BlobRange blobRange) { + public Mono> getPageRanges(BlobRange blobRange) { return this.getPageRanges(blobRange, null); } @@ -352,7 +353,7 @@ public Flux getPageRanges(BlobRange blobRange) { * @return * A reactive response emitting all the page ranges. */ - public Flux getPageRanges(BlobRange blobRange, BlobAccessConditions accessConditions) { + public Mono> getPageRanges(BlobRange blobRange, BlobAccessConditions accessConditions) { blobRange = blobRange == null ? new BlobRange(0) : blobRange; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; @@ -360,7 +361,7 @@ public Flux getPageRanges(BlobRange blobRange, BlobAccessConditions a null, null, snapshot, null, null, blobRange.toHeaderValue(), null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) - .flatMapMany(response -> Flux.fromIterable(response.value().pageRange())); + .map(response -> new SimpleResponse<>(response, response.value())); } /** @@ -377,7 +378,7 @@ public Flux getPageRanges(BlobRange blobRange, BlobAccessConditions a * @return * A reactive response emitting all the different page ranges. */ - public Flux getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { + public Mono> getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { return this.getPageRangesDiff(blobRange, prevSnapshot, null); } @@ -397,7 +398,7 @@ public Flux getPageRangesDiff(BlobRange blobRange, String prevSnapsho * @return A reactive response emitting all the different page ranges. * @throws IllegalArgumentException If {@code prevSnapshot} is {@code null} */ - public Flux getPageRangesDiff(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions) { + public Mono> getPageRangesDiff(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions) { blobRange = blobRange == null ? new BlobRange(0) : blobRange; accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; @@ -409,7 +410,7 @@ public Flux getPageRangesDiff(BlobRange blobRange, String prevSnapsho null, null, snapshot, null, null, prevSnapshot, blobRange.toHeaderValue(), null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), Context.NONE)) - .flatMapMany(response -> Flux.fromIterable(response.value().pageRange())); + .map(response -> new SimpleResponse<>(response, response.value())); } /** diff --git a/storage/client/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 similarity index 96% rename from storage/client/blob/src/main/java/com/azure/storage/blob/PageBlobClient.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/PageBlobClient.java index 14c0ea4644de..14fdb39d5702 100644 --- a/storage/client/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 @@ -12,6 +12,7 @@ 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.PageList; import com.azure.storage.blob.models.PageRange; import com.azure.storage.blob.models.SequenceNumberActionType; import com.azure.storage.blob.models.SourceModifiedAccessConditions; @@ -34,7 +35,7 @@ * *

    * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, - * and operations on the service are available on {@link StorageClient}. + * and operations on the service are available on {@link BlobServiceClient}. * *

    * Please refer to the Azure Docs @@ -325,7 +326,7 @@ public Response clearPages(PageRange pageRange, * @return * The information of the cleared pages. */ - public Iterable getPageRanges(BlobRange blobRange) { + public Response getPageRanges(BlobRange blobRange) { return this.getPageRanges(blobRange, null, null); } @@ -343,10 +344,8 @@ public Iterable getPageRanges(BlobRange blobRange) { * @return * All the page ranges. */ - public Iterable getPageRanges(BlobRange blobRange, - BlobAccessConditions accessConditions, Duration timeout) { - Flux response = pageBlobAsyncClient.getPageRanges(blobRange, accessConditions); - return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); + public Response getPageRanges(BlobRange blobRange, BlobAccessConditions accessConditions, Duration timeout) { + return Utility.blockWithOptionalTimeout(pageBlobAsyncClient.getPageRanges(blobRange, accessConditions), timeout); } /** @@ -363,7 +362,7 @@ public Iterable getPageRanges(BlobRange blobRange, * @return * All the different page ranges. */ - public Iterable getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { + public Response getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { return this.getPageRangesDiff(blobRange, prevSnapshot, null, null); } @@ -385,10 +384,8 @@ public Iterable getPageRangesDiff(BlobRange blobRange, String prevSna * @return * All the different page ranges. */ - public Iterable getPageRangesDiff(BlobRange blobRange, String prevSnapshot, - BlobAccessConditions accessConditions, Duration timeout) { - Flux response = pageBlobAsyncClient.getPageRangesDiff(blobRange, prevSnapshot, accessConditions); - return timeout == null ? response.toIterable() : response.timeout(timeout).toIterable(); + public Response getPageRangesDiff(BlobRange blobRange, String prevSnapshot, BlobAccessConditions accessConditions, Duration timeout) { + return Utility.blockWithOptionalTimeout(pageBlobAsyncClient.getPageRangesDiff(blobRange, prevSnapshot, accessConditions), timeout); } /** diff --git a/storage/client/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 similarity index 67% rename from storage/client/blob/src/main/java/com/azure/storage/blob/ProgressReporter.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ProgressReporter.java index fc882d4c30aa..4ac0ce9cda2f 100644 --- a/storage/client/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 @@ -11,7 +11,7 @@ import java.util.concurrent.locks.Lock; /** - * {@code ProgressReporterImpl} offers a convenient way to add progress tracking to a given Flowable. + * {@code ProgressReporter} offers a convenient way to add progress tracking to a given Flux. */ final class ProgressReporter { @@ -35,29 +35,28 @@ void rewindProgress() { } Flux addProgressReporting(Flux data) { - return Mono.just(this) - .flatMapMany(progressReporter -> { - /* - Each time there is a new subscription, we will rewind the progress. This is desirable specifically - for retries, which resubscribe on each try. The first time this flowable is subscribed to, the - rewind will be a noop as there will have been no progress made. Subsequent rewinds will work as - expected. - */ - progressReporter.rewindProgress(); - /* - Every time we emit some data, report it to the Tracker, which will pass it on to the end user. - */ - return data.doOnNext(buffer -> - progressReporter.reportProgress(buffer.remaining())); - }); + return Mono.just(this).flatMapMany(progressReporter -> { + /* + Each time there is a new subscription, we will rewind the progress. This is desirable specifically + for retries, which resubscribe on each try. The first time this flowable is subscribed to, the + rewind will be a noop as there will have been no progress made. Subsequent rewinds will work as + expected. + */ + progressReporter.rewindProgress(); + + /* + Every time we emit some data, report it to the Tracker, which will pass it on to the end user. + */ + return data.doOnNext(buffer -> progressReporter.reportProgress(buffer.remaining())); + }); } } /** - * This type is used to keep track of the total amount of data transferred for a single request. This is the type - * we will use when the customer uses the factory to add progress reporting to their Flowable. We need this - * additional type because we can't keep local state directly as lambdas require captured local variables to be - * effectively final. + * This type is used to keep track of the total amount of data transferred for a single request. This is the type we + * will use when the customer uses the factory to add progress reporting to their Flowable. We need this additional + * type because we can't keep local state directly as lambdas require captured local variables to be effectively + * final. */ private static class SequentialProgressReporter extends ProgressReporterImpl { SequentialProgressReporter(IProgressReceiver progressReceiver) { @@ -129,24 +128,19 @@ public void rewindProgress() { } /** - * Adds progress reporting functionality to the given {@code Flux}. Each subscription (and therefore each - * retry) will rewind the progress reported so as not to over-report. The data reported will be the total amount - * of data emitted so far, or the "current position" of the Flowable. + * Adds progress reporting functionality to the given {@code Flux}. Each subscription (and therefore each retry) + * will rewind the progress reported so as not to over-report. The data reported will be the total amount of data + * emitted so far, or the "current position" of the Flowable. * - * @param data - * The data whose transfer progress is to be tracked. - * @param progressReceiver - * {@link IProgressReceiver} - * - * @return A {@code Flux} that emits the same data as the source but calls a callback to report the total amount - * of data emitted so far. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=progress "Sample code for ProgressReporterFactor.addProgressReporting")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) + * @param data The data whose transfer progress is to be tracked. + * @param progressReceiver {@link IProgressReceiver} + * @return A {@code Flux} that emits the same data as the source but calls a callback to report the total amount of + * data emitted so far. + * @apiNote ## Sample Code \n [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=progress + * "Sample code for ProgressReporterFactor.addProgressReporting")] \n For more samples, please see the [Samples + * file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) */ - public static Flux addProgressReporting(Flux data, - IProgressReceiver progressReceiver) { + public static Flux addProgressReporting(Flux data, IProgressReceiver progressReceiver) { if (progressReceiver == null) { return data; } else { @@ -155,8 +149,7 @@ public static Flux addProgressReporting(Flux data, } } - static Flux addParallelProgressReporting(Flux data, - IProgressReceiver progressReceiver, Lock lock, AtomicLong totalProgress) { + static Flux addParallelProgressReporting(Flux data, IProgressReceiver progressReceiver, Lock lock, AtomicLong totalProgress) { if (progressReceiver == null) { return data; } else { diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/SASProtocol.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SASProtocol.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/SASProtocol.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SASProtocol.java index 64df03714ecb..475e6f4289f6 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/SASProtocol.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SASProtocol.java @@ -9,7 +9,7 @@ * Specifies the set of possible permissions for a shared access signature protocol. Values of this type can be used * to set the fields on the {@link AccountSASSignatureValues} and {@link ServiceSASSignatureValues} types. */ -enum SASProtocol { +public enum SASProtocol { /** * Permission to use SAS only through https granted. */ diff --git a/storage/client/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 similarity index 83% rename from storage/client/blob/src/main/java/com/azure/storage/blob/SASQueryParameters.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SASQueryParameters.java index 399e7ea1b6e6..7dead915f796 100644 --- a/storage/client/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 @@ -14,10 +14,10 @@ /** * 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. + * 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 { @@ -69,9 +69,10 @@ public final class SASQueryParameters { * 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 + * @param removeSASParametersFromMap When {@code true}, the SAS query parameters will be removed from + * queryParamsMap */ - SASQueryParameters(Map queryParamsMap, boolean removeSASParametersFromMap) { + 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); @@ -115,36 +116,27 @@ private T getQueryParameter(Map parameters, String name, B /** - * Creates a new {@link SASQueryParameters} object. These objects are only created internally by - * *SASSignatureValues classes. + * 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. + * @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) { + 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; @@ -196,8 +188,8 @@ public String services() { } /** - * @return The storage resource types being accessed (only for Account SAS). Please refer to - * {@link AccountSASResourceType} for more details. + * @return The storage resource types being accessed (only for Account SAS). Please refer to {@link + * AccountSASResourceType} for more details. */ public String resourceTypes() { return resourceTypes; @@ -248,8 +240,8 @@ public String resource() { } /** - * @return Please refer to {@link AccountSASPermission}, {@link BlobSASPermission}, or {@link ContainerSASPermission} - * for more details. + * @return Please refer to {@link AccountSASPermission}, {@link BlobSASPermission}, or {@link + * ContainerSASPermission} for more details. */ public String permissions() { return permissions; @@ -341,12 +333,12 @@ public String keyVersion() { UserDelegationKey userDelegationKey() { return new UserDelegationKey() - .signedExpiry(this.keyExpiry) - .signedOid(this.keyOid) - .signedService(this.keyService) - .signedStart(this.keyStart) - .signedTid(this.keyTid) - .signedVersion(this.keyVersion); + .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) { diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/SR.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SR.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/SR.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/SR.java diff --git a/storage/client/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 similarity index 69% rename from storage/client/blob/src/main/java/com/azure/storage/blob/ServiceSASSignatureValues.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/ServiceSASSignatureValues.java index f6b4767cada5..9fd8eaa2fc64 100644 --- a/storage/client/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 @@ -24,9 +24,9 @@ * Please see here for * more details on each value, including which are required. * - * @apiNote ## Sample Code \n [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_sas - * "Sample code for ServiceSASSignatureValues")] \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) + *

    Please see + * here + * for additional samples.

    */ final class ServiceSASSignatureValues { @@ -69,8 +69,8 @@ final class ServiceSASSignatureValues { /** * Creates an object with the specified expiry time and permissions * - * @param expiryTime - * @param permissions + * @param expiryTime Time the SAS becomes valid + * @param permissions Permissions granted by the SAS */ ServiceSASSignatureValues(OffsetDateTime expiryTime, String permissions) { this.expiryTime = expiryTime; @@ -80,7 +80,7 @@ final class ServiceSASSignatureValues { /** * Creates an object with the specified identifier * - * @param identifier + * @param identifier Identifier for the SAS */ ServiceSASSignatureValues(String identifier) { this.identifier = identifier; @@ -106,16 +106,19 @@ final class ServiceSASSignatureValues { } /** - * The version of the service this SAS will target. If not specified, it will default to the version targeted by the - * library. + * @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; } /** - * The version of the service this SAS will target. If not specified, it will default to the version targeted by the - * library. + * 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; @@ -123,14 +126,17 @@ public ServiceSASSignatureValues version(String version) { } /** - * {@link SASProtocol} + * @return the {@link SASProtocol} which determines the protocols allowed by the SAS. */ public SASProtocol protocol() { return protocol; } /** - * {@link SASProtocol} + * 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; @@ -138,14 +144,17 @@ public ServiceSASSignatureValues protocol(SASProtocol protocol) { } /** - * When the SAS will take effect. + * @return when the SAS will take effect. */ public OffsetDateTime startTime() { return startTime; } /** - * When the SAS will take effect. + * 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; @@ -153,14 +162,17 @@ public ServiceSASSignatureValues startTime(OffsetDateTime startTime) { } /** - * The time after which the SAS will no longer work. + * @return the time after which the SAS will no longer work. */ public OffsetDateTime expiryTime() { return expiryTime; } /** - * The time after which the SAS will no longer work. + * 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; @@ -168,16 +180,19 @@ public ServiceSASSignatureValues expiryTime(OffsetDateTime expiryTime) { } /** - * Please refer to either {@link ContainerSASPermission} or {@link BlobSASPermission} depending on the resource - * being accessed for help constructing the permissions string. + * @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; } /** - * Please refer to either {@link ContainerSASPermission} or {@link BlobSASPermission} depending on the resource - * being accessed for help constructing the permissions string. + * 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; @@ -185,14 +200,17 @@ public ServiceSASSignatureValues permissions(String permissions) { } /** - * {@link IPRange} + * @return the {@link IPRange} which determines the IP ranges that are allowed to use the SAS. */ public IPRange ipRange() { return ipRange; } /** - * {@link 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; @@ -200,14 +218,17 @@ public ServiceSASSignatureValues ipRange(IPRange ipRange) { } /** - * The resource the SAS user may access. + * @return the resource the SAS user may access. */ public String resource() { return resource; } /** - * The resource the SAS user may access. + * 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; @@ -215,14 +236,17 @@ public ServiceSASSignatureValues resource(String resource) { } /** - * The canonical name of the object the SAS user may access. + * @return the canonical name of the object the SAS user may access. */ public String canonicalName() { return canonicalName; } /** - * The canonical name of the object the SAS user may access. + * 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; @@ -230,34 +254,38 @@ public ServiceSASSignatureValues canonicalName(String canonicalName) { } /** - * The canonical name of the object the SAS user may access. + * Sets the canonical name of the object the SAS user may access. Constructs a canonical name of + * "/blob/{accountName}{Path of urlString}". * - * @throws RuntimeException If urlString is a malformed URL. + * @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 = null; + URL url; try { url = new URL(urlString); } catch (MalformedURLException e) { throw new RuntimeException(e); } - StringBuilder canonicalName = new StringBuilder("/blob"); - canonicalName.append('/').append(accountName).append(url.getPath()); - this.canonicalName = canonicalName.toString(); - + this.canonicalName = String.format("/blob/%s%s", accountName, url.getPath()); return this; } /** - * The specific snapshot the SAS user may access. + * @return the specific snapshot the SAS user may access. */ public String snapshotId() { return this.snapshotId; } /** - * The specific snapshot the SAS user may access. + * 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; @@ -265,7 +293,7 @@ public ServiceSASSignatureValues snapshotId(String snapshotId) { } /** - * The name of the access policy on the container this SAS references if any. Please see + * @return the name of the access policy on the container this SAS references if any. Please see * here * for more information. */ @@ -274,9 +302,12 @@ public String identifier() { } /** - * The name of the access policy on the container this SAS references if any. Please see + * 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; @@ -284,14 +315,17 @@ public ServiceSASSignatureValues identifier(String identifier) { } /** - * The cache-control header for the SAS. + * @return the cache-control header for the SAS. */ public String cacheControl() { return cacheControl; } /** - * The cache-control header for the SAS. + * 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; @@ -299,14 +333,17 @@ public ServiceSASSignatureValues cacheControl(String cacheControl) { } /** - * The content-disposition header for the SAS. + * @return the content-disposition header for the SAS. */ public String contentDisposition() { return contentDisposition; } /** - * The content-disposition header for the SAS. + * 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; @@ -314,14 +351,17 @@ public ServiceSASSignatureValues contentDisposition(String contentDisposition) { } /** - * The content-encoding header for the SAS. + * @return the content-encoding header for the SAS. */ public String contentEncoding() { return contentEncoding; } /** - * The content-encoding header for the SAS. + * 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; @@ -329,14 +369,17 @@ public ServiceSASSignatureValues contentEncoding(String contentEncoding) { } /** - * The content-language header for the SAS. + * @return the content-language header for the SAS. */ public String contentLanguage() { return contentLanguage; } /** - * The content-language header for the SAS. + * 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; @@ -344,14 +387,17 @@ public ServiceSASSignatureValues contentLanguage(String contentLanguage) { } /** - * The content-type header for the SAS. + * @return the content-type header for the SAS. */ public String contentType() { return contentType; } /** - * The content-type header for the SAS. + * 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; @@ -373,7 +419,7 @@ public SASQueryParameters generateSASQueryParameters(SharedKeyCredential sharedK // Signature is generated on the un-url-encoded values. final String stringToSign = stringToSign(); - String signature = null; + String signature; try { signature = sharedKeyCredentials.computeHmac256(stringToSign); } catch (InvalidKeyException e) { @@ -400,7 +446,7 @@ public SASQueryParameters generateSASQueryParameters(UserDelegationKey delegatio // Signature is generated on the un-url-encoded values. final String stringToSign = stringToSign(delegationKey); - String signature = null; + String signature; try { signature = Utility.delegateComputeHmac256(delegationKey, stringToSign); } catch (InvalidKeyException e) { @@ -420,21 +466,17 @@ private void assertGenerateOK(boolean usingUserDelegation) { Utility.assertNotNull("version", this.version); Utility.assertNotNull("canonicalName", this.canonicalName); - // Ensure either (expiryTime and permissions) or (identifier) is set - if (this.expiryTime == null || this.permissions == null) { - // Identifier is not required if user delegation is being used - if (!usingUserDelegation) { - Utility.assertNotNull("identifier", this.identifier); - } - } else { + // 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 (this.resource != null && this.resource.equals(Constants.UrlConstants.SAS_CONTAINER_CONSTANT)) { - if (this.snapshotId != null) { - throw new IllegalArgumentException("Cannot set a snapshotId without resource being a blob."); - } + if (Constants.UrlConstants.SAS_CONTAINER_CONSTANT.equals(this.resource) && this.snapshotId != null) { + throw new IllegalArgumentException("Cannot set a snapshotId without resource being a blob."); } } diff --git a/storage/client/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 similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/StorageException.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/StorageException.java diff --git a/storage/client/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 similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/URLParser.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/URLParser.java 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 new file mode 100644 index 000000000000..3fa8b292768d --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/UnexpectedLengthException.java @@ -0,0 +1,32 @@ +// 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/storage/client/blob/src/main/java/com/azure/storage/blob/Utility.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/Utility.java similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/Utility.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/Utility.java index 252a5e83bbaf..d22c2fc6dde2 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/Utility.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/Utility.java @@ -371,7 +371,7 @@ static URL appendToURLPath(URL baseURL, String name) { static URL stripLastPathSegment(URL baseURL) { UrlBuilder url = UrlBuilder.parse(baseURL); - if (url.path() != null || !url.path().contains("/")) { + if (url.path() == null || !url.path().contains("/")) { throw new IllegalArgumentException(String.format("URL %s does not contain path segments", baseURL)); } diff --git a/storage/client/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 similarity index 87% rename from storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java index a6f486ff075f..3439bb917017 100644 --- a/storage/client/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 @@ -4,18 +4,20 @@ package com.azure.storage.blob.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.PathParam; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; import com.azure.core.implementation.DateTimeRfc1123; import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.BodyParam; +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.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.implementation.util.Base64Util; import com.azure.core.util.Context; import com.azure.storage.blob.models.AppendBlobsAppendBlockFromUrlResponse; @@ -56,28 +58,28 @@ public final class AppendBlobsImpl { * @param client the instance of the service client containing this operation class. */ public AppendBlobsImpl(AzureBlobStorageImpl client) { - this.service = RestProxy.create(AppendBlobsService.class, client); + this.service = RestProxy.create(AppendBlobsService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for AppendBlobs to be used by - * the proxy service to perform REST calls. + * The interface defining all the services for AzureBlobStorageAppendBlobs + * to be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Blobs AppendBlob") + @ServiceInterface(name = "AzureBlobStorageAppendBlobs") private interface AppendBlobsService { - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @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); @@ -93,6 +95,7 @@ private interface AppendBlobsService { * @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, Context context) { final Integer timeout = null; final Map metadata = null; @@ -112,7 +115,7 @@ public Mono createWithRestResponseAsync(String contai String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.create(containerName, blob, this.client.url(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), 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, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -134,6 +137,7 @@ public Mono createWithRestResponseAsync(String contai * @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) { final String blobType = "AppendBlob"; String blobContentType = null; @@ -183,7 +187,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.url(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), 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, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -197,6 +201,7 @@ public Mono createWithRestResponseAsync(String contai * @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, Context context) { final Integer timeout = null; final String encryptionKey = null; @@ -212,7 +217,7 @@ public Mono appendBlockWithRestResponseAsync(Str String transactionalContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.appendBlock(containerName, blob, this.client.url(), body, timeout, contentLength, transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + 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); } /** @@ -235,6 +240,7 @@ public Mono appendBlockWithRestResponseAsync(Str * @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) { final String comp = "appendblock"; String leaseId = null; @@ -268,7 +274,7 @@ public Mono appendBlockWithRestResponseAsync(Str String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.appendBlock(containerName, blob, this.client.url(), body, timeout, contentLength, transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + 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); } /** @@ -282,6 +288,7 @@ public Mono appendBlockWithRestResponseAsync(Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @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, Context context) { final String sourceRange = null; final Integer timeout = null; @@ -299,7 +306,7 @@ public Mono appendBlockFromUrlWithRestRes DateTimeRfc1123 ifUnmodifiedSinceConverted = null; DateTimeRfc1123 sourceIfModifiedSinceConverted = null; DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; - return service.appendBlockFromUrl(containerName, blob, this.client.url(), sourceUrl, sourceRange, sourceContentMD5Converted, timeout, contentLength, this.client.version(), 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, timeout, contentLength, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -321,6 +328,7 @@ public Mono appendBlockFromUrlWithRestRes * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final String comp = "appendblock"; String leaseId = null; @@ -372,6 +380,6 @@ public Mono appendBlockFromUrlWithRestRes 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.url(), sourceUrl, sourceRange, sourceContentMD5Converted, timeout, contentLength, this.client.version(), 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, timeout, contentLength, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } } diff --git a/storage/client/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 similarity index 88% rename from storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java index c77d984c4e92..fa28f6e26d0e 100644 --- a/storage/client/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 @@ -6,10 +6,12 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; /** * A builder for creating a new instance of the AzureBlobStorage type. */ +@ServiceClientBuilder(serviceClients = AzureBlobStorageImpl.class) public final class AzureBlobStorageBuilder { /* * The URL of the service account, container, or blob that is the targe of the desired operation. @@ -65,18 +67,17 @@ public AzureBlobStorageBuilder pipeline(HttpPipeline pipeline) { * @return an instance of AzureBlobStorageImpl. */ public AzureBlobStorageImpl build() { - if (version == null) { - this.version = "2018-11-09"; - } if (pipeline == null) { this.pipeline = RestProxy.createDefaultPipeline(); } AzureBlobStorageImpl client = new AzureBlobStorageImpl(pipeline); if (this.url != null) { - client.url(this.url); + client.setUrl(this.url); } if (this.version != null) { - client.version(this.version); + client.setVersion(this.version); + } else { + client.setVersion("2018-11-09"); } return client; } diff --git a/storage/client/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 similarity index 89% rename from storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java index 6702b82da14e..5fc9bc8ae273 100644 --- a/storage/client/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 @@ -4,14 +4,13 @@ package com.azure.storage.blob.implementation; -import com.azure.core.ServiceClient; import com.azure.core.http.HttpPipeline; import com.azure.core.implementation.RestProxy; /** * Initializes a new instance of the AzureBlobStorage type. */ -public final class AzureBlobStorageImpl extends ServiceClient { +public final class AzureBlobStorageImpl { /** * The URL of the service account, container, or blob that is the targe of the desired operation. */ @@ -22,7 +21,7 @@ public final class AzureBlobStorageImpl extends ServiceClient { * * @return the url value. */ - public String url() { + public String getUrl() { return this.url; } @@ -30,11 +29,9 @@ public String url() { * Sets The URL of the service account, container, or blob that is the targe of the desired operation. * * @param url the url value. - * @return the service client itself. */ - AzureBlobStorageImpl url(String url) { + void setUrl(String url) { this.url = url; - return this; } /** @@ -47,7 +44,7 @@ AzureBlobStorageImpl url(String url) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -55,11 +52,23 @@ public String version() { * Sets Specifies the version of the operation to use for this request. * * @param version the version value. - * @return the service client itself. */ - AzureBlobStorageImpl version(String version) { + void setVersion(String version) { this.version = version; - return this; + } + + /** + * The HTTP pipeline to send requests through. + */ + private HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; } /** @@ -159,7 +168,7 @@ public AzureBlobStorageImpl() { * @param httpPipeline The HTTP pipeline to send requests through. */ public AzureBlobStorageImpl(HttpPipeline httpPipeline) { - super(httpPipeline); + this.httpPipeline = httpPipeline; this.services = new ServicesImpl(this); this.containers = new ContainersImpl(this); this.blobs = new BlobsImpl(this); diff --git a/storage/client/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 similarity index 87% rename from storage/client/blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java index e89e8972aed3..eba1efa297e4 100644 --- a/storage/client/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 @@ -4,20 +4,22 @@ package com.azure.storage.blob.implementation; -import com.azure.core.annotations.DELETE; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.GET; -import com.azure.core.annotations.HEAD; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.PathParam; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; 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.Get; +import com.azure.core.implementation.annotation.Head; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.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.implementation.util.Base64Util; import com.azure.core.util.Context; import com.azure.storage.blob.models.AccessTier; @@ -71,98 +73,98 @@ public final class BlobsImpl { * @param client the instance of the service client containing this operation class. */ public BlobsImpl(AzureBlobStorageImpl client) { - this.service = RestProxy.create(BlobsService.class, client); + this.service = RestProxy.create(BlobsService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for Blobs to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureBlobStorageBlobs to be + * used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Blobs") + @ServiceInterface(name = "AzureBlobStorageBlobs") private interface BlobsService { - @GET("{containerName}/{blob}") + @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); - @HEAD("{containerName}/{blob}") + @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); - @DELETE("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono undelete(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono setHTTPHeaders(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono acquireLease(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-duration") Integer duration, @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, @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}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono releaseLease(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, @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}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono renewLease(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, @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}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono changeLease(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, @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}") + @Put("{containerName}/{blob}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono breakLease(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, @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}") + @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); - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({204}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono abortCopyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("copyid") String copyId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-copy-action") String copyActionAbortConstant, @HeaderParam("x-ms-lease-id") String leaseId, Context context); - @PUT("{containerName}/{blob}") + @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); - @GET("{containerName}/{blob}") + @Get("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getAccountInfo(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @@ -177,6 +179,7 @@ private interface BlobsService { * @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, Context context) { final String snapshot = null; final String versionId = null; @@ -192,7 +195,7 @@ public Mono downloadWithRestResponseAsync(String containe final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.download(containerName, blob, this.client.url(), snapshot, versionId, timeout, range, rangeGetContentMD5, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + 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); } /** @@ -215,6 +218,7 @@ public Mono downloadWithRestResponseAsync(String containe * @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) { String leaseId = null; if (leaseAccessConditions != null) { @@ -238,7 +242,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.url(), snapshot, versionId, timeout, range, rangeGetContentMD5, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + 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); } /** @@ -250,6 +254,7 @@ public Mono downloadWithRestResponseAsync(String containe * @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, Context context) { final String snapshot = null; final String versionId = null; @@ -263,7 +268,7 @@ public Mono getPropertiesWithRestResponseAsync(Strin final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.getProperties(containerName, blob, this.client.url(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -284,6 +289,7 @@ public Mono getPropertiesWithRestResponseAsync(Strin * @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) { String leaseId = null; if (leaseAccessConditions != null) { @@ -307,11 +313,11 @@ 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.url(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** - * 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 storage 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. + * 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. * * @param containerName The container name. * @param blob The blob name. @@ -319,6 +325,7 @@ public Mono getPropertiesWithRestResponseAsync(Strin * @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 containerName, String blob, Context context) { final String snapshot = null; final String versionId = null; @@ -330,11 +337,11 @@ public Mono deleteWithRestResponseAsync(String containerNam final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.delete(containerName, blob, this.client.url(), snapshot, versionId, timeout, deleteSnapshots, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.delete(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, deleteSnapshots, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** - * 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 storage 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. + * 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. * * @param containerName The container name. * @param blob The blob name. @@ -349,6 +356,7 @@ public Mono deleteWithRestResponseAsync(String containerNam * @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 containerName, String blob, String snapshot, String versionId, Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { String leaseId = null; if (leaseAccessConditions != null) { @@ -372,7 +380,7 @@ 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.url(), snapshot, versionId, timeout, deleteSnapshots, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.delete(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, deleteSnapshots, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -384,11 +392,12 @@ public Mono deleteWithRestResponseAsync(String containerNam * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono undeleteWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final String requestId = null; final String comp = "undelete"; - return service.undelete(containerName, blob, this.client.url(), timeout, this.client.version(), requestId, comp, context); + return service.undelete(containerName, blob, this.client.getUrl(), timeout, this.client.getVersion(), requestId, comp, context); } /** @@ -402,9 +411,10 @@ public Mono undeleteWithRestResponseAsync(String containe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono undeleteWithRestResponseAsync(String containerName, String blob, Integer timeout, String requestId, Context context) { final String comp = "undelete"; - return service.undelete(containerName, blob, this.client.url(), timeout, this.client.version(), requestId, comp, context); + return service.undelete(containerName, blob, this.client.getUrl(), timeout, this.client.getVersion(), requestId, comp, context); } /** @@ -416,6 +426,7 @@ public Mono undeleteWithRestResponseAsync(String containe * @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 containerName, String blob, Context context) { final Integer timeout = null; final String requestId = null; @@ -431,7 +442,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.setHTTPHeaders(containerName, blob, this.client.url(), timeout, this.client.version(), requestId, comp, blobCacheControl, blobContentType, blobContentMD5Converted, blobContentEncoding, blobContentLanguage, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.setHTTPHeaders(containerName, blob, this.client.getUrl(), timeout, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentMD5Converted, blobContentEncoding, blobContentLanguage, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -448,6 +459,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str * @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 containerName, String blob, Integer timeout, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "properties"; String blobCacheControl = null; @@ -497,7 +509,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setHTTPHeaders(containerName, blob, this.client.url(), timeout, this.client.version(), requestId, comp, blobCacheControl, blobContentType, blobContentMD5Converted, blobContentEncoding, blobContentLanguage, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.setHTTPHeaders(containerName, blob, this.client.getUrl(), timeout, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentMD5Converted, blobContentEncoding, blobContentLanguage, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -509,6 +521,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str * @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, Context context) { final Integer timeout = null; final Map metadata = null; @@ -522,7 +535,7 @@ public Mono setMetadataWithRestResponseAsync(String co final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.setMetadata(containerName, blob, this.client.url(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -542,6 +555,7 @@ public Mono setMetadataWithRestResponseAsync(String co * @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) { final String comp = "metadata"; String leaseId = null; @@ -566,7 +580,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.url(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -578,6 +592,7 @@ public Mono setMetadataWithRestResponseAsync(String co * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono acquireLeaseWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final Integer duration = null; @@ -589,7 +604,7 @@ public Mono acquireLeaseWithRestResponseAsync(String final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.acquireLease(containerName, blob, this.client.url(), timeout, duration, proposedLeaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.acquireLease(containerName, blob, this.client.getUrl(), timeout, duration, proposedLeaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -606,6 +621,7 @@ public Mono acquireLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono acquireLeaseWithRestResponseAsync(String containerName, String blob, Integer timeout, Integer duration, String proposedLeaseId, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String action = "acquire"; @@ -627,7 +643,7 @@ public Mono acquireLeaseWithRestResponseAsync(String } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.acquireLease(containerName, blob, this.client.url(), timeout, duration, proposedLeaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.acquireLease(containerName, blob, this.client.getUrl(), timeout, duration, proposedLeaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -640,6 +656,7 @@ public Mono acquireLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono releaseLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, Context context) { final Integer timeout = null; final String requestId = null; @@ -649,7 +666,7 @@ public Mono releaseLeaseWithRestResponseAsync(String final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.releaseLease(containerName, blob, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.releaseLease(containerName, blob, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -665,6 +682,7 @@ public Mono releaseLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono releaseLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String action = "release"; @@ -686,7 +704,7 @@ public Mono releaseLeaseWithRestResponseAsync(String } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.releaseLease(containerName, blob, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.releaseLease(containerName, blob, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -699,6 +717,7 @@ public Mono releaseLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono renewLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, Context context) { final Integer timeout = null; final String requestId = null; @@ -708,7 +727,7 @@ public Mono renewLeaseWithRestResponseAsync(String cont final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.renewLease(containerName, blob, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.renewLease(containerName, blob, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -724,6 +743,7 @@ public Mono renewLeaseWithRestResponseAsync(String cont * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono renewLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String action = "renew"; @@ -745,7 +765,7 @@ public Mono renewLeaseWithRestResponseAsync(String cont } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.renewLease(containerName, blob, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.renewLease(containerName, blob, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -759,6 +779,7 @@ public Mono renewLeaseWithRestResponseAsync(String cont * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono changeLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, String proposedLeaseId, Context context) { final Integer timeout = null; final String requestId = null; @@ -768,7 +789,7 @@ public Mono changeLeaseWithRestResponseAsync(String co final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.changeLease(containerName, blob, this.client.url(), timeout, leaseId, proposedLeaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.changeLease(containerName, blob, this.client.getUrl(), timeout, leaseId, proposedLeaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -785,6 +806,7 @@ public Mono changeLeaseWithRestResponseAsync(String co * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono changeLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, String proposedLeaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String action = "change"; @@ -806,7 +828,7 @@ public Mono changeLeaseWithRestResponseAsync(String co } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.changeLease(containerName, blob, this.client.url(), timeout, leaseId, proposedLeaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.changeLease(containerName, blob, this.client.getUrl(), timeout, leaseId, proposedLeaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -818,6 +840,7 @@ public Mono changeLeaseWithRestResponseAsync(String co * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono breakLeaseWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final Integer breakPeriod = null; @@ -828,7 +851,7 @@ public Mono breakLeaseWithRestResponseAsync(String cont final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.breakLease(containerName, blob, this.client.url(), timeout, breakPeriod, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.breakLease(containerName, blob, this.client.getUrl(), timeout, breakPeriod, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -844,6 +867,7 @@ public Mono breakLeaseWithRestResponseAsync(String cont * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono breakLeaseWithRestResponseAsync(String containerName, String blob, Integer timeout, Integer breakPeriod, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String action = "break"; @@ -865,7 +889,7 @@ public Mono breakLeaseWithRestResponseAsync(String cont } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.breakLease(containerName, blob, this.client.url(), timeout, breakPeriod, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.breakLease(containerName, blob, this.client.getUrl(), timeout, breakPeriod, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -877,6 +901,7 @@ public Mono breakLeaseWithRestResponseAsync(String cont * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono createSnapshotWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final Map metadata = null; @@ -890,7 +915,7 @@ public Mono createSnapshotWithRestResponseAsync(Str final String leaseId = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.createSnapshot(containerName, blob, this.client.url(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -910,6 +935,7 @@ public Mono createSnapshotWithRestResponseAsync(Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final String comp = "snapshot"; OffsetDateTime ifModifiedSince = null; @@ -934,7 +960,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.url(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -947,6 +973,7 @@ public Mono createSnapshotWithRestResponseAsync(Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { final Integer timeout = null; final Map metadata = null; @@ -960,7 +987,7 @@ public Mono startCopyFromURLWithRestResponseAsync DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.startCopyFromURL(containerName, blob, this.client.url(), timeout, metadata, copySource, this.client.version(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + 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); } /** @@ -979,6 +1006,7 @@ public Mono startCopyFromURLWithRestResponseAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { OffsetDateTime sourceIfModifiedSince = null; if (sourceModifiedAccessConditions != null) { @@ -1020,7 +1048,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.url(), timeout, metadata, copySource, this.client.version(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + 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); } /** @@ -1033,6 +1061,7 @@ public Mono startCopyFromURLWithRestResponseAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { final Integer timeout = null; final Map metadata = null; @@ -1047,7 +1076,7 @@ public Mono copyFromURLWithRestResponseAsync(String co DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.copyFromURL(containerName, blob, this.client.url(), timeout, metadata, copySource, this.client.version(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + 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); } /** @@ -1066,6 +1095,7 @@ public Mono copyFromURLWithRestResponseAsync(String co * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final String xMsRequiresSync = "true"; OffsetDateTime sourceIfModifiedSince = null; @@ -1108,7 +1138,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.url(), timeout, metadata, copySource, this.client.version(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + 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); } /** @@ -1121,13 +1151,14 @@ public Mono copyFromURLWithRestResponseAsync(String co * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono abortCopyFromURLWithRestResponseAsync(String containerName, String blob, String copyId, Context context) { final Integer timeout = null; final String requestId = null; final String comp = "copy"; final String copyActionAbortConstant = "abort"; final String leaseId = null; - return service.abortCopyFromURL(containerName, blob, this.client.url(), copyId, timeout, this.client.version(), requestId, comp, copyActionAbortConstant, leaseId, context); + return service.abortCopyFromURL(containerName, blob, this.client.getUrl(), copyId, timeout, this.client.getVersion(), requestId, comp, copyActionAbortConstant, leaseId, context); } /** @@ -1143,6 +1174,7 @@ public Mono abortCopyFromURLWithRestResponseAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono abortCopyFromURLWithRestResponseAsync(String containerName, String blob, String copyId, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { final String comp = "copy"; final String copyActionAbortConstant = "abort"; @@ -1150,7 +1182,7 @@ public Mono abortCopyFromURLWithRestResponseAsync if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } - return service.abortCopyFromURL(containerName, blob, this.client.url(), copyId, timeout, this.client.version(), requestId, comp, copyActionAbortConstant, leaseId, context); + return service.abortCopyFromURL(containerName, blob, this.client.getUrl(), copyId, timeout, this.client.getVersion(), requestId, comp, copyActionAbortConstant, leaseId, context); } /** @@ -1163,12 +1195,13 @@ public Mono abortCopyFromURLWithRestResponseAsync * @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) { final Integer timeout = null; final String requestId = null; final String comp = "tier"; final String leaseId = null; - return service.setTier(containerName, blob, this.client.url(), timeout, tier, this.client.version(), requestId, comp, leaseId, context); + return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -1184,13 +1217,14 @@ public Mono setTierWithRestResponseAsync(String containerN * @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, Integer timeout, 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.url(), timeout, tier, this.client.version(), requestId, comp, leaseId, context); + return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -1202,9 +1236,10 @@ public Mono setTierWithRestResponseAsync(String containerN * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccountInfoWithRestResponseAsync(String containerName, String blob, Context context) { final String restype = "account"; final String comp = "properties"; - return service.getAccountInfo(containerName, blob, this.client.url(), this.client.version(), restype, comp, context); + return service.getAccountInfo(containerName, blob, this.client.getUrl(), this.client.getVersion(), restype, comp, context); } } diff --git a/storage/client/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 similarity index 88% rename from storage/client/blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java index 2c4645d2bd4b..390c2436de9a 100644 --- a/storage/client/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 @@ -4,19 +4,21 @@ package com.azure.storage.blob.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.GET; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.PathParam; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; import com.azure.core.implementation.DateTimeRfc1123; import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.BodyParam; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.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.implementation.util.Base64Util; import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobHTTPHeaders; @@ -33,12 +35,11 @@ import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.blob.models.StorageErrorException; import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - import java.net.URL; import java.time.OffsetDateTime; import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; /** * An instance of this class provides access to all the operations defined in @@ -61,38 +62,38 @@ public final class BlockBlobsImpl { * @param client the instance of the service client containing this operation class. */ public BlockBlobsImpl(AzureBlobStorageImpl client) { - this.service = RestProxy.create(BlockBlobsService.class, client); + this.service = RestProxy.create(BlockBlobsService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for BlockBlobs to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureBlobStorageBlockBlobs + * to be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Blobs BlockBlob") + @ServiceInterface(name = "AzureBlobStorageBlockBlobs") private interface BlockBlobsService { - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @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); - @GET("{containerName}/{blob}") + @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); @@ -109,6 +110,7 @@ private interface BlockBlobsService { * @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, Context context) { final Integer timeout = null; final Map metadata = null; @@ -128,7 +130,7 @@ public Mono uploadWithRestResponseAsync(String contain String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.upload(containerName, blob, this.client.url(), body, timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), 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, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -151,6 +153,7 @@ public Mono uploadWithRestResponseAsync(String contain * @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) { final String blobType = "BlockBlob"; String blobContentType = null; @@ -200,7 +203,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.url(), body, timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), 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, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -215,6 +218,7 @@ public Mono uploadWithRestResponseAsync(String contain * @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, Context context) { final Integer timeout = null; final String encryptionKey = null; @@ -224,7 +228,7 @@ public Mono stageBlockWithRestResponseAsync(String final String comp = "block"; final String leaseId = null; String transactionalContentMD5Converted = null; - return service.stageBlock(containerName, blob, this.client.url(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, context); + return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -246,6 +250,7 @@ public Mono stageBlockWithRestResponseAsync(String * @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) { final String comp = "block"; String leaseId = null; @@ -253,7 +258,7 @@ public Mono stageBlockWithRestResponseAsync(String leaseId = leaseAccessConditions.leaseId(); } String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); - return service.stageBlock(containerName, blob, this.client.url(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, context); + return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -268,6 +273,7 @@ public Mono stageBlockWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono stageBlockFromURLWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, URL sourceUrl, Context context) { final String sourceRange = null; final Integer timeout = null; @@ -282,7 +288,7 @@ public Mono stageBlockFromURLWithRestRespon String sourceContentMD5Converted = null; DateTimeRfc1123 sourceIfModifiedSinceConverted = null; DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; - return service.stageBlockFromURL(containerName, blob, this.client.url(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + 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); } /** @@ -306,6 +312,7 @@ public Mono stageBlockFromURLWithRestRespon * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final String comp = "block"; String leaseId = null; @@ -331,7 +338,7 @@ public Mono stageBlockFromURLWithRestRespon String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.stageBlockFromURL(containerName, blob, this.client.url(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + 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); } /** @@ -344,6 +351,7 @@ public Mono stageBlockFromURLWithRestRespon * @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, Context context) { final Integer timeout = null; final Map metadata = null; @@ -363,7 +371,7 @@ public Mono commitBlockListWithRestResponseAs String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.commitBlockList(containerName, blob, this.client.url(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blocks, this.client.version(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + 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); } /** @@ -385,6 +393,7 @@ public Mono commitBlockListWithRestResponseAs * @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) { final String comp = "blocklist"; String blobCacheControl = null; @@ -434,7 +443,7 @@ public Mono commitBlockListWithRestResponseAs 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.url(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blocks, this.client.version(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + 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); } /** @@ -447,6 +456,7 @@ public Mono commitBlockListWithRestResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getBlockListWithRestResponseAsync(String containerName, String blob, BlockListType listType, Context context) { final String snapshot = null; final String versionId = null; @@ -454,7 +464,7 @@ public Mono getBlockListWithRestResponseAsync(St final String requestId = null; final String comp = "blocklist"; final String leaseId = null; - return service.getBlockList(containerName, blob, this.client.url(), snapshot, versionId, listType, timeout, this.client.version(), requestId, comp, leaseId, context); + return service.getBlockList(containerName, blob, this.client.getUrl(), snapshot, versionId, listType, timeout, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -472,12 +482,13 @@ public Mono getBlockListWithRestResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final String comp = "blocklist"; String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } - return service.getBlockList(containerName, blob, this.client.url(), snapshot, versionId, listType, timeout, this.client.version(), requestId, comp, leaseId, context); + return service.getBlockList(containerName, blob, this.client.getUrl(), snapshot, versionId, listType, timeout, this.client.getVersion(), requestId, comp, leaseId, context); } } diff --git a/storage/client/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 similarity index 87% rename from storage/client/blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java index 780b3a356a61..efb3b64cdf8b 100644 --- a/storage/client/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 @@ -4,21 +4,23 @@ package com.azure.storage.blob.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.DELETE; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.GET; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.PathParam; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; import com.azure.core.implementation.CollectionFormat; import com.azure.core.implementation.DateTimeRfc1123; import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.BodyParam; +import com.azure.core.implementation.annotation.Delete; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.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.implementation.serializer.jackson.JacksonAdapter; import com.azure.core.util.Context; import com.azure.storage.blob.models.ContainersAcquireLeaseResponse; @@ -41,11 +43,10 @@ import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.SignedIdentifier; import com.azure.storage.blob.models.StorageErrorException; -import reactor.core.publisher.Mono; - import java.time.OffsetDateTime; import java.util.List; import java.util.Map; +import reactor.core.publisher.Mono; /** * An instance of this class provides access to all the operations defined in @@ -68,83 +69,83 @@ public final class ContainersImpl { * @param client the instance of the service client containing this operation class. */ public ContainersImpl(AzureBlobStorageImpl client) { - this.service = RestProxy.create(ContainersService.class, client); + this.service = RestProxy.create(ContainersService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for Containers to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureBlobStorageContainers + * to be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Blobs Containers") + @ServiceInterface(name = "AzureBlobStorageContainers") private interface ContainersService { - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono create(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-blob-public-access") PublicAccessType access, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, Context context); - @GET("{containerName}") + @Get("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getProperties(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-id") String leaseId, Context context); - @DELETE("{containerName}") + @Delete("{containerName}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono delete(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono setMetadata(@PathParam("containerName") String containerName, @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("restype") String restype, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, Context context); - @GET("{containerName}") + @Get("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getAccessPolicy(@PathParam("containerName") String containerName, @HostParam("url") String url, @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, @HeaderParam("x-ms-lease-id") String leaseId, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono setAccessPolicy(@PathParam("containerName") String containerName, @HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") SignedIdentifiersWrapper containerAcl, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-blob-public-access") PublicAccessType access, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono acquireLease(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-duration") Integer duration, @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono releaseLease(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono renewLease(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono breakLease(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono changeLease(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @GET("{containerName}") + @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); - @GET("{containerName}") + @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); - @GET("{containerName}") + @Get("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getAccountInfo(@PathParam("containerName") String containerName, @HostParam("url") String url, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @@ -158,13 +159,14 @@ private interface ContainersService { * @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, Context context) { final Integer timeout = null; final Map metadata = null; final PublicAccessType access = null; final String requestId = null; final String restype = "container"; - return service.create(containerName, this.client.url(), timeout, metadata, access, this.client.version(), requestId, restype, context); + return service.create(containerName, this.client.getUrl(), timeout, metadata, access, this.client.getVersion(), requestId, restype, context); } /** @@ -179,9 +181,10 @@ public Mono createWithRestResponseAsync(String contain * @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, Integer timeout, Map metadata, PublicAccessType access, String requestId, Context context) { final String restype = "container"; - return service.create(containerName, this.client.url(), timeout, metadata, access, this.client.version(), requestId, restype, context); + return service.create(containerName, this.client.getUrl(), timeout, metadata, access, this.client.getVersion(), requestId, restype, context); } /** @@ -192,12 +195,13 @@ public Mono createWithRestResponseAsync(String contain * @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, Context context) { final Integer timeout = null; final String requestId = null; final String restype = "container"; final String leaseId = null; - return service.getProperties(containerName, this.client.url(), timeout, this.client.version(), requestId, restype, leaseId, context); + return service.getProperties(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, leaseId, context); } /** @@ -211,13 +215,14 @@ public Mono getPropertiesWithRestResponseAsync( * @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, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { final String restype = "container"; String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } - return service.getProperties(containerName, this.client.url(), timeout, this.client.version(), requestId, restype, leaseId, context); + return service.getProperties(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, leaseId, context); } /** @@ -228,6 +233,7 @@ public Mono getPropertiesWithRestResponseAsync( * @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 containerName, Context context) { final Integer timeout = null; final String requestId = null; @@ -235,7 +241,7 @@ public Mono deleteWithRestResponseAsync(String contain final String leaseId = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.delete(containerName, this.client.url(), timeout, this.client.version(), requestId, restype, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.delete(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -250,6 +256,7 @@ public Mono deleteWithRestResponseAsync(String contain * @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 containerName, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String restype = "container"; String leaseId = null; @@ -266,7 +273,7 @@ public Mono deleteWithRestResponseAsync(String contain } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.delete(containerName, this.client.url(), timeout, this.client.version(), requestId, restype, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.delete(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -277,6 +284,7 @@ public Mono deleteWithRestResponseAsync(String contain * @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, Context context) { final Integer timeout = null; final Map metadata = null; @@ -285,7 +293,7 @@ public Mono setMetadataWithRestResponseAsync(Stri final String comp = "metadata"; final String leaseId = null; DateTimeRfc1123 ifModifiedSinceConverted = null; - return service.setMetadata(containerName, this.client.url(), timeout, metadata, this.client.version(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, context); + return service.setMetadata(containerName, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, context); } /** @@ -301,6 +309,7 @@ public Mono setMetadataWithRestResponseAsync(Stri * @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, Integer timeout, Map metadata, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String restype = "container"; final String comp = "metadata"; @@ -313,7 +322,7 @@ public Mono setMetadataWithRestResponseAsync(Stri ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); - return service.setMetadata(containerName, this.client.url(), timeout, metadata, this.client.version(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, context); + return service.setMetadata(containerName, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, context); } /** @@ -324,13 +333,14 @@ public Mono setMetadataWithRestResponseAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccessPolicyWithRestResponseAsync(String containerName, Context context) { final Integer timeout = null; final String requestId = null; final String restype = "container"; final String comp = "acl"; final String leaseId = null; - return service.getAccessPolicy(containerName, this.client.url(), timeout, this.client.version(), requestId, restype, comp, leaseId, context); + return service.getAccessPolicy(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, leaseId, context); } /** @@ -344,6 +354,7 @@ public Mono getAccessPolicyWithRestResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccessPolicyWithRestResponseAsync(String containerName, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { final String restype = "container"; final String comp = "acl"; @@ -351,7 +362,7 @@ public Mono getAccessPolicyWithRestResponseAs if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } - return service.getAccessPolicy(containerName, this.client.url(), timeout, this.client.version(), requestId, restype, comp, leaseId, context); + return service.getAccessPolicy(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, leaseId, context); } /** @@ -362,6 +373,7 @@ public Mono getAccessPolicyWithRestResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono setAccessPolicyWithRestResponseAsync(String containerName, Context context) { final Integer timeout = null; final PublicAccessType access = null; @@ -372,7 +384,7 @@ public Mono setAccessPolicyWithRestResponseAs SignedIdentifiersWrapper containerAclConverted = new SignedIdentifiersWrapper(null); DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.setAccessPolicy(containerName, this.client.url(), containerAclConverted, timeout, access, this.client.version(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.setAccessPolicy(containerName, this.client.getUrl(), containerAclConverted, timeout, access, this.client.getVersion(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -389,6 +401,7 @@ public Mono setAccessPolicyWithRestResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono setAccessPolicyWithRestResponseAsync(String containerName, List containerAcl, Integer timeout, PublicAccessType access, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String restype = "container"; final String comp = "acl"; @@ -407,7 +420,7 @@ public Mono setAccessPolicyWithRestResponseAs SignedIdentifiersWrapper containerAclConverted = new SignedIdentifiersWrapper(containerAcl); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setAccessPolicy(containerName, this.client.url(), containerAclConverted, timeout, access, this.client.version(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.setAccessPolicy(containerName, this.client.getUrl(), containerAclConverted, timeout, access, this.client.getVersion(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -418,6 +431,7 @@ public Mono setAccessPolicyWithRestResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono acquireLeaseWithRestResponseAsync(String containerName, Context context) { final Integer timeout = null; final Integer duration = null; @@ -428,7 +442,7 @@ public Mono acquireLeaseWithRestResponseAsync(St final String action = "acquire"; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.acquireLease(containerName, this.client.url(), timeout, duration, proposedLeaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.acquireLease(containerName, this.client.getUrl(), timeout, duration, proposedLeaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -444,6 +458,7 @@ public Mono acquireLeaseWithRestResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono acquireLeaseWithRestResponseAsync(String containerName, Integer timeout, Integer duration, String proposedLeaseId, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String restype = "container"; @@ -458,7 +473,7 @@ public Mono acquireLeaseWithRestResponseAsync(St } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.acquireLease(containerName, this.client.url(), timeout, duration, proposedLeaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.acquireLease(containerName, this.client.getUrl(), timeout, duration, proposedLeaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -470,6 +485,7 @@ public Mono acquireLeaseWithRestResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono releaseLeaseWithRestResponseAsync(String containerName, String leaseId, Context context) { final Integer timeout = null; final String requestId = null; @@ -478,7 +494,7 @@ public Mono releaseLeaseWithRestResponseAsync(St final String action = "release"; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.releaseLease(containerName, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.releaseLease(containerName, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -493,6 +509,7 @@ public Mono releaseLeaseWithRestResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono releaseLeaseWithRestResponseAsync(String containerName, String leaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String restype = "container"; @@ -507,7 +524,7 @@ public Mono releaseLeaseWithRestResponseAsync(St } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.releaseLease(containerName, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.releaseLease(containerName, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -519,6 +536,7 @@ public Mono releaseLeaseWithRestResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono renewLeaseWithRestResponseAsync(String containerName, String leaseId, Context context) { final Integer timeout = null; final String requestId = null; @@ -527,7 +545,7 @@ public Mono renewLeaseWithRestResponseAsync(String final String action = "renew"; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.renewLease(containerName, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.renewLease(containerName, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -542,6 +560,7 @@ public Mono renewLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono renewLeaseWithRestResponseAsync(String containerName, String leaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String restype = "container"; @@ -556,7 +575,7 @@ public Mono renewLeaseWithRestResponseAsync(String } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.renewLease(containerName, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.renewLease(containerName, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -567,6 +586,7 @@ public Mono renewLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono breakLeaseWithRestResponseAsync(String containerName, Context context) { final Integer timeout = null; final Integer breakPeriod = null; @@ -576,7 +596,7 @@ public Mono breakLeaseWithRestResponseAsync(String final String action = "break"; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.breakLease(containerName, this.client.url(), timeout, breakPeriod, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.breakLease(containerName, this.client.getUrl(), timeout, breakPeriod, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -591,6 +611,7 @@ public Mono breakLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono breakLeaseWithRestResponseAsync(String containerName, Integer timeout, Integer breakPeriod, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String restype = "container"; @@ -605,7 +626,7 @@ public Mono breakLeaseWithRestResponseAsync(String } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.breakLease(containerName, this.client.url(), timeout, breakPeriod, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.breakLease(containerName, this.client.getUrl(), timeout, breakPeriod, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -618,6 +639,7 @@ public Mono breakLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono changeLeaseWithRestResponseAsync(String containerName, String leaseId, String proposedLeaseId, Context context) { final Integer timeout = null; final String requestId = null; @@ -626,7 +648,7 @@ public Mono changeLeaseWithRestResponseAsync(Stri final String action = "change"; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.changeLease(containerName, this.client.url(), timeout, leaseId, proposedLeaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.changeLease(containerName, this.client.getUrl(), timeout, leaseId, proposedLeaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -642,6 +664,7 @@ public Mono changeLeaseWithRestResponseAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono changeLeaseWithRestResponseAsync(String containerName, String leaseId, String proposedLeaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String restype = "container"; @@ -656,7 +679,7 @@ public Mono changeLeaseWithRestResponseAsync(Stri } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.changeLease(containerName, this.client.url(), timeout, leaseId, proposedLeaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.changeLease(containerName, this.client.getUrl(), timeout, leaseId, proposedLeaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -667,6 +690,7 @@ public Mono changeLeaseWithRestResponseAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listBlobFlatSegmentWithRestResponseAsync(String containerName, Context context) { final String prefix = null; final String marker = null; @@ -676,7 +700,7 @@ public Mono listBlobFlatSegmentWithRestRe final String restype = "container"; final String comp = "list"; String includeConverted = null; - return service.listBlobFlatSegment(containerName, this.client.url(), prefix, marker, maxresults, includeConverted, timeout, this.client.version(), requestId, restype, comp, context); + return service.listBlobFlatSegment(containerName, this.client.getUrl(), prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -693,11 +717,12 @@ public Mono listBlobFlatSegmentWithRestRe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listBlobFlatSegmentWithRestResponseAsync(String containerName, String prefix, String marker, Integer maxresults, List include, Integer timeout, String requestId, Context context) { final String restype = "container"; final String comp = "list"; String includeConverted = JacksonAdapter.createDefaultSerializerAdapter().serializeList(include, CollectionFormat.CSV); - return service.listBlobFlatSegment(containerName, this.client.url(), prefix, marker, maxresults, includeConverted, timeout, this.client.version(), requestId, restype, comp, context); + return service.listBlobFlatSegment(containerName, this.client.getUrl(), prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -709,6 +734,7 @@ public Mono listBlobFlatSegmentWithRestRe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listBlobHierarchySegmentWithRestResponseAsync(String containerName, String delimiter, Context context) { final String prefix = null; final String marker = null; @@ -718,7 +744,7 @@ public Mono listBlobHierarchySegment final String restype = "container"; final String comp = "list"; String includeConverted = null; - return service.listBlobHierarchySegment(containerName, this.client.url(), prefix, delimiter, marker, maxresults, includeConverted, timeout, this.client.version(), requestId, restype, comp, context); + return service.listBlobHierarchySegment(containerName, this.client.getUrl(), prefix, delimiter, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -736,11 +762,12 @@ public Mono listBlobHierarchySegment * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listBlobHierarchySegmentWithRestResponseAsync(String containerName, String delimiter, String prefix, String marker, Integer maxresults, List include, Integer timeout, String requestId, Context context) { final String restype = "container"; final String comp = "list"; String includeConverted = JacksonAdapter.createDefaultSerializerAdapter().serializeList(include, CollectionFormat.CSV); - return service.listBlobHierarchySegment(containerName, this.client.url(), prefix, delimiter, marker, maxresults, includeConverted, timeout, this.client.version(), requestId, restype, comp, context); + return service.listBlobHierarchySegment(containerName, this.client.getUrl(), prefix, delimiter, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -751,9 +778,10 @@ public Mono listBlobHierarchySegment * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccountInfoWithRestResponseAsync(String containerName, Context context) { final String restype = "account"; final String comp = "properties"; - return service.getAccountInfo(containerName, this.client.url(), this.client.version(), restype, comp, context); + return service.getAccountInfo(containerName, this.client.getUrl(), this.client.getVersion(), restype, comp, context); } } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/ListBlobsIncludeItemWrapper.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ListBlobsIncludeItemWrapper.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/implementation/ListBlobsIncludeItemWrapper.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ListBlobsIncludeItemWrapper.java diff --git a/storage/client/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 similarity index 89% rename from storage/client/blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java index f6f6d23380cd..97dd44b22bc5 100644 --- a/storage/client/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 @@ -4,19 +4,21 @@ package com.azure.storage.blob.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.GET; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.PathParam; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; import com.azure.core.implementation.DateTimeRfc1123; import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.BodyParam; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.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.implementation.util.Base64Util; import com.azure.core.util.Context; import com.azure.storage.blob.models.BlobHTTPHeaders; @@ -37,12 +39,11 @@ import com.azure.storage.blob.models.SourceModifiedAccessConditions; import com.azure.storage.blob.models.StorageErrorException; import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - import java.net.URL; import java.time.OffsetDateTime; import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; /** * An instance of this class provides access to all the operations defined in @@ -65,58 +66,58 @@ public final class PageBlobsImpl { * @param client the instance of the service client containing this operation class. */ public PageBlobsImpl(AzureBlobStorageImpl client) { - this.service = RestProxy.create(PageBlobsService.class, client); + this.service = RestProxy.create(PageBlobsService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for PageBlobs to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureBlobStoragePageBlobs to + * be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Blobs PageBlobs") + @ServiceInterface(name = "AzureBlobStoragePageBlobs") private interface PageBlobsService { - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono clearPages(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @HeaderParam("Content-Length") long contentLength, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); - @PUT("{containerName}/{blob}") + @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); - @GET("{containerName}/{blob}") + @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); - @GET("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono resize(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-blob-content-length") long blobContentLength, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono updateSequenceNumber(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-sequence-number-action") SequenceNumberActionType sequenceNumberAction, @HeaderParam("x-ms-blob-sequence-number") Long blobSequenceNumber, @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}") + @Put("{containerName}/{blob}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono copyIncremental(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-copy-source") URL copySource, @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, Context context); @@ -133,6 +134,7 @@ private interface PageBlobsService { * @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, Context context) { final Integer timeout = null; final Map metadata = null; @@ -153,7 +155,7 @@ public Mono createWithRestResponseAsync(String containe String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.create(containerName, blob, this.client.url(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blobContentLength, blobSequenceNumber, this.client.version(), 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, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -177,6 +179,7 @@ public Mono createWithRestResponseAsync(String containe * @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) { final String blobType = "PageBlob"; String blobContentType = null; @@ -226,7 +229,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.url(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blobContentLength, blobSequenceNumber, this.client.version(), 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, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -240,6 +243,7 @@ public Mono createWithRestResponseAsync(String containe * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final Integer timeout = null; final String range = null; @@ -258,7 +262,7 @@ public Mono uploadPagesWithRestResponseAsync(Strin String transactionalContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.uploadPages(containerName, blob, this.client.url(), body, contentLength, transactionalContentMD5Converted, timeout, range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + 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); } /** @@ -282,6 +286,7 @@ public Mono uploadPagesWithRestResponseAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final String comp = "page"; final String pageWrite = "update"; @@ -320,7 +325,7 @@ public Mono uploadPagesWithRestResponseAsync(Strin String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.uploadPages(containerName, blob, this.client.url(), body, contentLength, transactionalContentMD5Converted, timeout, range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + 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); } /** @@ -333,6 +338,7 @@ public Mono uploadPagesWithRestResponseAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono clearPagesWithRestResponseAsync(String containerName, String blob, long contentLength, Context context) { final Integer timeout = null; final String range = null; @@ -347,7 +353,7 @@ public Mono clearPagesWithRestResponseAsync(String final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.clearPages(containerName, blob, this.client.url(), contentLength, timeout, range, this.client.version(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.clearPages(containerName, blob, this.client.getUrl(), contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -366,6 +372,7 @@ public Mono clearPagesWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono clearPagesWithRestResponseAsync(String containerName, String blob, long contentLength, Integer timeout, String range, String requestId, LeaseAccessConditions leaseAccessConditions, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "page"; final String pageWrite = "clear"; @@ -403,7 +410,7 @@ public Mono clearPagesWithRestResponseAsync(String } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.clearPages(containerName, blob, this.client.url(), contentLength, timeout, range, this.client.version(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.clearPages(containerName, blob, this.client.getUrl(), contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -419,6 +426,7 @@ public Mono clearPagesWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono uploadPagesFromURLWithRestResponseAsync(String containerName, String blob, URL sourceUrl, String sourceRange, long contentLength, String range, Context context) { final Integer timeout = null; final String requestId = null; @@ -437,7 +445,7 @@ public Mono uploadPagesFromURLWithRestRespo DateTimeRfc1123 ifUnmodifiedSinceConverted = null; DateTimeRfc1123 sourceIfModifiedSinceConverted = null; DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; - return service.uploadPagesFromURL(containerName, blob, this.client.url(), sourceUrl, sourceRange, sourceContentMD5Converted, contentLength, timeout, range, this.client.version(), 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, contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -460,6 +468,7 @@ public Mono uploadPagesFromURLWithRestRespo * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final String comp = "page"; final String pageWrite = "update"; @@ -516,7 +525,7 @@ public Mono uploadPagesFromURLWithRestRespo 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.url(), sourceUrl, sourceRange, sourceContentMD5Converted, contentLength, timeout, range, this.client.version(), 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, contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -528,6 +537,7 @@ public Mono uploadPagesFromURLWithRestRespo * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPageRangesWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; final String versionId = null; @@ -540,7 +550,7 @@ public Mono getPageRangesWithRestResponseAsync(S final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.getPageRanges(containerName, blob, this.client.url(), snapshot, versionId, timeout, range, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRanges(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -559,6 +569,7 @@ public Mono getPageRangesWithRestResponseAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final String comp = "pagelist"; String leaseId = null; @@ -583,7 +594,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.url(), snapshot, versionId, timeout, range, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRanges(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -595,6 +606,7 @@ public Mono getPageRangesWithRestResponseAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPageRangesDiffWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; final String versionId = null; @@ -608,7 +620,7 @@ public Mono getPageRangesDiffWithRestRespons final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.getPageRangesDiff(containerName, blob, this.client.url(), snapshot, versionId, timeout, prevsnapshot, range, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRangesDiff(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, prevsnapshot, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -628,6 +640,7 @@ public Mono getPageRangesDiffWithRestRespons * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final String comp = "pagelist"; String leaseId = null; @@ -652,7 +665,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.url(), snapshot, versionId, timeout, prevsnapshot, range, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRangesDiff(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, prevsnapshot, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -665,6 +678,7 @@ public Mono getPageRangesDiffWithRestRespons * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono resizeWithRestResponseAsync(String containerName, String blob, long blobContentLength, Context context) { final Integer timeout = null; final String requestId = null; @@ -674,7 +688,7 @@ public Mono resizeWithRestResponseAsync(String containe final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.resize(containerName, blob, this.client.url(), timeout, blobContentLength, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.resize(containerName, blob, this.client.getUrl(), timeout, blobContentLength, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -691,6 +705,7 @@ public Mono resizeWithRestResponseAsync(String containe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono resizeWithRestResponseAsync(String containerName, String blob, long blobContentLength, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "properties"; String leaseId = null; @@ -715,7 +730,7 @@ public Mono resizeWithRestResponseAsync(String containe } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.resize(containerName, blob, this.client.url(), timeout, blobContentLength, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.resize(containerName, blob, this.client.getUrl(), timeout, blobContentLength, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -728,6 +743,7 @@ public Mono resizeWithRestResponseAsync(String containe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateSequenceNumberWithRestResponseAsync(String containerName, String blob, SequenceNumberActionType sequenceNumberAction, Context context) { final Integer timeout = null; final Long blobSequenceNumber = 0L; @@ -738,7 +754,7 @@ public Mono updateSequenceNumberWithRestR final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.updateSequenceNumber(containerName, blob, this.client.url(), timeout, sequenceNumberAction, blobSequenceNumber, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.updateSequenceNumber(containerName, blob, this.client.getUrl(), timeout, sequenceNumberAction, blobSequenceNumber, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -756,6 +772,7 @@ public Mono updateSequenceNumberWithRestR * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateSequenceNumberWithRestResponseAsync(String containerName, String blob, SequenceNumberActionType sequenceNumberAction, Integer timeout, Long blobSequenceNumber, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "properties"; String leaseId = null; @@ -780,7 +797,7 @@ public Mono updateSequenceNumberWithRestR } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.updateSequenceNumber(containerName, blob, this.client.url(), timeout, sequenceNumberAction, blobSequenceNumber, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.updateSequenceNumber(containerName, blob, this.client.getUrl(), timeout, sequenceNumberAction, blobSequenceNumber, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -793,6 +810,7 @@ public Mono updateSequenceNumberWithRestR * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono copyIncrementalWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { final Integer timeout = null; final String requestId = null; @@ -801,7 +819,7 @@ public Mono copyIncrementalWithRestResponseAsy final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.copyIncremental(containerName, blob, this.client.url(), timeout, copySource, this.client.version(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.copyIncremental(containerName, blob, this.client.getUrl(), timeout, copySource, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -817,6 +835,7 @@ public Mono copyIncrementalWithRestResponseAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono copyIncrementalWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "incrementalcopy"; OffsetDateTime ifModifiedSince = null; @@ -837,6 +856,6 @@ public Mono copyIncrementalWithRestResponseAsy } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.copyIncremental(containerName, blob, this.client.url(), timeout, copySource, this.client.version(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.copyIncremental(containerName, blob, this.client.getUrl(), timeout, copySource, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } } diff --git a/storage/client/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 similarity index 82% rename from storage/client/blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index a31982006724..5d77ec9bcee0 100644 --- a/storage/client/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 @@ -4,18 +4,20 @@ package com.azure.storage.blob.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.GET; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.POST; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.BodyParam; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.Post; +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.KeyInfo; import com.azure.storage.blob.models.ListContainersIncludeType; @@ -50,43 +52,43 @@ public final class ServicesImpl { * @param client the instance of the service client containing this operation class. */ public ServicesImpl(AzureBlobStorageImpl client) { - this.service = RestProxy.create(ServicesService.class, client); + this.service = RestProxy.create(ServicesService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for Services to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureBlobStorageServices to + * be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Blobs Service") + @ServiceInterface(name = "AzureBlobStorageServices") private interface ServicesService { - @PUT("") + @Put("") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") StorageServiceProperties storageServiceProperties, @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("") + @Get("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getProperties(@HostParam("url") String url, @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("") + @Get("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getStatistics(@HostParam("url") String url, @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("") + @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); - @POST("") + @Post("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getUserDelegationKey(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") KeyInfo keyInfo, @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("") + @Get("") @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); @@ -100,12 +102,13 @@ private interface ServicesService { * @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(StorageServiceProperties storageServiceProperties, Context context) { final Integer timeout = null; final String requestId = null; final String restype = "service"; final String comp = "properties"; - return service.setProperties(this.client.url(), storageServiceProperties, timeout, this.client.version(), requestId, restype, comp, context); + return service.setProperties(this.client.getUrl(), storageServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -118,10 +121,11 @@ public Mono setPropertiesWithRestResponseAsync(St * @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(StorageServiceProperties storageServiceProperties, Integer timeout, String requestId, Context context) { final String restype = "service"; final String comp = "properties"; - return service.setProperties(this.client.url(), storageServiceProperties, timeout, this.client.version(), requestId, restype, comp, context); + return service.setProperties(this.client.getUrl(), storageServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -131,12 +135,13 @@ public Mono setPropertiesWithRestResponseAsync(St * @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(Context context) { final Integer timeout = null; final String requestId = null; final String restype = "service"; final String comp = "properties"; - return service.getProperties(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context); + return service.getProperties(this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -148,10 +153,11 @@ public Mono getPropertiesWithRestResponseAsync(Co * @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(Integer timeout, String requestId, Context context) { final String restype = "service"; final String comp = "properties"; - return service.getProperties(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context); + return service.getProperties(this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -161,12 +167,13 @@ public Mono getPropertiesWithRestResponseAsync(In * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getStatisticsWithRestResponseAsync(Context context) { final Integer timeout = null; final String requestId = null; final String restype = "service"; final String comp = "stats"; - return service.getStatistics(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context); + return service.getStatistics(this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -178,10 +185,11 @@ public Mono getStatisticsWithRestResponseAsync(Co * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getStatisticsWithRestResponseAsync(Integer timeout, String requestId, Context context) { final String restype = "service"; final String comp = "stats"; - return service.getStatistics(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context); + return service.getStatistics(this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -191,6 +199,7 @@ public Mono getStatisticsWithRestResponseAsync(In * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listContainersSegmentWithRestResponseAsync(Context context) { final String prefix = null; final String marker = null; @@ -199,7 +208,7 @@ public Mono listContainersSegmentWithRest final Integer timeout = null; final String requestId = null; final String comp = "list"; - return service.listContainersSegment(this.client.url(), prefix, marker, maxresults, include, timeout, this.client.version(), requestId, comp, context); + return service.listContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context); } /** @@ -215,9 +224,10 @@ public Mono listContainersSegmentWithRest * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listContainersSegmentWithRestResponseAsync(String prefix, String marker, Integer maxresults, ListContainersIncludeType include, Integer timeout, String requestId, Context context) { final String comp = "list"; - return service.listContainersSegment(this.client.url(), prefix, marker, maxresults, include, timeout, this.client.version(), requestId, comp, context); + return service.listContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context); } /** @@ -228,12 +238,13 @@ public Mono listContainersSegmentWithRest * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getUserDelegationKeyWithRestResponseAsync(KeyInfo keyInfo, Context context) { final Integer timeout = null; final String requestId = null; final String restype = "service"; final String comp = "userdelegationkey"; - return service.getUserDelegationKey(this.client.url(), keyInfo, timeout, this.client.version(), requestId, restype, comp, context); + return service.getUserDelegationKey(this.client.getUrl(), keyInfo, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -246,10 +257,11 @@ public Mono getUserDelegationKeyWithRestRe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getUserDelegationKeyWithRestResponseAsync(KeyInfo keyInfo, Integer timeout, String requestId, Context context) { final String restype = "service"; final String comp = "userdelegationkey"; - return service.getUserDelegationKey(this.client.url(), keyInfo, timeout, this.client.version(), requestId, restype, comp, context); + return service.getUserDelegationKey(this.client.getUrl(), keyInfo, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -259,9 +271,10 @@ public Mono getUserDelegationKeyWithRestRe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccountInfoWithRestResponseAsync(Context context) { final String restype = "account"; final String comp = "properties"; - return service.getAccountInfo(this.client.url(), this.client.version(), restype, comp, context); + return service.getAccountInfo(this.client.getUrl(), this.client.getVersion(), restype, comp, context); } } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifiersWrapper.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifiersWrapper.java similarity index 96% rename from storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifiersWrapper.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifiersWrapper.java index 41bac045975b..34509edfc9cf 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifiersWrapper.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifiersWrapper.java @@ -25,7 +25,7 @@ public final class SignedIdentifiersWrapper { * @param signedIdentifiers the list. */ @JsonCreator - public SignedIdentifiersWrapper(@JsonProperty("SignedIdentifiers") List signedIdentifiers) { + public SignedIdentifiersWrapper(@JsonProperty("SignedIdentifier") List signedIdentifiers) { this.signedIdentifiers = signedIdentifiers; } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/package-info.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/package-info.java similarity index 77% rename from storage/client/blob/src/main/java/com/azure/storage/blob/implementation/package-info.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/package-info.java index 5f341b8ad1be..dcf10679cc97 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/package-info.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/package-info.java @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the implementations and inner classes for + * Package containing the implementations and inner classes for * AzureBlobStorage. */ package com.azure.storage.blob.implementation; diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java similarity index 97% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java index 8b33f24bf571..04ded069ff53 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java @@ -4,6 +4,7 @@ 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.time.OffsetDateTime; @@ -12,6 +13,7 @@ * An Access policy. */ @JacksonXmlRootElement(localName = "AccessPolicy") +@Fluent public final class AccessPolicy { /* * the date-time the policy is active diff --git a/storage/client/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 similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/AccessTier.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccessTier.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AccountKind.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccountKind.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/AccountKind.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AccountKind.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAccessConditions.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobAccessConditions.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAccessConditions.java diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java index 8273338cb667..8dcea49cd76c 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ package com.azure.storage.blob.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; @@ -14,6 +15,7 @@ * Defines headers for AppendBlockFromUrl operation. */ @JacksonXmlRootElement(localName = "AppendBlob-AppendBlockFromUrl-Headers") +@Fluent public final class AppendBlobAppendBlockFromUrlHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java index 8fe788378e58..a12cefa924e6 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ package com.azure.storage.blob.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; @@ -14,6 +15,7 @@ * Defines headers for AppendBlock operation. */ @JacksonXmlRootElement(localName = "AppendBlob-AppendBlock-Headers") +@Fluent public final class AppendBlobAppendBlockHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java index 45fd447bde38..c2e5a3e0929e 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ package com.azure.storage.blob.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; @@ -14,6 +15,7 @@ * Defines headers for Create operation. */ @JacksonXmlRootElement(localName = "AppendBlob-Create-Headers") +@Fluent public final class AppendBlobCreateHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobItem.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobItem.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobItem.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockFromUrlResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockFromUrlResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockFromUrlResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockFromUrlResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobsCreateResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobsCreateResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobsCreateResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendBlobsCreateResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java index 5894e08f86e3..e63fabf516af 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java @@ -4,6 +4,7 @@ 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; @@ -12,6 +13,7 @@ * AppendBlobs_appendBlock, AppendBlobs_appendBlockFromUrl. */ @JacksonXmlRootElement(localName = "append-position-access-conditions") +@Fluent public final class AppendPositionAccessConditions { /* * Optional conditional header. The max length in bytes permitted for the diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ArchiveStatus.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ArchiveStatus.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ArchiveStatus.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ArchiveStatus.java diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java index e439f5b8b089..c27f9fcac790 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for AbortCopyFromURL operation. */ @JacksonXmlRootElement(localName = "Blob-AbortCopyFromURL-Headers") +@Fluent public final class BlobAbortCopyFromURLHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAccessConditions.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobAccessConditions.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAccessConditions.java diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java index 5bf6ef256011..d4649062bc60 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for AcquireLease operation. */ @JacksonXmlRootElement(localName = "Blob-AcquireLease-Headers") +@Fluent public final class BlobAcquireLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java index b136802ce69a..504b7201befe 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for BreakLease operation. */ @JacksonXmlRootElement(localName = "Blob-BreakLease-Headers") +@Fluent public final class BlobBreakLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java index 1c3010861eaf..67d6971d9ff3 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for ChangeLease operation. */ @JacksonXmlRootElement(localName = "Blob-ChangeLease-Headers") +@Fluent public final class BlobChangeLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java index 2568e1c566bc..140b771f8cd6 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for CopyFromURL operation. */ @JacksonXmlRootElement(localName = "Blob-CopyFromURL-Headers") +@Fluent public final class BlobCopyFromURLHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java index f185a465e483..e27c4fde4964 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for CreateSnapshot operation. */ @JacksonXmlRootElement(localName = "Blob-CreateSnapshot-Headers") +@Fluent public final class BlobCreateSnapshotHeaders { /* * Uniquely identifies the snapshot and indicates the snapshot version. It diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java index 7aeac53bc5a3..95e6289c3e40 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for Delete operation. */ @JacksonXmlRootElement(localName = "Blob-Delete-Headers") +@Fluent public final class BlobDeleteHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java index aa56c2e6683c..4e9e2997ebab 100644 --- a/storage/client/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 @@ -4,8 +4,9 @@ package com.azure.storage.blob.models; -import com.azure.core.annotations.HeaderCollection; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.azure.core.implementation.annotation.HeaderCollection; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -16,6 +17,7 @@ * Defines headers for Download operation. */ @JacksonXmlRootElement(localName = "Blob-Download-Headers") +@Fluent public final class BlobDownloadHeaders { /* * Returns the date and time the container was last modified. Any operation diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java similarity index 94% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java index 97f8e48a9c83..ac1f703d1cd7 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java @@ -4,6 +4,7 @@ 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; @@ -13,6 +14,7 @@ * The BlobFlatListSegment model. */ @JacksonXmlRootElement(localName = "Blobs") +@Fluent public final class BlobFlatListSegment { /* * The blobItems property. diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java index 81c8b54b4661..21243aaac732 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for GetAccountInfo operation. */ @JacksonXmlRootElement(localName = "Blob-GetAccountInfo-Headers") +@Fluent public final class BlobGetAccountInfoHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java index cb1d9e3ba176..728ae5fd9e1e 100644 --- a/storage/client/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 @@ -4,8 +4,9 @@ package com.azure.storage.blob.models; -import com.azure.core.annotations.HeaderCollection; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.azure.core.implementation.annotation.HeaderCollection; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -16,6 +17,7 @@ * Defines headers for GetProperties operation. */ @JacksonXmlRootElement(localName = "Blob-GetProperties-Headers") +@Fluent public final class BlobGetPropertiesHeaders { /* * Returns the date and time the blob was last modified. Any operation that diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java index aafbd1eb56e5..f25f4e566e6b 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.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; @@ -12,6 +13,7 @@ * Additional parameters for a set of operations. */ @JacksonXmlRootElement(localName = "blob-HTTP-headers") +@Fluent public final class BlobHTTPHeaders { /* * Optional. Sets the blob's cache control. If specified, this property is diff --git a/storage/client/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 similarity index 96% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java index a70c2d2122f0..c1885f617481 100644 --- a/storage/client/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 @@ -4,9 +4,11 @@ package com.azure.storage.blob.models; +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 +17,7 @@ */ @JacksonXmlRootElement(localName = "Blobs") @JsonDeserialize(using = CustomHierarchicalListingDeserializer.class) +@Fluent public final class BlobHierarchyListSegment { /* * The blobPrefixes property. diff --git a/storage/client/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 similarity index 88% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobItem.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobItem.java index eb73dd3366b6..3d777a4b2e38 100644 --- a/storage/client/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 @@ -4,15 +4,16 @@ 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.Map; /** * An Azure Storage blob. */ @JacksonXmlRootElement(localName = "Blob") +@Fluent public final class BlobItem { /* * The name property. @@ -50,7 +51,11 @@ public final class BlobItem { @JsonProperty(value = "Metadata") private Map metadata; - private boolean isPrefix = false; + /* + * The isPrefix property. + */ + @JsonProperty(value = "IsPrefix") + private Boolean isPrefix; /** * Get the name property: The name property. @@ -173,18 +178,21 @@ public BlobItem metadata(Map metadata) { } /** - * @return if the blob item is a prefix instead of an actual blob. + * Get the isPrefix property: The isPrefix property. + * + * @return the isPrefix value. */ - public boolean isPrefix() { - return isPrefix; + public Boolean isPrefix() { + return this.isPrefix; } /** - * Sets if the blob item is a prefix instead of an actual blob - * @param isPrefix if the item is a prefix - * @return the BlobItem object itself + * Set the isPrefix property: The isPrefix property. + * + * @param isPrefix the isPrefix value to set. + * @return the BlobItem object itself. */ - public BlobItem isPrefix(boolean isPrefix) { + public BlobItem isPrefix(Boolean isPrefix) { this.isPrefix = isPrefix; return this; } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobListDetails.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobListDetails.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobListDetails.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobListDetails.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobMetadata.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobMetadata.java similarity index 97% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobMetadata.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobMetadata.java index 5753ff479dbf..30eed457954b 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobMetadata.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobMetadata.java @@ -4,6 +4,7 @@ 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; @@ -13,6 +14,7 @@ * The BlobMetadata model. */ @JacksonXmlRootElement(localName = "Metadata") +@Fluent public final class BlobMetadata { /* * Unmatched properties from the message are deserialized this collection diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java similarity index 93% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java index 6507aaecfd38..55afd0bc2549 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * The BlobPrefix model. */ @JacksonXmlRootElement(localName = "BlobPrefix") +@Fluent public final class BlobPrefix { /* * The name property. diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java index a297fe40e043..d5bad7b9996e 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ package com.azure.storage.blob.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; @@ -14,6 +15,7 @@ * Properties of a blob. */ @JacksonXmlRootElement(localName = "Properties") +@Fluent public final class BlobProperties { /* * The creationTime property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobRange.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRange.java similarity index 93% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobRange.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRange.java index 183ebbf5664a..f39278c25512 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobRange.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRange.java @@ -40,11 +40,10 @@ public BlobRange(long offset) { * @param count * the number of bytes to download */ - public BlobRange(long offset, long count) { + public BlobRange(long offset, Long count) { this(offset); - if (count < 0) { - throw new IllegalArgumentException( - "BlobRange count must be greater than or equal to 0 if specified."); + if (count != null && count < 0) { + throw new IllegalArgumentException("BlobRange count must be greater than or equal to 0 if specified."); } this.count = count; } diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java index 661e9a24db97..f503b9ab6d30 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for ReleaseLease operation. */ @JacksonXmlRootElement(localName = "Blob-ReleaseLease-Headers") +@Fluent public final class BlobReleaseLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java index 2ee66b3adb36..863157cf8a42 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for RenewLease operation. */ @JacksonXmlRootElement(localName = "Blob-RenewLease-Headers") +@Fluent public final class BlobRenewLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java index 09111d5ae3e1..ed539d644bc1 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for SetHTTPHeaders operation. */ @JacksonXmlRootElement(localName = "Blob-SetHTTPHeaders-Headers") +@Fluent public final class BlobSetHTTPHeadersHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java index b831d8446cd1..5b3898194287 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for SetMetadata operation. */ @JacksonXmlRootElement(localName = "Blob-SetMetadata-Headers") +@Fluent public final class BlobSetMetadataHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 97% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java index d2dd04c235a7..372b1a09ebc0 100644 --- a/storage/client/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 @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * Defines headers for SetTier operation. */ @JacksonXmlRootElement(localName = "Blob-SetTier-Headers") +@Fluent public final class BlobSetTierHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java index c0059d598cce..a6b195a6e6dc 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for StartCopyFromURL operation. */ @JacksonXmlRootElement(localName = "Blob-StartCopyFromURL-Headers") +@Fluent public final class BlobStartCopyFromURLHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobType.java diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java index 3123885e3af1..cd1ea6a55d13 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for Undelete operation. */ @JacksonXmlRootElement(localName = "Blob-Undelete-Headers") +@Fluent public final class BlobUndeleteHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsAbortCopyFromURLResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsAbortCopyFromURLResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsAbortCopyFromURLResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsAbortCopyFromURLResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsAcquireLeaseResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsAcquireLeaseResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsAcquireLeaseResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsAcquireLeaseResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsBreakLeaseResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsBreakLeaseResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsBreakLeaseResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsBreakLeaseResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsChangeLeaseResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsChangeLeaseResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsChangeLeaseResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsChangeLeaseResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsCopyFromURLResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsCopyFromURLResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsCopyFromURLResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsCopyFromURLResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsCreateSnapshotResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsCreateSnapshotResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsCreateSnapshotResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsCreateSnapshotResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsDeleteResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsDeleteResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsDeleteResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsDeleteResponse.java diff --git a/storage/client/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 similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsDownloadResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsDownloadResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsGetAccountInfoResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetAccountInfoResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsGetAccountInfoResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetAccountInfoResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsGetPropertiesResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetPropertiesResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsGetPropertiesResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsGetPropertiesResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsReleaseLeaseResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsReleaseLeaseResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsReleaseLeaseResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsReleaseLeaseResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsRenewLeaseResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsRenewLeaseResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsRenewLeaseResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsRenewLeaseResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsSetHTTPHeadersResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetHTTPHeadersResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsSetHTTPHeadersResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetHTTPHeadersResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsSetMetadataResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetMetadataResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsSetMetadataResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetMetadataResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsSetTierResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetTierResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsSetTierResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsSetTierResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsStartCopyFromURLResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsStartCopyFromURLResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsStartCopyFromURLResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsStartCopyFromURLResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsUndeleteResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsUndeleteResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobsUndeleteResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlobsUndeleteResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/Block.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Block.java similarity index 96% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/Block.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Block.java index 8fbfcaa8a7ab..5cfa164c8c85 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/Block.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Block.java @@ -4,6 +4,7 @@ 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; @@ -12,6 +13,7 @@ * size. */ @JacksonXmlRootElement(localName = "Block") +@Fluent public final class Block { /* * The base64 encoded block ID. diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java index a2605e19cf43..6bec949d7180 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ package com.azure.storage.blob.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; @@ -14,6 +15,7 @@ * Defines headers for CommitBlockList operation. */ @JacksonXmlRootElement(localName = "BlockBlob-CommitBlockList-Headers") +@Fluent public final class BlockBlobCommitBlockListHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java index 26d77f85abad..fa50d846ebef 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for GetBlockList operation. */ @JacksonXmlRootElement(localName = "BlockBlob-GetBlockList-Headers") +@Fluent public final class BlockBlobGetBlockListHeaders { /* * Returns the date and time the container was last modified. Any operation diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobItem.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobItem.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobItem.java diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java index 1b434c919342..88dd3c6346ed 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ package com.azure.storage.blob.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; @@ -14,6 +15,7 @@ * Defines headers for StageBlockFromURL operation. */ @JacksonXmlRootElement(localName = "BlockBlob-StageBlockFromURL-Headers") +@Fluent public final class BlockBlobStageBlockFromURLHeaders { /* * If the blob has an MD5 hash and this operation is to read the full blob, diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java index 40108ad24ec2..56ffdfe93700 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ package com.azure.storage.blob.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; @@ -14,6 +15,7 @@ * Defines headers for StageBlock operation. */ @JacksonXmlRootElement(localName = "BlockBlob-StageBlock-Headers") +@Fluent public final class BlockBlobStageBlockHeaders { /* * If the blob has an MD5 hash and this operation is to read the full blob, diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java index e5430e100e6e..76c59b2f74d9 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ package com.azure.storage.blob.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; @@ -14,6 +15,7 @@ * Defines headers for Upload operation. */ @JacksonXmlRootElement(localName = "BlockBlob-Upload-Headers") +@Fluent public final class BlockBlobUploadHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobsCommitBlockListResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsCommitBlockListResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobsCommitBlockListResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsCommitBlockListResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobsGetBlockListResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsGetBlockListResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobsGetBlockListResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsGetBlockListResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockFromURLResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockFromURLResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockFromURLResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockFromURLResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobsUploadResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsUploadResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobsUploadResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockBlobsUploadResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockItem.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockItem.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockItem.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockList.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockList.java similarity index 97% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockList.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockList.java index 70a0fb8d312e..dfa4deadeb89 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockList.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockList.java @@ -4,6 +4,7 @@ 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; @@ -15,6 +16,7 @@ * The BlockList model. */ @JacksonXmlRootElement(localName = "BlockList") +@Fluent public final class BlockList { private static final class CommittedBlocksWrapper { @JacksonXmlProperty(localName = "Block") diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockListType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockListType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockListType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockListType.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java similarity index 97% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java index 9cc63338a899..40bb5d346e00 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java @@ -4,6 +4,7 @@ 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; @@ -13,6 +14,7 @@ * The BlockLookupList model. */ @JacksonXmlRootElement(localName = "BlockList") +@Fluent public final class BlockLookupList { /* * The committed property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ClearRange.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ClearRange.java similarity index 95% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ClearRange.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ClearRange.java index cb8d7a208ab3..e607faf87b05 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ClearRange.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ClearRange.java @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * The ClearRange model. */ @JacksonXmlRootElement(localName = "ClearRange") +@Fluent public final class ClearRange { /* * The start property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAccessConditions.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerAccessConditions.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAccessConditions.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerAccessPolicies.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAccessPolicies.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerAccessPolicies.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAccessPolicies.java diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java index 0ba172f04e33..bd6d0580bdcf 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for AcquireLease operation. */ @JacksonXmlRootElement(localName = "Container-AcquireLease-Headers") +@Fluent public final class ContainerAcquireLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java index 98a1106ccc6e..4df2a5f3ddef 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for BreakLease operation. */ @JacksonXmlRootElement(localName = "Container-BreakLease-Headers") +@Fluent public final class ContainerBreakLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java index 880214fc46b5..8c5371a5121f 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for ChangeLease operation. */ @JacksonXmlRootElement(localName = "Container-ChangeLease-Headers") +@Fluent public final class ContainerChangeLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java index 280734c61501..9a22e560ca72 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for Create operation. */ @JacksonXmlRootElement(localName = "Container-Create-Headers") +@Fluent public final class ContainerCreateHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java index 52f2623a635d..64af976e0367 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for Delete operation. */ @JacksonXmlRootElement(localName = "Container-Delete-Headers") +@Fluent public final class ContainerDeleteHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java index 4905b3c2949f..a1a76b2f57ba 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for GetAccessPolicy operation. */ @JacksonXmlRootElement(localName = "Container-GetAccessPolicy-Headers") +@Fluent public final class ContainerGetAccessPolicyHeaders { /* * Indicated whether data in the container may be accessed publicly and the diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java index c82baa2c1a6b..692c4a71fc52 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for GetAccountInfo operation. */ @JacksonXmlRootElement(localName = "Container-GetAccountInfo-Headers") +@Fluent public final class ContainerGetAccountInfoHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java index b37286c1b7af..df2d12bbcdb6 100644 --- a/storage/client/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 @@ -4,8 +4,9 @@ package com.azure.storage.blob.models; -import com.azure.core.annotations.HeaderCollection; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.azure.core.implementation.annotation.HeaderCollection; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -15,6 +16,7 @@ * Defines headers for GetProperties operation. */ @JacksonXmlRootElement(localName = "Container-GetProperties-Headers") +@Fluent public final class ContainerGetPropertiesHeaders { /* * The metadata property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java similarity index 97% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java index a334568661eb..543085f349c8 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java @@ -4,6 +4,7 @@ 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.Map; @@ -12,6 +13,7 @@ * An Azure Storage container. */ @JacksonXmlRootElement(localName = "Container") +@Fluent public final class ContainerItem { /* * The name property. diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java index 311c0c6ca66b..ef1252a5a8d4 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for ListBlobFlatSegment operation. */ @JacksonXmlRootElement(localName = "Container-ListBlobFlatSegment-Headers") +@Fluent public final class ContainerListBlobFlatSegmentHeaders { /* * The media type of the body of the response. For List Blobs this is diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java index 7456e14d8980..d1a671cf7550 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for ListBlobHierarchySegment operation. */ @JacksonXmlRootElement(localName = "Container-ListBlobHierarchySegment-Headers") +@Fluent public final class ContainerListBlobHierarchySegmentHeaders { /* * The media type of the body of the response. For List Blobs this is diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java similarity index 88% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java index f51d897112d5..fbca16f733d7 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerListDetails.java @@ -3,11 +3,11 @@ package com.azure.storage.blob.models; -import com.azure.storage.blob.StorageClient; +import com.azure.storage.blob.BlobServiceClient; /** * This type allows users to specify additional information the service should return with each container when listing - * containers in an account (via a {@link StorageClient} object). This type is immutable to ensure thread-safety of + * containers in an account (via a {@link BlobServiceClient} object). This type is immutable to ensure thread-safety of * requests, so changing the details for a different listing operation requires construction of a new object. Null may * be passed if none of the options are desirable. */ diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java index b4844ac52dcf..f159a57f2cd5 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Properties of a container. */ @JacksonXmlRootElement(localName = "ContainerProperties") +@Fluent public final class ContainerProperties { /* * The lastModified property. diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java index b437d814e16c..7a8766ab2424 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for ReleaseLease operation. */ @JacksonXmlRootElement(localName = "Container-ReleaseLease-Headers") +@Fluent public final class ContainerReleaseLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java index e9a03210ae1a..a192e95a96c8 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for RenewLease operation. */ @JacksonXmlRootElement(localName = "Container-RenewLease-Headers") +@Fluent public final class ContainerRenewLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java index a91ceed6d34d..763e75291800 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for SetAccessPolicy operation. */ @JacksonXmlRootElement(localName = "Container-SetAccessPolicy-Headers") +@Fluent public final class ContainerSetAccessPolicyHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java index 082886b7c0b5..e685322b83ff 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for SetMetadata operation. */ @JacksonXmlRootElement(localName = "Container-SetMetadata-Headers") +@Fluent public final class ContainerSetMetadataHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersAcquireLeaseResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersAcquireLeaseResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersAcquireLeaseResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersAcquireLeaseResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersBreakLeaseResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersBreakLeaseResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersBreakLeaseResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersBreakLeaseResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersChangeLeaseResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersChangeLeaseResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersChangeLeaseResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersChangeLeaseResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersCreateResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersCreateResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersCreateResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersCreateResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersDeleteResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersDeleteResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersDeleteResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersDeleteResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersGetAccessPolicyResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersGetAccessPolicyResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersGetAccessPolicyResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersGetAccessPolicyResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersGetAccountInfoResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersGetAccountInfoResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersGetAccountInfoResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersGetAccountInfoResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersGetPropertiesResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersGetPropertiesResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersGetPropertiesResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersGetPropertiesResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobFlatSegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobFlatSegmentResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobFlatSegmentResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobFlatSegmentResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobHierarchySegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobHierarchySegmentResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobHierarchySegmentResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersListBlobHierarchySegmentResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersReleaseLeaseResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersReleaseLeaseResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersReleaseLeaseResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersReleaseLeaseResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersRenewLeaseResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersRenewLeaseResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersRenewLeaseResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersRenewLeaseResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersSetAccessPolicyResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersSetAccessPolicyResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersSetAccessPolicyResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersSetAccessPolicyResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersSetMetadataResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersSetMetadataResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainersSetMetadataResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ContainersSetMetadataResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/CopyStatusType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CopyStatusType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/CopyStatusType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CopyStatusType.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/CorsRule.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CorsRule.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/CorsRule.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CorsRule.java index fa9035b072c6..e111fbb62e30 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/CorsRule.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CorsRule.java @@ -4,6 +4,7 @@ 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; @@ -15,6 +16,7 @@ * one domain (the origin domain) to call APIs in another domain. */ @JacksonXmlRootElement(localName = "CorsRule") +@Fluent public final class CorsRule { /* * The origin domains that are permitted to make a request against the diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/CustomHierarchicalListingDeserializer.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomHierarchicalListingDeserializer.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/CustomHierarchicalListingDeserializer.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/CustomHierarchicalListingDeserializer.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/DeleteSnapshotsOptionType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DeleteSnapshotsOptionType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/DeleteSnapshotsOptionType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/DeleteSnapshotsOptionType.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/EncryptionAlgorithmType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/EncryptionAlgorithmType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/EncryptionAlgorithmType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/EncryptionAlgorithmType.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java similarity index 97% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java index 90cf41b12f07..d583130cc13a 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Geo-Replication information for the Secondary Storage Service. */ @JacksonXmlRootElement(localName = "GeoReplication") +@Fluent public final class GeoReplication { /* * The status of the secondary location. Possible values include: 'live', diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/GeoReplicationStatusType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/GeoReplicationStatusType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/GeoReplicationStatusType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/GeoReplicationStatusType.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java similarity index 96% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java index d1aa23bbcef7..6c742e4ed786 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * Key information. */ @JacksonXmlRootElement(localName = "KeyInfo") +@Fluent public final class KeyInfo { /* * The date-time the key is active in ISO 8601 UTC time diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java similarity index 95% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java index eae367a636e2..9a43064e549f 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * Additional parameters for a set of operations. */ @JacksonXmlRootElement(localName = "lease-access-conditions") +@Fluent public final class LeaseAccessConditions { /* * If specified, the operation only succeeds if the resource's lease is diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/LeaseDurationType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/LeaseDurationType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/LeaseDurationType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/LeaseDurationType.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/LeaseStateType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/LeaseStateType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/LeaseStateType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/LeaseStateType.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/LeaseStatusType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/LeaseStatusType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/LeaseStatusType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/LeaseStatusType.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java index 1807bc8efe36..593688ccc3e1 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java @@ -4,6 +4,7 @@ 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; @@ -12,6 +13,7 @@ * An enumeration of blobs. */ @JacksonXmlRootElement(localName = "EnumerationResults") +@Fluent public final class ListBlobsFlatSegmentResponse { /* * The serviceEndpoint property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java index f79c285a1079..51aee2856567 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java @@ -4,6 +4,7 @@ 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; @@ -12,6 +13,7 @@ * An enumeration of blobs. */ @JacksonXmlRootElement(localName = "EnumerationResults") +@Fluent public final class ListBlobsHierarchySegmentResponse { /* * The serviceEndpoint property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsIncludeItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsIncludeItem.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsIncludeItem.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsIncludeItem.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsOptions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsOptions.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsOptions.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListBlobsOptions.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersIncludeType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersIncludeType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersIncludeType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersIncludeType.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java similarity index 96% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java index 19d3e61a2c75..ed6c27b57d90 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersOptions.java @@ -3,10 +3,10 @@ package com.azure.storage.blob.models; -import com.azure.storage.blob.StorageClient; +import com.azure.storage.blob.BlobServiceClient; /** - * Defines options available to configure the behavior of a call to listContainersSegment on a {@link StorageClient} + * Defines options available to configure the behavior of a call to listContainersSegment on a {@link BlobServiceClient} * object. See the constructor for details on each of the options. Null may be passed in place of an object of this * type if no options are desirable. */ diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java index deafc07a9443..97f342484a8f 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java @@ -4,6 +4,7 @@ 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; @@ -15,6 +16,7 @@ * An enumeration of containers. */ @JacksonXmlRootElement(localName = "EnumerationResults") +@Fluent public final class ListContainersSegmentResponse { /* * The serviceEndpoint property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/Logging.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Logging.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/Logging.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Logging.java index e86ad32a0ae7..9aa3f4cce40b 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/Logging.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Logging.java @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * Azure Analytics Logging settings. */ @JacksonXmlRootElement(localName = "Logging") +@Fluent public final class Logging { /* * The version of Storage Analytics to configure. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/Metadata.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Metadata.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/Metadata.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Metadata.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/Metrics.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Metrics.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/Metrics.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Metrics.java index c812d6a86a53..ee8ad19b2856 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/Metrics.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/Metrics.java @@ -4,6 +4,7 @@ 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; @@ -12,6 +13,7 @@ * for blobs. */ @JacksonXmlRootElement(localName = "Metrics") +@Fluent public final class Metrics { /* * The version of Storage Analytics to configure. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java index 3636dfd4c290..01e9de89ae16 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Additional parameters for a set of operations. */ @JacksonXmlRootElement(localName = "modified-access-conditions") +@Fluent public final class ModifiedAccessConditions { /* * Specify this header value to operate only on a blob if it has been diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobAccessConditions.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobAccessConditions.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobAccessConditions.java diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java index 45f30cefd53a..543c829bf271 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ package com.azure.storage.blob.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; @@ -14,6 +15,7 @@ * Defines headers for ClearPages operation. */ @JacksonXmlRootElement(localName = "PageBlob-ClearPages-Headers") +@Fluent public final class PageBlobClearPagesHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java index 3a1ea5cd5f9d..7e9aa95c1ff3 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for CopyIncremental operation. */ @JacksonXmlRootElement(localName = "PageBlob-CopyIncremental-Headers") +@Fluent public final class PageBlobCopyIncrementalHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java index 215c6f4c934a..6c4192fe4806 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ package com.azure.storage.blob.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; @@ -14,6 +15,7 @@ * Defines headers for Create operation. */ @JacksonXmlRootElement(localName = "PageBlob-Create-Headers") +@Fluent public final class PageBlobCreateHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java index 5f75cf82af76..c1d14635bf44 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for GetPageRangesDiff operation. */ @JacksonXmlRootElement(localName = "PageBlob-GetPageRangesDiff-Headers") +@Fluent public final class PageBlobGetPageRangesDiffHeaders { /* * Returns the date and time the container was last modified. Any operation diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java index a9004d8dd2c9..32b37ef1452c 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for GetPageRanges operation. */ @JacksonXmlRootElement(localName = "PageBlob-GetPageRanges-Headers") +@Fluent public final class PageBlobGetPageRangesHeaders { /* * Returns the date and time the container was last modified. Any operation diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobItem.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobItem.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobItem.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobItem.java diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java index f9396b66835c..e03c8720d2b6 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for Resize operation. */ @JacksonXmlRootElement(localName = "PageBlob-Resize-Headers") +@Fluent public final class PageBlobResizeHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java index 317c57bb35ce..5f606b24c262 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for UpdateSequenceNumber operation. */ @JacksonXmlRootElement(localName = "PageBlob-UpdateSequenceNumber-Headers") +@Fluent public final class PageBlobUpdateSequenceNumberHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java index ad21b582b509..cebeb20842e3 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ package com.azure.storage.blob.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; @@ -14,6 +15,7 @@ * Defines headers for UploadPagesFromURL operation. */ @JacksonXmlRootElement(localName = "PageBlob-UploadPagesFromURL-Headers") +@Fluent public final class PageBlobUploadPagesFromURLHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java index 29cf41bae0b8..7dd8eb12ae72 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ package com.azure.storage.blob.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; @@ -14,6 +15,7 @@ * Defines headers for UploadPages operation. */ @JacksonXmlRootElement(localName = "PageBlob-UploadPages-Headers") +@Fluent public final class PageBlobUploadPagesHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsClearPagesResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsClearPagesResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsClearPagesResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsClearPagesResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsCopyIncrementalResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsCopyIncrementalResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsCopyIncrementalResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsCopyIncrementalResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsCreateResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsCreateResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsCreateResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsCreateResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesDiffResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesDiffResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesDiffResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesDiffResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsResizeResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsResizeResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsResizeResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsResizeResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsUpdateSequenceNumberResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsUpdateSequenceNumberResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsUpdateSequenceNumberResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsUpdateSequenceNumberResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesFromURLResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesFromURLResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesFromURLResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesFromURLResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageList.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageList.java similarity index 96% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageList.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageList.java index cf921ab92646..b981bdf2f6ed 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageList.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageList.java @@ -4,6 +4,7 @@ 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; @@ -13,6 +14,7 @@ * the list of pages. */ @JacksonXmlRootElement(localName = "PageList") +@Fluent public final class PageList { /* * The pageRange property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageRange.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageRange.java similarity index 95% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PageRange.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageRange.java index 5ce78ebfb0db..53a76779cd4d 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageRange.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PageRange.java @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * The PageRange model. */ @JacksonXmlRootElement(localName = "PageRange") +@Fluent public final class PageRange { /* * The start property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PublicAccessType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PublicAccessType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/PublicAccessType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/PublicAccessType.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ReliableDownloadOptions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ReliableDownloadOptions.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ReliableDownloadOptions.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ReliableDownloadOptions.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java similarity index 97% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java index d6285c64af18..7877f6dd0bd7 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java @@ -4,6 +4,7 @@ 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; @@ -12,6 +13,7 @@ * persist. */ @JacksonXmlRootElement(localName = "RetentionPolicy") +@Fluent public final class RetentionPolicy { /* * Indicates whether a retention policy is enabled for the storage service diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java index df0399ff5912..c211020aeb24 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java @@ -4,6 +4,7 @@ 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; @@ -12,6 +13,7 @@ * PageBlobs_uploadPages, PageBlobs_clearPages, PageBlobs_uploadPagesFromURL. */ @JacksonXmlRootElement(localName = "sequence-number-access-conditions") +@Fluent public final class SequenceNumberAccessConditions { /* * Specify this header value to operate only on a blob if it has a sequence diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SequenceNumberActionType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SequenceNumberActionType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/SequenceNumberActionType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SequenceNumberActionType.java diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java index b0c6820cf084..88fa50830518 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for GetAccountInfo operation. */ @JacksonXmlRootElement(localName = "Service-GetAccountInfo-Headers") +@Fluent public final class ServiceGetAccountInfoHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/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 similarity index 97% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java index 3126a5153421..3b5b06ab3259 100644 --- a/storage/client/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 @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * Defines headers for GetProperties operation. */ @JacksonXmlRootElement(localName = "Service-GetProperties-Headers") +@Fluent public final class ServiceGetPropertiesHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java index 34fcda3653a6..55dda9cc8ddb 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for GetStatistics operation. */ @JacksonXmlRootElement(localName = "Service-GetStatistics-Headers") +@Fluent public final class ServiceGetStatisticsHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java index 9c685c290610..4a74086587af 100644 --- a/storage/client/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 @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Defines headers for GetUserDelegationKey operation. */ @JacksonXmlRootElement(localName = "Service-GetUserDelegationKey-Headers") +@Fluent public final class ServiceGetUserDelegationKeyHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/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 similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java index d22b9f1febc4..94908506ede7 100644 --- a/storage/client/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 @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * Defines headers for ListContainersSegment operation. */ @JacksonXmlRootElement(localName = "Service-ListContainersSegment-Headers") +@Fluent public final class ServiceListContainersSegmentHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/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 similarity index 97% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java index 065e595244fc..df15cc766400 100644 --- a/storage/client/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 @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * Defines headers for SetProperties operation. */ @JacksonXmlRootElement(localName = "Service-SetProperties-Headers") +@Fluent public final class ServiceSetPropertiesHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServicesGetAccountInfoResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetAccountInfoResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ServicesGetAccountInfoResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetAccountInfoResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServicesGetPropertiesResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetPropertiesResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ServicesGetPropertiesResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetPropertiesResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServicesGetStatisticsResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetStatisticsResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ServicesGetStatisticsResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetStatisticsResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServicesGetUserDelegationKeyResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetUserDelegationKeyResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ServicesGetUserDelegationKeyResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesGetUserDelegationKeyResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServicesListContainersSegmentResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesListContainersSegmentResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ServicesListContainersSegmentResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesListContainersSegmentResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServicesSetPropertiesResponse.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesSetPropertiesResponse.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/ServicesSetPropertiesResponse.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/ServicesSetPropertiesResponse.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java similarity index 96% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java index 417f49492e51..63e3aea5e584 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * signed identifier. */ @JacksonXmlRootElement(localName = "SignedIdentifier") +@Fluent public final class SignedIdentifier { /* * a unique id diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SkuName.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SkuName.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/SkuName.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SkuName.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java index 84b179bb0181..9874a3b9557e 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java @@ -5,6 +5,7 @@ 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; @@ -13,6 +14,7 @@ * Additional parameters for a set of operations. */ @JacksonXmlRootElement(localName = "source-modified-access-conditions") +@Fluent public final class SourceModifiedAccessConditions { /* * Specify this header value to operate only on a blob if it has been diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java similarity index 97% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java index 45971febb06e..91fffc8ba4bc 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * The properties that enable an account to host a static website. */ @JacksonXmlRootElement(localName = "StaticWebsite") +@Fluent public final class StaticWebsite { /* * Indicates whether this account is hosting a static website diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageAccountInfo.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageAccountInfo.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageAccountInfo.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageAccountInfo.java diff --git a/storage/client/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 similarity index 96% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageError.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageError.java index 55c96be21c80..2f8f01f4f6f9 100644 --- a/storage/client/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 @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * The StorageError model. */ @JacksonXmlRootElement(localName = "StorageError") +@Fluent public final class StorageError { /* * The code property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageErrorCode.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageErrorCode.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageErrorCode.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageErrorCode.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageErrorException.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageErrorException.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageErrorException.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageErrorException.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java similarity index 99% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java index 79e072ba2b05..a83c072fcce9 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java @@ -4,6 +4,7 @@ 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; @@ -15,6 +16,7 @@ * Storage Service Properties. */ @JacksonXmlRootElement(localName = "StorageServiceProperties") +@Fluent public final class StorageServiceProperties { /* * The logging property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java similarity index 94% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java index 5eb67c323064..04dd8dfc94dd 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java @@ -4,6 +4,7 @@ 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; @@ -11,6 +12,7 @@ * Stats for the storage service. */ @JacksonXmlRootElement(localName = "StorageServiceStats") +@Fluent public final class StorageServiceStats { /* * The geoReplication property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SyncCopyStatusType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SyncCopyStatusType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/SyncCopyStatusType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/SyncCopyStatusType.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java similarity index 98% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java index d267df92d7c2..7598fd90340d 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java @@ -4,6 +4,7 @@ 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.time.OffsetDateTime; @@ -12,6 +13,7 @@ * A user delegation key. */ @JacksonXmlRootElement(localName = "UserDelegationKey") +@Fluent public final class UserDelegationKey { /* * The Azure Active Directory object ID in GUID format. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/package-info.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/package-info.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/blob/models/package-info.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/models/package-info.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/package-info.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/package-info.java similarity index 77% rename from storage/client/blob/src/main/java/com/azure/storage/blob/package-info.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/package-info.java index 6048911e2d09..54ad22687275 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/package-info.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/package-info.java @@ -3,6 +3,6 @@ // Code generated by Microsoft (R) AutoRest Code Generator /** - * Package containing the classes for StorageClient. + * Package containing the classes for BlobServiceClient. */ package com.azure.storage.blob; diff --git a/storage/client/blob/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/common/credentials/package-info.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/credentials/package-info.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/common/credentials/package-info.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/credentials/package-info.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java similarity index 55% rename from storage/client/blob/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java index 80b157bff471..ae0519ee6a03 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java @@ -6,9 +6,9 @@ import java.util.concurrent.TimeUnit; /** - * Options for configuring the {@link RequestRetryPolicy}. Please refer to the Factory for more information. Note - * that there is no option for overall operation timeout. This is because Rx object have a timeout field which provides - * this functionality. + * Options for configuring the {@link RequestRetryPolicy}. Please refer to the Factory for more information. Note that + * there is no option for overall operation timeout. This is because Rx object have a timeout field which provides this + * functionality. */ public final class RequestRetryOptions { @@ -16,11 +16,8 @@ public final class RequestRetryOptions { private final int tryTimeout; private final long retryDelayInMs; private final long maxRetryDelayInMs; - /** - * 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, @@ -28,47 +25,43 @@ public final class RequestRetryOptions { */ public RequestRetryOptions() { this(RetryPolicyType.EXPONENTIAL, null, - null, null, null, null); + null, null, null, null); } /** * 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 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 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 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 - * this webpage - * @throws IllegalArgumentException If {@code retryDelayInMs} and {@code maxRetryDelayInMs} are not both null or non-null - * or {@code retryPolicyType} isn't {@link RetryPolicyType#EXPONENTIAL} or {@link RetryPolicyType#FIXED}. + * @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 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 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 + * this + * webpage + * @throws IllegalArgumentException If {@code retryDelayInMs} and {@code maxRetryDelayInMs} are not both null or + * non-null or {@code retryPolicyType} isn't {@link RetryPolicyType#EXPONENTIAL} or {@link RetryPolicyType#FIXED}. * *

    Sample Code

    * - *

    For more samples, please see the samples file

    + *

    For more samples, please see the samples + * file

    */ public RequestRetryOptions(RetryPolicyType retryPolicyType, Integer maxTries, Integer tryTimeout, - Long retryDelayInMs, Long maxRetryDelayInMs, String secondaryHost) { + Long retryDelayInMs, Long maxRetryDelayInMs, String secondaryHost) { this.retryPolicyType = retryPolicyType == null ? RetryPolicyType.EXPONENTIAL : retryPolicyType; if (maxTries != null) { assertInBounds("maxRetries", maxTries, 1, Integer.MAX_VALUE); @@ -85,7 +78,7 @@ public RequestRetryOptions(RetryPolicyType retryPolicyType, Integer maxTries, In } if ((retryDelayInMs == null && maxRetryDelayInMs != null) - || (retryDelayInMs != null && maxRetryDelayInMs == null)) { + || (retryDelayInMs != null && maxRetryDelayInMs == null)) { throw new IllegalArgumentException("Both retryDelay and maxRetryDelay must be null or neither can be null"); } @@ -111,36 +104,49 @@ public RequestRetryOptions(RetryPolicyType retryPolicyType, Integer maxTries, In this.secondaryHost = secondaryHost; } - int maxTries() { + /** + * @return the maximum number attempts that will be retried before the operation finally fails. + */ + public int maxTries() { return this.maxTries; } - int tryTimeout() { + /** + * @return the timeout in seconds allowed for each retry operation. + */ + public int tryTimeout() { return this.tryTimeout; } - String secondaryHost() { + /** + * @return the secondary host that retries could be attempted against. + */ + public String secondaryHost() { return this.secondaryHost; } - long retryDelayInMs() { + /** + * @return the delay in milliseconds between retry attempts. + */ + public long retryDelayInMs() { return retryDelayInMs; } - long maxRetryDelayInMs() { + /** + * @return the maximum delay in milliseconds between retry attempts. + */ + public long maxRetryDelayInMs() { return maxRetryDelayInMs; } /** * Calculates how long to delay before sending the next request. * - * @param tryCount - * An {@code int} indicating which try we are on. - * + * @param tryCount An {@code int} indicating which try we are on. * @return A {@code long} value of how many milliseconds to delay. */ long calculateDelayInMs(int tryCount) { - long delay = 0; + long delay; switch (this.retryPolicyType) { case EXPONENTIAL: delay = (pow(2L, tryCount - 1) - 1L) * this.retryDelayInMs; diff --git a/storage/client/file/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java similarity index 51% rename from storage/client/file/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java index 774a44999ce7..83bef0b2b49f 100644 --- a/storage/client/file/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java +++ b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java @@ -22,10 +22,10 @@ import java.util.concurrent.TimeoutException; /** - * This is a request policy in an {@link com.azure.core.http.HttpPipeline} for retrying a given HTTP request. The request - * that is retried will be identical each time it is reissued. Retries will try against a secondary if one is specified - * and the type of operation/error indicates that the secondary can handle the request. Exponential and fixed backoff are - * supported. The policy must only be used directly when creating a custom pipeline. + * This is a request policy in an {@link com.azure.core.http.HttpPipeline} for retrying a given HTTP request. The + * request that is retried will be identical each time it is reissued. Retries will try against a secondary if one is + * specified and the type of operation/error indicates that the secondary can handle the request. Exponential and fixed + * backoff are supported. The policy must only be used directly when creating a custom pipeline. */ public final class RequestRetryPolicy implements HttpPipelinePolicy { private final RequestRetryOptions requestRetryOptions; @@ -41,40 +41,32 @@ public RequestRetryPolicy(RequestRetryOptions requestRetryOptions) { @Override public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - HttpRequest httpRequest = context.httpRequest(); - boolean considerSecondary = (httpRequest.httpMethod().equals(HttpMethod.GET) - || httpRequest.httpMethod().equals(HttpMethod.HEAD)) - && (this.requestRetryOptions.secondaryHost() != null); + boolean considerSecondary = (this.requestRetryOptions.secondaryHost() != null) + && (HttpMethod.GET.equals(context.httpRequest().httpMethod()) || HttpMethod.HEAD.equals(context.httpRequest().httpMethod())); - return this.attemptAsync(httpRequest, next, 1, considerSecondary, 1); + return attemptAsync(context, next, context.httpRequest(), considerSecondary, 1, 1); } /** - * This method actually attempts to send the request and determines if we should attempt again and, if so, how - * long to wait before sending out the next request. + * This method actually attempts to send the request and determines if we should attempt again and, if so, how long + * to wait before sending out the next request. *

    - * Exponential retry algorithm: ((2 ^ attempt) - 1) * delay * random(0.8, 1.2) When to retry: connection failure - * or an HTTP status code of 500 or greater, except 501 and 505 If using a secondary: Odd tries go against - * primary; even tries go against the secondary For a primary wait ((2 ^ primaryTries - 1) * delay * random(0.8, - * 1.2) If secondary gets a 404, don't fail, retry but future retries are only against the primary When retrying - * against a secondary, ignore the retry count and wait (.1 second * random(0.8, 1.2)) + * Exponential retry algorithm: ((2 ^ attempt) - 1) * delay * random(0.8, 1.2) When to retry: connection failure or + * an HTTP status code of 500 or greater, except 501 and 505 If using a secondary: Odd tries go against primary; + * even tries go against the secondary For a primary wait ((2 ^ primaryTries - 1) * delay * random(0.8, 1.2) If + * secondary gets a 404, don't fail, retry but future retries are only against the primary When retrying against a + * secondary, ignore the retry count and wait (.1 second * random(0.8, 1.2)) * - * @param httpRequest - * The request to try. - * @param primaryTry - * This indicates how man tries we've attempted against the primary DC. - * @param considerSecondary - * Before each try, we'll select either the primary or secondary URL if appropriate. - * @param attempt - * This indicates the total number of attempts to send the request. - * - * @return A single containing either the successful response or an error that was not retryable because either - * the maxTries was exceeded or retries will not mitigate the issue. + * @param context The request to try. + * @param next The next policy to apply to the request + * @param originalRequest The unmodified original request + * @param primaryTry This indicates how man tries we've attempted against the primary DC. + * @param attempt This indicates the total number of attempts to send the request. + * @return A single containing either the successful response or an error that was not retryable because either the + * maxTries was exceeded or retries will not mitigate the issue. */ - private Mono attemptAsync(final HttpRequest httpRequest, HttpPipelineNextPolicy next, final int primaryTry, - final boolean considerSecondary, - final int attempt) { - + private Mono attemptAsync(final HttpPipelineCallContext context, HttpPipelineNextPolicy next, final HttpRequest originalRequest, + boolean considerSecondary, final int primaryTry, final int attempt) { // Determine which endpoint to try. It's primary if there is no secondary or if it is an odd number attempt. final boolean tryingPrimary = !considerSecondary || (attempt % 2 != 0); @@ -96,14 +88,14 @@ stream, the buffers that were emitted will have already been consumed (their pos ByteBuffers downstream will only actually consume a duplicate so the original is preserved. This only duplicates the ByteBuffer object, not the underlying data. */ - Flux bufferedBody = httpRequest.body() == null - ? null : httpRequest.body().map(ByteBuf::duplicate); - httpRequest.body(bufferedBody); + context.httpRequest(originalRequest.buffer()); + Flux bufferedBody = (context.httpRequest().body() == null) ? null : context.httpRequest().body().map(ByteBuf::duplicate); + context.httpRequest().body(bufferedBody); if (!tryingPrimary) { - UrlBuilder builder = UrlBuilder.parse(httpRequest.url()); + UrlBuilder builder = UrlBuilder.parse(context.httpRequest().url()); builder.host(this.requestRetryOptions.secondaryHost()); try { - httpRequest.url(builder.toURL()); + context.httpRequest().url(builder.toURL()); } catch (MalformedURLException e) { return Mono.error(e); } @@ -114,55 +106,53 @@ stream, the buffers that were emitted will have already been consumed (their pos until after the retry backoff delay, so we call delaySubscription. */ return next.clone().process() - .timeout(Duration.ofSeconds(this.requestRetryOptions.tryTimeout())) - .delaySubscription(Duration.ofMillis(delayMs)) - .flatMap(response -> { - boolean newConsiderSecondary = considerSecondary; - String action; - int statusCode = response.statusCode(); + .timeout(Duration.ofSeconds(this.requestRetryOptions.tryTimeout())) + .delaySubscription(Duration.ofMillis(delayMs)) + .flatMap(response -> { + boolean newConsiderSecondary = considerSecondary; + String action; + int statusCode = response.statusCode(); /* If attempt was against the secondary & it returned a StatusNotFound (404), then the resource was not found. This may be due to replication delay. So, in this case, we'll never try the secondary again for this operation. */ - if (!tryingPrimary && statusCode == 404) { - newConsiderSecondary = false; - action = "Retry: Secondary URL returned 404"; - } else if (statusCode == 503 || statusCode == 500) { - action = "Retry: Temporary error or server timeout"; - } else { - action = "NoRetry: Successful HTTP request"; - } - - if (action.charAt(0) == 'R' && attempt < requestRetryOptions.maxTries()) { + if (!tryingPrimary && statusCode == 404) { + newConsiderSecondary = false; + action = "Retry: Secondary URL returned 404"; + } else if (statusCode == 503 || statusCode == 500) { + action = "Retry: Temporary error or server timeout"; + } else { + action = "NoRetry: Successful HTTP request"; + } + + if (action.charAt(0) == 'R' && attempt < requestRetryOptions.maxTries()) { /* We increment primaryTry if we are about to try the primary again (which is when we consider the secondary and tried the secondary this time (tryingPrimary==false) or we do not consider the secondary at all (considerSecondary==false)). This will ensure primaryTry is correct when passed to calculate the delay. */ - int newPrimaryTry = !tryingPrimary || !considerSecondary - ? primaryTry + 1 : primaryTry; - return attemptAsync(httpRequest, next, newPrimaryTry, newConsiderSecondary, - attempt + 1); - } - return Mono.just(response); - }) - .onErrorResume(throwable -> { + int newPrimaryTry = (!tryingPrimary || !considerSecondary) ? primaryTry + 1 : primaryTry; + return attemptAsync(context, next, originalRequest, newConsiderSecondary, newPrimaryTry, attempt + 1); + } + + return Mono.just(response); + }).onErrorResume(throwable -> { /* It is likely that many users will not realize that their Flux must be replayable and get an error upon retries when the provided data length does not match the length of the exact data. We cannot enforce the desired Flux behavior, so we provide a hint when this is likely the root cause. */ - if (throwable instanceof IllegalStateException && attempt > 1) { - return Mono.error(new IllegalStateException("The request failed because the " - + "size of the contents of the provided Flux did not match the provided " - + "data size upon attempting to retry. This is likely caused by the Flux " - + "not being replayable. To support retries, all Fluxes must produce the " - + "same data for each subscriber. Please ensure this behavior.", throwable)); - } + if (throwable instanceof IllegalStateException && attempt > 1) { + return Mono.error(new IllegalStateException("The request failed because the " + + "size of the contents of the provided Flux did not match the provided " + + "data size upon attempting to retry. This is likely caused by the Flux " + + "not being replayable. To support retries, all Fluxes must produce the " + + "same data for each subscriber. Please ensure this behavior.", throwable)); + } /* IOException is a catch-all for IO related errors. Technically it includes many types which may @@ -170,28 +160,27 @@ we do not consider the secondary at all (considerSecondary==false)). This will either case, it is better to optimistically retry instead of failing too soon. A Timeout Exception is a client-side timeout coming from Rx. */ - String action; - if (throwable instanceof IOException) { - action = "Retry: Network error"; - } else if (throwable instanceof TimeoutException) { - action = "Retry: Client timeout"; - } else { - action = "NoRetry: Unknown error"; - } - - if (action.charAt(0) == 'R' && attempt < requestRetryOptions.maxTries()) { + String action; + if (throwable instanceof IOException) { + action = "Retry: Network error"; + } else if (throwable instanceof TimeoutException) { + action = "Retry: Client timeout"; + } else { + action = "NoRetry: Unknown error"; + } + + if (action.charAt(0) == 'R' && attempt < requestRetryOptions.maxTries()) { /* We increment primaryTry if we are about to try the primary again (which is when we consider the secondary and tried the secondary this time (tryingPrimary==false) or we do not consider the secondary at all (considerSecondary==false)). This will ensure primaryTry is correct when passed to calculate the delay. */ - int newPrimaryTry = !tryingPrimary || !considerSecondary - ? primaryTry + 1 : primaryTry; - return attemptAsync(httpRequest, next, newPrimaryTry, considerSecondary, - attempt + 1); - } - return Mono.error(throwable); - }); + int newPrimaryTry = (!tryingPrimary || !considerSecondary) ? primaryTry + 1 : primaryTry; + return attemptAsync(context, next, originalRequest, considerSecondary, newPrimaryTry, attempt + 1); + } + + return Mono.error(throwable); + }); } } diff --git a/storage/client/blob/src/main/java/com/azure/storage/common/policy/RetryPolicyType.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/RetryPolicyType.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/common/policy/RetryPolicyType.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/RetryPolicyType.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java diff --git a/storage/client/blob/src/main/java/com/azure/storage/common/policy/package-info.java b/sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/package-info.java similarity index 100% rename from storage/client/blob/src/main/java/com/azure/storage/common/policy/package-info.java rename to sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/common/policy/package-info.java diff --git a/storage/client/blob/src/samples/java/AzureIdentityExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java similarity index 89% rename from storage/client/blob/src/samples/java/AzureIdentityExample.java rename to sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java index 6550c8c02a76..9945273cbccd 100644 --- a/storage/client/blob/src/samples/java/AzureIdentityExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/AzureIdentityExample.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +package com.azure.storage.blob; + import com.azure.identity.credential.DefaultAzureCredential; -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; import java.util.Locale; @@ -30,7 +30,7 @@ public static void main(String[] args) { /* * Create a storage client using the Azure Identity credentials. */ - StorageClient storageClient = new StorageClientBuilder() + BlobServiceClient storageClient = new BlobServiceClientBuilder() .endpoint(endpoint) .credential(new DefaultAzureCredential()) .buildClient(); diff --git a/storage/client/blob/src/samples/java/BasicExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BasicExample.java similarity index 91% rename from storage/client/blob/src/samples/java/BasicExample.java rename to sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BasicExample.java index 3f8edbd367cb..c47e753b3f07 100644 --- a/storage/client/blob/src/samples/java/BasicExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BasicExample.java @@ -1,10 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import com.azure.storage.blob.BlockBlobClient; -import com.azure.storage.blob.ContainerClient; -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; +package com.azure.storage.blob; + import com.azure.storage.common.credentials.SharedKeyCredential; import java.io.ByteArrayInputStream; @@ -46,9 +44,9 @@ public static void main(String[] args) throws IOException { String endpoint = String.format(Locale.ROOT, "https://%s.blob.core.windows.net", accountName); /* - * Create a StorageClient object that wraps the service endpoint, credential and a request pipeline. + * Create a BlobServiceClient object that wraps the service endpoint, credential and a request pipeline. */ - StorageClient storageClient = new StorageClientBuilder().endpoint(endpoint).credential(credential).buildClient(); + BlobServiceClient storageClient = new BlobServiceClientBuilder().endpoint(endpoint).credential(credential).buildClient(); /* * This example shows several common operations just to get you started. 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 new file mode 100644 index 000000000000..54d5bc091850 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,392 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.storage.blob.models.AccessTier; +import com.azure.storage.blob.models.BlobAccessConditions; +import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobRange; +import com.azure.storage.blob.models.DeleteSnapshotsOptionType; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.Metadata; +import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.ReliableDownloadOptions; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.net.URL; +import java.time.OffsetDateTime; +import java.util.Collections; + +/** + * Code snippets for {@link BlobAsyncClient} + */ +@SuppressWarnings("unused") +public class BlobAsyncClientJavaDocCodeSnippets { + private BlobAsyncClient client = JavaDocCodeSnippetsHelpers.getBlobAsyncClient("blobName"); + private String leaseId = "leaseId"; + private String copyId = "copyId"; + private URL url = JavaDocCodeSnippetsHelpers.generateURL("https://sample.com"); + private String file = "file"; + + /** + * Code snippet for {@link BlobAsyncClient#exists()} + */ + public void existsCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.exists + client.exists().subscribe(response -> System.out.printf("Exists? %b%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.exists + } + + /** + * Code snippets for {@link BlobAsyncClient#startCopyFromURL(URL)} and + * {@link BlobAsyncClient#startCopyFromURL(URL, Metadata, ModifiedAccessConditions, BlobAccessConditions)} + */ + public void startCopyFromURL() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.startCopyFromURL#URL + client.startCopyFromURL(url) + .subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); + // 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)} + */ + public void abortCopyFromURL() { + // 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())); + // 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)} + */ + public void copyFromURL() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.copyFromURL#URL + client.copyFromURL(url).subscribe(response -> System.out.printf("Copy identifier: %s%n", response.value())); + // 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)} + * + * @throws UncheckedIOException If an I/O error occurs + */ + public void download() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.download + client.download().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.download + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.download#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean + BlobRange range = new BlobRange(1024, 2048L); + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); + + client.download(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.download#BlobRange-ReliableDownloadOptions-BlobAccessConditions-boolean + } + + /** + * Code snippets for {@link BlobAsyncClient#downloadToFile(String)} and + * {@link BlobAsyncClient#downloadToFile(String, BlobRange, Integer, ReliableDownloadOptions, BlobAccessConditions, boolean)} + */ + public void downloadToFile() { + // 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 + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean + BlobRange range = new BlobRange(1024, 2048L); + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); + + client.downloadToFile(file, range, null, options, null, false) + .subscribe(response -> System.out.println("Completed download to file")); + // END: com.azure.storage.blob.BlobAsyncClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean + } + + /** + * Code snippets for {@link BlobAsyncClient#delete()} and + * {@link BlobAsyncClient#delete(DeleteSnapshotsOptionType, BlobAccessConditions)} + */ + public void delete() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.delete + client.delete() + .subscribe(response -> System.out.printf("Delete completed with status %d%n", response.statusCode())); + // 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)} + */ + public void getProperties() { + // 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())); + // 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)} + */ + public void setHTTPHeaders() { + // 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())); + // 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)} + */ + public void setMetadata() { + // 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())); + // 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)} + */ + public void createSnapshot() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.createSnapshot + client.createSnapshot() + .subscribe(response -> System.out.printf("Identifier for the snapshot is %s%n", + response.value().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)} + */ + public void setTier() { + // 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())); + // 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() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.undelete + client.undelete() + .subscribe(response -> System.out.printf("Undelete completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.undelete + } + + /** + * Code snippets for {@link BlobAsyncClient#acquireLease(String, int)} and + * {@link BlobAsyncClient#acquireLease(String, int, ModifiedAccessConditions)} + */ + public void acquireLease() { + // 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())); + // END: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifModifiedSince(OffsetDateTime.now().minusDays(3)); + + client.acquireLease("proposedId", 60, modifiedAccessConditions) + .subscribe(response -> System.out.printf("Lease ID is %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.acquireLease#String-int-ModifiedAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#renewLease(String)} and + * {@link BlobAsyncClient#renewLease(String, ModifiedAccessConditions)} + */ + 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 + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.renewLease(leaseId, modifiedAccessConditions) + .subscribe(response -> System.out.printf("Renewed lease ID is %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.renewLease#String-ModifiedAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#releaseLease(String)} and + * {@link BlobAsyncClient#releaseLease(String, ModifiedAccessConditions)} + */ + 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 + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.releaseLease(leaseId, modifiedAccessConditions) + .subscribe(response -> System.out.printf("Release lease completed with status %d%n", response.statusCode())); + // END: com.azure.storage.blob.BlobAsyncClient.releaseLease#String-ModifiedAccessConditions + } + + /** + * Code snippets for {@link BlobAsyncClient#breakLease()} and + * {@link BlobAsyncClient#breakLease(Integer, ModifiedAccessConditions)} + */ + 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 + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.breakLease#Integer-ModifiedAccessConditions + Integer retainLeaseInSeconds = 5; + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.breakLease(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 + } + + /** + * Code snippets for {@link BlobAsyncClient#changeLease(String, String)} and + * {@link BlobAsyncClient#changeLease(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 + + // BEGIN: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + client.changeLease(leaseId, "proposedId", modifiedAccessConditions) + .subscribe(response -> System.out.printf("Changed lease ID is %s%n", response.value())); + // END: com.azure.storage.blob.BlobAsyncClient.changeLease#String-String-ModifiedAccessConditions + } + + /** + * Code snippet for {@link BlobAsyncClient#getAccountInfo()} + */ + public void getAccountInfo() { + // BEGIN: com.azure.storage.blob.BlobAsyncClient.getAccountInfo + client.getAccountInfo().subscribe(response -> System.out.printf("Account Kind: %s, SKU: %s%n", + response.value().accountKind(), response.value().skuName())); + // END: com.azure.storage.blob.BlobAsyncClient.getAccountInfo + } +} 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 new file mode 100644 index 000000000000..90a64765f384 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/BlobClientJavaDocCodeSnippets.java @@ -0,0 +1,387 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.storage.blob.models.AccessTier; +import com.azure.storage.blob.models.BlobAccessConditions; +import com.azure.storage.blob.models.BlobHTTPHeaders; +import com.azure.storage.blob.models.BlobRange; +import com.azure.storage.blob.models.DeleteSnapshotsOptionType; +import com.azure.storage.blob.models.LeaseAccessConditions; +import com.azure.storage.blob.models.Metadata; +import com.azure.storage.blob.models.ModifiedAccessConditions; +import com.azure.storage.blob.models.ReliableDownloadOptions; +import com.azure.storage.blob.models.StorageAccountInfo; + +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.net.URL; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Collections; + +/** + * Code snippets for {@link BlobClient} + */ +@SuppressWarnings("unused") +public class BlobClientJavaDocCodeSnippets { + private BlobClient client = JavaDocCodeSnippetsHelpers.getBlobClient("blobName"); + private String leaseId = "leaseId"; + private String copyId = "copyId"; + private URL url = JavaDocCodeSnippetsHelpers.generateURL("https://sample.com"); + private String file = "file"; + private Duration timeout = Duration.ofSeconds(30); + + /** + * Code snippets for {@link BlobClient#exists()} and {@link BlobClient#exists(Duration)} + */ + public void existsCodeSnippet() { + // BEGIN: com.azure.storage.blob.BlobClient.exists + System.out.printf("Exists? %b%n", client.exists().value()); + // 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)} + */ + public void startCopyFromURL() { + // BEGIN: com.azure.storage.blob.BlobClient.startCopyFromURL#URL + System.out.printf("Copy identifier: %s%n", client.startCopyFromURL(url).value()); + // 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)} + */ + 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()); + // 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)} + */ + public void copyFromURL() { + // BEGIN: com.azure.storage.blob.BlobClient.copyFromURL#URL + System.out.printf("Copy identifier: %s%n", client.copyFromURL(url).value()); + // 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)} + */ + 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()); + // 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)} + */ + public void downloadToFile() { + // BEGIN: com.azure.storage.blob.BlobClient.downloadToFile#String + client.downloadToFile(file); + 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 + BlobRange range = new BlobRange(1024, 2048L); + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5); + + client.downloadToFile(file, range, null, options, null, false, timeout); + System.out.println("Completed download to file"); + // END: com.azure.storage.blob.BlobClient.downloadToFile#String-BlobRange-Integer-ReliableDownloadOptions-BlobAccessConditions-boolean-Duration + } + + /** + * Code snippets for {@link BlobClient#delete()} and + * {@link BlobClient#delete(DeleteSnapshotsOptionType, BlobAccessConditions, Duration)} + */ + public void delete() { + // BEGIN: com.azure.storage.blob.BlobClient.delete + System.out.printf("Delete completed with status %d%n", client.delete().statusCode()); + // 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 + } + + /** + * Code snippets for {@link BlobClient#getProperties()} + */ + public void getProperties() { + // BEGIN: com.azure.storage.blob.BlobClient.getProperties + BlobProperties properties = client.getProperties().value(); + System.out.printf("Type: %s, Size: %d%n", properties.blobType(), properties.blobSize()); + // END: com.azure.storage.blob.BlobClient.getProperties + } + + /** + * Code snippet for {@link BlobClient#getProperties(BlobAccessConditions, Duration)} + */ + public void getPropertiesWithTimeout() { + // BEGIN: com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + BlobProperties properties = client.getProperties(accessConditions, timeout).value(); + System.out.printf("Type: %s, Size: %d%n", properties.blobType(), properties.blobSize()); + // END: com.azure.storage.blob.BlobClient.getProperties#BlobAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders)} and + * {@link BlobClient#setHTTPHeaders(BlobHTTPHeaders, BlobAccessConditions, Duration)} + */ + 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 + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + System.out.printf("Set HTTP headers completed with status %d%n", + client.setHTTPHeaders(new BlobHTTPHeaders() + .blobContentLanguage("en-US") + .blobContentType("binary"), accessConditions, timeout) + .statusCode()); + // END: com.azure.storage.blob.BlobClient.setHTTPHeaders#BlobHTTPHeaders-BlobAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#setMetadata(Metadata)} and + * {@link BlobClient#setMetadata(Metadata, BlobAccessConditions, Duration)} + */ + 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)); + + System.out.printf("Set metadata completed with status %d%n", + client.setMetadata( + new Metadata(Collections.singletonMap("metadata", "value")), accessConditions, timeout).statusCode()); + // END: com.azure.storage.blob.BlobClient.setMetadata#Metadata-BlobAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#createSnapshot()} and + * {@link BlobClient#createSnapshot(Metadata, BlobAccessConditions, Duration)} + */ + 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 + + // BEGIN: com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration + Metadata snapshotMetadata = new Metadata(Collections.singletonMap("metadata", "value")); + BlobAccessConditions accessConditions = new BlobAccessConditions() + .leaseAccessConditions(new LeaseAccessConditions().leaseId(leaseId)); + + System.out.printf("Identifier for the snapshot is %s%n", + client.createSnapshot(snapshotMetadata, accessConditions, timeout).value().getSnapshotId()); + // END: com.azure.storage.blob.BlobClient.createSnapshot#Metadata-BlobAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#setTier(AccessTier)} and + * {@link BlobClient#setTier(AccessTier, LeaseAccessConditions, Duration)} + */ + 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 + LeaseAccessConditions accessConditions = new LeaseAccessConditions().leaseId(leaseId); + + System.out.printf("Set tier completed with status code %d%n", + client.setTier(AccessTier.HOT, accessConditions, timeout).statusCode()); + // END: com.azure.storage.blob.BlobClient.setTier#AccessTier-LeaseAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#undelete()} and {@link BlobClient#undelete(Duration)} + */ + 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 + } + + /** + * Code snippets for {@link BlobClient#acquireLease(String, int)} and + * {@link BlobClient#acquireLease(String, int, ModifiedAccessConditions, Duration)} + */ + 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 + + // BEGIN: com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifModifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("Lease ID is %s%n", + client.acquireLease("proposedId", 60, modifiedAccessConditions, timeout).value()); + // END: com.azure.storage.blob.BlobClient.acquireLease#String-int-ModifiedAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#renewLease(String)} and + * {@link BlobClient#renewLease(String, ModifiedAccessConditions, Duration)} + */ + 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 + + // BEGIN: com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("Renewed lease ID is %s%n", + client.renewLease(leaseId, modifiedAccessConditions, timeout).value()); + // END: com.azure.storage.blob.BlobClient.renewLease#String-ModifiedAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#releaseLease(String)} and + * {@link BlobClient#releaseLease(String, ModifiedAccessConditions, Duration)} + */ + 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 + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("Release lease completed with status %d%n", + client.releaseLease(leaseId, modifiedAccessConditions, timeout).statusCode()); + // END: com.azure.storage.blob.BlobClient.releaseLease#String-ModifiedAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#breakLease()} and + * {@link BlobClient#breakLease(Integer, ModifiedAccessConditions, Duration)} + */ + 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 + + // BEGIN: com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration + Integer retainLeaseInSeconds = 5; + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("The broken lease has %d seconds remaining on the lease", + client.breakLease(retainLeaseInSeconds, modifiedAccessConditions, timeout).value()); + // END: com.azure.storage.blob.BlobClient.breakLease#Integer-ModifiedAccessConditions-Duration + } + + /** + * Code snippets for {@link BlobClient#changeLease(String, String)} and + * {@link BlobClient#changeLease(String, String, ModifiedAccessConditions, Duration)} + */ + 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 + + // BEGIN: com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration + ModifiedAccessConditions modifiedAccessConditions = new ModifiedAccessConditions() + .ifUnmodifiedSince(OffsetDateTime.now().minusDays(3)); + + System.out.printf("Changed lease ID is %s%n", + client.changeLease(leaseId, "proposedId", modifiedAccessConditions, timeout).value()); + // END: com.azure.storage.blob.BlobClient.changeLease#String-String-ModifiedAccessConditions-Duration + } + + /** + * Code snippet for {@link BlobClient#getAccountInfo()} + */ + public void getAccountInfo() { + // BEGIN: com.azure.storage.blob.BlobClient.getAccountInfo + StorageAccountInfo accountInfo = client.getAccountInfo().value(); + System.out.printf("Account Kind: %s, SKU: %s%n", accountInfo.accountKind(), accountInfo.skuName()); + // END: com.azure.storage.blob.BlobClient.getAccountInfo + } + + /** + * Code snippet for {@link BlobClient#getAccountInfo(Duration)} + */ + 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 + } +} diff --git a/storage/client/blob/src/samples/java/FileTransferExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java similarity index 93% rename from storage/client/blob/src/samples/java/FileTransferExample.java rename to sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java index cfd281c1e3f8..33886cd10750 100644 --- a/storage/client/blob/src/samples/java/FileTransferExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/FileTransferExample.java @@ -1,10 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import com.azure.storage.blob.BlockBlobClient; -import com.azure.storage.blob.ContainerClient; -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; +package com.azure.storage.blob; + import com.azure.storage.common.credentials.SharedKeyCredential; import java.io.File; @@ -52,10 +50,10 @@ public static void main(String[] args) throws IOException, NoSuchAlgorithmExcept String endPoint = String.format(Locale.ROOT, "https://%s.blob.core.windows.net", accountName); /* - * Create a StorageClient object that wraps the service endpoint, credential and a request pipeline. + * Create a BlobServiceClient object that wraps the service endpoint, credential and a request pipeline. * Now you can use the storageClient to perform various container and blob operations. */ - StorageClient storageClient = new StorageClientBuilder().endpoint(endPoint).credential(credential).buildClient(); + BlobServiceClient storageClient = new BlobServiceClientBuilder().endpoint(endPoint).credential(credential).buildClient(); /* 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 new file mode 100644 index 000000000000..febf2861cad9 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/JavaDocCodeSnippetsHelpers.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import java.net.MalformedURLException; +import java.net.URL; + +final class JavaDocCodeSnippetsHelpers { + static ContainerAsyncClient getContainerAsyncClient() { + return new ContainerClientBuilder().buildAsyncClient(); + } + + static BlobAsyncClient getBlobAsyncClient(String blobName) { + return getContainerAsyncClient().getBlobAsyncClient(blobName); + } + + static BlobClient getBlobClient(String blobName) { + return new BlobClient(getBlobAsyncClient(blobName)); + } + + static URL generateURL(String urlString) { + try { + return new URL(urlString); + } catch (MalformedURLException ex) { + throw new RuntimeException(ex); + } + } +} diff --git a/storage/client/blob/src/samples/java/ListContainersExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java similarity index 84% rename from storage/client/blob/src/samples/java/ListContainersExample.java rename to sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java index ab8c9b3709bc..5588ef64241c 100644 --- a/storage/client/blob/src/samples/java/ListContainersExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/ListContainersExample.java @@ -1,8 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; +package com.azure.storage.blob; + import com.azure.storage.common.credentials.SharedKeyCredential; import java.util.Locale; @@ -32,9 +32,9 @@ public static void main(String[] args) { String endpoint = String.format(Locale.ROOT, "https://%s.blob.core.windows.net", accountName); /* - * Create a StorageClient object that wraps the service endpoint, credential and a request pipeline. + * Create a BlobServiceClient object that wraps the service endpoint, credential and a request pipeline. */ - StorageClient storageClient = new StorageClientBuilder().endpoint(endpoint).credential(credential).buildClient(); + BlobServiceClient storageClient = new BlobServiceClientBuilder().endpoint(endpoint).credential(credential).buildClient(); /* * Create 3 different containers from the storageClient. diff --git a/storage/client/blob/src/samples/java/SampleHelper.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SampleHelper.java similarity index 94% rename from storage/client/blob/src/samples/java/SampleHelper.java rename to sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SampleHelper.java index d841413f06bc..f72655d856bd 100644 --- a/storage/client/blob/src/samples/java/SampleHelper.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SampleHelper.java @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +package com.azure.storage.blob; + import com.azure.core.util.configuration.ConfigurationManager; /** diff --git a/storage/client/blob/src/samples/java/SetMetadataAndHTTPHeadersExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java similarity index 87% rename from storage/client/blob/src/samples/java/SetMetadataAndHTTPHeadersExample.java rename to sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java index 6b475499eab2..591e78141f70 100644 --- a/storage/client/blob/src/samples/java/SetMetadataAndHTTPHeadersExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/SetMetadataAndHTTPHeadersExample.java @@ -1,10 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -import com.azure.storage.blob.BlockBlobClient; -import com.azure.storage.blob.ContainerClient; -import com.azure.storage.blob.StorageClient; -import com.azure.storage.blob.StorageClientBuilder; +package com.azure.storage.blob; + import com.azure.storage.blob.models.BlobHTTPHeaders; import com.azure.storage.blob.models.Metadata; import com.azure.storage.common.credentials.SharedKeyCredential; @@ -42,9 +40,9 @@ public static void main(String[] args) throws IOException { String endpoint = String.format(Locale.ROOT, "https://%s.blob.core.windows.net", accountName); /* - * Create a StorageClient object that wraps the service endpoint, credential and a request pipeline. + * Create a BlobServiceClient object that wraps the service endpoint, credential and a request pipeline. */ - StorageClient storageClient = new StorageClientBuilder().endpoint(endpoint).credential(credential).buildClient(); + BlobServiceClient storageClient = new BlobServiceClientBuilder().endpoint(endpoint).credential(credential).buildClient(); /* * Create a container client from storageClient. diff --git a/storage/client/blob/src/samples/java/StorageErrorHandlingExample.java b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java similarity index 94% rename from storage/client/blob/src/samples/java/StorageErrorHandlingExample.java rename to sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java index 50d4e81d600c..3a84d7026f7b 100644 --- a/storage/client/blob/src/samples/java/StorageErrorHandlingExample.java +++ b/sdk/storage/azure-storage-blob/src/samples/java/com/azure/storage/blob/StorageErrorHandlingExample.java @@ -1,10 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +package com.azure.storage.blob; + import com.azure.core.http.HttpResponse; -import com.azure.storage.blob.ContainerClient; -import com.azure.storage.blob.ContainerClientBuilder; -import com.azure.storage.blob.StorageException; import com.azure.storage.blob.models.StorageErrorCode; /** diff --git a/storage/client/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 similarity index 90% rename from storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy rename to sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/APISpec.groovy index fb306c17ff35..1768e02fab74 100644 --- a/storage/client/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 @@ -3,14 +3,21 @@ package com.azure.storage.blob -import com.azure.core.http.* +import com.azure.core.http.HttpClient +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.HttpResponse import com.azure.core.http.policy.HttpLogDetailLevel import com.azure.core.http.policy.HttpPipelinePolicy +import com.azure.core.http.ProxyOptions import com.azure.core.http.rest.Response import com.azure.core.util.configuration.ConfigurationManager import com.azure.identity.credential.EnvironmentCredential import com.azure.storage.blob.models.* 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 @@ -92,16 +99,16 @@ class APISpec extends Specification { /* URLs to various kinds of accounts. */ - StorageClient primaryServiceURL + BlobServiceClient primaryServiceURL @Shared - static StorageClient alternateServiceURL + static BlobServiceClient alternateServiceURL @Shared - static StorageClient blobStorageServiceURL + static BlobServiceClient blobStorageServiceURL @Shared - static StorageClient premiumServiceURL + static BlobServiceClient premiumServiceURL /* Constants for testing that the context parameter is properly passed to the pipeline. @@ -189,10 +196,10 @@ class APISpec extends Specification { } } - static StorageClient getGenericServiceURL(SharedKeyCredential creds) { + static BlobServiceClient getGenericServiceURL(SharedKeyCredential creds) { // TODO: logging? - return new StorageClientBuilder() + return new BlobServiceClientBuilder() .endpoint("https://" + creds.accountName() + ".blob.core.windows.net") .httpClient(getHttpClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) @@ -201,7 +208,7 @@ class APISpec extends Specification { } static void cleanupContainers() throws MalformedURLException { - StorageClient serviceURL = new StorageClientBuilder() + BlobServiceClient serviceURL = new BlobServiceClientBuilder() .endpoint("http://" + primaryCreds.accountName() + ".blob.core.windows.net") .credential(primaryCreds) .buildClient() @@ -403,7 +410,7 @@ class APISpec extends Specification { response.value().contentEncoding() == contentEncoding && response.value().contentLanguage() == contentLanguage && response.value().contentMD5() == contentMD5 && - response.headers().value("Content-Type") == (contentType == null ? "application/octet-stream" : contentType) + response.headers().value("Content-Type") == contentType } static Metadata getMetadataFromHeaders(HttpHeaders headers) { @@ -496,43 +503,51 @@ class APISpec extends Specification { to play too nicely with mocked objects and the complex reflection stuff on both ends made it more difficult to work with than was worth it. Because this type is just for BlobDownload, we don't need to accept a header type. */ - def getStubResponseForBlobDownload(int code, Flux body, String etag) { - return new HttpResponse() { + static class MockDownloadHttpResponse extends HttpResponse { + private final int statusCode + private final HttpHeaders headers + private final Flux body + + MockDownloadHttpResponse(HttpResponse response, int statusCode, Flux body) { + this.request(response.request()) + this.statusCode = statusCode + this.headers = response.headers() + this.body = body + } - @Override - int statusCode() { - return code - } + @Override + int statusCode() { + return statusCode + } - @Override - String headerValue(String s) { - return null - } + @Override + String headerValue(String s) { + return headers.value(s) + } - @Override - HttpHeaders headers() { - return new HttpHeaders() - } + @Override + HttpHeaders headers() { + return headers + } - @Override - Flux body() { - return body - } + @Override + Flux body() { + return body + } - @Override - Mono bodyAsByteArray() { - return null - } + @Override + Mono bodyAsByteArray() { + return Mono.error(new IOException()) + } - @Override - Mono bodyAsString() { - return null - } + @Override + Mono bodyAsString() { + return Mono.error(new IOException()) + } - @Override - Mono bodyAsString(Charset charset) { - return null - } + @Override + Mono bodyAsString(Charset charset) { + return Mono.error(new IOException()) } } @@ -550,9 +565,10 @@ class APISpec extends Specification { } def getOAuthServiceURL() { - return new StorageClientBuilder() + return new BlobServiceClientBuilder() .endpoint(String.format("https://%s.blob.core.windows.net/", primaryCreds.accountName())) .credential(new EnvironmentCredential()) // AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .buildClient() } diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/test/java/com/azure/storage/blob/AppendBlobAPITest.groovy rename to sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/AppendBlobAPITest.groovy index b295c16c976d..5d6f364f7e5e 100644 --- a/storage/client/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 @@ -57,6 +57,9 @@ class AppendBlobAPITest extends APISpec { bu.create(headers, null, null, null) Response response = bu.getProperties() + // If the value isn't set the service will automatically set it + contentType = (contentType == null) ? "application/octet-stream" : contentType + then: validateBlobProperties(response, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentMD5, contentType) diff --git a/storage/client/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 similarity index 94% rename from storage/client/blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy rename to sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobAPITest.groovy index d0be4d532642..4ad895869cba 100644 --- a/storage/client/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,10 +4,15 @@ 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 spock.lang.Unroll import java.nio.ByteBuffer @@ -76,50 +81,50 @@ class BlobAPITest extends APISpec { This is to test the appropriate integration of DownloadResponse, including setting the correct range values on HTTPGetterInfo. */ -// def "Download with retry range"() { -// /* -// We are going to make a request for some range on a blob. The Flux returned will throw an exception, forcing -// a retry per the ReliableDownloadOptions. The next request should have the same range header, which was generated -// from the count and offset values in HTTPGetterInfo that was constructed on the initial call to download. We -// don't need to check the data here, but we want to ensure that the correct range is set each time. This will -// test the correction of a bug that was found which caused HTTPGetterInfo to have an incorrect offset when it was -// constructed in BlobClient.download(). -// */ -// setup: -// HttpPipelinePolicy mockPolicy = Mock(HttpPipelinePolicy) { -// process(_ as HttpPipelineCallContext, _ as HttpPipelineNextPolicy) >> { -// HttpPipelineCallContext context, HttpPipelineNextPolicy next -> -// HttpRequest request = context.httpRequest() -// if (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 -// // TODO stub responses failing azure.core.implementation checks; too many nulls -// return Mono.just(getStubResponseForBlobDownload(206, Flux.error(new IOException()), "etag")) -// } -// } -// } -// -// BlobClient bu2 = new BlobClientBuilder() -// .endpoint(bu.getBlobUrl().toString()) -// .credential(primaryCreds) -// .addPolicy(mockPolicy) -// .buildClient() -// -// when: -// def range = new BlobRange(2, 5L) -// def options = new ReliableDownloadOptions().maxRetryRequests(3) -// bu2.download(new ByteArrayOutputStream(), options, range, null, false, null) -// -// then: -// /* -// Because the dummy Flux always throws an error. This will also validate that an IllegalArgumentException is -// NOT thrown because the types would not match. -// */ -// def e = thrown(RuntimeException) -// e.getCause() instanceof IOException -// } + def "Download with retry range"() { + /* + We are going to make a request for some range on a blob. The Flux returned will throw an exception, forcing + a retry per the ReliableDownloadOptions. The next request should have the same range header, which was generated + from the count and offset values in HTTPGetterInfo that was constructed on the initial call to download. We + don't need to check the data here, but we want to ensure that the correct range is set each time. This will + test the correction of a bug that was found which caused HTTPGetterInfo to have an incorrect offset when it was + 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() + + when: + BlobRange range = new BlobRange(2, 5L) + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(3) + bu2.download(new ByteArrayOutputStream(), range, options, null, false, null) + + then: + /* + Because the dummy Flux always throws an error. This will also validate that an IllegalArgumentException is + NOT thrown because the types would not match. + */ + def e = thrown(RuntimeException) + e.getCause() instanceof IOException + } def "Download min"() { when: @@ -138,7 +143,7 @@ class BlobAPITest extends APISpec { when: def outStream = new ByteArrayOutputStream() - bu.download(outStream, null, range, null, false, null) + bu.download(outStream, range, null, null, false, null) String bodyStr = outStream.toString() then: @@ -208,7 +213,7 @@ class BlobAPITest extends APISpec { def "Download md5"() { when: - VoidResponse response = bu.download(new ByteArrayOutputStream(), null, new BlobRange(0 ,3), null, true, null) + VoidResponse response = bu.download(new ByteArrayOutputStream(), new BlobRange(0 ,3), null, null, true, null) byte[] contentMD5 = response.headers().value("content-md5").getBytes() then: @@ -231,16 +236,11 @@ class BlobAPITest extends APISpec { ByteArrayOutputStream originalStream = new ByteArrayOutputStream() bu.download(originalStream) - String snapshot = bu.createSnapshot().value() BlockBlobClient bu2 = bu.asBlockBlobClient() + BlobClient bu3 = bu.createSnapshot().value() bu2.upload(new ByteArrayInputStream("ABC".getBytes()), 3) then: - BlobClient bu3 = new BlobClientBuilder() - .endpoint(bu.getBlobUrl().toString()) - .snapshot(snapshot) - .credential(primaryCreds) - .buildBlobClient() ByteArrayOutputStream snapshotStream = new ByteArrayOutputStream() bu3.download(snapshotStream) snapshotStream.toByteArray() == originalStream.toByteArray() @@ -358,8 +358,7 @@ class BlobAPITest extends APISpec { validateBasicHeaders(response.headers()) } - // TODO (alzimmer): Figure out why getProperties returns null after setHTTPHeaders - /*def "Set HTTP headers min"() { + def "Set HTTP headers min"() { when: BlobProperties properties = bu.getProperties().value() BlobHTTPHeaders headers = new BlobHTTPHeaders() @@ -368,15 +367,15 @@ class BlobAPITest extends APISpec { .blobContentType("type") .blobCacheControl(properties.cacheControl()) .blobContentLanguage(properties.contentLanguage()) - .blobContentMD5(Base64.getDecoder().decode(properties.contentMD5())) + .blobContentMD5(Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultData.array()))) bu.setHTTPHeaders(headers) then: - bu.getProperties().headers().value("x-ms-blob-content-type") == "type" - }*/ + bu.getProperties().headers().value("Content-Type") == "type" + } - /*@Unroll + @Unroll def "Set HTTP headers headers"() { setup: BlobHTTPHeaders putHeaders = new BlobHTTPHeaders().blobCacheControl(cacheControl) @@ -397,7 +396,7 @@ class BlobAPITest extends APISpec { cacheControl | contentDisposition | contentEncoding | contentLanguage | contentMD5 | contentType null | null | null | null | null | null "control" | "disposition" | "encoding" | "language" | Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultData.array())) | "type" - }*/ + } @Unroll @@ -981,12 +980,8 @@ class BlobAPITest extends APISpec { def "Snapshot"() { when: - Response snapshotResponse = bu.createSnapshot() - BlobClient bu2 = new BlobClientBuilder() - .endpoint(bu.getBlobUrl().toString()) - .credential(primaryCreds) - .snapshot(snapshotResponse.value()) - .buildBlobClient() + Response snapshotResponse = bu.createSnapshot() + BlobClient bu2 = snapshotResponse.value() then: bu2.getProperties().statusCode() == 200 @@ -1009,12 +1004,8 @@ class BlobAPITest extends APISpec { metadata.put(key2, value2) } - Response response = bu.createSnapshot(metadata, null, null) - BlobClient bu2 = new BlobClientBuilder() - .endpoint(bu.getBlobUrl().toString()) - .credential(primaryCreds) - .snapshot(response.value()) - .buildBlobClient() + Response response = bu.createSnapshot(metadata, null, null) + BlobClient bu2 = response.value() expect: response.statusCode() == 201 @@ -1872,7 +1863,7 @@ class BlobAPITest extends APISpec { def "Get account info error"() { when: - StorageClient serviceURL = new StorageClientBuilder() + BlobServiceClient serviceURL = new BlobServiceClientBuilder() .endpoint(primaryServiceURL.getAccountUrl().toString()) .buildClient() serviceURL.getContainerClient(generateContainerName()).getBlobClient(generateBlobName()) diff --git a/storage/client/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 similarity index 97% rename from storage/client/blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java rename to sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlobOutputStreamTest.java index 7ebc5e8487cf..e7955c9b7be9 100644 --- a/storage/client/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 @@ -17,12 +17,12 @@ public class BlobOutputStreamTest { private static final Random RANDOM = new Random(); - private static StorageClient storageClient; + private static BlobServiceClient storageClient; private static ContainerClient containerClient; @BeforeClass public static void setup() { - storageClient = new StorageClientBuilder() + 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)))) diff --git a/storage/client/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 similarity index 97% rename from storage/client/blob/src/test/java/com/azure/storage/blob/BlockBlobAPITest.groovy rename to sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobAPITest.groovy index 63ec8837697b..d5aaa8a65dcd 100644 --- a/storage/client/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 @@ -349,13 +349,16 @@ class BlockBlobAPITest extends APISpec { bu.commitBlockList(ids, headers, null, null, null) Response response = bu.getProperties() + // If the value isn't set the service will automatically set it + contentType = (contentType == null) ? "application/octet-stream" : contentType + then: 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" TODO (alzimmer): Figure out why getProperties returns null for this one + "control" | "disposition" | "encoding" | "language" | MessageDigest.getInstance("MD5").digest(defaultData.array()) | "type" } @Unroll @@ -614,8 +617,7 @@ class BlockBlobAPITest extends APISpec { bu.upload(null, 0).statusCode() == 201 } - // TODO (alzimmer): Determine why getProperties returns null - /*@Unroll + @Unroll def "Upload headers"() { setup: BlobHTTPHeaders headers = new BlobHTTPHeaders().blobCacheControl(cacheControl) @@ -629,14 +631,18 @@ class BlockBlobAPITest extends APISpec { bu.upload(defaultInputStream.get(), defaultDataSize, headers, null, null, null) Response response = bu.getProperties() + // If the value isn't set the service will automatically set it + contentMD5 = (contentMD5 == null) ? MessageDigest.getInstance("MD5").digest(defaultData.array()) : contentMD5 + contentType = (contentType == null) ? "application/octet-stream" : contentType + then: 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 def "Upload metadata"() { diff --git a/storage/client/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 similarity index 100% rename from storage/client/blob/src/test/java/com/azure/storage/blob/BlockBlobInputOutputStreamTest.groovy rename to sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/BlockBlobInputOutputStreamTest.groovy diff --git a/storage/client/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 similarity index 99% rename from storage/client/blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy rename to sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ContainerAPITest.groovy index 86da9838d53b..d0027bffbb83 100644 --- a/storage/client/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 @@ -618,7 +618,7 @@ class ContainerAPITest extends APISpec { values.put("foo", "bar") metadataBlob.create(512, null, null, values, null, null) - String snapshotTime = normal.createSnapshot().value() + String snapshotTime = normal.createSnapshot().value().getSnapshotId() BlockBlobClient uncommittedBlob = cu.getBlockBlobClient(uncommittedName) @@ -1624,7 +1624,7 @@ class ContainerAPITest extends APISpec { def "Get account info error"() { when: - StorageClient serviceURL = new StorageClientBuilder() + BlobServiceClient serviceURL = new BlobServiceClientBuilder() .endpoint(primaryServiceURL.getAccountUrl().toString()) .buildClient() 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 new file mode 100644 index 000000000000..864e23a7a082 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseMockFlux.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpResponse; +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; +import reactor.core.publisher.Operators; + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; + +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; + static final int DR_TEST_SCENARIO_MAX_RETRIES_EXCEEDED = 3; + static final int DR_TEST_SCENARIO_NON_RETRYABLE_ERROR = 4; + static final int DR_TEST_SCENARIO_ERROR_GETTER_MIDDLE = 6; + static final int DR_TEST_SCENARIO_INFO_TEST = 8; + + private int scenario; + private int tryNumber; + private HTTPGetterInfo info; + private ByteBuffer scenarioData; + + DownloadResponseMockFlux(int scenario) { + this.scenario = scenario; + switch (this.scenario) { + case DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK: + 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); + break; + case DR_TEST_SCENARIO_MAX_RETRIES_EXCEEDED: + case DR_TEST_SCENARIO_NON_RETRYABLE_ERROR: + case DR_TEST_SCENARIO_ERROR_GETTER_MIDDLE: + case DR_TEST_SCENARIO_INFO_TEST: + break; + default: + throw new IllegalArgumentException("Invalid download resource test scenario."); + } + } + + ByteBuffer getScenarioData() { + return this.scenarioData; + } + + int getTryNumber() { + return this.tryNumber; + } + + @Override + public void subscribe(CoreSubscriber subscriber) { + switch (this.scenario) { + case DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK: + subscriber.onNext(Unpooled.wrappedBuffer(this.scenarioData.duplicate())); + Operators.complete(subscriber); + break; + + case DR_TEST_SCENARIO_SUCCESSFUL_MULTI_CHUNK: + for (int i = 0; i < 4; i++) { + ByteBuffer toSend = this.scenarioData.duplicate(); + toSend.position(i * 256); + toSend.limit((i + 1) * 256); + subscriber.onNext(Unpooled.wrappedBuffer(toSend)); + } + Operators.complete(subscriber); + break; + + case DR_TEST_SCENARIO_SUCCESSFUL_STREAM_FAILURES: + if (this.tryNumber <= 3) { + // tryNumber is 1 indexed, so we have to sub 1. + if (this.info.offset() != (this.tryNumber - 1) * 256 + || this.info.count() != this.scenarioData.remaining() - (this.tryNumber - 1) * 256) { + Operators.error(subscriber, new IllegalArgumentException("Info values are incorrect.")); + return; + } + ByteBuffer toSend = this.scenarioData.duplicate(); + toSend.position((this.tryNumber - 1) * 256); + toSend.limit(this.tryNumber * 256); + subscriber.onNext(Unpooled.wrappedBuffer(toSend)); + Operators.error(subscriber, new IOException()); + break; + } + if (this.info.offset() != (this.tryNumber - 1) * 256 + || this.info.count() != this.scenarioData.remaining() - (this.tryNumber - 1) * 256) { + Operators.error(subscriber, new IllegalArgumentException("Info values are incorrect.")); + return; + } + ByteBuffer toSend = this.scenarioData.duplicate(); + toSend.position((this.tryNumber - 1) * 256); + toSend.limit(this.tryNumber * 256); + subscriber.onNext(Unpooled.wrappedBuffer(toSend)); + Operators.complete(subscriber); + break; + + case DR_TEST_SCENARIO_MAX_RETRIES_EXCEEDED: + Operators.error(subscriber, new IOException()); + break; + + case DR_TEST_SCENARIO_NON_RETRYABLE_ERROR: + Operators.error(subscriber, new Exception()); + break; + + case DR_TEST_SCENARIO_ERROR_GETTER_MIDDLE: + if (this.tryNumber == 1) { + /* + We return a retryable error here so we have to invoke the getter, which will throw an error in + this case. + */ + Operators.error(subscriber, new IOException()); + } else { + Operators.error(subscriber, new IllegalArgumentException("Retried after getter error.")); + } + break; + + case DR_TEST_SCENARIO_INFO_TEST: + switch (this.tryNumber) { + case 1: // Test the value of info when getting the initial response. + case 2: // Test the value of info when getting an intermediate response. + Operators.error(subscriber, new IOException()); + break; + case 3: + // All calls to getter checked. Exit. This test does not check for data. + Operators.complete(subscriber); + break; + default: + throw new IllegalArgumentException("Invalid try number."); + } + break; + + default: + Operators.error(subscriber, new IllegalArgumentException("Invalid test case")); + } + } + + Mono getter(HTTPGetterInfo info) { + this.tryNumber++; + this.info = info; + BlobsDownloadResponse rawResponse = new BlobsDownloadResponse(null, 200, new HttpHeaders(), this, new BlobDownloadHeaders()); + DownloadAsyncResponse response = new DownloadAsyncResponse(rawResponse, info, this::getter); + + switch (this.scenario) { + case DR_TEST_SCENARIO_ERROR_GETTER_MIDDLE: + switch (this.tryNumber) { + case 1: + return Mono.just(response); + case 2: + /* + This validates that we don't retry in the getter even if it's a retryable error from the + service. + */ + throw new StorageErrorException("Message", new HttpResponse() { + @Override + public int statusCode() { + return 500; + } + + @Override + public String headerValue(String s) { + return null; + } + + @Override + public HttpHeaders headers() { + return null; + } + + @Override + public Flux body() { + return null; + } + + @Override + public Mono bodyAsByteArray() { + return null; + } + + @Override + public Mono bodyAsString() { + return null; + } + + @Override + public Mono bodyAsString(Charset charset) { + return null; + } + }); + default: + throw new IllegalArgumentException("Retried after error in getter"); + } + case DR_TEST_SCENARIO_INFO_TEST: + // We also test that the info is updated in DR_TEST_SCENARIO_SUCCESSFUL_STREAM_FAILURES. + if (info.count() != 10 || info.offset() != 20 || !info.eTag().equals("etag")) { + throw new IllegalArgumentException("Info values incorrect"); + } + return Mono.just(response); + default: + return Mono.just(response); + } + } +} diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseTest.groovy new file mode 100644 index 000000000000..f784283d4de6 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/DownloadResponseTest.groovy @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob + + +import com.azure.core.implementation.util.FluxUtil +import com.azure.storage.blob.models.ReliableDownloadOptions +import com.azure.storage.blob.models.StorageErrorException +import spock.lang.Unroll + +class DownloadResponseTest extends APISpec { + BlockBlobClient bu + + def setup() { + bu = cu.getBlockBlobClient(generateBlobName()) + bu.upload(defaultInputStream.get(), defaultText.length()) + } + + /* + This shouldn't really be different from anything else we're doing in the other tests. Just a sanity check against + a real use case. + */ + + def "Network call"() { + expect: + OutputStream outputStream = new ByteArrayOutputStream() + bu.download(outputStream) + outputStream.toByteArray() == defaultData.array() + } + + @Unroll + def "Successful"() { + setup: + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario) + + HTTPGetterInfo info = new HTTPGetterInfo() + .offset(0) + .count(flux.getScenarioData().remaining()) + .eTag("etag") + + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5) + + when: + DownloadAsyncResponse response = flux.getter(info).block() + + then: + FluxUtil.collectByteBufStream(response.body(options), false).block().nioBuffer() == flux.getScenarioData() + flux.getTryNumber() == tryNumber + + + where: + scenario | tryNumber + DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK | 1 + DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_MULTI_CHUNK | 1 + DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_STREAM_FAILURES | 4 + } + + @Unroll + def "Failure"() { + setup: + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(scenario) + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5) + HTTPGetterInfo info = new HTTPGetterInfo().eTag("etag") + + when: + DownloadAsyncResponse response = flux.getter(info).block() + response.body(options).blockFirst() + + then: + def e = thrown(Throwable) // Blocking subscribe will sometimes wrap the IOException in a RuntimeException. + if (e.getCause() != null) { + e = e.getCause() + } + exceptionType.isInstance(e) + flux.getTryNumber() == tryNumber + + /* + tryNumber is 7 because the initial request is the first try, then it will fail when retryCount>maxRetryCount, + which is when retryCount=6 and therefore tryNumber=7 + */ + where: + scenario | exceptionType | tryNumber + DownloadResponseMockFlux.DR_TEST_SCENARIO_MAX_RETRIES_EXCEEDED | IOException | 7 + DownloadResponseMockFlux.DR_TEST_SCENARIO_NON_RETRYABLE_ERROR | Exception | 1 + DownloadResponseMockFlux.DR_TEST_SCENARIO_ERROR_GETTER_MIDDLE | StorageErrorException | 2 + } + + @Unroll + def "Info null IA"() { + setup: + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK) + + when: + new DownloadAsyncResponse(flux.getter(info).block().rawResponse(), info, { HTTPGetterInfo newInfo -> flux.getter(newInfo) }) + + then: + thrown(IllegalArgumentException) + + where: + info | _ + null | _ + new HTTPGetterInfo().eTag(null) | _ + } + + def "Options IA"() { + when: + new ReliableDownloadOptions().maxRetryRequests(-1) + + then: + thrown(IllegalArgumentException) + } + + def "Getter IA"() { + setup: + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_SUCCESSFUL_ONE_CHUNK) + + when: + DownloadAsyncResponse response = new DownloadAsyncResponse(flux.getter(new HTTPGetterInfo()).block() + .rawResponse(), new HTTPGetterInfo().eTag("etag"), null) + response.body(null).blockFirst() + + then: + thrown(IllegalArgumentException) + } + + def "Info"() { + setup: + DownloadResponseMockFlux flux = new DownloadResponseMockFlux(DownloadResponseMockFlux.DR_TEST_SCENARIO_INFO_TEST) + HTTPGetterInfo info = new HTTPGetterInfo() + .offset(20) + .count(10) + .eTag("etag") + + ReliableDownloadOptions options = new ReliableDownloadOptions().maxRetryRequests(5) + + when: + DownloadAsyncResponse response = flux.getter(info).block() + response.body(options).blockFirst() + + then: + flux.getTryNumber() == 3 + } + + def "Info count IA"() { + when: + new HTTPGetterInfo().count(-1) + + then: + thrown(IllegalArgumentException) + } +} diff --git a/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/HelperTest.groovy b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/HelperTest.groovy new file mode 100644 index 000000000000..aa20ad8c4666 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/HelperTest.groovy @@ -0,0 +1,737 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob + +import com.azure.core.http.rest.Response +import com.azure.core.http.rest.VoidResponse +import com.azure.storage.blob.models.BlobRange +import com.azure.storage.blob.models.UserDelegationKey +import com.azure.storage.common.credentials.SASTokenCredential +import com.azure.storage.common.credentials.SharedKeyCredential +import spock.lang.Unroll + +import java.time.LocalDateTime +import java.time.OffsetDateTime +import java.time.ZoneOffset + +class HelperTest extends APISpec { + + // TODO (alzimmer): Turn this on when nextPageLink can be passed into listing + /*def "responseError"() { + when: + cu.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 + individual parts later. + */ + + @Unroll + def "serviceSasSignatures string to sign"() { + when: + ServiceSASSignatureValues v = new ServiceSASSignatureValues() + if (permissions != null) { + v.permissions(new BlobSASPermission().read(true).toString()) + } else { + v.permissions("") + } + + if (snapId != null) { + v.resource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT) + } else { + v.resource(Constants.UrlConstants.SAS_BLOB_CONSTANT) + } + + v.startTime(startTime) + .canonicalName(String.format("/blob/%s/containerName/blobName", primaryCreds.accountName())) + .snapshotId(snapId) + + if (expiryTime == null) { + v.expiryTime(OffsetDateTime.now()) + } else { + v.expiryTime(expiryTime) + } + + if (ipRange != null) { + v.ipRange(new IPRange().ipMin("ip")) + } + + v.identifier(identifier) + .protocol(protocol) + .cacheControl(cacheControl) + .contentDisposition(disposition) + .contentEncoding(encoding) + .contentLanguage(language) + .contentType(type) + + SASQueryParameters token = v.generateSASQueryParameters(primaryCreds) + + 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()) + } else { + expectedStringToSign = String.format(expectedStringToSign, + Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiryTime), + primaryCreds.accountName()) + } + + then: + token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + + /* + We don't test the blob or containerName properties because canonicalized resource is always added as at least + /blob/accountName. We test canonicalization of resources later. Again, this is not to test a fully functional + sas but the construction of the string to sign. + Signed resource is tested elsewhere, as we work some minor magic in choosing which value to use. + */ + where: + permissions | startTime | expiryTime | identifier | ipRange | protocol | snapId | cacheControl | disposition | encoding | language | type || expectedStringToSign + new BlobSASPermission() | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | null | null | null | null | null || "r\n\n%s\n" + "/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | OffsetDateTime.now(ZoneOffset.UTC).minusDays(1) | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | null | null | null | null | null || "\n%s\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | "id" | null | null | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\nid\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | new IPRange() | null | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\nip\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | SASProtocol.HTTPS_ONLY | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n" + SASProtocol.HTTPS_ONLY + "\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | "snapId" | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\nsnapId\n\n\n\n\n" + null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | "control" | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\ncontrol\n\n\n\n" + null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | null | "disposition" | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\ndisposition\n\n\n" + null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | null | null | "encoding" | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\nencoding\n\n" + null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | null | null | null | "language" | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\nlanguage\n" + null | null | OffsetDateTime.now(ZoneOffset.UTC).plusDays(1) | null | null | null | null | null | null | null | null | "type" || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\ntype" + } + + @Unroll + def "serviceSasSignatures string to sign user delegation key"() { + when: + ServiceSASSignatureValues v = new ServiceSASSignatureValues() + if (permissions != null) { + v.permissions(new BlobSASPermission().read(true).toString()) + } else { + v.permissions("") + } + + v.startTime(startTime) + .canonicalName(String.format("/blob/%s/containerName/blobName", primaryCreds.accountName())) + .snapshotId(snapId) + + if (expiryTime == null) { + v.expiryTime(OffsetDateTime.now()) + } else { + v.expiryTime(expiryTime) + } + + if (snapId != null) { + v.resource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT) + } else { + v.resource(Constants.UrlConstants.SAS_BLOB_CONSTANT) + } + + if (ipRange != null) { + v.ipRange(new IPRange().ipMin("ip")) + } + + v.protocol(protocol) + .cacheControl(cacheControl) + .contentDisposition(disposition) + .contentEncoding(encoding) + .contentLanguage(language) + .contentType(type) + + UserDelegationKey key = new UserDelegationKey() + .signedOid(keyOid) + .signedTid(keyTid) + .signedStart(keyStart) + .signedExpiry(keyExpiry) + .signedService(keyService) + .signedVersion(keyVersion) + .value(keyValue) + + SASQueryParameters token = v.generateSASQueryParameters(key) + + expectedStringToSign = String.format(expectedStringToSign, Utility.ISO_8601_UTC_DATE_FORMATTER.format(v.expiryTime()), primaryCreds.accountName()) + + then: + token.signature() == Utility.delegateComputeHmac256(key, expectedStringToSign) + + /* + We test string to sign functionality directly related to user delegation sas specific parameters + */ + where: + permissions | startTime | expiryTime | keyOid | keyTid | keyStart | keyExpiry | keyService | keyVersion | keyValue | ipRange | protocol | snapId | cacheControl | disposition | encoding | language | type || expectedStringToSign + new BlobSASPermission() | null | null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "r\n\n%s\n" + "/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n%s\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | 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 || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | "11111111-1111-1111-1111-111111111111" | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n11111111-1111-1111-1111-111111111111\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | "22222222-2222-2222-2222-222222222222" | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n22222222-2222-2222-2222-222222222222\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | 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 || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n2018-01-01T00:00:00Z\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | null | null | OffsetDateTime.of(LocalDateTime.of(2018, 1, 1, 0, 0), ZoneOffset.UTC) | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n2018-01-01T00:00:00Z\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | null | null | null | "b" | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n\nb\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | null | null | null | null | "2018-06-17" | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n\n\n2018-06-17\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | new IPRange() | null | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n\n\n\nip\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | SASProtocol.HTTPS_ONLY | null | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n" + SASProtocol.HTTPS_ONLY + "\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + null | null | null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | "snapId" | null | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\nsnapId\n\n\n\n\n" + null | null | null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | "control" | null | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\ncontrol\n\n\n\n" + null | null | null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | "disposition" | null | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\ndisposition\n\n\n" + null | null | null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | "encoding" | null | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\nencoding\n\n" + null | null | null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | "language" | null || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\nlanguage\n" + null | null | null | null | null | null | null | null | null | "3hd4LRwrARVGbeMRQRfTLIsGMkCPuZJnvxZDU7Gak8c=" | null | null | null | null | null | null | null | "type" || "\n\n%s\n/blob/%s/containerName/blobName\n\n\n\n\n\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\ntype" + } + + @Unroll + def "serviceSASSignatureValues canonicalizedResource"() { + setup: + ServiceSASSignatureValues v = new ServiceSASSignatureValues() + .expiryTime(expiryTime) + .permissions(new BlobSASPermission().toString()) + .resource(expectedResource) + .canonicalName(String.format("/blob/%s/%s", primaryCreds.accountName(), containerName)) + .snapshotId(snapId) + + if (blobName != null) { + v.canonicalName(v.canonicalName() + "/" + blobName) + } + + expectedStringToSign = String.format(expectedStringToSign, + Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiryTime), + primaryCreds.accountName()) + + when: + SASQueryParameters token = v.generateSASQueryParameters(primaryCreds) + + then: + token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + token.resource() == expectedResource + + where: + containerName | blobName | snapId | expiryTime || expectedResource | expectedStringToSign + "c" | "b" | "id" | OffsetDateTime.now() || "bs" | "\n\n%s\n" + "/blob/%s/c/b\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nbs\nid\n\n\n\n\n" + "c" | "b" | null | OffsetDateTime.now() || "b" | "\n\n%s\n" + "/blob/%s/c/b\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nb\n\n\n\n\n\n" + "c" | null | null | OffsetDateTime.now() || "c" | "\n\n%s\n" + "/blob/%s/c\n\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\nc\n\n\n\n\n\n" + + } + + @Unroll + def "serviceSasSignatureValues IA"() { + setup: + ServiceSASSignatureValues v = new ServiceSASSignatureValues() + .permissions(new AccountSASPermission().toString()) + .expiryTime(OffsetDateTime.now()) + .resource(containerName) + .canonicalName(blobName) + .snapshotId("2018-01-01T00:00:00.0000000Z") + .version(version) + + when: + v.generateSASQueryParameters((SharedKeyCredential)creds) + + then: + def e = thrown(IllegalArgumentException) + 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" + } + + @Unroll + def "BlobSASPermissions toString"() { + setup: + BlobSASPermission perms = new BlobSASPermission() + .read(read) + .write(write) + .delete(delete) + .create(create) + .add(add) + + expect: + perms.toString() == expectedString + + where: + read | write | delete | create | add || 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 || "a" + true | true | true | true | true || "racwd" + } + + @Unroll + def "BlobSASPermissions parse"() { + when: + BlobSASPermission perms = BlobSASPermission.parse(permString) + + then: + perms.read() == read + perms.write() == write + perms.delete() == delete + perms.create() == create + perms.add() == add + + where: + permString || read | write | delete | create | add + "r" || true | false | false | false | false + "w" || false | true | false | false | false + "d" || false | false | true | false | false + "c" || false | false | false | true | false + "a" || false | false | false | false | true + "racwd" || true | true | true | true | true + "dcwra" || true | true | true | true | true + } + + def "BlobSASPermissions parse IA"() { + when: + BlobSASPermission.parse("rwaq") + + then: + thrown(IllegalArgumentException) + } + + @Unroll + def "ContainerSASPermissions toString"() { + setup: + ContainerSASPermission perms = new ContainerSASPermission() + .read(read) + .write(write) + .delete(delete) + .create(create) + .add(add) + .list(list) + + expect: + perms.toString() == expectedString + + where: + read | write | delete | create | add | list || expectedString + true | false | false | false | false | false || "r" + false | true | false | false | false | false || "w" + false | false | true | false | false | false || "d" + false | false | false | true | false | false || "c" + false | false | false | false | true | false || "a" + false | false | false | false | false | true || "l" + true | true | true | true | true | true || "racwdl" + } + + @Unroll + def "ContainerSASPermissions parse"() { + when: + ContainerSASPermission perms = ContainerSASPermission.parse(permString) + + then: + perms.read() == read + perms.write() == write + perms.delete() == delete + perms.create() == create + perms.add() == add + perms.list() == list + + where: + permString || read | write | delete | create | add | list + "r" || true | false | false | false | false | false + "w" || false | true | false | false | false | false + "d" || false | false | true | false | false | false + "c" || false | false | false | true | false | false + "a" || false | false | false | false | true | false + "l" || false | false | false | false | false | true + "racwdl" || true | true | true | true | true | true + "dcwrla" || true | true | true | true | true | true + } + + def "ContainerSASPermissions parse IA"() { + when: + ContainerSASPermission.parse("rwaq") + + then: + thrown(IllegalArgumentException) + } + + @Unroll + def "IPRange toString"() { + setup: + def ip = new IPRange() + .ipMin(min) + .ipMax(max) + + expect: + ip.toString() == expectedString + + where: + min | max || expectedString + "a" | "b" || "a-b" + "a" | null || "a" + null | "b" || "" + } + + @Unroll + def "IPRange parse"() { + when: + IPRange ip = IPRange.parse(rangeStr) + + then: + ip.ipMin() == min + ip.ipMax() == max + + where: + rangeStr || min | max + "a-b" || "a" | "b" + "a" || "a" | null + "" || "" | null + } + + @Unroll + def "SASProtocol parse"() { + expect: + SASProtocol.parse(protocolStr) == protocol + + where: + protocolStr || protocol + "https" || SASProtocol.HTTPS_ONLY + "https,http" || SASProtocol.HTTPS_HTTP + } + + /* + This test will ensure that each field gets placed into the proper location within the string to sign and that null + values are handled correctly. We will validate the whole SAS with service calls as well as correct serialization of + individual parts later. + */ + + @Unroll + def "accountSasSignatures string to sign"() { + when: + AccountSASSignatureValues v = new AccountSASSignatureValues() + .permissions(new AccountSASPermission().read(true).toString()) + .services("b") + .resourceTypes("o") + .startTime(startTime) + .expiryTime(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + .protocol(protocol) + + if (ipRange != null) { + v.ipRange(new IPRange().ipMin("ip")) + } + + def token = v.generateSASQueryParameters(primaryCreds) + + expectedStringToSign = String.format(expectedStringToSign, primaryCreds.accountName()) + + then: + token.signature() == primaryCreds.computeHmac256(expectedStringToSign) + + where: + startTime | ipRange | protocol || expectedStringToSign + OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC) | null | null || "%s\nr\nb\no\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n" + null | new IPRange() | null || "%s\nr\nb\no\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\nip\n\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n" + null | null | SASProtocol.HTTPS_ONLY || "%s\nr\nb\no\n\n" + Utility.ISO_8601_UTC_DATE_FORMATTER.format(OffsetDateTime.of(2017, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC)) + "\n\n" + SASProtocol.HTTPS_ONLY + "\n" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "\n" + } + + @Unroll + def "accountSasSignatureValues IA"() { + setup: + AccountSASSignatureValues v = new AccountSASSignatureValues() + .permissions(permissions) + .services(service) + .resourceTypes(resourceType) + .expiryTime(expiryTime) + .version(version) + + when: + v.generateSASQueryParameters(creds) + + then: + def e = thrown(IllegalArgumentException) + 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" + } + + @Unroll + def "AccountSASPermissions toString"() { + setup: + AccountSASPermission perms = new AccountSASPermission() + .read(read) + .write(write) + .delete(delete) + .list(list) + .add(add) + .create(create) + .update(update) + .processMessages(process) + + expect: + perms.toString() == expectedString + + where: + read | write | delete | list | add | create | update | process || expectedString + true | false | false | false | false | false | false | false || "r" + false | true | false | false | false | false | false | false || "w" + false | false | true | false | false | false | false | false || "d" + false | false | false | true | false | false | false | false || "l" + false | false | false | false | true | false | false | false || "a" + false | false | false | false | false | true | false | false || "c" + false | false | false | false | false | false | true | false || "u" + false | false | false | false | false | false | false | true || "p" + true | true | true | true | true | true | true | true || "rwdlacup" + } + + @Unroll + def "AccountSASPermissions parse"() { + when: + AccountSASPermission perms = AccountSASPermission.parse(permString) + + then: + perms.read() == read + perms.write() == write + perms.delete() == delete + perms.list() == list + perms.add() == add + perms.create() == create + perms.update() == update + perms.processMessages() == process + + where: + permString || read | write | delete | list | add | create | update | process + "r" || true | false | false | false | false | false | false | false + "w" || false | true | false | false | false | false | false | false + "d" || false | false | true | false | false | false | false | false + "l" || false | false | false | true | false | false | false | false + "a" || false | false | false | false | true | false | false | false + "c" || false | false | false | false | false | true | false | false + "u" || false | false | false | false | false | false | true | false + "p" || false | false | false | false | false | false | false | true + "rwdlacup" || true | true | true | true | true | true | true | true + "lwrupcad" || true | true | true | true | true | true | true | true + } + + def "AccountSASPermissions parse IA"() { + when: + AccountSASPermission.parse("rwaq") + + then: + thrown(IllegalArgumentException) + } + + @Unroll + def "AccountSASResourceType toString"() { + setup: + AccountSASResourceType resourceTypes = new AccountSASResourceType() + .service(service) + .container(container) + .object(object) + + expect: + resourceTypes.toString() == expectedString + + where: + service | container | object || expectedString + true | false | false || "s" + false | true | false || "c" + false | false | true || "o" + true | true | true || "sco" + } + + @Unroll + def "AccountSASResourceType parse"() { + when: + AccountSASResourceType resourceTypes = AccountSASResourceType.parse(resourceTypeString) + + then: + resourceTypes.service() == service + resourceTypes.container() == container + resourceTypes.object() == object + + where: + resourceTypeString || service | container | object + "s" || true | false | false + "c" || false | true | false + "o" || false | false | true + "sco" || true | true | true + } + + @Unroll + def "AccountSASResourceType IA"() { + when: + AccountSASResourceType.parse("scq") + + then: + thrown(IllegalArgumentException) + } + + def "BlobURLParts"() { + setup: + BlobURLParts parts = new BlobURLParts() + .scheme("http") + .host("host") + .containerName("container") + .blobName("blob") + .snapshot("snapshot") + + ServiceSASSignatureValues sasValues = new ServiceSASSignatureValues() + .expiryTime(OffsetDateTime.now(ZoneOffset.UTC).plusDays(1)) + .permissions("r") + .canonicalName(String.format("/blob/%s/container/blob", primaryCreds.accountName())) + .resource(Constants.UrlConstants.SAS_BLOB_SNAPSHOT_CONSTANT) + + parts.sasQueryParameters(sasValues.generateSASQueryParameters(primaryCreds)) + + when: + String[] splitParts = parts.toURL().toString().split("\\?") + + then: + splitParts.size() == 2 // Ensure that there is only one question mark even when sas and snapshot are present + splitParts[0] == "http://host/container/blob" + splitParts[1].contains("snapshot=snapshot") + splitParts[1].contains("sp=r") + splitParts[1].contains("sig=") + splitParts[1].split("&").size() == 6 // snapshot & sv & sr & sp & sig & se + } + + def "URLParser"() { + when: + BlobURLParts parts = URLParser.parse(new URL("http://host/container/blob?snapshot=snapshot&sv=" + Constants.HeaderConstants.TARGET_STORAGE_VERSION + "&sr=c&sp=r&sig=Ee%2BSodSXamKSzivSdRTqYGh7AeMVEk3wEoRZ1yzkpSc%3D")) + + then: + parts.scheme() == "http" + parts.host() == "host" + parts.containerName() == "container" + parts.blobName() == "blob" + parts.snapshot() == "snapshot" + parts.sasQueryParameters().permissions() == "r" + parts.sasQueryParameters().version() == Constants.HeaderConstants.TARGET_STORAGE_VERSION + parts.sasQueryParameters().resource() == "c" + parts.sasQueryParameters().signature() == Utility.safeURLDecode("Ee%2BSodSXamKSzivSdRTqYGh7AeMVEk3wEoRZ1yzkpSc%3D") + } +} diff --git a/storage/client/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 similarity index 92% rename from storage/client/blob/src/test/java/com/azure/storage/blob/PageBlobAPITest.groovy rename to sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/PageBlobAPITest.groovy index eee346b00728..26e8ce24a9a0 100644 --- a/storage/client/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 @@ -40,7 +40,7 @@ class PageBlobAPITest extends APISpec { def "Create sequence number"() { when: bu.create(PageBlobClient.PAGE_BYTES, 2, null, null, - null, null) + null, null) then: Integer.parseInt(bu.getProperties().headers().value("x-ms-blob-sequence-number")) == 2 @@ -50,24 +50,27 @@ class PageBlobAPITest 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(PageBlobClient.PAGE_BYTES, null, headers, null, null, null) Response response = bu.getProperties(null, null) + // If the value isn't set the service will automatically set it + contentType = (contentType == null) ? "application/octet-stream" : contentType + then: 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(defaultData.array())) | "type" TODO (alzimmer): Determine why getProperties returns null + "control" | "disposition" | "encoding" | "language" | Base64.getEncoder().encode(MessageDigest.getInstance("MD5").digest(defaultData.array())) | "type" } @Unroll @@ -109,7 +112,7 @@ class PageBlobAPITest extends APISpec { expect: bu.create(PageBlobClient.PAGE_BYTES, null, null, null, bac, null) - .statusCode() == 201 + .statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID @@ -159,7 +162,7 @@ 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))) + new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) then: response.statusCode() == 201 @@ -306,7 +309,7 @@ class PageBlobAPITest extends APISpec { when: destURL.uploadPagesFromURL(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES * 2 - 1), - sourceURL.getBlobUrl(), PageBlobClient.PAGE_BYTES * 2) + sourceURL.getBlobUrl(), PageBlobClient.PAGE_BYTES * 2) then: ByteArrayOutputStream outputStream = new ByteArrayOutputStream() @@ -323,8 +326,8 @@ class PageBlobAPITest extends APISpec { thrown(IllegalArgumentException) where: - sourceOffset | range - (Long)PageBlobClient.PAGE_BYTES | null + sourceOffset | range + (Long) PageBlobClient.PAGE_BYTES | null } def "Upload page from URL MD5"() { @@ -354,14 +357,14 @@ class PageBlobAPITest extends APISpec { when: destURL.uploadPagesFromURL(pageRange, bu.getBlobUrl(), null, - MessageDigest.getInstance("MD5").digest("garbage".getBytes()), null, null, null) + MessageDigest.getInstance("MD5").digest("garbage".getBytes()), null, null, null) then: thrown(StorageException) } @Unroll - def "Upload page from URL destination AC"() { + def "Upload page from URL destination AC"() { setup: cu.setAccessPolicy(PublicAccessType.CONTAINER, null, null, null) def sourceURL = cu.getPageBlobClient(generateBlobName()) @@ -504,7 +507,7 @@ class PageBlobAPITest extends APISpec { Response response = bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1)) then: - !bu.getPageRanges(new BlobRange(0)).iterator().hasNext() + bu.getPageRanges(new BlobRange(0)).value().pageRange().size() == 0 validateBasicHeaders(response.headers()) response.value().contentMD5() == null response.value().blobSequenceNumber() == 0 @@ -536,7 +539,7 @@ class PageBlobAPITest extends APISpec { expect: bu.clearPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), pac, null) - .statusCode() == 201 + .statusCode() == 201 where: modified | unmodified | match | noneMatch | leaseID | sequenceNumberLT | sequenceNumberLTE | sequenceNumberEqual @@ -600,21 +603,20 @@ class PageBlobAPITest extends APISpec { thrown(StorageException) } - // TODO (alzimmer): Turn this on once paged responses become available - /*def "Get page ranges"() { + def "Get page ranges"() { setup: bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) when: - Iterable response = bu.getPageRanges(new BlobRange(0, PageBlobClient.PAGE_BYTES)) + Response response = bu.getPageRanges(new BlobRange(0, PageBlobClient.PAGE_BYTES)) then: response.statusCode() == 200 - response.body().pageRange().size() == 1 - validateBasicHeaders(headers) - headers.blobContentLength() == (long) PageBlobClient.PAGE_BYTES - }*/ + response.value().pageRange().size() == 1 + validateBasicHeaders(response.headers()) + Integer.parseInt(response.headers().value("x-ms-blob-content-length")) == PageBlobClient.PAGE_BYTES + } def "Get page ranges min"() { when: @@ -639,7 +641,7 @@ class PageBlobAPITest extends APISpec { when: - bu.getPageRanges(new BlobRange(0, PageBlobClient.PAGE_BYTES), bac, null).iterator().hasNext() + bu.getPageRanges(new BlobRange(0, PageBlobClient.PAGE_BYTES), bac, null) then: notThrown(StorageException) @@ -666,7 +668,7 @@ class PageBlobAPITest extends APISpec { .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) when: - bu.getPageRanges(new BlobRange(0, PageBlobClient.PAGE_BYTES), bac, null).iterator().hasNext() + bu.getPageRanges(new BlobRange(0, PageBlobClient.PAGE_BYTES), bac, null) then: thrown(StorageException) @@ -685,21 +687,20 @@ class PageBlobAPITest extends APISpec { bu = cu.getPageBlobClient(generateBlobName()) when: - bu.getPageRanges(null).iterator().hasNext() + bu.getPageRanges(null) then: thrown(StorageException) } - // TODO (alzimmer): This test needs to be restructured to support the Iterable T return - /*def "Get page ranges diff"() { + def "Get page ranges diff"() { setup: bu.create(PageBlobClient.PAGE_BYTES * 2) bu.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() + String snapshot = bu.createSnapshot(null, null, null).value().getSnapshotId() bu.uploadPages(new PageRange().start(0).end(PageBlobClient.PAGE_BYTES - 1), new ByteArrayInputStream(getRandomByteArray(PageBlobClient.PAGE_BYTES))) @@ -707,23 +708,22 @@ class PageBlobAPITest extends APISpec { bu.clearPages(new PageRange().start(PageBlobClient.PAGE_BYTES).end(PageBlobClient.PAGE_BYTES * 2 - 1)) when: - Iterable response = bu.getPageRangesDiff(new BlobRange(0, PageBlobClient.PAGE_BYTES * 2), snapshot) - PageBlobGetPageRangesDiffHeaders headers = response.headers() + Response response = bu.getPageRangesDiff(new BlobRange(0, PageBlobClient.PAGE_BYTES * 2), snapshot) then: - response.body().pageRange().size() == 1 - response.body().pageRange().get(0).start() == 0 - response.body().pageRange().get(0).end() == PageBlobClient.PAGE_BYTES - 1 - response.body().clearRange().size() == 1 - response.body().clearRange().get(0).start() == PageBlobClient.PAGE_BYTES - response.body().clearRange().get(0).end() == PageBlobClient.PAGE_BYTES * 2 - 1 - validateBasicHeaders(headers) - headers.blobContentLength() == PageBlobClient.PAGE_BYTES * 2 - }*/ + response.value().pageRange().size() == 1 + response.value().pageRange().get(0).start() == 0 + response.value().pageRange().get(0).end() == PageBlobClient.PAGE_BYTES - 1 + response.value().clearRange().size() == 1 + response.value().clearRange().get(0).start() == PageBlobClient.PAGE_BYTES + response.value().clearRange().get(0).end() == PageBlobClient.PAGE_BYTES * 2 - 1 + validateBasicHeaders(response.headers()) + Integer.parseInt(response.headers().value("x-ms-blob-content-length")) == PageBlobClient.PAGE_BYTES * 2 + } def "Get page ranges diff min"() { setup: - String snapshot = bu.createSnapshot().value() + String snapshot = bu.createSnapshot().value().getSnapshotId() when: bu.getPageRangesDiff(null, snapshot).iterator().hasNext() @@ -735,7 +735,7 @@ class PageBlobAPITest extends APISpec { @Unroll def "Get page ranges diff AC"() { setup: - String snapshot = bu.createSnapshot(null, null, null).value() + String snapshot = bu.createSnapshot().value().getSnapshotId() BlobAccessConditions bac = new BlobAccessConditions() .leaseAccessConditions(new LeaseAccessConditions().leaseId(setupBlobLeaseCondition(bu, leaseID))) .modifiedAccessConditions(new ModifiedAccessConditions() @@ -745,7 +745,7 @@ class PageBlobAPITest extends APISpec { .ifNoneMatch(noneMatch)) when: - bu.getPageRangesDiff(new BlobRange(0, PageBlobClient.PAGE_BYTES), snapshot, bac, null).iterator().hasNext() + bu.getPageRangesDiff(new BlobRange(0, PageBlobClient.PAGE_BYTES), snapshot, bac, null) then: notThrown(StorageException) @@ -774,7 +774,7 @@ class PageBlobAPITest extends APISpec { .ifNoneMatch(setupBlobMatchCondition(bu, noneMatch))) when: - bu.getPageRangesDiff(new BlobRange(0, PageBlobClient.PAGE_BYTES), snapshot, bac, null).iterator().hasNext() + bu.getPageRangesDiff(new BlobRange(0, PageBlobClient.PAGE_BYTES), snapshot, bac, null) then: thrown(StorageException) @@ -793,7 +793,7 @@ class PageBlobAPITest extends APISpec { bu = cu.getPageBlobClient(generateBlobName()) when: - bu.getPageRangesDiff(null, "snapshot").iterator().hasNext() + bu.getPageRangesDiff(null, "snapshot") then: thrown(StorageException) @@ -811,13 +811,13 @@ class PageBlobAPITest extends APISpec { thrown(IllegalArgumentException) where: - start | end - 1 | 1 - -PageBlobClient.PAGE_BYTES | PageBlobClient.PAGE_BYTES - 1 - 0 | 0 - 1 | PageBlobClient.PAGE_BYTES - 1 - 0 | PageBlobClient.PAGE_BYTES - PageBlobClient.PAGE_BYTES * 2 | PageBlobClient.PAGE_BYTES - 1 + start | end + 1 | 1 + -PageBlobClient.PAGE_BYTES | PageBlobClient.PAGE_BYTES - 1 + 0 | 0 + 1 | PageBlobClient.PAGE_BYTES - 1 + 0 | PageBlobClient.PAGE_BYTES + PageBlobClient.PAGE_BYTES * 2 | PageBlobClient.PAGE_BYTES - 1 } def "Resize"() { @@ -931,7 +931,7 @@ class PageBlobAPITest extends APISpec { expect: bu.updateSequenceNumber(SequenceNumberActionType.UPDATE, 1, bac, null) - .statusCode() == 200 + .statusCode() == 200 where: modified | unmodified | match | noneMatch | leaseID @@ -984,7 +984,7 @@ class PageBlobAPITest extends APISpec { setup: cu.setAccessPolicy(PublicAccessType.BLOB, null) PageBlobClient bu2 = cu.getPageBlobClient(generateBlobName()) - String snapshot = bu.createSnapshot().value() + String snapshot = bu.createSnapshot().value().getSnapshotId() Response copyResponse = bu2.copyIncremental(bu.getBlobUrl(), snapshot) String status = copyResponse.value().toString() @@ -1012,7 +1012,7 @@ class PageBlobAPITest extends APISpec { setup: cu.setAccessPolicy(PublicAccessType.BLOB, null) PageBlobClient bu2 = cu.getPageBlobClient(generateBlobName()) - String snapshot = bu.createSnapshot().value() + String snapshot = bu.createSnapshot().value().getSnapshotId() expect: bu2.copyIncremental(bu.getBlobUrl(), snapshot).statusCode() == 202 @@ -1023,7 +1023,7 @@ class PageBlobAPITest extends APISpec { setup: cu.setAccessPolicy(PublicAccessType.BLOB, null) PageBlobClient bu2 = cu.getPageBlobClient(generateBlobName()) - String snapshot = bu.createSnapshot().value() + String snapshot = bu.createSnapshot().value().getSnapshotId() Response copyResponse = bu2.copyIncremental(bu.getBlobUrl(), snapshot) String status = copyResponse.value().toString() @@ -1038,7 +1038,7 @@ class PageBlobAPITest extends APISpec { sleep(1000) } - snapshot = bu.createSnapshot().value() + snapshot = bu.createSnapshot().value().getSnapshotId() match = setupBlobMatchCondition(bu2, match) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) @@ -1063,9 +1063,9 @@ class PageBlobAPITest extends APISpec { setup: cu.setAccessPolicy(PublicAccessType.BLOB, null) PageBlobClient bu2 = cu.getPageBlobClient(generateBlobName()) - String snapshot = bu.createSnapshot().value() + String snapshot = bu.createSnapshot().value().getSnapshotId() bu2.copyIncremental(bu.getBlobUrl(), snapshot) - snapshot = bu.createSnapshot().value() + snapshot = bu.createSnapshot().value().getSnapshotId() noneMatch = setupBlobMatchCondition(bu2, noneMatch) def mac = new ModifiedAccessConditions() .ifModifiedSince(modified) 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 new file mode 100644 index 000000000000..773d552ea319 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ProgressReporterTest.groovy @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob + +import io.netty.buffer.ByteBuf +import io.netty.buffer.Unpooled +import reactor.core.publisher.Flux + +import java.nio.ByteBuffer +import java.util.concurrent.atomic.AtomicLong +import java.util.concurrent.locks.ReentrantLock + +class ProgressReporterTest extends APISpec { + def "Report progress sequential"() { + setup: + ByteBuffer buf1 = getRandomData(10) + ByteBuffer buf2 = getRandomData(15) + ByteBuffer buf3 = getRandomData(5) + + IProgressReceiver mockReceiver = Mock(IProgressReceiver) + + Flux data = Flux.just(buf1, buf2, buf3) + data = ProgressReporter.addProgressReporting(data, mockReceiver) + + when: + data.subscribe() + data.subscribe() // Subscribing twice enforces invocation of rewind + + then: + // The same benchmarks should be reported on each subscription (retry). We should never go over total data size. + 2 * mockReceiver.reportProgress(10) + 2 * mockReceiver.reportProgress(25) + 2 * mockReceiver.reportProgress(30) + 0 * mockReceiver.reportProgress({it > 30}) + } + + 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) }) + + when: + BlockBlobAsyncClient bu = new BlobClientBuilder() + .endpoint(cu.getContainerUrl().toString()) + .blobName(generateBlobName()) + .credential(primaryCreds) + .buildBlockBlobAsyncClient() + bu.upload(data, buffer.remaining()).block() + + then: + /* + With the HTTP client, etc. involved, the best we can guarantee is that it's called once with the total. There + may or may not be any intermediary calls. This test mostly looks to validate that there is no interference + with actual network calls. + */ + 1 * mockReceiver.reportProgress(1 * 1024 * 1024) + } + + def "Report progress parallel"() { + setup: + ByteBuffer buf1 = getRandomData(10) + ByteBuffer buf2 = getRandomData(15) + ByteBuffer buf3 = getRandomData(5) + + ReentrantLock lock = new ReentrantLock() + AtomicLong totalProgress = new AtomicLong(0) + + IProgressReceiver mockReceiver = Mock(IProgressReceiver) + Flux data = Flux.just(buf1, buf2, buf3) + Flux data2 = Flux.just(buf3, buf2, buf1) + data = ProgressReporter.addParallelProgressReporting(data, mockReceiver, lock, totalProgress) + data2 = ProgressReporter.addParallelProgressReporting(data2, mockReceiver, lock, totalProgress) + + when: + data.subscribe() + data2.subscribe() + data.subscribe() + data2.subscribe() + + sleep(3000) // These Fluxes should complete quickly, but we don't want to block or it'll order everything + + then: + /* + There should be at least one call reporting the total length of the data. There may be two if both data and + data2 complete before the second batch of subscriptions + */ + (1..2) * mockReceiver.reportProgress(60) + + /* + There should be 12 calls total, but either one or two of them could be reporting the total length, so we + can only guarantee four calls with an unknown parameter. This test doesn't strictly mimic the network as + there would never be concurrent subscriptions to the same Flux as may be the case here, but it is good + enough. + */ + (10..11) * mockReceiver.reportProgress(_) + + /* + 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}) + } + + // 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 new file mode 100644 index 000000000000..a0b3c2d69e84 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RequestRetryTestFactory.java @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob; + +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpMethod; +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.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.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +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; + +class RequestRetryTestFactory { + static final int RETRY_TEST_SCENARIO_RETRY_UNTIL_SUCCESS = 1; + + static final int RETRY_TEST_SCENARIO_RETRY_UNTIL_MAX_RETRIES = 2; + + static final int RETRY_TEST_SCENARIO_NON_RETRYABLE = 3; + + static final int RETRY_TEST_SCENARIO_NON_RETRYABLE_SECONDARY = 4; + + static final int RETRY_TEST_SCENARIO_NETWORK_ERROR = 5; + + static final int RETRY_TEST_SCENARIO_EXPONENTIAL_TIMING = 6; + + static final int RETRY_TEST_SCENARIO_FIXED_TIMING = 7; + + static final int RETRY_TEST_SCENARIO_TRY_TIMEOUT = 8; + + static final int RETRY_TEST_SCENARIO_NON_REPLAYABLE_FLOWABLE = 9; + + // Cancelable + + 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()); + 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)); + + /* + We wrap the response in a StorageErrorException to mock the HttpClient. Any responses that the HttpClient receives + that is not an expected response is wrapped in a StorageErrorException. + */ + private static final Mono RETRY_TEST_TEMPORARY_ERROR_RESPONSE = Mono.just(new RetryTestResponse(503)); + + private static final Mono RETRY_TEST_TIMEOUT_ERROR_RESPONSE = Mono.just(new RetryTestResponse(500)); + + private static final Mono RETRY_TEST_NON_RETRYABLE_ERROR = Mono.just(new RetryTestResponse(400)); + + private static final Mono RETRY_TEST_NOT_FOUND_RESPONSE = Mono.just(new RetryTestResponse(404)); + + private int retryTestScenario; + + private RequestRetryOptions options; + + /* + It is atypical and not recommended to have mutable state on the factory itself. However, the tests will need to + be able to validate the number of tries, and the tests will not have access to the policies, so we break our own + rule here. + */ + private int tryNumber; + + private OffsetDateTime time; + + RequestRetryTestFactory(int scenario, RequestRetryOptions options) { + this.retryTestScenario = scenario; + this.options = options; + } + + Mono send(URL url) { + return new HttpPipelineBuilder() + .policies(new RequestRetryPolicy(this.options)) + .httpClient(new RetryTestClient(this)) + .build() + .send(new HttpRequest(HttpMethod.GET, url).body(Flux.just(RETRY_TEST_DEFAULT_DATA))); + } + + int getTryNumber() { + return this.tryNumber; + } + + // The retry factory only really cares about the status code. + private static final class RetryTestResponse extends HttpResponse { + int statusCode; + + RetryTestResponse(int statusCode) { + this.statusCode = statusCode; + } + + @Override + public int statusCode() { + return this.statusCode; + } + + @Override + public String headerValue(String headerName) { + return null; + } + + @Override + public HttpHeaders headers() { + return null; + } + + @Override + public Flux body() { + return null; + } + + @Override + public Mono bodyAsByteArray() { + return null; + } + + @Override + public Mono bodyAsString() { + return null; + } + + @Override + public Mono bodyAsString(Charset charset) { + return null; + } + } + + private final class RetryTestClient implements HttpClient { + private RequestRetryTestFactory factory; + + RetryTestClient(RequestRetryTestFactory parent) { + this.factory = parent; + } + + @Override + public Mono send(HttpRequest request) { + this.factory.tryNumber++; + if (this.factory.tryNumber > this.factory.options.maxTries()) { + throw new IllegalArgumentException("Try number has exceeded max tries"); + } + + // Validate the expected preconditions for each try: The correct host is used. + String expectedHost = RETRY_TEST_PRIMARY_HOST; + if (this.factory.tryNumber % 2 == 0) { + /* + Special cases: retry until success scenario fail's on the 4th try with a 404 on the secondary, so we + never expect it to check the secondary after that. All other tests should continue to check the + secondary. + Exponential timing only tests secondary backoff once but uses the rest of the retries to hit the max + delay. + */ + if (!((this.factory.retryTestScenario == RequestRetryTestFactory.RETRY_TEST_SCENARIO_RETRY_UNTIL_SUCCESS && this.factory.tryNumber > 4) + || (this.factory.retryTestScenario == RequestRetryTestFactory.RETRY_TEST_SCENARIO_EXPONENTIAL_TIMING && this.factory.tryNumber > 2))) { + expectedHost = RETRY_TEST_SECONDARY_HOST; + } + } + + if (!request.url().getHost().equals(expectedHost)) { + throw new IllegalArgumentException("The host does not match the expected host"); + } + + /* + This policy will add test headers and query parameters. Ensure they are removed/reset for each retry. + The retry policy should be starting with a fresh copy of the request for every try. + */ + if (request.headers().value(RETRY_TEST_HEADER) != null) { + throw new IllegalArgumentException("Headers not reset."); + } + if ((request.url().getQuery() != null && request.url().getQuery().contains(RETRY_TEST_QUERY_PARAM))) { + throw new IllegalArgumentException("Query params not reset."); + } + + // Subscribe and block until all information is read to prevent a blocking on another thread exception from Reactor. + ByteBuf buf = Unpooled.buffer(); + Disposable disposable = request.body().subscribe(buf::writeBytes); + 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) { + throw new IllegalArgumentException(("Body not reset.")); + } + + /* + Modify the request as policies downstream of the retry policy are likely to do. These must be reset on each + try. + */ + request.headers().put(RETRY_TEST_HEADER, "testheader"); + UrlBuilder builder = UrlBuilder.parse(request.url()); + builder.setQueryParameter(RETRY_TEST_QUERY_PARAM, "testquery"); + try { + request.url(builder.toURL()); + } catch (MalformedURLException e) { + throw new IllegalArgumentException("The URL has been mangled"); + } + + switch (this.factory.retryTestScenario) { + case RETRY_TEST_SCENARIO_RETRY_UNTIL_SUCCESS: + switch (this.factory.tryNumber) { + case 1: + /* + The timer is set with a timeout on the Mono used to make the request. If the Mono + doesn't return success fast enough, it will throw a TimeoutException. We can short circuit + the waiting by simply returning an error. We will validate the time parameter later. Here, + we just test that a timeout is retried. + */ + return Mono.error(new TimeoutException()); + case 2: + return RETRY_TEST_TEMPORARY_ERROR_RESPONSE; + case 3: + return RETRY_TEST_TIMEOUT_ERROR_RESPONSE; + case 4: + /* + By returning 404 when we should be testing against the secondary, we exercise the logic + that should prevent further tries to secondary when the secondary evidently doesn't have the + data. + */ + return RETRY_TEST_NOT_FOUND_RESPONSE; + case 5: + // Just to get to a sixth try where we ensure we should not be trying the secondary again. + return RETRY_TEST_TEMPORARY_ERROR_RESPONSE; + case 6: + return RETRY_TEST_OK_RESPONSE; + default: + throw new IllegalArgumentException("Continued trying after success."); + } + + case RETRY_TEST_SCENARIO_RETRY_UNTIL_MAX_RETRIES: + return RETRY_TEST_TEMPORARY_ERROR_RESPONSE; + + case RETRY_TEST_SCENARIO_NON_RETRYABLE: + if (this.factory.tryNumber == 1) { + return RETRY_TEST_NON_RETRYABLE_ERROR; + } else { + throw new IllegalArgumentException("Continued trying after non retryable error."); + } + + case RETRY_TEST_SCENARIO_NON_RETRYABLE_SECONDARY: + switch (this.factory.tryNumber) { + case 1: + return RETRY_TEST_TEMPORARY_ERROR_RESPONSE; + case 2: + return RETRY_TEST_NON_RETRYABLE_ERROR; + default: + throw new IllegalArgumentException("Continued trying after non retryable error."); + } + + case RETRY_TEST_SCENARIO_NETWORK_ERROR: + switch (this.factory.tryNumber) { + case 1: + // fall through + case 2: + return Mono.error(new IOException()); + case 3: + return RETRY_TEST_OK_RESPONSE; + default: + throw new IllegalArgumentException("Continued retrying after success."); + } + + case RETRY_TEST_SCENARIO_TRY_TIMEOUT: + switch (this.factory.tryNumber) { + case 1: + case 2: + return RETRY_TEST_OK_RESPONSE.delaySubscription(Duration.ofSeconds(options.tryTimeout() + 1)); + case 3: + return RETRY_TEST_OK_RESPONSE.delaySubscription(Duration.ofSeconds(options.tryTimeout() - 1)); + default: + throw new IllegalArgumentException("Continued retrying after success"); + } + + case RETRY_TEST_SCENARIO_EXPONENTIAL_TIMING: + switch (this.factory.tryNumber) { + case 1: + this.factory.time = OffsetDateTime.now(); + return RETRY_TEST_TEMPORARY_ERROR_RESPONSE; + case 2: + /* + Calculation for secondary is always the same, so we don't need to keep testing it. Not + trying the secondary any more will also speed up the test. + */ + return testDelayBounds(1, false, RETRY_TEST_NOT_FOUND_RESPONSE); + case 3: + return testDelayBounds(2, true, RETRY_TEST_TEMPORARY_ERROR_RESPONSE); + case 4: + return testDelayBounds(3, true, RETRY_TEST_TEMPORARY_ERROR_RESPONSE); + case 5: + /* + With the current configuration in RetryTest, the maxRetryDelay should be reached upon the + fourth try to the primary. + */ + return testMaxDelayBounds(RETRY_TEST_TEMPORARY_ERROR_RESPONSE); + case 6: + return testMaxDelayBounds(RETRY_TEST_OK_RESPONSE); + default: + throw new IllegalArgumentException("Max retries exceeded/continued retrying after success"); + } + + case RETRY_TEST_SCENARIO_FIXED_TIMING: + switch (this.factory.tryNumber) { + case 1: + this.factory.time = OffsetDateTime.now(); + return RETRY_TEST_TEMPORARY_ERROR_RESPONSE; + case 2: + return testDelayBounds(1, false, RETRY_TEST_TEMPORARY_ERROR_RESPONSE); + case 3: + return testDelayBounds(2, true, RETRY_TEST_TEMPORARY_ERROR_RESPONSE); + case 4: + /* + Fixed backoff means it's always the same and we never hit the max, no need to keep testing. + */ + return RETRY_TEST_OK_RESPONSE; + default: + throw new IllegalArgumentException("Retries continued after success."); + } + + case RETRY_TEST_SCENARIO_NON_REPLAYABLE_FLOWABLE: + switch (this.factory.tryNumber) { + case 1: + return RETRY_TEST_TEMPORARY_ERROR_RESPONSE; + case 2: + return Mono.error(new UnexpectedLengthException("Unexpected length", 5, 6)); + default: + throw new IllegalArgumentException("Retries continued on non retryable error."); + } + default: + throw new IllegalArgumentException("Invalid retry test scenario."); + } + } + + @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. + */ + private long calcPrimaryDelay(int tryNumber) { + switch (this.factory.retryTestScenario) { + case RETRY_TEST_SCENARIO_EXPONENTIAL_TIMING: + return (long) Math.ceil( + ((pow(2L, tryNumber - 1) - 1L) * this.factory.options.retryDelayInMs()) / 1000); + case RETRY_TEST_SCENARIO_FIXED_TIMING: + return (long) Math.ceil(this.factory.options.retryDelayInMs() / 1000); + default: + throw new IllegalArgumentException("Invalid test scenario"); + } + } + + private OffsetDateTime calcUpperBound(OffsetDateTime start, int primaryTryNumber, boolean tryingPrimary) { + if (tryingPrimary) { + return start.plus(calcPrimaryDelay(primaryTryNumber) * 1000 + 500, ChronoUnit.MILLIS); + } else { + return start.plus(1400, ChronoUnit.MILLIS); + } + } + + private OffsetDateTime calcLowerBound(OffsetDateTime start, int primaryTryNumber, boolean tryingPrimary) { + if (tryingPrimary) { + return start.plus(calcPrimaryDelay(primaryTryNumber) * 1000 - 500, ChronoUnit.MILLIS); + } else { + return start.plus(700, ChronoUnit.MILLIS); + } + } + + private Mono testDelayBounds(int primaryTryNumber, boolean tryingPrimary, Mono response) { + /* + We have to return a new Mono so that the calculation for time is performed at the correct time, i.e. when + the Mono is actually subscribed to. This mocks an HttpClient because the requests are made only when + the Mono is subscribed to, not when all the infrastructure around it is put in place, and we care about + the delay before the request itself. + */ + return Mono.defer(() -> Mono.fromCallable(() -> { + OffsetDateTime now = OffsetDateTime.now(); + if (now.isAfter(calcUpperBound(factory.time, primaryTryNumber, tryingPrimary)) + || now.isBefore(calcLowerBound(factory.time, primaryTryNumber, tryingPrimary))) { + throw new IllegalArgumentException("Delay was not within jitter bounds"); + } + + factory.time = now; + return response.block(); + })); + } + + private Mono testMaxDelayBounds(Mono response) { + return Mono.defer(() -> Mono.fromCallable(() -> { + OffsetDateTime now = OffsetDateTime.now(); + if (now.isAfter(factory.time.plusSeconds((long) Math.ceil((factory.options.maxRetryDelayInMs() / 1000) + 1)))) { + throw new IllegalArgumentException("Max retry delay exceeded"); + } else if (now.isBefore(factory.time.plusSeconds((long) Math.ceil((factory.options.maxRetryDelayInMs() / 1000) - 1)))) { + throw new IllegalArgumentException("Retry did not delay long enough"); + } + + factory.time = now; + return response.block(); + })); + } + } +} 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 new file mode 100644 index 000000000000..ab5f9aabd872 --- /dev/null +++ b/sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/RetryTest.groovy @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.storage.blob + + +import com.azure.core.http.HttpResponse +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) + static RequestRetryOptions retryTestOptions = new RequestRetryOptions(RetryPolicyType.EXPONENTIAL, 6, 2, + 1000L, 4000L, RequestRetryTestFactory.RETRY_TEST_SECONDARY_HOST) + + def "Retries until success"() { + setup: + RequestRetryTestFactory retryTestFactory = new RequestRetryTestFactory(RequestRetryTestFactory.RETRY_TEST_SCENARIO_RETRY_UNTIL_SUCCESS, retryTestOptions) + + when: + HttpResponse response = retryTestFactory.send(retryTestURL).block() + + then: + response.statusCode() == 200 + retryTestFactory.getTryNumber() == 6 + } + + def "Retries until max retries"() { + setup: + RequestRetryTestFactory retryTestFactory = new RequestRetryTestFactory(RequestRetryTestFactory.RETRY_TEST_SCENARIO_RETRY_UNTIL_MAX_RETRIES, retryTestOptions) + + when: + HttpResponse response = retryTestFactory.send(retryTestURL).block() + + then: + response.statusCode() == 503 + retryTestFactory.getTryNumber() == retryTestOptions.maxTries() + } + + def "Retries non retryable"() { + setup: + RequestRetryTestFactory retryTestFactory = new RequestRetryTestFactory(RequestRetryTestFactory.RETRY_TEST_SCENARIO_NON_RETRYABLE, retryTestOptions) + + when: + HttpResponse response = retryTestFactory.send(retryTestURL).block() + + then: + response.statusCode() == 400 + retryTestFactory.getTryNumber() == 1 + } + + def "Retries non retryable secondary"() { + setup: + RequestRetryTestFactory retryTestFactory = new RequestRetryTestFactory(RequestRetryTestFactory.RETRY_TEST_SCENARIO_NON_RETRYABLE_SECONDARY, retryTestOptions) + + when: + HttpResponse response = retryTestFactory.send(retryTestURL).block() + + then: + response.statusCode() == 400 + retryTestFactory.getTryNumber() == 2 + } + + def "Retries network error"() { + setup: + RequestRetryTestFactory retryTestFactory = new RequestRetryTestFactory(RequestRetryTestFactory.RETRY_TEST_SCENARIO_NETWORK_ERROR, retryTestOptions) + + when: + HttpResponse response = retryTestFactory.send(retryTestURL).block() + + then: + response.statusCode() == 200 + retryTestFactory.getTryNumber() == 3 + } + + def "Retries try timeout"() { + setup: + RequestRetryTestFactory retryTestFactory = new RequestRetryTestFactory(RequestRetryTestFactory.RETRY_TEST_SCENARIO_TRY_TIMEOUT, retryTestOptions) + + when: + HttpResponse response = retryTestFactory.send(retryTestURL).block() + + then: + response.statusCode() == 200 + retryTestFactory.getTryNumber() == 3 + } + + def "Retries exponential delay"() { + setup: + RequestRetryTestFactory retryTestFactory = new RequestRetryTestFactory(RequestRetryTestFactory.RETRY_TEST_SCENARIO_EXPONENTIAL_TIMING, retryTestOptions) + + when: + HttpResponse response = retryTestFactory.send(retryTestURL).block() + + then: + response.statusCode() == 200 + retryTestFactory.getTryNumber() == 6 + } + + def "Retries fixed delay"() { + setup: + RequestRetryTestFactory retryTestFactory = new RequestRetryTestFactory(RequestRetryTestFactory.RETRY_TEST_SCENARIO_FIXED_TIMING, retryTestOptions) + + when: + HttpResponse response = retryTestFactory.send(retryTestURL).block() + + then: + response.statusCode() == 200 + retryTestFactory.getTryNumber() == 4 + } + + def "Retries non replyable flux"() { + setup: + RequestRetryTestFactory retryTestFactory = new RequestRetryTestFactory(RequestRetryTestFactory.RETRY_TEST_SCENARIO_NON_REPLAYABLE_FLOWABLE, retryTestOptions) + + when: + retryTestFactory.send(retryTestURL).block() + + then: + def e = thrown(IllegalStateException) + e.getMessage().startsWith("The request failed because") + e.getCause() instanceof UnexpectedLengthException + } + + @Unroll + def "Retries options invalid"() { + when: + new RequestRetryOptions(null, maxTries, tryTimeout, retryDelayInMs, maxRetryDelayInMs, null) + + then: + thrown(IllegalArgumentException) + + where: + maxTries | tryTimeout | retryDelayInMs | maxRetryDelayInMs + 0 | null | null | null + null | 0 | null | null + null | null | 0 | 1 + null | null | 1 | 0 + null | null | null | 1 + null | null | 1 | null + null | null | 5 | 4 + } +} diff --git a/storage/client/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 similarity index 91% rename from storage/client/blob/src/test/java/com/azure/storage/blob/SASTest.groovy rename to sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/SASTest.groovy index 2824ac1d3067..45d44751d1a0 100644 --- a/storage/client/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,10 +3,10 @@ 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.StorageErrorCode import com.azure.storage.blob.models.UserDelegationKey import com.azure.storage.common.credentials.SASTokenCredential import com.azure.storage.common.credentials.SharedKeyCredential @@ -17,24 +17,10 @@ import java.time.OffsetDateTime import java.time.ZoneOffset class SASTest extends APISpec { - - def "responseError"() { - when: - cu.listBlobsFlat() - - 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(" new ProxyOptions(ProxyOptions.Type.HTTP, new InetSocketAddress("localhost", 8888)))*/) .buildClient(); @@ -82,7 +82,7 @@ public void sample() throws IOException { //@Test public void asyncSample() throws IOException { // get service client - StorageAsyncClient serviceClient = new StorageClientBuilder().endpoint(ACCOUNT_ENDPOINT) + 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)))*/) .buildAsyncClient(); @@ -161,7 +161,7 @@ public void uploadDownloadFromFile() throws IOException { fstream.close(); // get service client - StorageClient serviceClient = new StorageClientBuilder().endpoint(ACCOUNT_ENDPOINT) + 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)))*/) .buildClient(); @@ -191,7 +191,7 @@ public void uploadDownloadFromFileAsync() throws IOException { fstream.close(); // get service client - StorageAsyncClient serviceClient = new StorageClientBuilder().endpoint(ACCOUNT_ENDPOINT) + 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)))*/) .buildAsyncClient(); diff --git a/storage/client/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 similarity index 97% rename from storage/client/blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy rename to sdk/storage/azure-storage-blob/src/test/java/com/azure/storage/blob/ServiceAPITest.groovy index d6e8861b4739..830dd34c2203 100644 --- a/storage/client/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 @@ -234,7 +234,7 @@ class ServiceAPITest extends APISpec { def "Set props error"() { when: - new StorageClientBuilder() + new BlobServiceClientBuilder() .endpoint("https://error.blob.core.windows.net") .credential(primaryCreds) .buildClient() @@ -251,7 +251,7 @@ class ServiceAPITest extends APISpec { def "Get props error"() { when: - new StorageClientBuilder() + new BlobServiceClientBuilder() .endpoint("https://error.blob.core.windows.net") .credential(primaryCreds) .buildClient() @@ -306,7 +306,7 @@ class ServiceAPITest extends APISpec { def "Get stats"() { setup: String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCreds.accountName()) - StorageClient serviceClient = new StorageClientBuilder().endpoint(secondaryEndpoint) + BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(secondaryEndpoint) .credential(primaryCreds).buildClient() Response response = serviceClient.getStatistics() @@ -321,7 +321,7 @@ class ServiceAPITest extends APISpec { def "Get stats min"() { setup: String secondaryEndpoint = String.format("https://%s-secondary.blob.core.windows.net", primaryCreds.accountName()) - StorageClient serviceClient = new StorageClientBuilder().endpoint(secondaryEndpoint) + BlobServiceClient serviceClient = new BlobServiceClientBuilder().endpoint(secondaryEndpoint) .credential(primaryCreds).buildClient() expect: serviceClient.getStatistics().statusCode() == 200 @@ -354,7 +354,7 @@ class ServiceAPITest extends APISpec { def "Get account info error"() { when: - StorageClient serviceURL = new StorageClientBuilder() + BlobServiceClient serviceURL = new BlobServiceClientBuilder() .endpoint(primaryServiceURL.getAccountUrl().toString()) .buildClient() serviceURL.getAccountInfo() @@ -368,7 +368,7 @@ class ServiceAPITest extends APISpec { def "Invalid account name"() { setup: URL badURL = new URL("http://fake.blobfake.core.windows.net") - StorageClient client = new StorageClientBuilder() + BlobServiceClient client = new BlobServiceClientBuilder() .endpoint(badURL.toString()) .credential(primaryCreds) .retryOptions(new RequestRetryOptions(null, 2, null, null, null, null)) diff --git a/storage/client/blob/swagger/blob.json b/sdk/storage/azure-storage-blob/swagger/blob.json similarity index 99% rename from storage/client/blob/swagger/blob.json rename to sdk/storage/azure-storage-blob/swagger/blob.json index 4a89d47458cc..0bf6a308f327 100644 --- a/storage/client/blob/swagger/blob.json +++ b/sdk/storage/azure-storage-blob/swagger/blob.json @@ -2405,15 +2405,6 @@ "format": "file" } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -2706,15 +2697,6 @@ } } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -5077,15 +5059,6 @@ } } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -5791,15 +5764,6 @@ } } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -5930,15 +5894,6 @@ "$ref": "#/definitions/PageList" } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -6056,15 +6011,6 @@ "$ref": "#/definitions/PageList" } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -6683,15 +6629,6 @@ } } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -6939,7 +6876,13 @@ "$ref": "#/definitions/BlobProperties" }, "Metadata": { - "$ref": "#/definitions/BlobMetadata" + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "IsPrefix": { + "type": "boolean" } } }, @@ -7763,7 +7706,10 @@ "description": "a collection of signed identifiers", "type": "array", "items": { - "$ref": "#/definitions/SignedIdentifier" + "$ref": "#/definitions/SignedIdentifier", + "xml": { + "name": "SignedIdentifier" + } }, "xml": { "wrapped": true, @@ -7864,7 +7810,7 @@ "pattern": "^[a-zA-Z0-9]+(?:/[a-zA-Z0-9]+)*(?:\\.[a-zA-Z0-9]+){0,1}$", "minLength": 1, "maxLength": 1024, - "x-ms-parameter-location": "client", + "x-ms-parameter-location": "method", "description": "The blob name." }, "BlobCacheControl": { @@ -8119,7 +8065,7 @@ "in": "path", "required": true, "type": "string", - "x-ms-parameter-location": "client", + "x-ms-parameter-location": "method", "description": "The container name." }, "ContentCrc64": { @@ -8698,4 +8644,4 @@ "description": "Content disposition for given resource" } } -} \ No newline at end of file +} diff --git a/sdk/storage/azure-storage-file/CHANGELOG.md b/sdk/storage/azure-storage-file/CHANGELOG.md new file mode 100644 index 000000000000..155020a406d2 --- /dev/null +++ b/sdk/storage/azure-storage-file/CHANGELOG.md @@ -0,0 +1,21 @@ +# Release History + +## 12.0.0-preview.2 (2019-08-08) +Version 12.0.0-preview.2 is a preview of our efforts in creating a client library that is developer-friendly, idiomatic to the Java ecosystem, and as consistent across different languages and platforms as possible. The principles that guide our efforts can be found in the [Azure SDK Design Guidelines for Java](https://azuresdkspecs.z5.web.core.windows.net/JavaSpec.html). + +For details on the Azure SDK for Java (August 2019 Preview) release, you can refer to the [release announcement](https://aka.ms/azure-sdk-preview2-java). + +This package's +[documentation](https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/storage/azure-storage-file/README.md) +and +[samples](https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/storage/azure-storage-file/src/samples/java/com/azure/file) +demonstrate the new API. + +### Features included in `azure-storage-file` +- This is initial SDK release for storage file service. +- Packages scoped by functionality + - `azure-storage-file` contains a `FileServiceClient`, `FileServiceAsyncClient`, `ShareClient`, `ShareAsyncClient`, `DirectoryClient`, `DirectoryAsyncClient`, `FileClient` and `FileAsyncClient` for storage file operations. +- Client instances are scoped to storage file service. +- Reactive streams support using [Project Reactor](https://projectreactor.io/). + + diff --git a/storage/client/file/README.md b/sdk/storage/azure-storage-file/README.md similarity index 75% rename from storage/client/file/README.md rename to sdk/storage/azure-storage-file/README.md index db523e4d3e44..75e91197b6d4 100644 --- a/storage/client/file/README.md +++ b/sdk/storage/azure-storage-file/README.md @@ -1,12 +1,13 @@ # Azure File client library for Java -The Server Message Block (SMB) protocol is the preferred file share protocol used on-premises today. +The Server Message Block (SMB) protocol is the preferred file share protocol used on-premises today. The Microsoft Azure File service enables customers to leverage the availability and scalability of Azure’s Cloud Infrastructure as a Service (IaaS) SMB without having to rewrite SMB client applications. -Files stored in Azure File service shares are accessible via the SMB protocol, and also via REST APIs. -The File service offers the following four resources: the storage account, shares, directories, and files. +Files stored in Azure File service shares are accessible via the SMB protocol, and also via REST APIs. +The File service offers the following four resources: the storage account, shares, directories, and files. Shares provide a way to organize sets of files and also can be mounted as an SMB file share that is hosted in the cloud. -[Source code][source_code] | [Package (Maven)][package] | [API reference documentation][api_documentation] | [Product documentation][azconfig_docs] +[Source code][source_code] | [API reference documentation][api_documentation] | [Product documentation][storage_docs] | +[Samples][samples] ## Getting started @@ -14,7 +15,7 @@ Shares provide a way to organize sets of files and also can be mounted as an SMB - [Java Development Kit (JDK)][jdk] with version 8 or above - [Azure Subscription][azure_subscription] -- [Create Strorage Account][storage_account] +- [Create Storage Account][storage_account] ### Adding the package to your product @@ -22,14 +23,14 @@ Shares provide a way to organize sets of files and also can be mounted as an SMB com.azure azure-storage-file - 12.0.0-preview.1 + 12.0.0-preview.2 ``` ### Create a Storage Account To create a Storage Account you can use the Azure Portal or [Azure CLI][azure_cli]. -```Powershell +```powershell az group create \ --name storage-resource-group \ --location westus @@ -37,50 +38,49 @@ az group create \ ### Authenticate the client -In order to interact with the Storage service (File Service, Share, Directory, MessageId, File) you'll need to create an instance of the Service Client class. +In order to interact with the Storage service (File Service, Share, Directory, 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 -az storage file generate-sas - --name {account name} - --expiry {date/time to expire SAS token} - --permission {permission to grant} - --connection-string {connection string of the storage account} -``` - -```Powershell -CONNECTION_STRING= - -az storage file generate-sas - --name javasdksas - --expiry 2019-06-05 - --permission rpau - --connection-string $CONNECTION_STRING -``` -b. Alternatively, get the Account SAS Token from the Azure Portal. -``` -Go to your storage account -> Shared access signature -> Click on Generate SAS and connection string -``` + * Use the [Azure CLI][azure_cli] snippet below to get the SAS token from the Storage account. + ```powershell + az storage file generate-sas + --name {account name} + --expiry {date/time to expire SAS token} + --permission {permission to grant} + --connection-string {connection string of the storage account} + ``` + + ```powershell + CONNECTION_STRING= + + az storage file generate-sas + --name javasdksas + --expiry 2019-06-05 + --permission rpau + --connection-string $CONNECTION_STRING + ``` + * Alternatively, get the Account SAS Token from the Azure Portal. + 1. Go to your storage account. + 1. Click on "Shared access signature". + 1. Click on "Generate SAS and connection string". - **Shared Key Credential** + * There are two ways to create a shared key credential, the first is using the storage account name and account key. The second is using the storage connection string. + 1. Use account name and account key. + 1. The account name is your storage account name. + 1. Go to your storage account. + 1. Select "Access keys" tab. + 1. Copy the "Key" value for either Key 1 or Key 2. + 1. Use the connection string + 1. Go to your storage account. + 1. Select "Access keys" tab. + 1. Copy the "Connection string" value for either Key 1 or Key 2. -a. Use account name and account key. Account name is your storage account name. -``` -// Here is where we get the key -Go to your storage account -> Access keys -> Key 1/ Key 2 -> Key -``` -b. Use the connection string -``` -// Here is where we get the key -Go to your storage account -> Access Keys -> Keys 1/ Key 2 -> Connection string -``` ## Key concepts + ### URL format Files are addressable using the following URL format: ``` @@ -103,7 +103,7 @@ https://myaccount.file.core.windows.net/myshare/mydirectorypath/myfile ### Handling Exceptions ```java -TODO +// TODO ``` ### Resource Names @@ -128,12 +128,12 @@ The Azure File service naming rules for directory and file names are as follows: 1. Directory names cannot end with the forward slash character (/). If provided, it will be automatically removed. 1. File names must not end with the forward slash character (/). 1. Reserved URL characters must be properly escaped. -1. The following characters are not allowed: " \ / : | < > * ? +1. The following characters are not allowed: `" \ / : | < > * ?` 1. Illegal URL path characters not allowed. Code points like \uE000, while valid in NTFS filenames, are not valid Unicode characters. In addition, some ASCII or Unicode characters, like control characters (0x00 to 0x1F, \u0081, etc.), are also not allowed. For rules governing Unicode strings in HTTP/1.1 see [RFC 2616, Section 2.2: Basic Rules][RFC_URL_1] and [RFC 3987][RFL_URL_2]. 1. The following file names are not allowed: LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, PRN, AUX, NUL, CON, CLOCK$, dot character (.), and two dot characters (..). ### Metadata Names -Metadata for a share or file resource is stored as name-value pairs associated with the resource. Directories do not have metadata. Metadata names must adhere to the naming rules for [C# identifiers][C_identifiers]. +Metadata for a share or file resource is stored as name-value pairs associated with the resource. Directories do not have metadata. Metadata names must adhere to the naming rules for [C# identifiers][csharp_identifiers]. Note that metadata names preserve the case with which they were created, but are case-insensitive when set or read. If two or more metadata headers with the same name are submitted for a resource, the Azure File service returns status code 400 (Bad Request). @@ -141,17 +141,17 @@ Note that metadata names preserve the case with which they were created, but are The File Service REST API provides operations on accounts and manage file service properties. It allows the operations of listing and deleting shares, getting and setting file service properties. Once you have the SASToken, you can construct the file service client with `${accountName}`, `${sasToken}` -``` +```java String fileServiceURL = String.format("https://%s.file.core.windows.net", accountName); FileServiceClient fileServiceClient = new FileServiceClientBuilder().endpoint(fileServiceURL) .credential(sasToken).buildClient(); ``` -### Share +### Share The share resource includes metadata and properties for that share. It allows the opertions of creating, creating snapshot, deleting shares, getting share properties, setting metadata, getting and setting ACL (Access policy). Once you have the SASToken, you can construct the file service client with `${accountName}`, `${shareName}`, `${sasToken}` -``` +```java String shareURL = String.format("https://%s.file.core.windows.net", accountName); ShareClient shareClient = new ShareClientBuilder().endpoint(shareURL) .credential(sasToken).shareName(shareName).buildClient(); @@ -160,45 +160,45 @@ ShareClient shareClient = new ShareClientBuilder().endpoint(shareURL) ### Directory The directory resource includes the properties for that directory. It allows the operations of creating, listing, deleting directories or subdirectories or files, getting properties, setting metadata, listing and force closing the handles. Once you have the SASToken, you can construct the file service client with `${accountName}`, `${shareName}`, `${directoryPath}`, `${sasToken}` - - ``` - String directoryURL = String.format("https://%s.file.core.windows.net/%s%s", accountName, shareName, directoryPath, sasToken); - DirectoryClient directoryClient = new DirectoryClientBuilder().endpoint(directoryURL) + +```java +String directoryURL = String.format("https://%s.file.core.windows.net/%s%s", accountName, shareName, directoryPath, sasToken); +DirectoryClient directoryClient = new DirectoryClientBuilder().endpoint(directoryURL) .credential(sasToken).shareName(shareName).directoryName(directoryPath).buildClient(); - ``` +``` ### File The file resource includes the properties for that file. It allows the operations of creating, uploading, copying, downloading, deleting files or range of the files, getting properties, setting metadata, listing and force closing the handles. Once you have the SASToken, you can construct the file service client with `${accountName}`, `${shareName}`, `${directoryPath}`, `${fileName}`, `${sasToken}` - - ``` - String fileURL = String.format("https://%s.file.core.windows.net", accountName); - FileClient fileClient = new FileClientBuilder().endpoint(fileURL) + +```java +String fileURL = String.format("https://%s.file.core.windows.net", accountName); +FileClient fileClient = new FileClientBuilder().endpoint(fileURL) .credential(sasToken).shareName(shareName).filePath(directoryPath + "/" + fileName).buildClient(); - ``` +``` ## Examples The following sections provide several code snippets covering some of the most common Configuration Service tasks, including: -- [Create a Share](#Create-a-share) -- [Create a snapshot on Share](#Create-a-snapshot-on-share) -- [Create a Directory](#Create-a-directory) -- [Create a Subdirectory](#Create-a-subdirectory) -- [Create a File](#Create-a-file) -- [List all Shares](#List-all-shares) -- [List all Subdirectories and Files](#List-all-subdirectories-and-files) -- [List all ranges on file](#List-all-ranges-on-file) -- [Delete a Share](#Delete-a-share) -- [Delete a Directory](#Delete-a-directory) -- [Delete a Subdirectory](#Delete-a-subdirectory) -- [Delete a File](#Delete-a-file) -- [Copy a File](#Copy-a-file) +- [Create a Share](#create-a-share) +- [Create a snapshot on Share](#create-a-snapshot-on-share) +- [Create a Directory](#create-a-directory) +- [Create a Subdirectory](#create-a-subdirectory) +- [Create a File](#create-a-file) +- [List all Shares](#list-all-shares) +- [List all Subdirectories and Files](#list-all-subdirectories-and-files) +- [List all ranges on file](#list-all-ranges-on-file) +- [Delete a Share](#delete-a-share) +- [Delete a Directory](#delete-a-directory) +- [Delete a Subdirectory](#delete-a-subdirectory) +- [Delete a File](#delete-a-file) +- [Copy a File](#copy-a-file) - [Abort copy a File](#Abort-copy-a-file) -- [Upload data to Storage File](#Upload-data-to-storage) -- [Upload file to Storage File](#Upload-file-to-storage) -- [Download data from Storage File](#Download-data-from-storage) -- [Download file from Storage File](#Download-file-from-storage) -- [Get a File Service property](#Get-a-file-service-property) -- [Set a File Service property](#set-a-file-service-property) +- [Upload data to Storage File](#upload-data-to-storage) +- [Upload file to Storage File](#upload-file-to-storage) +- [Download data from file range](#download-data-from-file-range) +- [Download file from Storage File](#download-file-from-storage) +- [Get a file service properties](#get-a-file-service-properties) +- [Set a file service properties](#set-a-file-service-properties) - [Set a Share metadata](#Set-a-share-metadata) - [Get a Share access policy](#Get-a-share-access-policy) - [Set a Share access policy](#Set-a-share-access-policy) @@ -209,7 +209,7 @@ The following sections provide several code snippets covering some of the most c ### Create a share Create a share in the Storage Account. Throws StorageErrorException If the share fails to be created. -Taking a FileServiceClient in KeyConcept, [`${fileServiceClient}`](#File-services) . +Taking a FileServiceClient in KeyConcept, [`${fileServiceClient}`](#File-services). ```Java String shareName = "testshare"; @@ -217,7 +217,7 @@ fileServiceClient.createShare(shareName); ``` ### Create a snapshot on Share -Taking a FileServiceClient in KeyConcept, [`${fileServiceClient}`](#File-services) . +Taking a FileServiceClient in KeyConcept, [`${fileServiceClient}`](#File-services). ```Java String shareName = "testshare"; @@ -226,7 +226,7 @@ shareClient.createSnapshot(); ``` ### Create a directory -Taking the [`${shareClient}](#Create-snapshot-on-share) initialized above, [`${shareClient}`](#Share) . +Taking the [`${shareClient}](#create-a-snapshot-on-share) initialized above, [`${shareClient}`](#share). ```Java String dirName = "testdir"; @@ -234,7 +234,7 @@ shareClient.createDirectory(dirName); ``` ### Create a subdirectory -Taking the directoryClient in KeyConcept, [`${directoryClient}`](#Directory) . +Taking the directoryClient in KeyConcept, [`${directoryClient}`](#Directory). ```Java String subDirName = "testsubdir"; @@ -256,7 +256,7 @@ Taking the fileServiceClient in KeyConcept, [`${fileServiceClient}`](#File-servi fileServiceClient.listShares(); ``` -### Create all subdirectories and files +### List all subdirectories and files Taking the directoryClient in KeyConcept, [`${directoryClient}`](#Directory) ```Java @@ -383,7 +383,7 @@ shareClient.getAccessPolicy(); ### Set a share access policy Taking the shareClient in KeyConcept, [`${shareClient}`](#Share) . -```Java +```java AccessPolicy accessPolicy = new AccessPolicy().permission("r") .start(OffsetDateTime.now(ZoneOffset.UTC)) .expiry(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10)); @@ -432,13 +432,11 @@ When you interact with file using this Java client library, errors returned by t ## Next steps ### More Samples -- [FileServiceSample](src/samples/java/file/FileServiceSample.java) -- [ShareSample](src/samples/java/file/ShareSample.java) -- [DirectorySample](src/samples/java/file/DirectorySample.java) -- [FileSample](src/samples/java/file/FileSample.java) -- [AsyncSample](src/samples/java/file/AsyncSample.java) - -[Quickstart: Create a Java Spring app with App Configuration](https://docs.microsoft.com/en-us/azure/azure-app-configuration/quickstart-java-spring-app) +- [FileServiceSample][samples_file_service] +- [ShareSample][samples_share] +- [DirectorySample][samples_directory] +- [FileSample][samples_file] +- [AsyncSample][samples_async] ## Contributing This project welcomes contributions and suggestions. Most contributions require you to agree to a @@ -462,17 +460,22 @@ If you would like to become an active contributor to this project please follow 5. Create new Pull Request -[source_code]: to-be-continue -[package]: to-be-continue -[api_documentation]: https://docs.microsoft.com/en-us/rest/api/storageservices/file-service-rest-api -[storage_docs]: https://docs.microsoft.com/en-us/azure/storage/files/storage-files-introduction -[jdk]: https://docs.microsoft.com/en-us/java/azure/java-supported-jdk-runtime?view=azure-java-stable +[source_code]: src/ +[api_documentation]: https://docs.microsoft.com/rest/api/storageservices/file-service-rest-api +[storage_docs]: https://docs.microsoft.com/azure/storage/files/storage-files-introduction +[jdk]: https://docs.microsoft.com/java/azure/java-supported-jdk-runtime?view=azure-java-stable [maven]: https://maven.apache.org/ -[azure_subscription]: https://azure.microsoft.com/en-us/free/ -[storage_account]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal +[azure_subscription]: https://azure.microsoft.com/free/ +[storage_account]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal [azure_cli]: https://docs.microsoft.com/cli/azure -[sas_token]: https://docs.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1 +[sas_token]: https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1 [RFC_URL_1]: https://www.ietf.org/rfc/rfc2616.txt [RFL_URL_2]: https://www.ietf.org/rfc/rfc3987.txt -[C_identifiers]: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/ -[storage_file_rest]: https://docs.microsoft.com/en-us/rest/api/storageservices/file-service-error-codes +[csharp_identifiers]: https://docs.microsoft.com/dotnet/csharp/language-reference/ +[storage_file_rest]: https://docs.microsoft.com/rest/api/storageservices/file-service-error-codes +[samples]: src/samples +[samples_file_service]: src/samples/java/com/azure/storage/file/FileServiceSample.java +[samples_share]: src/samples/java/com/azure/storage/file/ShareSample.java +[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 diff --git a/storage/client/file/pom.xml b/sdk/storage/azure-storage-file/pom.xml similarity index 93% rename from storage/client/file/pom.xml rename to sdk/storage/azure-storage-file/pom.xml index 5355d4211040..e913291d39fc 100644 --- a/storage/client/file/pom.xml +++ b/sdk/storage/azure-storage-file/pom.xml @@ -5,7 +5,7 @@ com.azure azure-client-sdk-parent - 1.1.0 + 1.2.0 ../../../pom.client.xml @@ -13,7 +13,7 @@ com.azure azure-storage-file - 12.0.0-preview.1 + 12.0.0-preview.2 azure-storage-file https://github.com/Azure/azure-sdk-for-java @@ -35,7 +35,7 @@ com.azure azure-core - 1.0.0-preview.2 + 1.0.0-preview.3 -[source_code]: to-be-continue -[package]: to-be-continue -[api_documentation]: https://docs.microsoft.com/en-us/rest/api/storageservices/queue-service-rest-api -[storage_docs]: https://docs.microsoft.com/en-us/azure/storage/queues/storage-queues-introduction -[jdk]: https://docs.microsoft.com/en-us/java/azure/java-supported-jdk-runtime?view=azure-java-stable +[source_code]: src +[api_documentation]: https://docs.microsoft.com/rest/api/storageservices/queue-service-rest-api +[storage_docs]: https://docs.microsoft.com/azure/storage/queues/storage-queues-introduction +[jdk]: https://docs.microsoft.com/java/azure/java-supported-jdk-runtime?view=azure-java-stable [maven]: https://maven.apache.org/ -[azure_subscription]: https://azure.microsoft.com/en-us/free/ -[storage_account]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal +[azure_subscription]: https://azure.microsoft.com/free/ +[storage_account]: https://docs.microsoft.com/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal [azure_cli]: https://docs.microsoft.com/cli/azure -[sas_token]: https://docs.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1 -[storage_rest]: https://docs.microsoft.com/en-us/rest/api/storageservices/queue-service-error-codes -[samples]: samples/ +[sas_token]: https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1 +[storage_rest]: https://docs.microsoft.com/rest/api/storageservices/queue-service-error-codes +[samples]: src/samples +[samples_queue_service]: src/samples/java/com/azure/storage/queue/QueueServiceSamples.java +[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 diff --git a/storage/client/queue/pom.xml b/sdk/storage/azure-storage-queue/pom.xml similarity index 93% rename from storage/client/queue/pom.xml rename to sdk/storage/azure-storage-queue/pom.xml index c018da31ab26..c2b22cc0e430 100644 --- a/storage/client/queue/pom.xml +++ b/sdk/storage/azure-storage-queue/pom.xml @@ -5,7 +5,7 @@ com.azure azure-client-sdk-parent - 1.1.0 + 1.2.0 ../../../pom.client.xml @@ -13,7 +13,7 @@ com.azure azure-storage-queue - 12.0.0-preview.1 + 12.0.0-preview.2 azure-storage-queue https://github.com/Azure/azure-sdk-for-java @@ -35,7 +35,7 @@ com.azure azure-core - 1.0.0-preview.2 + 1.0.0-preview.3 org.slf4j @@ -45,7 +45,7 @@ com.azure azure-core-test - 1.0.0-preview.2 + 1.0.0-preview.3 test diff --git a/storage/client/queue/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java similarity index 97% rename from storage/client/queue/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java index db8045e723a1..a9892459cda6 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java @@ -116,10 +116,10 @@ public String computeHmac256(final String stringToSign) { byte[] utf8Bytes = stringToSign.getBytes(StandardCharsets.UTF_8); return Base64.getEncoder().encodeToString(hmacSha256.doFinal(utf8Bytes)); } catch (final NoSuchAlgorithmException e) { - LOGGER.asError().log(e.getMessage()); + LOGGER.error(e.getMessage()); throw new RuntimeException(e); } catch (InvalidKeyException e) { - LOGGER.asError().log("Please double check the account key. Error details: " + e.getMessage()); + LOGGER.error("Please double check the account key. Error details: " + e.getMessage()); throw new RuntimeException("Please double check the account key. Error details: " + e.getMessage()); } } @@ -232,7 +232,7 @@ private String computeHMACSHA256(String stringToSign) { String signature = Base64.getEncoder().encodeToString(hmacSha256.doFinal(utf8Bytes)); return String.format(AUTHORIZATION_HEADER_FORMAT, accountName, signature); } catch (NoSuchAlgorithmException | InvalidKeyException ex) { - LOGGER.asError().log(ex.getMessage()); + LOGGER.error(ex.getMessage()); throw new Error(ex); } } diff --git a/storage/client/queue/src/main/java/com/azure/storage/common/credentials/package-info.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/credentials/package-info.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/common/credentials/package-info.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/credentials/package-info.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/policy/RequestRetryOptions.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/policy/RequestRetryPolicy.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/common/policy/RetryPolicyType.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/policy/RetryPolicyType.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/common/policy/RetryPolicyType.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/policy/RetryPolicyType.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/common/policy/package-info.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/policy/package-info.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/common/policy/package-info.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/common/policy/package-info.java diff --git a/storage/client/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 similarity index 88% rename from storage/client/queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueAsyncClient.java index 8df2931f44d2..659d128dc243 100644 --- a/storage/client/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 @@ -55,7 +55,7 @@ public final class QueueAsyncClient { private final String queueName; /** - * Creates a QueueAsyncClient that sends requests to the storage queue service at {@code AzureQueueStorageImpl#url() endpoint}. + * Creates a QueueAsyncClient that sends requests to the storage queue service at {@code AzureQueueStorageImpl#getUrl() endpoint}. * Each service call goes through the {@link HttpPipeline pipeline} in the {@code AzureQueueStorageImpl client}. * * @param client Client that interacts with the service interfaces @@ -64,9 +64,9 @@ public final class QueueAsyncClient { QueueAsyncClient(AzureQueueStorageImpl client, String queueName) { this.queueName = queueName; - this.client = new AzureQueueStorageBuilder().pipeline(client.httpPipeline()) - .url(client.url()) - .version(client.version()) + this.client = new AzureQueueStorageBuilder().pipeline(client.getHttpPipeline()) + .url(client.getUrl()) + .version(client.getVersion()) .build(); } @@ -92,9 +92,9 @@ public final class QueueAsyncClient { */ public URL getQueueUrl() { try { - return new URL(client.url()); + return new URL(client.getUrl()); } catch (MalformedURLException ex) { - LOGGER.asError().log("Queue URL is malformed"); + LOGGER.error("Queue URL is malformed"); throw new RuntimeException("Queue URL is malformed"); } } @@ -108,6 +108,9 @@ public URL getQueueUrl() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.create} * + *

    For more information, see the + * Azure Docs.

    + * * @return A response that only contains headers and response status code * @throws StorageErrorException If a queue with the same name already exists in the queue service. */ @@ -124,6 +127,9 @@ public Mono create() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.create#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. @@ -142,6 +148,9 @@ public Mono create(Map metadata) { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.delete} * + *

    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 */ @@ -159,6 +168,9 @@ public Mono delete() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.getProperties} * + *

    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 StorageErrorException If the queue doesn't exist @@ -183,6 +195,9 @@ public Mono> getProperties() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.clearMetadata#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 StorageErrorException If the queue doesn't exist @@ -201,6 +216,9 @@ public Mono setMetadata(Map metadata) { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.getAccessPolicy} * + *

    For more information, see the + * Azure Docs.

    + * * @return The stored access policies specified on the queue. * @throws StorageErrorException If the queue doesn't exist */ @@ -218,6 +236,9 @@ public Flux getAccessPolicy() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.setAccessPolicy} * + *

    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, @@ -237,6 +258,9 @@ public Mono setAccessPolicy(List permissions) { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.clearMessages} * + *

    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 */ @@ -254,6 +278,9 @@ public Mono clearMessages() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.enqueueMessage#string} * + *

    For more information, see the + * Azure Docs.

    + * * @param messageText Message text * @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#messageId() messageId} and * {@link EnqueuedMessage#popReceipt() popReceipt} that are used to interact with the message and other metadata @@ -277,6 +304,9 @@ public Mono> enqueueMessage(String messageText) { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.enqueueMessageLiveTime#string-duration-duration} * + *

    For more information, see the + * Azure Docs.

    + * * @param messageText Message text * @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue in seconds. * If unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0 @@ -307,6 +337,9 @@ public Mono> enqueueMessage(String messageText, Durati * * {@codesnippet com.azure.storage.queue.queueAsyncClient.dequeueMessages} * + *

    For more information, see the + * Azure Docs.

    + * * @return The first {@link DequeuedMessage} in the queue, it contains * {@link DequeuedMessage#messageId() messageId} and {@link DequeuedMessage#popReceipt() popReceipt} used to interact * with the message, additionally it contains other metadata about the message. @@ -325,6 +358,9 @@ public Flux dequeueMessages() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer} * + *

    For more information, see the + * Azure Docs.

    + * * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested * all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 * messages. @@ -347,6 +383,9 @@ public Flux dequeueMessages(Integer maxMessages) { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.dequeueMessages#integer-duration} * + *

    For more information, see the + * Azure Docs.

    + * * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested * all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 * messages. @@ -376,6 +415,9 @@ public Flux dequeueMessages(Integer maxMessages, Duration visib * * {@codesnippet com.azure.storage.queue.queueAsyncClient.peekMessages} * + *

    For more information, see the + * Azure Docs.

    + * * @return A {@link PeekedMessage} that contains metadata about the message. */ public Flux peekMessages() { @@ -394,6 +436,9 @@ public Flux peekMessages() { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.peekMessages#integer} * + *

    For more information, see the + * Azure Docs.

    + * * @param maxMessages Optional. Maximum number of messages to peek, if there are less messages exist in the queue than requested * all the messages will be peeked. If left empty only 1 message will be peeked, the allowed range is 1 to 32 * messages. @@ -415,6 +460,9 @@ public Flux peekMessages(Integer maxMessages) { * * {@codesnippet com.azure.storage.queue.queueAsyncClient.updateMessage} * + *

    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 @@ -440,6 +488,9 @@ public Mono> updateMessage(String messageText, String m * * {@codesnippet com.azure.storage.queue.queueAsyncClient.deleteMessage} * + *

    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 A response that only contains headers and response status code diff --git a/storage/client/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 similarity index 86% rename from storage/client/queue/src/main/java/com/azure/storage/queue/QueueClient.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClient.java index 763c58560871..3e55da311b15 100644 --- a/storage/client/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 @@ -63,6 +63,9 @@ public URL getQueueUrl() { * *{@codesnippet com.azure.storage.queue.queueClient.create} * + *

    For more information, see the + * Azure Docs.

    + * * @return A response that only contains headers and response status code * @throws StorageErrorException If a queue with the same name already exists in the queue service. */ @@ -79,6 +82,9 @@ public VoidResponse create() { * * {@codesnippet com.azure.storage.queue.queueClient.create#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. @@ -96,6 +102,9 @@ public VoidResponse create(Map metadata) { * * {@codesnippet com.azure.storage.queue.queueClient.delete} * + *

    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 */ @@ -112,6 +121,9 @@ public VoidResponse delete() { * * {@codesnippet com.azure.storage.queue.queueClient.getProperties} * + *

    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 StorageErrorException If the queue doesn't exist @@ -135,6 +147,9 @@ public Response getProperties() { * * {@codesnippet com.azure.storage.queue.queueClient.clearMetadata#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 StorageErrorException If the queue doesn't exist @@ -152,6 +167,9 @@ public VoidResponse setMetadata(Map metadata) { * * {@codesnippet com.azure.storage.queue.queueClient.getAccessPolicy} * + *

    For more information, see the + * Azure Docs.

    + * * @return The stored access policies specified on the queue. * @throws StorageErrorException If the queue doesn't exist */ @@ -168,6 +186,9 @@ public Iterable getAccessPolicy() { * * {@codesnippet com.azure.storage.queue.queueClient.setAccessPolicy} * + *

    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, @@ -186,6 +207,9 @@ public VoidResponse setAccessPolicy(List permissions) { * * {@codesnippet com.azure.storage.queue.queueClient.clearMessages} * + *

    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 */ @@ -202,6 +226,9 @@ public VoidResponse clearMessages() { * * {@codesnippet com.azure.storage.queue.queueClient.enqueueMessage#string} * + *

    For more information, see the + * Azure Docs.

    + * * @param messageText Message text * @return A {@link EnqueuedMessage} value that contains the {@link EnqueuedMessage#messageId() messageId} and * {@link EnqueuedMessage#popReceipt() popReceipt} that are used to interact with the message and other metadata @@ -225,6 +252,9 @@ public Response enqueueMessage(String messageText) { * * {@codesnippet com.azure.storage.queue.queueClient.enqueueMessageLiveTime#string-duration-duration} * + *

    For more information, see the + * Azure Docs.

    + * * @param messageText Message text * @param visibilityTimeout Optional. The timeout period for how long the message is invisible in the queue in seconds. * If unset the value will default to 0 and the message will be instantly visible. The timeout must be between 0 @@ -250,6 +280,9 @@ public Response enqueueMessage(String messageText, Duration vis * * {@codesnippet com.azure.storage.queue.queueClient.dequeueMessages} * + *

    For more information, see the + * Azure Docs.

    + * * @return The first {@link DequeuedMessage} in the queue, it contains * {@link DequeuedMessage#messageId() messageId} and {@link DequeuedMessage#popReceipt() popReceipt} used to interact * with the message, additionally it contains other metadata about the message. @@ -268,6 +301,9 @@ public Iterable dequeueMessages() { * * {@codesnippet com.azure.storage.queue.queueClient.dequeueMessages#integer} * + *

    For more information, see the + * Azure Docs.

    + * * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested * all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 * messages. @@ -290,6 +326,9 @@ public Iterable dequeueMessages(Integer maxMessages) { * * {@codesnippet com.azure.storage.queue.queueClient.dequeueMessages#integer-duration} * + *

    For more information, see the + * Azure Docs.

    + * * @param maxMessages Optional. Maximum number of messages to get, if there are less messages exist in the queue than requested * all the messages will be returned. If left empty only 1 message will be retrieved, the allowed range is 1 to 32 * messages. @@ -317,6 +356,9 @@ public Iterable dequeueMessages(Integer maxMessages, Duration v * * {@codesnippet com.azure.storage.queue.queueClient.peekMessages} * + *

    For more information, see the + * Azure Docs.

    + * * @return A {@link PeekedMessage} that contains metadata about the message. */ public Iterable peekMessages() { @@ -335,6 +377,9 @@ public Iterable peekMessages() { * * {@codesnippet com.azure.storage.queue.queueClient.peekMessages#integer} * + *

    For more information, see the + * Azure Docs.

    + * * @param maxMessages Optional. Maximum number of messages to peek, if there are less messages exist in the queue than requested * all the messages will be peeked. If left empty only 1 message will be peeked, the allowed range is 1 to 32 * messages. @@ -355,6 +400,9 @@ public Iterable peekMessages(Integer maxMessages) { * * {@codesnippet com.azure.storage.queue.queueClient.updateMessage} * + *

    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 @@ -378,6 +426,9 @@ public Response updateMessage(String messageText, String message * * {@codesnippet com.azure.storage.queue.queueClient.deleteMessage} * + *

    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 A response that only contains headers and response status code diff --git a/storage/client/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 similarity index 97% rename from storage/client/queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueClientBuilder.java index d272cfc1bbf8..8105465505d6 100644 --- a/storage/client/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 @@ -4,6 +4,7 @@ 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; @@ -20,6 +21,7 @@ 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; @@ -45,7 +47,8 @@ * {@codesnippet com.azure.storage.queue.queueAsyncClient.instantiation.sastoken} * *

    If the {@code endpoint} doesn't contain the queue name or {@code SASTokenCredential} they may be set using - * {@link QueueClientBuilder#queueName(String) queueName} and {@link QueueClientBuilder#credential(SASTokenCredential) credential}.

    + * {@link QueueClientBuilder#queueName(String) queueName} and {@link QueueClientBuilder#credential(SASTokenCredential) credential} + * together with endpoint..

    * *

    Instantiating a synchronous Queue Client with credential

    * {@codesnippet com.azure.storage.queue.queueClient.instantiation.credential} @@ -135,7 +138,7 @@ public QueueAsyncClient buildAsyncClient() { Objects.requireNonNull(queueName); if (sasTokenCredential == null && sharedKeyCredential == null) { - LOGGER.asError().log("Credentials are required for authorization"); + LOGGER.error("Credentials are required for authorization"); throw new IllegalArgumentException("Credentials are required for authorization"); } @@ -163,7 +166,7 @@ public QueueAsyncClient buildAsyncClient() { HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(logLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); @@ -202,7 +205,7 @@ public QueueClientBuilder endpoint(String endpoint) { this.sasTokenCredential = credential; } } catch (MalformedURLException ex) { - LOGGER.asError().log("The Azure Storage Queue endpoint url is malformed. Endpoint: " + endpoint); + LOGGER.error("The Azure Storage Queue endpoint url is malformed. Endpoint: " + endpoint); throw new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed. Endpoint: " + endpoint); } @@ -270,12 +273,13 @@ private void getEndPointFromConnectionString(String connectionString) { try { this.endpoint = new URL(String.format("https://%s.queue.core.windows.net", accountName)); } catch (MalformedURLException e) { - LOGGER.asError().log("There is no valid account for the connection string. " + LOGGER.error("There is no valid account for the connection string. " + "Connection String: %s", connectionString); throw 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. * diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueConfiguration.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueConfiguration.java similarity index 87% rename from storage/client/queue/src/main/java/com/azure/storage/queue/QueueConfiguration.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueConfiguration.java index 7a794525484f..77eecad75022 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/QueueConfiguration.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueConfiguration.java @@ -8,5 +8,5 @@ class QueueConfiguration { //TODO: Eventually remove these hardcoded strings with https://github.com/Azure/azure-sdk-for-java/issues/3141 static final String NAME = "azure-storage-queue"; - static final String VERSION = "12.0.0-preview.1"; + static final String VERSION = "12.0.0-preview.2"; } diff --git a/storage/client/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 similarity index 92% rename from storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceAsyncClient.java index e093f1d34b17..5c5a78f2dc0c 100644 --- a/storage/client/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 @@ -21,13 +21,14 @@ import com.azure.storage.queue.models.StorageErrorException; 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.util.ArrayList; import java.util.List; import java.util.Map; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; /** * This class provides a client that contains all the operations for interacting with a queue account in Azure Storage. @@ -68,9 +69,9 @@ public final class QueueServiceAsyncClient { */ public URL getQueueServiceUrl() { try { - return new URL(client.url()); + return new URL(client.getUrl()); } catch (MalformedURLException ex) { - LOGGER.asError().log("Queue Service URL is malformed"); + LOGGER.error("Queue Service URL is malformed"); throw new RuntimeException("Storage account URL is malformed"); } } @@ -153,6 +154,9 @@ public Mono deleteQueue(String queueName) { * * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.listQueues} * + *

    For more information, see the + * Azure Docs.

    + * * @return {@link QueueItem Queues} in the storage account */ public Flux listQueues() { @@ -171,6 +175,9 @@ public Flux listQueues() { * * {@codesnippet com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions} * + *

    For more information, see the + * Azure Docs.

    + * * @param options Options for listing queues * @return {@link QueueItem Queues} in the storage account that satisfy the filter requirements */ @@ -213,7 +220,7 @@ Flux listQueues(String marker, QueuesSegmentOptions options) { private Flux listQueues(ServicesListQueuesSegmentResponse response, List include, Context context) { ListQueuesSegmentResponse value = response.value(); Mono result = client.services() - .listQueuesSegmentWithRestResponseAsync(value.prefix(), value.marker(), value.maxResults(), include, null, null, context); + .listQueuesSegmentWithRestResponseAsync(value.prefix(), value.nextMarker(), value.maxResults(), include, null, null, context); return result.flatMapMany(r -> extractAndFetchQueues(r, include, context)); } @@ -240,6 +247,9 @@ private Flux extractAndFetchQueues(ServicesListQueuesSegmentResponse * * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.getProperties} * + *

    For more information, see the + * Azure Docs.

    + * * @return Storage account Queue service properties */ public Mono> getProperties() { @@ -264,6 +274,9 @@ public Mono> getProperties() { * * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.setPropertiesEnableMetrics#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 @@ -292,6 +305,9 @@ public Mono setProperties(StorageServiceProperties properties) { * * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.getStatistics} * + *

    For more information, see the + * Azure Docs.

    + * * @return The geo replication information about the Queue service */ public Mono> getStatistics() { diff --git a/storage/client/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 similarity index 91% rename from storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClient.java index a002e5b12f87..78ef5b204281 100644 --- a/storage/client/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 @@ -127,6 +127,9 @@ public VoidResponse deleteQueue(String queueName) { * * {@codesnippet com.azure.storage.queue.queueServiceClient.listQueues} * + *

    For more information, see the + * Azure Docs.

    + * * @return {@link QueueItem Queues} in the storage account */ public Iterable listQueues() { @@ -145,6 +148,9 @@ public Iterable listQueues() { * * {@codesnippet com.azure.storage.queue.queueServiceClient.listQueues#queueSergmentOptions} * + *

    For more information, see the + * Azure Docs.

    + * * @param options Options for listing queues * @return {@link QueueItem Queues} in the storage account that satisfy the filter requirements */ @@ -176,6 +182,9 @@ Iterable listQueues(String marker, QueuesSegmentOptions options) { * * {@codesnippet com.azure.storage.queue.queueServiceClient.getProperties} * + *

    For more information, see the + * Azure Docs.

    + * * @return Storage account Queue service properties */ public Response getProperties() { @@ -199,6 +208,9 @@ public Response getProperties() { * * {@codesnippet com.azure.storage.queue.queueServiceClient.setPropertiesEnableMetrics#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 @@ -226,6 +238,9 @@ public VoidResponse setProperties(StorageServiceProperties properties) { * * {@codesnippet com.azure.storage.queue.queueServiceClient.getStatistics} * + *

    For more information, see the + * Azure Docs.

    + * * @return The geo replication information about the Queue service */ public Response getStatistics() { diff --git a/storage/client/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 similarity index 90% rename from storage/client/queue/src/main/java/com/azure/storage/queue/QueueServiceClientBuilder.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/QueueServiceClientBuilder.java index 63b191256f5d..b7254eccc549 100644 --- a/storage/client/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 @@ -4,6 +4,7 @@ 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; @@ -22,7 +23,9 @@ 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.Objects; /** @@ -41,8 +44,8 @@ *

    Instantiating an Asynchronous Queue Service Client with SAS token

    * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.instantiation.sastoken} * - *

    If the {@code endpoint} doesn't contain {@code SASTokenCredential} they may be set using - * {@link QueueClientBuilder#credential(SASTokenCredential) credential}.

    + *

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

    * *

    Instantiating a synchronous Queue Service Client with SAS token

    * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.instantiation.credential} @@ -50,9 +53,6 @@ *

    Instantiating an Asynchronous Queue Service Client with SAS token

    * {@codesnippet com.azure.storage.queue.queueServiceAsyncClient.instantiation.credential} * - *

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

    - * *

    Another way to authenticate the client is using a {@link SharedKeyCredential}. To create a SharedKeyCredential * a connection string from the Storage Queue service must be used. Set the SharedKeyCredential with * {@link QueueServiceClientBuilder#connectionString(String) connectionString}. If the builder has both a SASTokenCredential and @@ -71,6 +71,7 @@ */ 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; @@ -111,7 +112,7 @@ public QueueServiceAsyncClient buildAsyncClient() { Objects.requireNonNull(endpoint); if (sasTokenCredential == null && sharedKeyCredential == null) { - LOGGER.asError().log("Credentials are required for authorization"); + LOGGER.error("Credentials are required for authorization"); throw new IllegalArgumentException("Credentials are required for authorization"); } @@ -139,7 +140,7 @@ public QueueServiceAsyncClient buildAsyncClient() { HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(logLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); @@ -188,7 +189,7 @@ public QueueServiceClientBuilder endpoint(String endpoint) { this.sasTokenCredential = credential; } } catch (MalformedURLException ex) { - LOGGER.asError().log("The Azure Storage Queue endpoint url is malformed."); + LOGGER.error("The Azure Storage Queue endpoint url is malformed."); throw new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed."); } @@ -229,11 +230,28 @@ public QueueServiceClientBuilder credential(SharedKeyCredential credential) { * @throws NullPointerException If {@code connectionString} is {@code null}. */ public QueueServiceClientBuilder 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.error("There is no valid account for the connection string. " + + "Connection String: %s", connectionString); + throw 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. * diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/README.md b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/README.md similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/README.md rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/README.md diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageBuilder.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageBuilder.java similarity index 84% rename from storage/client/queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageBuilder.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageBuilder.java index f3582e10e1a4..bf79a8453997 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageBuilder.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageBuilder.java @@ -6,10 +6,12 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; /** - * A appendBlobClientBuilder for creating a new instance of the AzureQueueStorage type. + * A builder for creating a new instance of the AzureQueueStorage type. */ +@ServiceClientBuilder(serviceClients = AzureQueueStorageImpl.class) public final class AzureQueueStorageBuilder { /* * The URL of the service account, queue or message that is the targe of the desired operation. @@ -65,17 +67,18 @@ public AzureQueueStorageBuilder pipeline(HttpPipeline pipeline) { * @return an instance of AzureQueueStorageImpl. */ public AzureQueueStorageImpl build() { - if (version == null) { - this.version = "2018-03-28"; - } if (pipeline == null) { this.pipeline = RestProxy.createDefaultPipeline(); } AzureQueueStorageImpl client = new AzureQueueStorageImpl(pipeline); if (this.url != null) { - client.url(this.url); + client.setUrl(this.url); + } + if (this.version != null) { + client.setVersion(this.version); + } else { + client.setVersion("2018-03-28"); } - client.version(this.version); return client; } } diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java similarity index 86% rename from storage/client/queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java index 1573b9c7e05b..1ee2de77a19a 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java @@ -4,14 +4,13 @@ package com.azure.storage.queue.implementation; -import com.azure.core.ServiceClient; import com.azure.core.http.HttpPipeline; import com.azure.core.implementation.RestProxy; /** * Initializes a new instance of the AzureQueueStorage type. */ -public final class AzureQueueStorageImpl extends ServiceClient { +public final class AzureQueueStorageImpl { /** * The URL of the service account, queue or message that is the targe of the desired operation. */ @@ -22,7 +21,7 @@ public final class AzureQueueStorageImpl extends ServiceClient { * * @return the url value. */ - public String url() { + public String getUrl() { return this.url; } @@ -30,11 +29,9 @@ public String url() { * Sets The URL of the service account, queue or message that is the targe of the desired operation. * * @param url the url value. - * @return the service client itself. */ - AzureQueueStorageImpl url(String url) { + void setUrl(String url) { this.url = url; - return this; } /** @@ -47,7 +44,7 @@ AzureQueueStorageImpl url(String url) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -55,11 +52,23 @@ public String version() { * Sets Specifies the version of the operation to use for this request. * * @param version the version value. - * @return the service client itself. */ - AzureQueueStorageImpl version(String version) { + void setVersion(String version) { this.version = version; - return this; + } + + /** + * The HTTP pipeline to send requests through. + */ + private HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; } /** @@ -131,7 +140,7 @@ public AzureQueueStorageImpl() { * @param httpPipeline The HTTP pipeline to send requests through. */ public AzureQueueStorageImpl(HttpPipeline httpPipeline) { - super(httpPipeline); + this.httpPipeline = httpPipeline; this.services = new ServicesImpl(this); this.queues = new QueuesImpl(this); this.messages = new MessagesImpl(this); diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/ListQueuesIncludeTypeWrapper.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/ListQueuesIncludeTypeWrapper.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/implementation/ListQueuesIncludeTypeWrapper.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/ListQueuesIncludeTypeWrapper.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java similarity index 70% rename from storage/client/queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java index f5e6c952f5de..f3ae3de6b70a 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java @@ -4,18 +4,20 @@ package com.azure.storage.queue.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.DELETE; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PathParam; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; import com.azure.core.implementation.RestProxy; +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.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +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.queue.models.MessageIdsDeleteResponse; import com.azure.storage.queue.models.MessageIdsUpdateResponse; @@ -44,31 +46,33 @@ public final class MessageIdsImpl { * @param client the instance of the service client containing this operation class. */ public MessageIdsImpl(AzureQueueStorageImpl client) { - this.service = RestProxy.create(MessageIdsService.class, client); + this.service = RestProxy.create(MessageIdsService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for MessageIds to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureQueueStorageMessageIds + * to be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Queues MessageId") + @ServiceInterface(name = "AzureQueueStorageMessageIds") private interface MessageIdsService { - @PUT("{queueName}/messages/{messageid}") + @Put("{queueName}/messages/{messageid}") @ExpectedResponses({204}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono update(@HostParam("url") String url, @PathParam("queueName") String queueName, @PathParam("messageid") String messageId, @BodyParam("application/xml; charset=utf-8") QueueMessage queueMessage, @QueryParam("popreceipt") String popReceipt, @QueryParam("visibilitytimeout") int visibilitytimeout, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); + Mono update(@PathParam("queueName") String queueName, @PathParam("messageid") String messageid, @HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") QueueMessage queueMessage, @QueryParam("popreceipt") String popReceipt, @QueryParam("visibilitytimeout") int visibilitytimeout, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); - @DELETE("{queueName}/messages/{messageid}") + @Delete("{queueName}/messages/{messageid}") @ExpectedResponses({204}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono delete(@HostParam("url") String url, @PathParam("queueName") String queueName, @PathParam("messageid") String messageId, @QueryParam("popreceipt") String popReceipt, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); + Mono delete(@PathParam("queueName") String queueName, @PathParam("messageid") String messageid, @HostParam("url") String url, @QueryParam("popreceipt") String popReceipt, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); } /** * 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. * + * @param queueName The queue name. + * @param messageid The message ID name. * @param queueMessage A Message object which can be stored in a Queue. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation. * @param visibilitytimeout 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. @@ -76,15 +80,18 @@ private interface MessageIdsService { * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono updateWithRestResponseAsync(String queueName, String messageId, QueueMessage queueMessage, String popReceipt, int visibilitytimeout, Context context) { + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateWithRestResponseAsync(String queueName, String messageid, QueueMessage queueMessage, String popReceipt, int visibilitytimeout, Context context) { final Integer timeout = null; final String requestId = null; - return service.update(this.client.url(), queueName, messageId, queueMessage, popReceipt, visibilitytimeout, timeout, this.client.version(), requestId, context); + return service.update(queueName, messageid, this.client.getUrl(), queueMessage, popReceipt, visibilitytimeout, timeout, this.client.getVersion(), requestId, context); } /** * 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. * + * @param queueName The queue name. + * @param messageid The message ID name. * @param queueMessage A Message object which can be stored in a Queue. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation. * @param visibilitytimeout 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. @@ -94,27 +101,33 @@ public Mono updateWithRestResponseAsync(String queueNa * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono updateWithRestResponseAsync(String queueName, String messageId, QueueMessage queueMessage, String popReceipt, int visibilitytimeout, Integer timeout, String requestId, Context context) { - return service.update(this.client.url(), queueName, messageId, queueMessage, popReceipt, visibilitytimeout, timeout, this.client.version(), requestId, context); + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateWithRestResponseAsync(String queueName, String messageid, QueueMessage queueMessage, String popReceipt, int visibilitytimeout, Integer timeout, String requestId, Context context) { + return service.update(queueName, messageid, this.client.getUrl(), queueMessage, popReceipt, visibilitytimeout, timeout, this.client.getVersion(), requestId, context); } /** * The Delete operation deletes the specified message. * + * @param queueName The queue name. + * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message 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. */ - public Mono deleteWithRestResponseAsync(String queueName, String messageId, String popReceipt, Context context) { + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteWithRestResponseAsync(String queueName, String messageid, String popReceipt, Context context) { final Integer timeout = null; final String requestId = null; - return service.delete(this.client.url(), queueName, messageId, popReceipt, timeout, this.client.version(), requestId, context); + return service.delete(queueName, messageid, this.client.getUrl(), popReceipt, timeout, this.client.getVersion(), requestId, context); } /** * The Delete operation deletes the specified message. * + * @param queueName The queue name. + * @param messageid The message ID name. * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation. * @param timeout The 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-queue-service-operations>Setting Timeouts for Queue 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. @@ -122,7 +135,8 @@ public Mono deleteWithRestResponseAsync(String queueNa * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono deleteWithRestResponseAsync(String queueName, String messageId, String popReceipt, Integer timeout, String requestId, Context context) { - return service.delete(this.client.url(), queueName, messageId, popReceipt, timeout, this.client.version(), requestId, context); + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteWithRestResponseAsync(String queueName, String messageid, String popReceipt, Integer timeout, String requestId, Context context) { + return service.delete(queueName, messageid, this.client.getUrl(), popReceipt, timeout, this.client.getVersion(), requestId, context); } } diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java similarity index 76% rename from storage/client/queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java index 84f680cad1db..a076018746b2 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java @@ -4,19 +4,21 @@ package com.azure.storage.queue.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.DELETE; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.GET; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PathParam; -import com.azure.core.annotations.POST; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.BodyParam; +import com.azure.core.implementation.annotation.Delete; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.PathParam; +import com.azure.core.implementation.annotation.Post; +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.queue.models.MessagesClearResponse; import com.azure.storage.queue.models.MessagesDequeueResponse; @@ -47,56 +49,59 @@ public final class MessagesImpl { * @param client the instance of the service client containing this operation class. */ public MessagesImpl(AzureQueueStorageImpl client) { - this.service = RestProxy.create(MessagesService.class, client); + this.service = RestProxy.create(MessagesService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for Messages to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureQueueStorageMessages to + * be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Queues Messages") + @ServiceInterface(name = "AzureQueueStorageMessages") private interface MessagesService { - @GET("{queueName}/messages") + @Get("{queueName}/messages") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono dequeue(@HostParam("url") String url, @PathParam("queueName") String queueName, @QueryParam("numofmessages") Integer numberOfMessages, @QueryParam("visibilitytimeout") Integer visibilitytimeout, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); + Mono dequeue(@PathParam("queueName") String queueName, @HostParam("url") String url, @QueryParam("numofmessages") Integer numberOfMessages, @QueryParam("visibilitytimeout") Integer visibilitytimeout, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); - @DELETE("{queueName}/messages") + @Delete("{queueName}/messages") @ExpectedResponses({204}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono clear(@HostParam("url") String url, @PathParam("queueName") String queueName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); + Mono clear(@PathParam("queueName") String queueName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); - @POST("{queueName}/messages") + @Post("{queueName}/messages") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono enqueue(@HostParam("url") String url, @PathParam("queueName") String queueName, @BodyParam("application/xml; charset=utf-8") QueueMessage queueMessage, @QueryParam("visibilitytimeout") Integer visibilitytimeout, @QueryParam("messagettl") Integer messageTimeToLive, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); + Mono enqueue(@PathParam("queueName") String queueName, @HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") QueueMessage queueMessage, @QueryParam("visibilitytimeout") Integer visibilitytimeout, @QueryParam("messagettl") Integer messageTimeToLive, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); - @GET("{queueName}/messages") + @Get("{queueName}/messages") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono peek(@HostParam("url") String url, @PathParam("queueName") String queueName, @QueryParam("numofmessages") Integer numberOfMessages, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("peekonly") String peekonly, Context context); + Mono peek(@PathParam("queueName") String queueName, @HostParam("url") String url, @QueryParam("numofmessages") Integer numberOfMessages, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("peekonly") String peekonly, Context context); } /** * The Dequeue operation retrieves one or more messages from the front of the queue. * + * @param queueName The queue name. * @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 dequeueWithRestResponseAsync(String queueName, Context context) { final Integer numberOfMessages = null; final Integer visibilitytimeout = null; final Integer timeout = null; final String requestId = null; - return service.dequeue(this.client.url(), queueName, numberOfMessages, visibilitytimeout, timeout, this.client.version(), requestId, context); + return service.dequeue(queueName, this.client.getUrl(), numberOfMessages, visibilitytimeout, timeout, this.client.getVersion(), requestId, context); } /** * The Dequeue operation retrieves one or more messages from the front of the queue. * + * @param queueName The queue name. * @param numberOfMessages 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. * @param visibilitytimeout 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. * @param timeout The 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-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. @@ -105,55 +110,63 @@ public Mono dequeueWithRestResponseAsync(String queueNa * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono dequeueWithRestResponseAsync(String queueName, Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId, Context context) { - return service.dequeue(this.client.url(), queueName, numberOfMessages, visibilitytimeout, timeout, this.client.version(), requestId, context); + return service.dequeue(queueName, this.client.getUrl(), numberOfMessages, visibilitytimeout, timeout, this.client.getVersion(), requestId, context); } /** * The Clear operation deletes all messages from the specified queue. * + * @param queueName The queue name. * @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 clearWithRestResponseAsync(String queueName, Context context) { final Integer timeout = null; final String requestId = null; - return service.clear(this.client.url(), queueName, timeout, this.client.version(), requestId, context); + return service.clear(queueName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, context); } /** * The Clear operation deletes all messages from the specified queue. * + * @param queueName The queue name. * @param timeout The 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-queue-service-operations>Setting Timeouts for Queue 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 clearWithRestResponseAsync(String queueName, Integer timeout, String requestId, Context context) { - return service.clear(this.client.url(), queueName, timeout, this.client.version(), requestId, context); + return service.clear(queueName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, context); } /** * 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. * + * @param queueName The queue name. * @param queueMessage A Message object which can be stored in a Queue. * @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 enqueueWithRestResponseAsync(String queueName, QueueMessage queueMessage, Context context) { final Integer visibilitytimeout = null; final Integer messageTimeToLive = null; final Integer timeout = null; final String requestId = null; - return service.enqueue(this.client.url(), queueName, queueMessage, visibilitytimeout, messageTimeToLive, timeout, this.client.version(), requestId, context); + return service.enqueue(queueName, this.client.getUrl(), queueMessage, visibilitytimeout, messageTimeToLive, timeout, this.client.getVersion(), requestId, context); } /** * 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. * + * @param queueName The queue name. * @param queueMessage A Message object which can be stored in a Queue. * @param visibilitytimeout 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. * @param messageTimeToLive 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. @@ -163,28 +176,32 @@ public Mono enqueueWithRestResponseAsync(String queueNa * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono enqueueWithRestResponseAsync(String queueName, QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, String requestId, Context context) { - return service.enqueue(this.client.url(), queueName, queueMessage, visibilitytimeout, messageTimeToLive, timeout, this.client.version(), requestId, context); + return service.enqueue(queueName, this.client.getUrl(), queueMessage, visibilitytimeout, messageTimeToLive, timeout, this.client.getVersion(), requestId, context); } /** * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility of the message. * + * @param queueName The queue name. * @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 peekWithRestResponseAsync(String queueName, Context context) { final Integer numberOfMessages = null; final Integer timeout = null; final String requestId = null; final String peekonly = "true"; - return service.peek(this.client.url(), queueName, numberOfMessages, timeout, this.client.version(), requestId, peekonly, context); + return service.peek(queueName, this.client.getUrl(), numberOfMessages, timeout, this.client.getVersion(), requestId, peekonly, context); } /** * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility of the message. * + * @param queueName The queue name. * @param numberOfMessages 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. * @param timeout The 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-queue-service-operations>Setting Timeouts for Queue 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. @@ -192,8 +209,9 @@ public Mono peekWithRestResponseAsync(String queueName, Co * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono peekWithRestResponseAsync(String queueName, Integer numberOfMessages, Integer timeout, String requestId, Context context) { final String peekonly = "true"; - return service.peek(this.client.url(), queueName, numberOfMessages, timeout, this.client.version(), requestId, peekonly, context); + return service.peek(queueName, this.client.getUrl(), numberOfMessages, timeout, this.client.getVersion(), requestId, peekonly, context); } } diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java similarity index 74% rename from storage/client/queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java index db933d31e423..814523ddd6db 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java @@ -4,19 +4,21 @@ package com.azure.storage.queue.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.DELETE; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.GET; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PathParam; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.BodyParam; +import com.azure.core.implementation.annotation.Delete; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.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.queue.models.QueuesCreateResponse; import com.azure.storage.queue.models.QueuesDeleteResponse; @@ -51,65 +53,68 @@ public final class QueuesImpl { * @param client the instance of the service client containing this operation class. */ public QueuesImpl(AzureQueueStorageImpl client) { - this.service = RestProxy.create(QueuesService.class, client); + this.service = RestProxy.create(QueuesService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for Queues to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureQueueStorageQueues to + * be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Queues Queue") + @ServiceInterface(name = "AzureQueueStorageQueues") private interface QueuesService { - @PUT("{queueName}") + @Put("{queueName}") @ExpectedResponses({201, 204}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@HostParam("url") String url, @PathParam("queueName") String queueName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); + Mono create(@PathParam("queueName") String queueName, @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, Context context); - @DELETE("{queueName}") + @Delete("{queueName}") @ExpectedResponses({204}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono delete(@HostParam("url") String url, @PathParam("queueName") String queueName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); + Mono delete(@PathParam("queueName") String queueName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); - @GET("{queueName}") + @Get("{queueName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getProperties(@HostParam("url") String url, @PathParam("queueName") String queueName, @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 getProperties(@PathParam("queueName") String queueName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); - @PUT("{queueName}") + @Put("{queueName}") @ExpectedResponses({204}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setMetadata(@HostParam("url") String url, @PathParam("queueName") String queueName, @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, Context context); + Mono setMetadata(@PathParam("queueName") String queueName, @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, Context context); - @GET("{queueName}") + @Get("{queueName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getAccessPolicy(@HostParam("url") String url, @PathParam("queueName") String queueName, @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 getAccessPolicy(@PathParam("queueName") String queueName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); - @PUT("{queueName}") + @Put("{queueName}") @ExpectedResponses({204}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setAccessPolicy(@HostParam("url") String url, @PathParam("queueName") String queueName, @BodyParam("application/xml; charset=utf-8") SignedIdentifiersWrapper queueAcl, @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 setAccessPolicy(@PathParam("queueName") String queueName, @HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") SignedIdentifiersWrapper queueAcl, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); } /** * creates a new queue under the given account. * + * @param queueName The queue name. * @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 queueName, Context context) { final Integer timeout = null; final Map metadata = null; final String requestId = null; - return service.create(this.client.url(), queueName, timeout, metadata, this.client.version(), requestId, context); + return service.create(queueName, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, context); } /** * creates a new queue under the given account. * + * @param queueName The queue name. * @param timeout The 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-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. * @param metadata 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. * @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. @@ -117,82 +122,94 @@ public Mono createWithRestResponseAsync(String queueName, * @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 queueName, Integer timeout, Map metadata, String requestId, Context context) { - return service.create(this.client.url(), queueName, timeout, metadata, this.client.version(), requestId, context); + return service.create(queueName, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, context); } /** * operation permanently deletes the specified queue. * + * @param queueName The queue name. * @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 queueName, Context context) { final Integer timeout = null; final String requestId = null; - return service.delete(this.client.url(), queueName, timeout, this.client.version(), requestId, context); + return service.delete(queueName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, context); } /** * operation permanently deletes the specified queue. * + * @param queueName The queue name. * @param timeout The 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-queue-service-operations>Setting Timeouts for Queue 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 deleteWithRestResponseAsync(String queueName, Integer timeout, String requestId, Context context) { - return service.delete(this.client.url(), queueName, timeout, this.client.version(), requestId, context); + return service.delete(queueName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, context); } /** * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-values pairs. * + * @param queueName The queue name. * @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 queueName, Context context) { final Integer timeout = null; final String requestId = null; final String comp = "metadata"; - return service.getProperties(this.client.url(), queueName, timeout, this.client.version(), requestId, comp, context); + return service.getProperties(queueName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, comp, context); } /** * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-values pairs. * + * @param queueName The queue name. * @param timeout The 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-queue-service-operations>Setting Timeouts for Queue 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 getPropertiesWithRestResponseAsync(String queueName, Integer timeout, String requestId, Context context) { final String comp = "metadata"; - return service.getProperties(this.client.url(), queueName, timeout, this.client.version(), requestId, comp, context); + return service.getProperties(queueName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, comp, context); } /** * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. * + * @param queueName The queue name. * @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 queueName, Context context) { final Integer timeout = null; final Map metadata = null; final String requestId = null; final String comp = "metadata"; - return service.setMetadata(this.client.url(), queueName, timeout, metadata, this.client.version(), requestId, comp, context); + return service.setMetadata(queueName, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, comp, context); } /** * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. * + * @param queueName The queue name. * @param timeout The 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-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. * @param metadata 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. * @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. @@ -200,57 +217,65 @@ public Mono setMetadataWithRestResponseAsync(String q * @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 queueName, Integer timeout, Map metadata, String requestId, Context context) { final String comp = "metadata"; - return service.setMetadata(this.client.url(), queueName, timeout, metadata, this.client.version(), requestId, comp, context); + return service.setMetadata(queueName, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, comp, context); } /** * returns details about any stored access policies specified on the queue that may be used with Shared Access Signatures. * + * @param queueName The queue name. * @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 getAccessPolicyWithRestResponseAsync(String queueName, Context context) { final Integer timeout = null; final String requestId = null; final String comp = "acl"; - return service.getAccessPolicy(this.client.url(), queueName, timeout, this.client.version(), requestId, comp, context); + return service.getAccessPolicy(queueName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, comp, context); } /** * returns details about any stored access policies specified on the queue that may be used with Shared Access Signatures. * + * @param queueName The queue name. * @param timeout The 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-queue-service-operations>Setting Timeouts for Queue 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 getAccessPolicyWithRestResponseAsync(String queueName, Integer timeout, String requestId, Context context) { final String comp = "acl"; - return service.getAccessPolicy(this.client.url(), queueName, timeout, this.client.version(), requestId, comp, context); + return service.getAccessPolicy(queueName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, comp, context); } /** * sets stored access policies for the queue that may be used with Shared Access Signatures. * + * @param queueName The queue name. * @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 setAccessPolicyWithRestResponseAsync(String queueName, Context context) { final Integer timeout = null; final String requestId = null; final String comp = "acl"; SignedIdentifiersWrapper queueAclConverted = new SignedIdentifiersWrapper(null); - return service.setAccessPolicy(this.client.url(), queueName, queueAclConverted, timeout, this.client.version(), requestId, comp, context); + return service.setAccessPolicy(queueName, this.client.getUrl(), queueAclConverted, timeout, this.client.getVersion(), requestId, comp, context); } /** * sets stored access policies for the queue that may be used with Shared Access Signatures. * + * @param queueName The queue name. * @param queueAcl the acls for the queue. * @param timeout The 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-queue-service-operations>Setting Timeouts for Queue 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. @@ -258,9 +283,10 @@ public Mono setAccessPolicyWithRestResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono setAccessPolicyWithRestResponseAsync(String queueName, List queueAcl, Integer timeout, String requestId, Context context) { final String comp = "acl"; SignedIdentifiersWrapper queueAclConverted = new SignedIdentifiersWrapper(queueAcl); - return service.setAccessPolicy(this.client.url(), queueName, queueAclConverted, timeout, this.client.version(), requestId, comp, context); + return service.setAccessPolicy(queueName, this.client.getUrl(), queueAclConverted, timeout, this.client.getVersion(), requestId, comp, context); } } diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java similarity index 82% rename from storage/client/queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java index 1dc20d2b42fa..cd0931bd273d 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java @@ -4,18 +4,20 @@ package com.azure.storage.queue.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.GET; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; import com.azure.core.implementation.CollectionFormat; import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.BodyParam; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.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.implementation.serializer.jackson.JacksonAdapter; import com.azure.core.util.Context; import com.azure.storage.queue.models.ListQueuesIncludeType; @@ -49,33 +51,33 @@ public final class ServicesImpl { * @param client the instance of the service client containing this operation class. */ public ServicesImpl(AzureQueueStorageImpl client) { - this.service = RestProxy.create(ServicesService.class, client); + this.service = RestProxy.create(ServicesService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for Services to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureQueueStorageServices to + * be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Queues Services") + @ServiceInterface(name = "AzureQueueStorageServices") private interface ServicesService { - @PUT("") + @Put("") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") StorageServiceProperties storageServiceProperties, @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("") + @Get("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getProperties(@HostParam("url") String url, @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("") + @Get("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getStatistics(@HostParam("url") String url, @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("") + @Get("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono listQueuesSegment(@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("comp") String comp, Context context); @@ -89,12 +91,13 @@ private interface ServicesService { * @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(StorageServiceProperties storageServiceProperties, Context context) { final Integer timeout = null; final String requestId = null; final String restype = "service"; final String comp = "properties"; - return service.setProperties(this.client.url(), storageServiceProperties, timeout, this.client.version(), requestId, restype, comp, context); + return service.setProperties(this.client.getUrl(), storageServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -107,10 +110,11 @@ public Mono setPropertiesWithRestResponseAsync(St * @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(StorageServiceProperties storageServiceProperties, Integer timeout, String requestId, Context context) { final String restype = "service"; final String comp = "properties"; - return service.setProperties(this.client.url(), storageServiceProperties, timeout, this.client.version(), requestId, restype, comp, context); + return service.setProperties(this.client.getUrl(), storageServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -120,12 +124,13 @@ public Mono setPropertiesWithRestResponseAsync(St * @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(Context context) { final Integer timeout = null; final String requestId = null; final String restype = "service"; final String comp = "properties"; - return service.getProperties(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context); + return service.getProperties(this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -137,10 +142,11 @@ public Mono getPropertiesWithRestResponseAsync(Co * @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(Integer timeout, String requestId, Context context) { final String restype = "service"; final String comp = "properties"; - return service.getProperties(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context); + return service.getProperties(this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -150,12 +156,13 @@ public Mono getPropertiesWithRestResponseAsync(In * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getStatisticsWithRestResponseAsync(Context context) { final Integer timeout = null; final String requestId = null; final String restype = "service"; final String comp = "stats"; - return service.getStatistics(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context); + return service.getStatistics(this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -167,10 +174,11 @@ public Mono getStatisticsWithRestResponseAsync(Co * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getStatisticsWithRestResponseAsync(Integer timeout, String requestId, Context context) { final String restype = "service"; final String comp = "stats"; - return service.getStatistics(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context); + return service.getStatistics(this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -180,6 +188,7 @@ public Mono getStatisticsWithRestResponseAsync(In * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listQueuesSegmentWithRestResponseAsync(Context context) { final String prefix = null; final String marker = null; @@ -188,7 +197,7 @@ public Mono listQueuesSegmentWithRestResponse final String requestId = null; final String comp = "list"; String includeConverted = null; - return service.listQueuesSegment(this.client.url(), prefix, marker, maxresults, includeConverted, timeout, this.client.version(), requestId, comp, context); + return service.listQueuesSegment(this.client.getUrl(), prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, comp, context); } /** @@ -204,9 +213,10 @@ public Mono listQueuesSegmentWithRestResponse * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listQueuesSegmentWithRestResponseAsync(String prefix, String marker, Integer maxresults, List include, Integer timeout, String requestId, Context context) { final String comp = "list"; String includeConverted = JacksonAdapter.createDefaultSerializerAdapter().serializeList(include, CollectionFormat.CSV); - return service.listQueuesSegment(this.client.url(), prefix, marker, maxresults, includeConverted, timeout, this.client.version(), requestId, comp, context); + return service.listQueuesSegment(this.client.getUrl(), prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, comp, context); } } diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/SignedIdentifiersWrapper.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/SignedIdentifiersWrapper.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/implementation/SignedIdentifiersWrapper.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/SignedIdentifiersWrapper.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/package-info.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/package-info.java similarity index 77% rename from storage/client/queue/src/main/java/com/azure/storage/queue/implementation/package-info.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/package-info.java index 80e51df7f967..324cc0b19dc2 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/implementation/package-info.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/implementation/package-info.java @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the implementations and inner classes for + * Package containing the implementations and inner classes for * AzureQueueStorage. */ package com.azure.storage.queue.implementation; diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/AccessPolicy.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/AccessPolicy.java similarity index 97% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/AccessPolicy.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/AccessPolicy.java index e2a86de1dcbc..40eec9949e94 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/AccessPolicy.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/AccessPolicy.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.models; +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; @@ -12,6 +13,7 @@ * An Access policy. */ @JacksonXmlRootElement(localName = "AccessPolicy") +@Fluent public final class AccessPolicy { /* * the date-time the policy is active diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/CorsRule.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/CorsRule.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/CorsRule.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/CorsRule.java index e5836439cdf3..ae40f253efb6 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/CorsRule.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/CorsRule.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -15,6 +16,7 @@ * one domain (the origin domain) to call APIs in another domain. */ @JacksonXmlRootElement(localName = "CorsRule") +@Fluent public final class CorsRule { /* * The origin domains that are permitted to make a request against the diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/DequeuedMessage.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/DequeuedMessage.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/DequeuedMessage.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/DequeuedMessage.java index 65e6e941c717..81614fc1cba9 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/DequeuedMessage.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/DequeuedMessage.java @@ -1,9 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.storage.queue.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; @@ -13,6 +15,7 @@ * on a Queue. */ @JacksonXmlRootElement(localName = "QueueMessage") +@Fluent public final class DequeuedMessage { /* * The Id of the Message. diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/EnqueuedMessage.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/EnqueuedMessage.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/EnqueuedMessage.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/EnqueuedMessage.java index 16f1cccb9e24..096bbac70bdb 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/EnqueuedMessage.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/EnqueuedMessage.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -14,6 +15,7 @@ * on a Queue. */ @JacksonXmlRootElement(localName = "QueueMessage") +@Fluent public final class EnqueuedMessage { /* * The Id of the Message. diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java similarity index 97% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java index 1fc313b4a45b..c6975aae93dc 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplication.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * The GeoReplication model. */ @JacksonXmlRootElement(localName = "GeoReplication") +@Fluent public final class GeoReplication { /* * The status of the secondary location. Possible values include: 'live', diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/GeoReplicationStatusType.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplicationStatusType.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/GeoReplicationStatusType.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/GeoReplicationStatusType.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ListQueuesIncludeType.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ListQueuesIncludeType.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/ListQueuesIncludeType.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ListQueuesIncludeType.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ListQueuesSegmentResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ListQueuesSegmentResponse.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/ListQueuesSegmentResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ListQueuesSegmentResponse.java index 8e34bc50503b..90d462272f47 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ListQueuesSegmentResponse.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ListQueuesSegmentResponse.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.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; @@ -15,6 +16,7 @@ * The object returned when calling List Queues on a Queue Service. */ @JacksonXmlRootElement(localName = "EnumerationResults") +@Fluent public final class ListQueuesSegmentResponse { /* * The serviceEndpoint property. diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/Logging.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Logging.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/Logging.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Logging.java index c5289b4fb5a5..a08399c0186c 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/Logging.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Logging.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * Azure Analytics Logging settings. */ @JacksonXmlRootElement(localName = "Logging") +@Fluent public final class Logging { /* * The version of Storage Analytics to configure. diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessageIdDeleteHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdDeleteHeaders.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/MessageIdDeleteHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdDeleteHeaders.java index e369a4d60c99..c51a8961f2bb 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessageIdDeleteHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdDeleteHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * Defines headers for Delete operation. */ @JacksonXmlRootElement(localName = "MessageId-Delete-Headers") +@Fluent public final class MessageIdDeleteHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessageIdUpdateHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdUpdateHeaders.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/MessageIdUpdateHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdUpdateHeaders.java index a0129420618d..dba25a728e8e 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessageIdUpdateHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdUpdateHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * Defines headers for Update operation. */ @JacksonXmlRootElement(localName = "MessageId-Update-Headers") +@Fluent public final class MessageIdUpdateHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessageIdsDeleteResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdsDeleteResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/MessageIdsDeleteResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdsDeleteResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessageIdsUpdateResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdsUpdateResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/MessageIdsUpdateResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessageIdsUpdateResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesClearHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesClearHeaders.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesClearHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesClearHeaders.java index 6bb1165cb4de..6265fda56273 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesClearHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesClearHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * Defines headers for Clear operation. */ @JacksonXmlRootElement(localName = "Messages-Clear-Headers") +@Fluent public final class MessagesClearHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesClearResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesClearResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesClearResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesClearResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueHeaders.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueHeaders.java index 3957cd8a79d4..d9e8fd905f03 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * Defines headers for Dequeue operation. */ @JacksonXmlRootElement(localName = "Messages-Dequeue-Headers") +@Fluent public final class MessagesDequeueHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesDequeueResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueHeaders.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueHeaders.java index 39dc57ed0c2a..d98604bb3c84 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * Defines headers for Enqueue operation. */ @JacksonXmlRootElement(localName = "Messages-Enqueue-Headers") +@Fluent public final class MessagesEnqueueHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesEnqueueResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesPeekHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesPeekHeaders.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesPeekHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesPeekHeaders.java index 4733069112ac..fc4c65fcd5bd 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesPeekHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesPeekHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * Defines headers for Peek operation. */ @JacksonXmlRootElement(localName = "Messages-Peek-Headers") +@Fluent public final class MessagesPeekHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesPeekResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesPeekResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/MessagesPeekResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/MessagesPeekResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/Metrics.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Metrics.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/Metrics.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Metrics.java index 8c9b2fe7923a..03a16a676ba1 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/Metrics.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/Metrics.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * The Metrics model. */ @JacksonXmlRootElement(localName = "Metrics") +@Fluent public final class Metrics { /* * The version of Storage Analytics to configure. diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/PeekedMessage.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/PeekedMessage.java similarity index 97% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/PeekedMessage.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/PeekedMessage.java index edc9960d2d74..c8a3c26ab973 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/PeekedMessage.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/PeekedMessage.java @@ -1,9 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.storage.queue.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; @@ -13,6 +15,7 @@ * on a Queue. */ @JacksonXmlRootElement(localName = "QueueMessage") +@Fluent public final class PeekedMessage { /* * The Id of the Message. diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueCreateHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueCreateHeaders.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueCreateHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueCreateHeaders.java index 7e0bee9cd7eb..5feda5191d35 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueCreateHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueCreateHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * Defines headers for Create operation. */ @JacksonXmlRootElement(localName = "Queue-Create-Headers") +@Fluent public final class QueueCreateHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueDeleteHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueDeleteHeaders.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueDeleteHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueDeleteHeaders.java index 5a29a098628c..5d1db54847da 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueDeleteHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueDeleteHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * Defines headers for Delete operation. */ @JacksonXmlRootElement(localName = "Queue-Delete-Headers") +@Fluent public final class QueueDeleteHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueGetAccessPolicyHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetAccessPolicyHeaders.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueGetAccessPolicyHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetAccessPolicyHeaders.java index 65fa98edf8aa..904ed5a98bca 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueGetAccessPolicyHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetAccessPolicyHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * Defines headers for GetAccessPolicy operation. */ @JacksonXmlRootElement(localName = "Queue-GetAccessPolicy-Headers") +@Fluent public final class QueueGetAccessPolicyHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueGetPropertiesHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetPropertiesHeaders.java similarity index 97% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueGetPropertiesHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetPropertiesHeaders.java index 20286e8a0ddb..15d84b0192e7 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueGetPropertiesHeaders.java @@ -4,8 +4,9 @@ package com.azure.storage.queue.models; -import com.azure.core.annotations.HeaderCollection; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.azure.core.implementation.annotation.HeaderCollection; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -15,6 +16,7 @@ * Defines headers for GetProperties operation. */ @JacksonXmlRootElement(localName = "Queue-GetProperties-Headers") +@Fluent public final class QueueGetPropertiesHeaders { /* * The metadata property. diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueItem.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueItem.java similarity index 96% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueItem.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueItem.java index 1575af6babcb..ea9ca80c5100 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueItem.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueItem.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.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.Map; @@ -12,6 +13,7 @@ * An Azure Storage Queue. */ @JacksonXmlRootElement(localName = "Queue") +@Fluent public final class QueueItem { /* * The name of the Queue. diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueMessage.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueMessage.java similarity index 94% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueMessage.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueMessage.java index 204825759ab0..edd78cbfd5d3 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueMessage.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueMessage.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * A Message object which can be stored in a Queue. */ @JacksonXmlRootElement(localName = "QueueMessage") +@Fluent public final class QueueMessage { /* * The content of the message diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueProperties.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueProperties.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueProperties.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueProperties.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueSetAccessPolicyHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetAccessPolicyHeaders.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueSetAccessPolicyHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetAccessPolicyHeaders.java index c2152ccc6a5c..672543a78f1b 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueSetAccessPolicyHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetAccessPolicyHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * Defines headers for SetAccessPolicy operation. */ @JacksonXmlRootElement(localName = "Queue-SetAccessPolicy-Headers") +@Fluent public final class QueueSetAccessPolicyHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueSetMetadataHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetMetadataHeaders.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueSetMetadataHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetMetadataHeaders.java index f68e00835afa..4c1997da6277 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueueSetMetadataHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueueSetMetadataHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * Defines headers for SetMetadata operation. */ @JacksonXmlRootElement(localName = "Queue-SetMetadata-Headers") +@Fluent public final class QueueSetMetadataHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesCreateResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesCreateResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesCreateResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesCreateResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesDeleteResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesDeleteResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesDeleteResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesDeleteResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesGetAccessPolicyResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesGetAccessPolicyResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesGetAccessPolicyResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesGetAccessPolicyResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesGetPropertiesResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesGetPropertiesResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesGetPropertiesResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesGetPropertiesResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesSegmentOptions.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesSegmentOptions.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesSegmentOptions.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesSegmentOptions.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesSetAccessPolicyResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesSetAccessPolicyResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesSetAccessPolicyResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesSetAccessPolicyResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesSetMetadataResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesSetMetadataResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/QueuesSetMetadataResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/QueuesSetMetadataResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/RetentionPolicy.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/RetentionPolicy.java similarity index 97% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/RetentionPolicy.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/RetentionPolicy.java index 045580d2c31a..ada0ae8d0e2c 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/RetentionPolicy.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/RetentionPolicy.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * the retention policy. */ @JacksonXmlRootElement(localName = "RetentionPolicy") +@Fluent public final class RetentionPolicy { /* * Indicates whether a retention policy is enabled for the storage service diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ServiceGetPropertiesHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetPropertiesHeaders.java similarity index 97% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/ServiceGetPropertiesHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetPropertiesHeaders.java index e58eab15aff9..5c099801501f 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ServiceGetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetPropertiesHeaders.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * Defines headers for GetProperties operation. */ @JacksonXmlRootElement(localName = "Service-GetProperties-Headers") +@Fluent public final class ServiceGetPropertiesHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ServiceGetStatisticsHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetStatisticsHeaders.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/ServiceGetStatisticsHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetStatisticsHeaders.java index ac56fc0624e8..2dfaf92bbeaa 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ServiceGetStatisticsHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceGetStatisticsHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * Defines headers for GetStatistics operation. */ @JacksonXmlRootElement(localName = "Service-GetStatistics-Headers") +@Fluent public final class ServiceGetStatisticsHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ServiceListQueuesSegmentHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceListQueuesSegmentHeaders.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/ServiceListQueuesSegmentHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceListQueuesSegmentHeaders.java index 341fd32e50a9..8670be5637ce 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ServiceListQueuesSegmentHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceListQueuesSegmentHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.queue.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; @@ -13,6 +14,7 @@ * Defines headers for ListQueuesSegment operation. */ @JacksonXmlRootElement(localName = "Service-ListQueuesSegment-Headers") +@Fluent public final class ServiceListQueuesSegmentHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ServiceSetPropertiesHeaders.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceSetPropertiesHeaders.java similarity index 97% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/ServiceSetPropertiesHeaders.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceSetPropertiesHeaders.java index aa98c955afe4..6ae6da4ef69b 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ServiceSetPropertiesHeaders.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServiceSetPropertiesHeaders.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * Defines headers for SetProperties operation. */ @JacksonXmlRootElement(localName = "Service-SetProperties-Headers") +@Fluent public final class ServiceSetPropertiesHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ServicesGetPropertiesResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesGetPropertiesResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/ServicesGetPropertiesResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesGetPropertiesResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ServicesGetStatisticsResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesGetStatisticsResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/ServicesGetStatisticsResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesGetStatisticsResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ServicesListQueuesSegmentResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesListQueuesSegmentResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/ServicesListQueuesSegmentResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesListQueuesSegmentResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/ServicesSetPropertiesResponse.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesSetPropertiesResponse.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/ServicesSetPropertiesResponse.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/ServicesSetPropertiesResponse.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/SignedIdentifier.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/SignedIdentifier.java similarity index 96% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/SignedIdentifier.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/SignedIdentifier.java index 7764f3a25ea7..56465abb7435 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/SignedIdentifier.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/SignedIdentifier.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * signed identifier. */ @JacksonXmlRootElement(localName = "SignedIdentifier") +@Fluent public final class SignedIdentifier { /* * a unique id diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/StorageError.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageError.java similarity index 94% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/StorageError.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageError.java index 0e264e6da0b8..b86ff0fd7e3f 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/StorageError.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageError.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * The StorageError model. */ @JacksonXmlRootElement(localName = "StorageError") +@Fluent public final class StorageError { /* * The message property. diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/StorageErrorCode.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageErrorCode.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/StorageErrorCode.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageErrorCode.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/StorageErrorException.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageErrorException.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/StorageErrorException.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageErrorException.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/StorageServiceProperties.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceProperties.java similarity index 98% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/StorageServiceProperties.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceProperties.java index e13cbde9e5cf..8a607a5a4494 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/StorageServiceProperties.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceProperties.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.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; @@ -15,6 +16,7 @@ * Storage Service Properties. */ @JacksonXmlRootElement(localName = "StorageServiceProperties") +@Fluent public final class StorageServiceProperties { /* * Azure Analytics Logging settings diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/StorageServiceStats.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceStats.java similarity index 95% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/StorageServiceStats.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceStats.java index d70c794bda65..6e45d422538f 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/StorageServiceStats.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/StorageServiceStats.java @@ -4,6 +4,7 @@ package com.azure.storage.queue.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * Stats for the storage service. */ @JacksonXmlRootElement(localName = "StorageServiceStats") +@Fluent public final class StorageServiceStats { /* * Geo-Replication information for the Secondary Storage Service diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/UpdatedMessage.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/UpdatedMessage.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/UpdatedMessage.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/UpdatedMessage.java diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/models/package-info.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/package-info.java similarity index 76% rename from storage/client/queue/src/main/java/com/azure/storage/queue/models/package-info.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/package-info.java index 92606a7993c1..3444962847a8 100644 --- a/storage/client/queue/src/main/java/com/azure/storage/queue/models/package-info.java +++ b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/models/package-info.java @@ -3,6 +3,6 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the data models for AzureQueueStorage. + * Package containing the data models for AzureQueueStorage. */ package com.azure.storage.queue.models; diff --git a/storage/client/queue/src/main/java/com/azure/storage/queue/package-info.java b/sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/package-info.java similarity index 100% rename from storage/client/queue/src/main/java/com/azure/storage/queue/package-info.java rename to sdk/storage/azure-storage-queue/src/main/java/com/azure/storage/queue/package-info.java diff --git a/storage/client/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 similarity index 100% rename from storage/client/queue/src/samples/java/com/azure/storage/queue/AsyncSamples.java rename to sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/AsyncSamples.java diff --git a/storage/client/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 similarity index 100% rename from storage/client/queue/src/samples/java/com/azure/storage/queue/MessageSamples.java rename to sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/MessageSamples.java diff --git a/storage/client/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 similarity index 100% rename from storage/client/queue/src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java rename to sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueExceptionSamples.java diff --git a/storage/client/queue/src/samples/java/com/azure/storage/queue/QueueServiceSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceSamples.java similarity index 100% rename from storage/client/queue/src/samples/java/com/azure/storage/queue/QueueServiceSamples.java rename to sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/QueueServiceSamples.java diff --git a/storage/client/queue/src/samples/java/com/azure/storage/queue/SampleHelper.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/SampleHelper.java similarity index 100% rename from storage/client/queue/src/samples/java/com/azure/storage/queue/SampleHelper.java rename to sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/SampleHelper.java diff --git a/storage/client/queue/src/samples/java/com/azure/storage/queue/javadoc/QueueJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/javadoc/QueueJavaDocCodeSamples.java similarity index 100% rename from storage/client/queue/src/samples/java/com/azure/storage/queue/javadoc/QueueJavaDocCodeSamples.java rename to sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/javadoc/QueueJavaDocCodeSamples.java diff --git a/storage/client/queue/src/samples/java/com/azure/storage/queue/javadoc/QueueServiceJavaDocCodeSamples.java b/sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/javadoc/QueueServiceJavaDocCodeSamples.java similarity index 100% rename from storage/client/queue/src/samples/java/com/azure/storage/queue/javadoc/QueueServiceJavaDocCodeSamples.java rename to sdk/storage/azure-storage-queue/src/samples/java/com/azure/storage/queue/javadoc/QueueServiceJavaDocCodeSamples.java diff --git a/storage/client/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 similarity index 99% rename from storage/client/queue/src/test/java/com/azure/storage/queue/QueueAsyncClientTests.java rename to sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueAsyncClientTests.java index f658e2aff324..e2b4b9529d00 100644 --- a/storage/client/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 @@ -37,7 +37,6 @@ protected void beforeTest() { if (interceptorManager.isPlaybackMode()) { client = helper.setupClient((connectionString, endpoint) -> new QueueClientBuilder() .connectionString(connectionString) - .endpoint(endpoint) .queueName(queueName) .httpClient(interceptorManager.getPlaybackClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) @@ -45,7 +44,6 @@ protected void beforeTest() { } else { client = helper.setupClient((connectionString, endpoint) -> new QueueClientBuilder() .connectionString(connectionString) - .endpoint(endpoint) .queueName(queueName) .httpClient(HttpClient.createDefault().wiretap(true)) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) diff --git a/storage/client/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 similarity index 99% rename from storage/client/queue/src/test/java/com/azure/storage/queue/QueueClientTests.java rename to sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTests.java index c0da15213d8c..4e3f782d7ec6 100644 --- a/storage/client/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 @@ -43,14 +43,13 @@ protected void beforeTest() { if (interceptorManager.isPlaybackMode()) { client = helper.setupClient((connectionString, endpoint) -> new QueueClientBuilder() .connectionString(connectionString) - .endpoint(endpoint) .queueName(queueName) .httpClient(interceptorManager.getPlaybackClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .buildClient(), true, logger); } else { client = helper.setupClient((connectionString, endpoint) -> new QueueClientBuilder() - .endpoint(endpoint) + .connectionString(connectionString) .queueName(queueName) .httpClient(HttpClient.createDefault().wiretap(true)) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) diff --git a/storage/client/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 similarity index 100% rename from storage/client/queue/src/test/java/com/azure/storage/queue/QueueClientTestsBase.java rename to sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueClientTestsBase.java diff --git a/storage/client/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 similarity index 97% rename from storage/client/queue/src/test/java/com/azure/storage/queue/QueueServiceAsyncClientTests.java rename to sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceAsyncClientTests.java index 8d0b89aa9be0..1be35f6a8910 100644 --- a/storage/client/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 @@ -34,14 +34,12 @@ protected void beforeTest() { if (interceptorManager.isPlaybackMode()) { serviceClient = helper.setupClient((connectionString, endpoint) -> new QueueServiceClientBuilder() .connectionString(connectionString) - .endpoint(endpoint) .httpClient(interceptorManager.getPlaybackClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .buildAsyncClient(), true, logger); } else { serviceClient = helper.setupClient((connectionString, endpoint) -> new QueueServiceClientBuilder() .connectionString(connectionString) - .endpoint(endpoint) .httpClient(HttpClient.createDefault().wiretap(true)) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) @@ -206,6 +204,9 @@ public void listQueuesWithLimit() { } 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(); } diff --git a/storage/client/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 similarity index 99% rename from storage/client/queue/src/test/java/com/azure/storage/queue/QueueServiceClientTests.java rename to sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTests.java index c6587872c6fb..39e1b9d2beb4 100644 --- a/storage/client/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 @@ -40,14 +40,12 @@ protected void beforeTest() { if (interceptorManager.isPlaybackMode()) { serviceClient = helper.setupClient((connectionString, endpoint) -> new QueueServiceClientBuilder() .connectionString(connectionString) - .endpoint(endpoint) .httpClient(interceptorManager.getPlaybackClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .buildClient(), true, logger); } else { serviceClient = helper.setupClient((connectionString, endpoint) -> new QueueServiceClientBuilder() .connectionString(connectionString) - .endpoint(endpoint) .httpClient(HttpClient.createDefault().wiretap(true)) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) diff --git a/storage/client/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 similarity index 92% rename from storage/client/queue/src/test/java/com/azure/storage/queue/QueueServiceClientTestsBase.java rename to sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/QueueServiceClientTestsBase.java index 3b86144d6f22..f090814fbfc9 100644 --- a/storage/client/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 @@ -54,8 +54,7 @@ String getQueueName() { @Test public abstract void listQueuesWithPrefix(); - // TODO (alzimmer): This test is off for now until we determine how to handle paging with limited results - //@Test + @Test public abstract void listQueuesWithLimit(); @Test diff --git a/storage/client/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 similarity index 97% rename from storage/client/queue/src/test/java/com/azure/storage/queue/TestHelpers.java rename to sdk/storage/azure-storage-queue/src/test/java/com/azure/storage/queue/TestHelpers.java index bac3f552860f..48639715112f 100644 --- a/storage/client/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 @@ -41,7 +41,7 @@ T setupClient(BiFunction clientBuilder, boolean isPlaybac } if (ImplUtils.isNullOrEmpty(connectionString) && ImplUtils.isNullOrEmpty(queueEndpoint)) { - logger.asWarning().log("{} and {} must be set to build the testing client", azureStorageConnectionString, azureStorageQueueEndpoint); + logger.warning("{} and {} must be set to build the testing client", azureStorageConnectionString, azureStorageQueueEndpoint); fail(); return null; } 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 new file mode 100644 index 000000000000..cebb31166bc9 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessages.json @@ -0,0 +1,161 @@ +{ + "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/storage/client/queue/src/test/resources/session-records/clearMessagesQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessagesQueueDoesNotExist.json similarity index 55% rename from storage/client/queue/src/test/resources/session-records/clearMessagesQueueDoesNotExist.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessagesQueueDoesNotExist.json index 9fb11f03c696..d5ff4fab7281 100644 --- a/storage/client/queue/src/test/resources/session-records/clearMessagesQueueDoesNotExist.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/clearMessagesQueueDoesNotExist.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue0499487b/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue95540dc6/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -13,17 +13,17 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd223222-4003-0028-3175-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd223222-4003-0028-3175-37b82d000000\nTime:2019-07-10T23:18:05.7976908Z", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT", + "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://sima.queue.core.windows.net/queue0499487b/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue95540dc6/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -32,11 +32,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd223243-4003-0028-4e75-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd223243-4003-0028-4e75-37b82d000000\nTime:2019-07-10T23:18:05.8547315Z", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT", + "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" : [ "queue0499487b" ] + "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 new file mode 100644 index 000000000000..6ace1ebfcc3d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueue.json @@ -0,0 +1,90 @@ +{ + "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/storage/client/queue/src/test/resources/session-records/createQueueTwiceDifferentMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceDifferentMetadata.json similarity index 51% rename from storage/client/queue/src/test/resources/session-records/createQueueTwiceDifferentMetadata.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceDifferentMetadata.json index e7297afd23b1..104f97276190 100644 --- a/storage/client/queue/src/test/resources/session-records/createQueueTwiceDifferentMetadata.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceDifferentMetadata.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue2172697c", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue88691a05", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "0d290a57-6003-009e-6676-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT" + "x-ms-request-id" : "1cdd82fd-e003-0073-1609-4740b5000000", + "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" } }, { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue2172697c", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue88691a05", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -29,17 +29,17 @@ "retry-after" : "0", "Content-Length" : "222", "StatusCode" : "409", - "x-ms-request-id" : "0d290a73-6003-009e-7e76-37b6d5000000", - "Body" : "QueueAlreadyExistsThe specified queue already exists.\nRequestId:0d290a73-6003-009e-7e76-37b6d5000000\nTime:2019-07-10T23:24:49.9481623Z", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT", + "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://sima.queue.core.windows.net?prefix=queue2172697c&include=&comp=list", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue88691a05&include=&comp=list", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -48,17 +48,17 @@ "Cache-Control" : "no-cache", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "0d290a84-6003-009e-0f76-37b6d5000000", - "Body" : "queue2172697cqueue2172697c", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT", + "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://sima.queue.core.windows.net/queue2172697c/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue88691a05/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -66,15 +66,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "0d290a9d-6003-009e-2776-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT" + "x-ms-request-id" : "1cdd830e-e003-0073-2409-4740b5000000", + "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue2172697c", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue88691a05", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -82,9 +82,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "0d290aa4-6003-009e-2d76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT" + "x-ms-request-id" : "1cdd8317-e003-0073-2d09-4740b5000000", + "Date" : "Tue, 30 Jul 2019 19:01:06 GMT" } } ], - "variables" : [ "queue2172697c" ] + "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 new file mode 100644 index 000000000000..cc245715abd6 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueTwiceSameMetadata.json @@ -0,0 +1,125 @@ +{ + "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/storage/client/queue/src/test/resources/session-records/createQueueWithMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueWithMetadata.json similarity index 51% rename from storage/client/queue/src/test/resources/session-records/createQueueWithMetadata.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueWithMetadata.json index 3c8381cb8777..a884a0d89d21 100644 --- a/storage/client/queue/src/test/resources/session-records/createQueueWithMetadata.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createQueueWithMetadata.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue2741227a", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue84974cab", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "0d290770-6003-009e-1d76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT" + "x-ms-request-id" : "1cdd81fa-e003-0073-3209-4740b5000000", + "Date" : "Tue, 30 Jul 2019 19:01:04 GMT" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue2741227a?comp=metadata", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue84974cab?comp=metadata", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -31,16 +31,16 @@ "x-ms-approximate-messages-count" : "0", "x-ms-meta-metadata1" : "value1", "StatusCode" : "200", - "x-ms-request-id" : "0d290788-6003-009e-3176-37b6d5000000", + "x-ms-request-id" : "1cdd824c-e003-0073-7709-4740b5000000", "x-ms-meta-metadata2" : "value2", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT" + "Date" : "Tue, 30 Jul 2019 19:01:04 GMT" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net?prefix=queue2741227a&include=&comp=list", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue84974cab&include=&comp=list", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -49,17 +49,17 @@ "Cache-Control" : "no-cache", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "0d2907ab-6003-009e-4e76-37b6d5000000", - "Body" : "queue2741227aqueue2741227a", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT", + "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://sima.queue.core.windows.net/queue2741227a/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue84974cab/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -67,15 +67,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "0d2907b9-6003-009e-5976-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT" + "x-ms-request-id" : "1cdd8260-e003-0073-0a09-4740b5000000", + "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue2741227a", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue84974cab", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -83,9 +83,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "0d2907c4-6003-009e-6276-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT" + "x-ms-request-id" : "1cdd8267-e003-0073-1109-4740b5000000", + "Date" : "Tue, 30 Jul 2019 19:01:05 GMT" } } ], - "variables" : [ "queue2741227a" ] + "variables" : [ "queue84974cab" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/createTwiceDifferentMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceDifferentMetadata.json similarity index 52% rename from storage/client/queue/src/test/resources/session-records/createTwiceDifferentMetadata.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceDifferentMetadata.json index 2c1103e32db9..70bd9c8373e7 100644 --- a/storage/client/queue/src/test/resources/session-records/createTwiceDifferentMetadata.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceDifferentMetadata.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue0432116e", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60199648", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd226070-4003-0028-4675-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT" + "x-ms-request-id" : "807246c6-4003-00b9-5d03-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" } }, { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue0432116e", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60199648", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -29,17 +29,17 @@ "retry-after" : "0", "Content-Length" : "222", "StatusCode" : "409", - "x-ms-request-id" : "dd22608d-4003-0028-5f75-37b82d000000", - "Body" : "QueueAlreadyExistsThe specified queue already exists.\nRequestId:dd22608d-4003-0028-5f75-37b82d000000\nTime:2019-07-10T23:18:38.0176580Z", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT", + "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://sima.queue.core.windows.net/queue0432116e/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60199648/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -47,15 +47,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd22609f-4003-0028-7175-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT" + "x-ms-request-id" : "80724708-4003-00b9-1a03-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue0432116e", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue60199648", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -63,9 +63,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd2260a4-4003-0028-7675-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT" + "x-ms-request-id" : "80724714-4003-00b9-2503-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" } } ], - "variables" : [ "queue0432116e" ] + "variables" : [ "queue60199648" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/createTwiceSameMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceSameMetadata.json similarity index 51% rename from storage/client/queue/src/test/resources/session-records/createTwiceSameMetadata.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceSameMetadata.json index 67e8f6692f9c..49af0912970a 100644 --- a/storage/client/queue/src/test/resources/session-records/createTwiceSameMetadata.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createTwiceSameMetadata.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue1490420b", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue8880966a", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd225ee9-4003-0028-6675-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT" + "x-ms-request-id" : "8072446f-4003-00b9-1303-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:36 GMT" } }, { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue1490420b", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue8880966a", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -28,15 +28,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd225f04-4003-0028-7875-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT" + "x-ms-request-id" : "80724495-4003-00b9-3803-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:36 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue1490420b/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue8880966a/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -44,15 +44,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd225f21-4003-0028-1175-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT" + "x-ms-request-id" : "807244ad-4003-00b9-5003-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:36 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue1490420b", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue8880966a", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -60,9 +60,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd225f32-4003-0028-2175-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT" + "x-ms-request-id" : "807244ca-4003-00b9-6d03-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" } } ], - "variables" : [ "queue1490420b" ] + "variables" : [ "queue8880966a" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/createWithMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithMetadata.json similarity index 53% rename from storage/client/queue/src/test/resources/session-records/createWithMetadata.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithMetadata.json index e81225ed944a..de90dd17f28c 100644 --- a/storage/client/queue/src/test/resources/session-records/createWithMetadata.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithMetadata.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue98908a15", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue23765c5d", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd2231c8-4003-0028-6375-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT" + "x-ms-request-id" : "8071dcea-4003-00b9-4003-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue98908a15?comp=metadata", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue23765c5d?comp=metadata", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -31,16 +31,16 @@ "x-ms-approximate-messages-count" : "0", "x-ms-meta-metadata1" : "value1", "StatusCode" : "200", - "x-ms-request-id" : "dd2231df-4003-0028-7475-37b82d000000", + "x-ms-request-id" : "8071dd11-4003-00b9-6603-47d378000000", "x-ms-meta-metadata2" : "value2", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT" + "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue98908a15/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue23765c5d/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -48,15 +48,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd2231f6-4003-0028-0975-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT" + "x-ms-request-id" : "8071dd3b-4003-00b9-0f03-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue98908a15", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue23765c5d", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -64,9 +64,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd223209-4003-0028-1b75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT" + "x-ms-request-id" : "8071dd54-4003-00b9-2703-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" } } ], - "variables" : [ "queue98908a15" ] + "variables" : [ "queue23765c5d" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/createWithSASToken.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSASToken.json similarity index 55% rename from storage/client/queue/src/test/resources/session-records/createWithSASToken.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSASToken.json index b0f0da481c19..06af19821b53 100644 --- a/storage/client/queue/src/test/resources/session-records/createWithSASToken.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSASToken.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue99626420/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue95805f24/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -13,11 +13,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd222843-4003-0028-5275-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd222843-4003-0028-5275-37b82d000000\nTime:2019-07-10T23:18:01.0102891Z", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT", + "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" : [ "queue99626420" ] + "variables" : [ "queue95805f24" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/createWithSharedKey.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSharedKey.json similarity index 55% rename from storage/client/queue/src/test/resources/session-records/createWithSharedKey.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSharedKey.json index 45ad59b25dad..f7db9ce0ce35 100644 --- a/storage/client/queue/src/test/resources/session-records/createWithSharedKey.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/createWithSharedKey.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue46849fbc/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue07130666/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -13,11 +13,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd226200-4003-0028-1275-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd226200-4003-0028-1275-37b82d000000\nTime:2019-07-10T23:18:39.1594759Z", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT", + "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" : [ "queue46849fbc" ] + "variables" : [ "queue07130666" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/deleteExisting.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExisting.json similarity index 51% rename from storage/client/queue/src/test/resources/session-records/deleteExisting.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExisting.json index ffaa890d1729..326bd01d83b8 100644 --- a/storage/client/queue/src/test/resources/session-records/deleteExisting.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExisting.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue69325b7f", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd223362-4003-0028-4f75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT" + "x-ms-request-id" : "8071de75-4003-00b9-4103-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" } }, { "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue69325b7f/messages?visibilitytimeout=0&messagettl=604800", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005/messages?visibilitytimeout=0&messagettl=604800", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0", + "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" : { @@ -29,17 +29,17 @@ "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd223387-4003-0028-7075-37b82d000000", - "Body" : "23c03c48-1eb9-48c9-aded-b6c6adb39e9eWed, 10 Jul 2019 23:18:06 GMTWed, 17 Jul 2019 23:18:06 GMTAgAAAAMAAAAAAAAA1NHmunU31QE=Wed, 10 Jul 2019 23:18:06 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT", + "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://sima.queue.core.windows.net/queue69325b7f", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -47,15 +47,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd223398-4003-0028-0175-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT" + "x-ms-request-id" : "8071debe-4003-00b9-0903-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:06 GMT" } }, { "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue69325b7f/messages?visibilitytimeout=0&messagettl=604800", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005/messages?visibilitytimeout=0&messagettl=604800", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0", + "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" : { @@ -65,17 +65,17 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd225eb4-4003-0028-3c75-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd225eb4-4003-0028-3c75-37b82d000000\nTime:2019-07-10T23:18:36.4715552Z", - "Date" : "Wed, 10 Jul 2019 23:18:35 GMT", + "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://sima.queue.core.windows.net/queue69325b7f/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue11519005/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -84,11 +84,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd225ecd-4003-0028-5175-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd225ecd-4003-0028-5175-37b82d000000\nTime:2019-07-10T23:18:36.5175891Z", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT", + "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" : [ "queue69325b7f" ] + "variables" : [ "queue11519005" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/deleteExistingQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExistingQueue.json similarity index 52% rename from storage/client/queue/src/test/resources/session-records/deleteExistingQueue.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExistingQueue.json index 414ed34da046..d711d370bf2b 100644 --- a/storage/client/queue/src/test/resources/session-records/deleteExistingQueue.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteExistingQueue.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue15727eac", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue520260d0", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "0d290577-6003-009e-6976-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:46 GMT" + "x-ms-request-id" : "1cdd8083-e003-0073-6a09-4740b5000000", + "Date" : "Tue, 30 Jul 2019 19:01:01 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue15727eac", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue520260d0", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -28,15 +28,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "0d2905e7-6003-009e-4776-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:46 GMT" + "x-ms-request-id" : "1cdd8163-e003-0073-3009-4740b5000000", + "Date" : "Tue, 30 Jul 2019 19:01:02 GMT" } }, { "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue15727eac/messages?visibilitytimeout=0&messagettl=604800", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue520260d0/messages?visibilitytimeout=0&messagettl=604800", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0", + "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" : { @@ -46,17 +46,17 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "0d290618-6003-009e-7176-37b6d5000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:0d290618-6003-009e-7176-37b6d5000000\nTime:2019-07-10T23:24:47.1091308Z", - "Date" : "Wed, 10 Jul 2019 23:24:47 GMT", + "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://sima.queue.core.windows.net?prefix=queue15727eac&include=&comp=list", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue520260d0&include=&comp=list", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -65,11 +65,11 @@ "Cache-Control" : "no-cache", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "0d290643-6003-009e-1b76-37b6d5000000", - "Body" : "queue15727eac", - "Date" : "Wed, 10 Jul 2019 23:24:47 GMT", + "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" : [ "queue15727eac" ] + "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 new file mode 100644 index 000000000000..f3bcf1a4fbf6 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessage.json @@ -0,0 +1,124 @@ +{ + "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 new file mode 100644 index 000000000000..02698922bb52 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidMessageId.json @@ -0,0 +1,109 @@ +{ + "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 new file mode 100644 index 000000000000..875c4a238ffb --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageInvalidPopReceipt.json @@ -0,0 +1,109 @@ +{ + "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/storage/client/queue/src/test/resources/session-records/deleteMessageQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageQueueDoesNotExist.json similarity index 54% rename from storage/client/queue/src/test/resources/session-records/deleteMessageQueueDoesNotExist.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageQueueDoesNotExist.json index c03dedb5c488..287a17ccf8f1 100644 --- a/storage/client/queue/src/test/resources/session-records/deleteMessageQueueDoesNotExist.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMessageQueueDoesNotExist.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue055108e6/messages/invalid?popreceipt=call", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5543243d/messages/invalid?popreceipt=call", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -13,17 +13,17 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd226381-4003-0028-5575-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd226381-4003-0028-5575-37b82d000000\nTime:2019-07-10T23:18:40.1101585Z", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT", + "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://sima.queue.core.windows.net/queue055108e6/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5543243d/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -32,11 +32,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd226390-4003-0028-6375-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd226390-4003-0028-6375-37b82d000000\nTime:2019-07-10T23:18:40.1591931Z", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT", + "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" : [ "queue055108e6" ] + "variables" : [ "queue5543243d" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/deleteMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMetadata.json similarity index 53% rename from storage/client/queue/src/test/resources/session-records/deleteMetadata.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMetadata.json index 8ba83a6d8d21..705c7722d081 100644 --- a/storage/client/queue/src/test/resources/session-records/deleteMetadata.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteMetadata.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue679519e2", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd2263ff-4003-0028-4975-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT" + "x-ms-request-id" : "80724d57-4003-00b9-3403-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue679519e2?comp=metadata", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9?comp=metadata", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -31,16 +31,16 @@ "x-ms-approximate-messages-count" : "0", "x-ms-meta-metadata1" : "value1", "StatusCode" : "200", - "x-ms-request-id" : "dd226409-4003-0028-5275-37b82d000000", + "x-ms-request-id" : "80724d80-4003-00b9-5a03-47d378000000", "x-ms-meta-metadata2" : "value2", - "Date" : "Wed, 10 Jul 2019 23:18:40 GMT" + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } }, { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue679519e2?comp=metadata", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9?comp=metadata", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -48,15 +48,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd226418-4003-0028-6075-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:40 GMT" + "x-ms-request-id" : "80724d98-4003-00b9-7203-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue679519e2?comp=metadata", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9?comp=metadata", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -66,15 +66,15 @@ "Content-Length" : "0", "x-ms-approximate-messages-count" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dd226420-4003-0028-6875-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:40 GMT" + "x-ms-request-id" : "80724db1-4003-00b9-0b03-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue679519e2/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -82,15 +82,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd226434-4003-0028-7b75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:40 GMT" + "x-ms-request-id" : "80724dd4-4003-00b9-2d03-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue679519e2", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue743794d9", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -98,9 +98,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd22644c-4003-0028-1275-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:40 GMT" + "x-ms-request-id" : "80724dec-4003-00b9-4503-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } } ], - "variables" : [ "queue679519e2" ] + "variables" : [ "queue743794d9" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/deleteNonExistent.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistent.json similarity index 55% rename from storage/client/queue/src/test/resources/session-records/deleteNonExistent.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistent.json index 2fa6701c17ac..525cc82bc6b9 100644 --- a/storage/client/queue/src/test/resources/session-records/deleteNonExistent.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistent.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue04551c5d", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue784292a2", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -13,17 +13,17 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd226108-4003-0028-4e75-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd226108-4003-0028-4e75-37b82d000000\nTime:2019-07-10T23:18:38.4209499Z", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT", + "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://sima.queue.core.windows.net/queue04551c5d/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue784292a2/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -32,11 +32,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd226119-4003-0028-5e75-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd226119-4003-0028-5e75-37b82d000000\nTime:2019-07-10T23:18:38.4689812Z", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT", + "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" : [ "queue04551c5d" ] + "variables" : [ "queue784292a2" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/deleteNonExistentQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistentQueue.json similarity index 52% rename from storage/client/queue/src/test/resources/session-records/deleteNonExistentQueue.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistentQueue.json index bf9105b3ccdc..2e67336c2204 100644 --- a/storage/client/queue/src/test/resources/session-records/deleteNonExistentQueue.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/deleteNonExistentQueue.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue82016a1d", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue5883546e", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -13,17 +13,17 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "0d290bd9-6003-009e-4476-37b6d5000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:0d290bd9-6003-009e-4476-37b6d5000000\nTime:2019-07-10T23:24:50.9128531Z", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT", + "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://sima.queue.core.windows.net?prefix=queue82016a1d&include=&comp=list", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue5883546e&include=&comp=list", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -32,11 +32,11 @@ "Cache-Control" : "no-cache", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "0d290bf6-6003-009e-5b76-37b6d5000000", - "Body" : "queue82016a1d", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT", + "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" : [ "queue82016a1d" ] + "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 new file mode 100644 index 000000000000..235330aad38c --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMessage.json @@ -0,0 +1,90 @@ +{ + "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 new file mode 100644 index 000000000000..aacfeda6c1d6 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueMultipleMessages.json @@ -0,0 +1,109 @@ +{ + "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/storage/client/queue/src/test/resources/session-records/dequeueQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueQueueDoesNotExist.json similarity index 54% rename from storage/client/queue/src/test/resources/session-records/dequeueQueueDoesNotExist.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueQueueDoesNotExist.json index 3bef9c37aaf6..c92f5ac1b9fb 100644 --- a/storage/client/queue/src/test/resources/session-records/dequeueQueueDoesNotExist.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueQueueDoesNotExist.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue39822dce/messages?numofmessages=1&visibilitytimeout=30", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue03640269/messages?numofmessages=1&visibilitytimeout=30", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -13,17 +13,17 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd2260e6-4003-0028-3075-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd2260e6-4003-0028-3075-37b82d000000\nTime:2019-07-10T23:18:38.3148712Z", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT", + "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://sima.queue.core.windows.net/queue39822dce/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue03640269/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -32,11 +32,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd2260f8-4003-0028-4175-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd2260f8-4003-0028-4175-37b82d000000\nTime:2019-07-10T23:18:38.3619056Z", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT", + "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" : [ "queue39822dce" ] + "variables" : [ "queue03640269" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/dequeueTooManyMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueTooManyMessages.json similarity index 55% rename from storage/client/queue/src/test/resources/session-records/dequeueTooManyMessages.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueTooManyMessages.json index 757caa567efa..c1216be98ccd 100644 --- a/storage/client/queue/src/test/resources/session-records/dequeueTooManyMessages.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/dequeueTooManyMessages.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue03015bde", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue33803725", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd2226b1-4003-0028-0675-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:59 GMT" + "x-ms-request-id" : "8071cf82-4003-00b9-6203-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:01 GMT" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue03015bde/messages?numofmessages=64&visibilitytimeout=30", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue33803725/messages?numofmessages=64&visibilitytimeout=30", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -29,17 +29,17 @@ "retry-after" : "0", "Content-Length" : "456", "StatusCode" : "400", - "x-ms-request-id" : "dd2226cd-4003-0028-1d75-37b82d000000", - "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:dd2226cd-4003-0028-1d75-37b82d000000\nTime:2019-07-10T23:18:00.2767678Znumofmessages64132", - "Date" : "Wed, 10 Jul 2019 23:17:59 GMT", + "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://sima.queue.core.windows.net/queue03015bde/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue33803725/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -47,15 +47,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd2226e0-4003-0028-2e75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:59 GMT" + "x-ms-request-id" : "8071cfc0-4003-00b9-1d03-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:01 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue03015bde", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue33803725", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -63,9 +63,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd2226fd-4003-0028-4a75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:59 GMT" + "x-ms-request-id" : "8071cfe1-4003-00b9-3d03-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" } } ], - "variables" : [ "queue03015bde" ] + "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 new file mode 100644 index 000000000000..015e74ada642 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueEmptyMessage.json @@ -0,0 +1,90 @@ +{ + "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 new file mode 100644 index 000000000000..4be6f36d26c0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueMessage.json @@ -0,0 +1,90 @@ +{ + "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/storage/client/queue/src/test/resources/session-records/enqueueQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueQueueDoesNotExist.json similarity index 55% rename from storage/client/queue/src/test/resources/session-records/enqueueQueueDoesNotExist.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueQueueDoesNotExist.json index 9433eea40c38..9859c91ffdb1 100644 --- a/storage/client/queue/src/test/resources/session-records/enqueueQueueDoesNotExist.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueQueueDoesNotExist.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue39910e47/messages?visibilitytimeout=0&messagettl=604800", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue50657bc8/messages?visibilitytimeout=0&messagettl=604800", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0", + "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" : { @@ -14,17 +14,17 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd2229a6-4003-0028-6475-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd2229a6-4003-0028-6475-37b82d000000\nTime:2019-07-10T23:18:01.6777634Z", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT", + "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://sima.queue.core.windows.net/queue39910e47/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue50657bc8/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -33,11 +33,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd2229bd-4003-0028-7575-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd2229bd-4003-0028-7575-37b82d000000\nTime:2019-07-10T23:18:01.7277985Z", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT", + "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" : [ "queue39910e47" ] + "variables" : [ "queue50657bc8" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/enqueueShortTimeToLiveMessage.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueShortTimeToLiveMessage.json similarity index 51% rename from storage/client/queue/src/test/resources/session-records/enqueueShortTimeToLiveMessage.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueShortTimeToLiveMessage.json index bb6b2172664f..5c546664731c 100644 --- a/storage/client/queue/src/test/resources/session-records/enqueueShortTimeToLiveMessage.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/enqueueShortTimeToLiveMessage.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue69359315", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd221f37-4003-0028-1c75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:54 GMT" + "x-ms-request-id" : "8071be6d-4003-00b9-4a03-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:18:56 GMT" } }, { "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue69359315/messages?visibilitytimeout=0&messagettl=2", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f/messages?visibilitytimeout=0&messagettl=2", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0", + "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" : { @@ -29,17 +29,17 @@ "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", "retry-after" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd221f43-4003-0028-2775-37b82d000000", - "Body" : "c96e7db1-1d4a-4743-b165-a5835968722aWed, 10 Jul 2019 23:17:54 GMTWed, 10 Jul 2019 23:17:56 GMTAgAAAAMAAAAAAAAApcYOtHU31QE=Wed, 10 Jul 2019 23:17:54 GMT", - "Date" : "Wed, 10 Jul 2019 23:17:54 GMT", + "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://sima.queue.core.windows.net/queue69359315/messages?peekonly=true", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f/messages?peekonly=true", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -48,17 +48,17 @@ "Cache-Control" : "no-cache", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dd222634-4003-0028-1675-37b82d000000", + "x-ms-request-id" : "8071cea8-4003-00b9-0e03-47d378000000", "Body" : "", - "Date" : "Wed, 10 Jul 2019 23:17:59 GMT", + "Date" : "Tue, 30 Jul 2019 18:19:01 GMT", "Content-Type" : "application/xml" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue69359315/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -66,15 +66,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd22264c-4003-0028-2c75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:59 GMT" + "x-ms-request-id" : "8071cec0-4003-00b9-2603-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:01 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue69359315", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue4952015f", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -82,9 +82,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd222666-4003-0028-4375-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:59 GMT" + "x-ms-request-id" : "8071cee0-4003-00b9-4603-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:01 GMT" } } ], - "variables" : [ "queue69359315" ] + "variables" : [ "queue4952015f" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/getAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicy.json similarity index 54% rename from storage/client/queue/src/test/resources/session-records/getAccessPolicy.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicy.json index 79f9317b619d..f4583b3a1ca6 100644 --- a/storage/client/queue/src/test/resources/session-records/getAccessPolicy.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicy.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue276184e3", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9583269e", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd222bac-4003-0028-2175-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:02 GMT" + "x-ms-request-id" : "8071d4c3-4003-00b9-7003-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue276184e3?comp=acl", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9583269e?comp=acl", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -29,17 +29,17 @@ "Cache-Control" : "no-cache", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dd222bc0-4003-0028-3175-37b82d000000", + "x-ms-request-id" : "8071d4e3-4003-00b9-0e03-47d378000000", "Body" : "", - "Date" : "Wed, 10 Jul 2019 23:18:02 GMT", + "Date" : "Tue, 30 Jul 2019 18:19:03 GMT", "Content-Type" : "application/xml" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue276184e3/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9583269e/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -47,15 +47,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd222be3-4003-0028-4d75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:02 GMT" + "x-ms-request-id" : "8071d4fb-4003-00b9-2603-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue276184e3", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue9583269e", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -63,9 +63,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd222bfe-4003-0028-6375-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:02 GMT" + "x-ms-request-id" : "8071d50b-4003-00b9-3503-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:03 GMT" } } ], - "variables" : [ "queue276184e3" ] + "variables" : [ "queue9583269e" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/getAccessPolicyQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicyQueueDoesNotExist.json similarity index 55% rename from storage/client/queue/src/test/resources/session-records/getAccessPolicyQueueDoesNotExist.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicyQueueDoesNotExist.json index 8c772f655188..f51ee48724c7 100644 --- a/storage/client/queue/src/test/resources/session-records/getAccessPolicyQueueDoesNotExist.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getAccessPolicyQueueDoesNotExist.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue66823709?comp=acl", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue066060ee?comp=acl", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -13,17 +13,17 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd22604d-4003-0028-2a75-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd22604d-4003-0028-2a75-37b82d000000\nTime:2019-07-10T23:18:37.8315254Z", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT", + "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://sima.queue.core.windows.net/queue66823709/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue066060ee/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -32,11 +32,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd226056-4003-0028-3275-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd226056-4003-0028-3275-37b82d000000\nTime:2019-07-10T23:18:37.8795608Z", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT", + "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" : [ "queue66823709" ] + "variables" : [ "queue066060ee" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/getProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getProperties.json similarity index 53% rename from storage/client/queue/src/test/resources/session-records/getProperties.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/getProperties.json index a7c0a0ec5332..c603492afe88 100644 --- a/storage/client/queue/src/test/resources/session-records/getProperties.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getProperties.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue36601253", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue98021a59", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd2227b8-4003-0028-6075-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT" + "x-ms-request-id" : "8071d0a9-4003-00b9-7f03-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue36601253?comp=metadata", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue98021a59?comp=metadata", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -31,16 +31,16 @@ "x-ms-approximate-messages-count" : "0", "x-ms-meta-metadata1" : "value1", "StatusCode" : "200", - "x-ms-request-id" : "dd2227d1-4003-0028-7675-37b82d000000", + "x-ms-request-id" : "8071d0df-4003-00b9-3403-47d378000000", "x-ms-meta-metadata2" : "value2", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT" + "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue36601253/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue98021a59/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -48,15 +48,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd2227f9-4003-0028-1775-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT" + "x-ms-request-id" : "8071d0ff-4003-00b9-5303-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue36601253", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue98021a59", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -64,9 +64,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd222807-4003-0028-2575-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT" + "x-ms-request-id" : "8071d123-4003-00b9-7703-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" } } ], - "variables" : [ "queue36601253" ] + "variables" : [ "queue98021a59" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/getPropertiesQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getPropertiesQueueDoesNotExist.json similarity index 55% rename from storage/client/queue/src/test/resources/session-records/getPropertiesQueueDoesNotExist.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/getPropertiesQueueDoesNotExist.json index fe98b22946df..c81fadfa36f6 100644 --- a/storage/client/queue/src/test/resources/session-records/getPropertiesQueueDoesNotExist.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getPropertiesQueueDoesNotExist.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue7527481d?comp=metadata", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue89138457?comp=metadata", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -13,17 +13,17 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd222681-4003-0028-5b75-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd222681-4003-0028-5b75-37b82d000000\nTime:2019-07-10T23:18:00.1126512Z", - "Date" : "Wed, 10 Jul 2019 23:17:59 GMT", + "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://sima.queue.core.windows.net/queue7527481d/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue89138457/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -32,11 +32,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd22269d-4003-0028-7375-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd22269d-4003-0028-7375-37b82d000000\nTime:2019-07-10T23:18:00.1626872Z", - "Date" : "Wed, 10 Jul 2019 23:17:59 GMT", + "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" : [ "queue7527481d" ] + "variables" : [ "queue89138457" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/getQueueDoesNotCreateAQueue.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getQueueDoesNotCreateAQueue.json similarity index 52% rename from storage/client/queue/src/test/resources/session-records/getQueueDoesNotCreateAQueue.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/getQueueDoesNotCreateAQueue.json index 7776d4fed478..0f91979ead55 100644 --- a/storage/client/queue/src/test/resources/session-records/getQueueDoesNotCreateAQueue.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/getQueueDoesNotCreateAQueue.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue48695d7f/messages?visibilitytimeout=0&messagettl=604800", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue881089d3/messages?visibilitytimeout=0&messagettl=604800", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0", + "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" : { @@ -14,17 +14,17 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "0d290a18-6003-009e-3676-37b6d5000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:0d290a18-6003-009e-3676-37b6d5000000\nTime:2019-07-10T23:24:49.7390111Z", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT", + "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://sima.queue.core.windows.net?prefix=queue48695d7f&include=&comp=list", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue881089d3&include=&comp=list", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -33,11 +33,11 @@ "Cache-Control" : "no-cache", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "0d290a2f-6003-009e-4876-37b6d5000000", - "Body" : "queue48695d7f", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT", + "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" : [ "queue48695d7f" ] + "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 new file mode 100644 index 000000000000..60f43a830052 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueues.json @@ -0,0 +1,186 @@ +{ + "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 new file mode 100644 index 000000000000..a3a8affdfea0 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesIncludeMetadata.json @@ -0,0 +1,186 @@ +{ + "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 new file mode 100644 index 000000000000..fc87bcea2c77 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithLimit.json @@ -0,0 +1,205 @@ +{ + "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 new file mode 100644 index 000000000000..25ab0025e774 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/listQueuesWithPrefix.json @@ -0,0 +1,186 @@ +{ + "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 new file mode 100644 index 000000000000..dd793491431d --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMessage.json @@ -0,0 +1,90 @@ +{ + "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 new file mode 100644 index 000000000000..ec67bb0d5044 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekMultipleMessages.json @@ -0,0 +1,109 @@ +{ + "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/storage/client/queue/src/test/resources/session-records/peekQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekQueueDoesNotExist.json similarity index 55% rename from storage/client/queue/src/test/resources/session-records/peekQueueDoesNotExist.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/peekQueueDoesNotExist.json index c9de737c1617..5efe773a0a36 100644 --- a/storage/client/queue/src/test/resources/session-records/peekQueueDoesNotExist.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekQueueDoesNotExist.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue5442745c/messages?peekonly=true", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue163539f6/messages?peekonly=true", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -13,17 +13,17 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd221dd8-4003-0028-5075-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd221dd8-4003-0028-5075-37b82d000000\nTime:2019-07-10T23:17:53.9252561Z", - "Date" : "Wed, 10 Jul 2019 23:17:53 GMT", + "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://sima.queue.core.windows.net/queue5442745c/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue163539f6/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -32,11 +32,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd221df7-4003-0028-6d75-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd221df7-4003-0028-6d75-37b82d000000\nTime:2019-07-10T23:17:54.0093158Z", - "Date" : "Wed, 10 Jul 2019 23:17:53 GMT", + "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" : [ "queue5442745c" ] + "variables" : [ "queue163539f6" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/peekTooManyMessages.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekTooManyMessages.json similarity index 55% rename from storage/client/queue/src/test/resources/session-records/peekTooManyMessages.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/peekTooManyMessages.json index f653e97e1e0c..0e21d3f3e056 100644 --- a/storage/client/queue/src/test/resources/session-records/peekTooManyMessages.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/peekTooManyMessages.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue80227035", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue007623b2", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd22612f-4003-0028-7275-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT" + "x-ms-request-id" : "80724850-4003-00b9-5203-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue80227035/messages?numofmessages=64&peekonly=true", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue007623b2/messages?numofmessages=64&peekonly=true", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -29,17 +29,17 @@ "retry-after" : "0", "Content-Length" : "456", "StatusCode" : "400", - "x-ms-request-id" : "dd226138-4003-0028-7a75-37b82d000000", - "Body" : "OutOfRangeQueryParameterValueOne of the query parameters specified in the request URI is outside the permissible range.\nRequestId:dd226138-4003-0028-7a75-37b82d000000\nTime:2019-07-10T23:18:38.5780592Znumofmessages64132", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT", + "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://sima.queue.core.windows.net/queue80227035/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue007623b2/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -47,15 +47,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd22613d-4003-0028-7f75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT" + "x-ms-request-id" : "80724884-4003-00b9-0503-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue80227035", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue007623b2", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -63,9 +63,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd226149-4003-0028-0975-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT" + "x-ms-request-id" : "807248a6-4003-00b9-2603-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:38 GMT" } } ], - "variables" : [ "queue80227035" ] + "variables" : [ "queue007623b2" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/setAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicy.json similarity index 57% rename from storage/client/queue/src/test/resources/session-records/setAccessPolicy.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicy.json index ac6e9881a669..cc3a358651b1 100644 --- a/storage/client/queue/src/test/resources/session-records/setAccessPolicy.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicy.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue656812ca", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd225f53-4003-0028-4075-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT" + "x-ms-request-id" : "807244f3-4003-00b9-1603-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" } }, { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue656812ca?comp=acl", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1?comp=acl", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0", + "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" : { @@ -29,15 +29,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd225f6a-4003-0028-5575-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT" + "x-ms-request-id" : "80724521-4003-00b9-4103-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue656812ca?comp=acl", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1?comp=acl", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -46,17 +46,17 @@ "Cache-Control" : "no-cache", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "dd225f7e-4003-0028-6675-37b82d000000", + "x-ms-request-id" : "80724540-4003-00b9-5f03-47d378000000", "Body" : "testpermission2000-01-01T00:00:00.0000000Z2020-01-01T00:00:00.0000000Zraup", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT", + "Date" : "Tue, 30 Jul 2019 18:19:37 GMT", "Content-Type" : "application/xml" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue656812ca/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -64,15 +64,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd225f8c-4003-0028-7475-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT" + "x-ms-request-id" : "80724551-4003-00b9-7003-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue656812ca", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue392406b1", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -80,9 +80,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd225f98-4003-0028-7e75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT" + "x-ms-request-id" : "80724569-4003-00b9-0803-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" } } ], - "variables" : [ "queue656812ca" ] + "variables" : [ "queue392406b1" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/setAccessPolicyQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicyQueueDoesNotExist.json similarity index 57% rename from storage/client/queue/src/test/resources/session-records/setAccessPolicyQueueDoesNotExist.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicyQueueDoesNotExist.json index b2b42bce18c3..831f07e70edb 100644 --- a/storage/client/queue/src/test/resources/session-records/setAccessPolicyQueueDoesNotExist.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setAccessPolicyQueueDoesNotExist.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue01052e33?comp=acl", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue15204045?comp=acl", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0", + "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" : { @@ -14,17 +14,17 @@ "retry-after" : "0", "Content-Length" : "294", "StatusCode" : "400", - "x-ms-request-id" : "dd22645d-4003-0028-2375-37b82d000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:dd22645d-4003-0028-2375-37b82d000000\nTime:2019-07-10T23:18:40.8086534Z00", - "Date" : "Wed, 10 Jul 2019 23:18:40 GMT", + "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://sima.queue.core.windows.net/queue01052e33/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue15204045/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -33,11 +33,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd22646a-4003-0028-2f75-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd22646a-4003-0028-2f75-37b82d000000\nTime:2019-07-10T23:18:40.8566884Z", - "Date" : "Wed, 10 Jul 2019 23:18:40 GMT", + "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" : [ "queue01052e33" ] + "variables" : [ "queue15204045" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/setInvalidAccessPolicy.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidAccessPolicy.json similarity index 55% rename from storage/client/queue/src/test/resources/session-records/setInvalidAccessPolicy.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidAccessPolicy.json index fe186f2b4ac1..c053664720a1 100644 --- a/storage/client/queue/src/test/resources/session-records/setInvalidAccessPolicy.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidAccessPolicy.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue424460ef", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue598515b0", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd226338-4003-0028-1475-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT" + "x-ms-request-id" : "80724b93-4003-00b9-7c03-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } }, { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue424460ef?comp=acl", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue598515b0?comp=acl", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0", + "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" : { @@ -30,17 +30,17 @@ "retry-after" : "0", "Content-Length" : "371", "StatusCode" : "400", - "x-ms-request-id" : "dd22634c-4003-0028-2575-37b82d000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:dd22634c-4003-0028-2575-37b82d000000\nTime:2019-07-10T23:18:39.9250246Z1304Signed identifier ID cannot be empty or over 64 characters in length", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT", + "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://sima.queue.core.windows.net/queue424460ef/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue598515b0/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -48,15 +48,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd22635d-4003-0028-3675-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT" + "x-ms-request-id" : "80724bde-4003-00b9-4503-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue424460ef", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue598515b0", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -64,9 +64,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd226363-4003-0028-3a75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT" + "x-ms-request-id" : "80724bf9-4003-00b9-6003-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } } ], - "variables" : [ "queue424460ef" ] + "variables" : [ "queue598515b0" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/setInvalidMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidMetadata.json similarity index 53% rename from storage/client/queue/src/test/resources/session-records/setInvalidMetadata.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidMetadata.json index eb9faafed36f..5e4a36f56436 100644 --- a/storage/client/queue/src/test/resources/session-records/setInvalidMetadata.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setInvalidMetadata.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue38693e14", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue04921afb", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd22272a-4003-0028-7175-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:59 GMT" + "x-ms-request-id" : "8071d01e-4003-00b9-7903-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" } }, { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue38693e14?comp=metadata", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue04921afb?comp=metadata", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -29,17 +29,17 @@ "retry-after" : "0", "Content-Length" : "285", "StatusCode" : "400", - "x-ms-request-id" : "dd22274f-4003-0028-0b75-37b82d000000", - "Body" : "EmptyMetadataKeyThe key for one of the metadata key-value pairs is empty.\nRequestId:dd22274f-4003-0028-0b75-37b82d000000\nTime:2019-07-10T23:18:00.5359517Zbad metadata", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT", + "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://sima.queue.core.windows.net/queue38693e14/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue04921afb/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -47,15 +47,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd222779-4003-0028-2875-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT" + "x-ms-request-id" : "8071d05e-4003-00b9-3603-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue38693e14", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue04921afb", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -63,9 +63,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd222798-4003-0028-4375-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT" + "x-ms-request-id" : "8071d078-4003-00b9-5003-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:02 GMT" } } ], - "variables" : [ "queue38693e14" ] + "variables" : [ "queue04921afb" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/setMetadata.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadata.json similarity index 53% rename from storage/client/queue/src/test/resources/session-records/setMetadata.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadata.json index 5d60ce89a352..4f5b33d48612 100644 --- a/storage/client/queue/src/test/resources/session-records/setMetadata.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadata.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue625780b6", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd2263a4-4003-0028-7675-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT" + "x-ms-request-id" : "80724c9b-4003-00b9-7c03-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } }, { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue625780b6?comp=metadata", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba?comp=metadata", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -28,15 +28,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd2263c0-4003-0028-0f75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT" + "x-ms-request-id" : "80724cc8-4003-00b9-2803-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue625780b6?comp=metadata", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba?comp=metadata", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -47,16 +47,16 @@ "x-ms-approximate-messages-count" : "0", "x-ms-meta-metadata1" : "value1", "StatusCode" : "200", - "x-ms-request-id" : "dd2263d2-4003-0028-2075-37b82d000000", + "x-ms-request-id" : "80724ce7-4003-00b9-4503-47d378000000", "x-ms-meta-metadata2" : "value2", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT" + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue625780b6/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -64,15 +64,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd2263dd-4003-0028-2a75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT" + "x-ms-request-id" : "80724d0c-4003-00b9-6903-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue625780b6", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue228395ba", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -80,9 +80,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd2263ea-4003-0028-3775-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT" + "x-ms-request-id" : "80724d24-4003-00b9-0103-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:39 GMT" } } ], - "variables" : [ "queue625780b6" ] + "variables" : [ "queue228395ba" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/setMetadataQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadataQueueDoesNotExist.json similarity index 55% rename from storage/client/queue/src/test/resources/session-records/setMetadataQueueDoesNotExist.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadataQueueDoesNotExist.json index 4d7536d402ce..2403d75b3cd8 100644 --- a/storage/client/queue/src/test/resources/session-records/setMetadataQueueDoesNotExist.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setMetadataQueueDoesNotExist.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue570099c0?comp=metadata", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue1023979b?comp=metadata", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -13,17 +13,17 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd2260d2-4003-0028-2175-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd2260d2-4003-0028-2175-37b82d000000\nTime:2019-07-10T23:18:38.2057923Z", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT", + "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://sima.queue.core.windows.net/queue570099c0/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue1023979b/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -32,11 +32,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd2260d9-4003-0028-2775-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd2260d9-4003-0028-2775-37b82d000000\nTime:2019-07-10T23:18:38.2538267Z", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT", + "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" : [ "queue570099c0" ] + "variables" : [ "queue1023979b" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/setProperties.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setProperties.json similarity index 67% rename from storage/client/queue/src/test/resources/session-records/setProperties.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/setProperties.json index 3c832f439b70..6788bd49edd8 100644 --- a/storage/client/queue/src/test/resources/session-records/setProperties.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setProperties.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net?restype=service&comp=properties", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -13,17 +13,17 @@ "Cache-Control" : "no-cache", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "0d2906b5-6003-009e-0476-37b6d5000000", + "x-ms-request-id" : "1cdd81c0-e003-0073-8009-4740b5000000", "Body" : "1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse", - "Date" : "Wed, 10 Jul 2019 23:24:47 GMT", + "Date" : "Tue, 30 Jul 2019 19:01:03 GMT", "Content-Type" : "application/xml" } }, { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net?restype=service&comp=properties", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0", + "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" : { @@ -32,15 +32,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "0d2906d0-6003-009e-1a76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:47 GMT" + "x-ms-request-id" : "1cdd81d5-e003-0073-1309-4740b5000000", + "Date" : "Tue, 30 Jul 2019 19:01:03 GMT" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net?restype=service&comp=properties", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -49,17 +49,17 @@ "Cache-Control" : "no-cache", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "0d290712-6003-009e-4e76-37b6d5000000", + "x-ms-request-id" : "1cdd81e5-e003-0073-1d09-4740b5000000", "Body" : "1.0falsetruetruetrue31.0truefalsetrue31.0truefalsetrue3", - "Date" : "Wed, 10 Jul 2019 23:24:47 GMT", + "Date" : "Tue, 30 Jul 2019 19:01:03 GMT", "Content-Type" : "application/xml" } }, { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net?restype=service&comp=properties", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0", + "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" : { @@ -68,15 +68,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "202", - "x-ms-request-id" : "0d290721-6003-009e-5b76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT" + "x-ms-request-id" : "1cdd81eb-e003-0073-2309-4740b5000000", + "Date" : "Tue, 30 Jul 2019 19:01:03 GMT" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net?restype=service&comp=properties", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?restype=service&comp=properties", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -85,17 +85,17 @@ "Cache-Control" : "no-cache", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "0d290739-6003-009e-7076-37b6d5000000", + "x-ms-request-id" : "1cdd81ed-e003-0073-2509-4740b5000000", "Body" : "1.0falsefalsefalsefalse1.0truetruetrue71.0falsefalse", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT", + "Date" : "Tue, 30 Jul 2019 19:01:03 GMT", "Content-Type" : "application/xml" } }, { "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net?prefix=queue49487893&include=&comp=list", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net?prefix=queue30084080&include=&comp=list", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "Transfer-Encoding" : "chunked", @@ -104,11 +104,11 @@ "Cache-Control" : "no-cache", "retry-after" : "0", "StatusCode" : "200", - "x-ms-request-id" : "0d29074d-6003-009e-0176-37b6d5000000", - "Body" : "queue49487893", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT", + "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" : [ "queue49487893" ] + "variables" : [ "queue30084080" ] } \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/setTooManyAccessPolicies.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setTooManyAccessPolicies.json similarity index 54% rename from storage/client/queue/src/test/resources/session-records/setTooManyAccessPolicies.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/setTooManyAccessPolicies.json index adee338b1414..52ffab91ef1e 100644 --- a/storage/client/queue/src/test/resources/session-records/setTooManyAccessPolicies.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/setTooManyAccessPolicies.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue265747a2", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue02682f2a", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -12,15 +12,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "201", - "x-ms-request-id" : "dd22600f-4003-0028-7075-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT" + "x-ms-request-id" : "80724626-4003-00b9-4103-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" } }, { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue265747a2?comp=acl", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue02682f2a?comp=acl", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0", + "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" : { @@ -30,17 +30,17 @@ "retry-after" : "0", "Content-Length" : "294", "StatusCode" : "400", - "x-ms-request-id" : "dd226022-4003-0028-0175-37b82d000000", - "Body" : "InvalidXmlDocumentXML specified is not syntactically valid.\nRequestId:dd226022-4003-0028-0175-37b82d000000\nTime:2019-07-10T23:18:37.6694120Z00", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT", + "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://sima.queue.core.windows.net/queue265747a2/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue02682f2a/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -48,15 +48,15 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd226034-4003-0028-1175-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT" + "x-ms-request-id" : "8072465c-4003-00b9-7603-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" } }, { "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue265747a2", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue02682f2a", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -64,9 +64,9 @@ "retry-after" : "0", "Content-Length" : "0", "StatusCode" : "204", - "x-ms-request-id" : "dd226043-4003-0028-2075-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT" + "x-ms-request-id" : "80724670-4003-00b9-0a03-47d378000000", + "Date" : "Tue, 30 Jul 2019 18:19:37 GMT" } } ], - "variables" : [ "queue265747a2" ] + "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 new file mode 100644 index 000000000000..a0d2027ab04f --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessage.json @@ -0,0 +1,128 @@ +{ + "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 new file mode 100644 index 000000000000..849ea36b90c2 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidMessageId.json @@ -0,0 +1,110 @@ +{ + "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 new file mode 100644 index 000000000000..960abdc79ba2 --- /dev/null +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageInvalidPopReceipt.json @@ -0,0 +1,110 @@ +{ + "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/storage/client/queue/src/test/resources/session-records/updateMessageQueueDoesNotExist.json b/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageQueueDoesNotExist.json similarity index 59% rename from storage/client/queue/src/test/resources/session-records/updateMessageQueueDoesNotExist.json rename to sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageQueueDoesNotExist.json index 9341ea4a7989..b87cef21fed8 100644 --- a/storage/client/queue/src/test/resources/session-records/updateMessageQueueDoesNotExist.json +++ b/sdk/storage/azure-storage-queue/src/test/resources/session-records/updateMessageQueueDoesNotExist.json @@ -1,10 +1,10 @@ { "networkCallRecords" : [ { "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue77530b22/messages/doesn't?popreceipt=exist&visibilitytimeout=5", + "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-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0", + "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" : { @@ -14,17 +14,17 @@ "retry-after" : "0", "Content-Length" : "415", "StatusCode" : "400", - "x-ms-request-id" : "dd2229e1-4003-0028-1475-37b82d000000", - "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:dd2229e1-4003-0028-1475-37b82d000000\nTime:2019-07-10T23:18:01.7878412ZpopreceiptexistInvalid pop receipt format", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT", + "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://sima.queue.core.windows.net/queue77530b22/messages", + "Uri" : "https://azstoragesdkaccount.queue.core.windows.net/queue960895d5/messages", "Headers" : { "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" + "User-Agent" : "azsdk-java-azure-storage-queue/12.0.0-preview.2 1.8.0_201; Windows 10 10.0" }, "Response" : { "x-ms-version" : "2018-03-28", @@ -33,11 +33,11 @@ "retry-after" : "0", "Content-Length" : "217", "StatusCode" : "404", - "x-ms-request-id" : "dd2229fb-4003-0028-2a75-37b82d000000", - "Body" : "QueueNotFoundThe specified queue does not exist.\nRequestId:dd2229fb-4003-0028-2a75-37b82d000000\nTime:2019-07-10T23:18:01.8368763Z", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT", + "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" : [ "queue77530b22" ] + "variables" : [ "queue960895d5" ] } \ No newline at end of file diff --git a/storage/client/queue/swagger/queue.json b/sdk/storage/azure-storage-queue/swagger/queue.json similarity index 98% rename from storage/client/queue/swagger/queue.json rename to sdk/storage/azure-storage-queue/swagger/queue.json index 06155a07afed..977d767b9f84 100644 --- a/storage/client/queue/swagger/queue.json +++ b/sdk/storage/azure-storage-queue/swagger/queue.json @@ -326,6 +326,9 @@ "operationId": "Queue_Create", "description": "creates a new queue under the given account.", "parameters": [ + { + "$ref": "#/parameters/QueueName" + }, { "$ref": "#/parameters/Timeout" }, @@ -401,6 +404,9 @@ "operationId": "Queue_Delete", "description": "operation permanently deletes the specified queue", "parameters": [ + { + "$ref": "#/parameters/QueueName" + }, { "$ref": "#/parameters/Timeout" }, @@ -456,6 +462,9 @@ "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" }, @@ -518,6 +527,9 @@ "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" }, @@ -586,6 +598,9 @@ "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" }, @@ -641,6 +656,9 @@ "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" }, @@ -709,6 +727,9 @@ "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" }, @@ -770,6 +791,9 @@ "operationId": "Messages_Clear", "description": "The Clear operation deletes all messages from the specified queue.", "parameters": [ + { + "$ref": "#/parameters/QueueName" + }, { "$ref": "#/parameters/Timeout" }, @@ -825,6 +849,9 @@ "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" }, @@ -892,6 +919,9 @@ "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" }, @@ -963,6 +993,12 @@ "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" }, @@ -1038,6 +1074,12 @@ "operationId": "MessageId_Delete", "description": "The Delete operation deletes the specified message.", "parameters": [ + { + "$ref": "#/parameters/QueueName" + }, + { + "$ref": "#/parameters/MessageId" + }, { "$ref": "#/parameters/PopReceipt" }, @@ -1432,7 +1474,7 @@ "name": "QueueMessage" } }, - "PeekedMessageItem": { + "PeekedMessage": { "description": "The object returned in the QueueMessageList array when calling Peek Messages on a Queue", "type": "object", "required": [ @@ -1530,7 +1572,7 @@ "description": "The object returned when calling Peek Messages on a Queue", "type": "array", "items": { - "$ref": "#/definitions/PeekedMessageItem", + "$ref": "#/definitions/PeekedMessage", "xml": { "name": "QueueMessage" } @@ -1746,7 +1788,7 @@ "required": true, "type": "string", "x-ms-parameter-location": "method", - "description": "The container name." + "description": "The message ID name." }, "MessageTTL": { "name": "messagettl", diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml new file mode 100644 index 000000000000..a69f0e790a1f --- /dev/null +++ b/sdk/storage/ci.yml @@ -0,0 +1,42 @@ +# 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/storage/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/storage/ + +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: storage + Artifacts: + - name: azure-storage-blob + safeName: azurestorageblob + - name: azure-storage-file + safeName: azurestoragefile + - name: azure-storage-queue + safeName: azurestoragequeue \ No newline at end of file diff --git a/storage/data-plane/.gitignore b/sdk/storage/microsoft-azure-storage-blob/.gitignore similarity index 100% rename from storage/data-plane/.gitignore rename to sdk/storage/microsoft-azure-storage-blob/.gitignore diff --git a/storage/data-plane/.travis.yml b/sdk/storage/microsoft-azure-storage-blob/.travis.yml similarity index 100% rename from storage/data-plane/.travis.yml rename to sdk/storage/microsoft-azure-storage-blob/.travis.yml diff --git a/storage/data-plane/BreakingChanges.txt b/sdk/storage/microsoft-azure-storage-blob/BreakingChanges.txt similarity index 100% rename from storage/data-plane/BreakingChanges.txt rename to sdk/storage/microsoft-azure-storage-blob/BreakingChanges.txt diff --git a/storage/data-plane/CONTRIBUTING.md b/sdk/storage/microsoft-azure-storage-blob/CONTRIBUTING.md similarity index 100% rename from storage/data-plane/CONTRIBUTING.md rename to sdk/storage/microsoft-azure-storage-blob/CONTRIBUTING.md diff --git a/storage/data-plane/ChangeLog.txt b/sdk/storage/microsoft-azure-storage-blob/ChangeLog.txt similarity index 100% rename from storage/data-plane/ChangeLog.txt rename to sdk/storage/microsoft-azure-storage-blob/ChangeLog.txt diff --git a/storage/data-plane/ISSUE_TEMPLATE.md b/sdk/storage/microsoft-azure-storage-blob/ISSUE_TEMPLATE.md similarity index 100% rename from storage/data-plane/ISSUE_TEMPLATE.md rename to sdk/storage/microsoft-azure-storage-blob/ISSUE_TEMPLATE.md diff --git a/storage/data-plane/LICENSE b/sdk/storage/microsoft-azure-storage-blob/LICENSE similarity index 100% rename from storage/data-plane/LICENSE rename to sdk/storage/microsoft-azure-storage-blob/LICENSE diff --git a/storage/data-plane/README.md b/sdk/storage/microsoft-azure-storage-blob/README.md similarity index 100% rename from storage/data-plane/README.md rename to sdk/storage/microsoft-azure-storage-blob/README.md diff --git a/storage/data-plane/pom.xml b/sdk/storage/microsoft-azure-storage-blob/pom.xml similarity index 98% rename from storage/data-plane/pom.xml rename to sdk/storage/microsoft-azure-storage-blob/pom.xml index ef4ccc0aaa71..b852348c1a7e 100644 --- a/storage/data-plane/pom.xml +++ b/sdk/storage/microsoft-azure-storage-blob/pom.xml @@ -10,7 +10,7 @@ com.azure azure-data-sdk-parent 1.1.0 - ../../pom.data.xml + ../../../pom.data.xml com.microsoft.azure diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AccountSASPermission.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AccountSASPermission.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AccountSASPermission.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AccountSASPermission.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AccountSASResourceType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AccountSASResourceType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AccountSASResourceType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AccountSASResourceType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AccountSASService.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AccountSASService.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AccountSASService.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AccountSASService.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AccountSASSignatureValues.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AccountSASSignatureValues.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AccountSASSignatureValues.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AccountSASSignatureValues.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AnonymousCredentials.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AnonymousCredentials.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AnonymousCredentials.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AnonymousCredentials.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AppendBlobAccessConditions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AppendBlobAccessConditions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AppendBlobAccessConditions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AppendBlobAccessConditions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AppendBlobURL.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AppendBlobURL.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/AppendBlobURL.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AppendBlobURL.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlobAccessConditions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobAccessConditions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlobAccessConditions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobAccessConditions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlobListDetails.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobListDetails.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlobListDetails.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobListDetails.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlobRange.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobRange.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlobRange.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobRange.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlobSASPermission.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobSASPermission.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlobSASPermission.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobSASPermission.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlobURL.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobURL.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlobURL.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobURL.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlobURLParts.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobURLParts.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlobURLParts.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobURLParts.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlockBlobURL.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlockBlobURL.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/BlockBlobURL.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlockBlobURL.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/CommonRestResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/CommonRestResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/CommonRestResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/CommonRestResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/Constants.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/Constants.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/Constants.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/Constants.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ContainerAccessConditions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ContainerAccessConditions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ContainerAccessConditions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ContainerAccessConditions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ContainerListDetails.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ContainerListDetails.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ContainerListDetails.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ContainerListDetails.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ContainerSASPermission.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ContainerSASPermission.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ContainerSASPermission.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ContainerSASPermission.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ContainerURL.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ContainerURL.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ContainerURL.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ContainerURL.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/DownloadResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/DownloadResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/DownloadResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/DownloadResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedAppendBlobs.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedAppendBlobs.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedAppendBlobs.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedAppendBlobs.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedBlobs.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedBlobs.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedBlobs.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedBlobs.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedBlockBlobs.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedBlockBlobs.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedBlockBlobs.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedBlockBlobs.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedContainers.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedContainers.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedContainers.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedContainers.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedPageBlobs.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedPageBlobs.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedPageBlobs.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedPageBlobs.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedServices.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedServices.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedServices.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedServices.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedStorageClient.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedStorageClient.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/GeneratedStorageClient.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedStorageClient.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/HTTPGetterInfo.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/HTTPGetterInfo.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/HTTPGetterInfo.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/HTTPGetterInfo.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ICredentials.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ICredentials.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ICredentials.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ICredentials.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/IPRange.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/IPRange.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/IPRange.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/IPRange.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/IProgressReceiver.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/IProgressReceiver.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/IProgressReceiver.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/IProgressReceiver.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ListBlobsOptions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ListBlobsOptions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ListBlobsOptions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ListBlobsOptions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ListContainersOptions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ListContainersOptions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ListContainersOptions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ListContainersOptions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/LoggingFactory.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/LoggingFactory.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/LoggingFactory.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/LoggingFactory.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/LoggingOptions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/LoggingOptions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/LoggingOptions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/LoggingOptions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/Metadata.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/Metadata.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/Metadata.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/Metadata.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/PageBlobAccessConditions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/PageBlobAccessConditions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/PageBlobAccessConditions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/PageBlobAccessConditions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/PageBlobURL.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/PageBlobURL.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/PageBlobURL.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/PageBlobURL.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/PipelineOptions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/PipelineOptions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/PipelineOptions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/PipelineOptions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ProgressReporter.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ProgressReporter.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ProgressReporter.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ProgressReporter.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ReliableDownloadOptions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ReliableDownloadOptions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ReliableDownloadOptions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ReliableDownloadOptions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/RequestIDFactory.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/RequestIDFactory.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/RequestIDFactory.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/RequestIDFactory.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/RequestRetryFactory.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/RequestRetryFactory.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/RequestRetryFactory.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/RequestRetryFactory.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/RequestRetryOptions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/RequestRetryOptions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/RequestRetryOptions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/RequestRetryOptions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/RetryPolicyType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/RetryPolicyType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/RetryPolicyType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/RetryPolicyType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/SASProtocol.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/SASProtocol.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/SASProtocol.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/SASProtocol.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/SASQueryParameters.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/SASQueryParameters.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/SASQueryParameters.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/SASQueryParameters.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/SR.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/SR.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/SR.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/SR.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ServiceSASSignatureValues.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ServiceSASSignatureValues.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ServiceSASSignatureValues.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ServiceSASSignatureValues.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ServiceURL.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ServiceURL.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/ServiceURL.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/ServiceURL.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/SetResponseFieldFactory.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/SetResponseFieldFactory.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/SetResponseFieldFactory.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/SetResponseFieldFactory.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/SharedKeyCredentials.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/SharedKeyCredentials.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/SharedKeyCredentials.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/SharedKeyCredentials.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/StorageException.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/StorageException.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/StorageException.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/StorageException.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/StorageURL.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/StorageURL.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/StorageURL.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/StorageURL.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/TelemetryFactory.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/TelemetryFactory.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/TelemetryFactory.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/TelemetryFactory.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/TelemetryOptions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/TelemetryOptions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/TelemetryOptions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/TelemetryOptions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/TokenCredentials.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/TokenCredentials.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/TokenCredentials.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/TokenCredentials.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/TransferManager.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/TransferManager.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/TransferManager.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/TransferManager.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/TransferManagerDownloadFromBlobOptions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/TransferManagerDownloadFromBlobOptions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/TransferManagerDownloadFromBlobOptions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/TransferManagerDownloadFromBlobOptions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/TransferManagerUploadToBlockBlobOptions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/TransferManagerUploadToBlockBlobOptions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/TransferManagerUploadToBlockBlobOptions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/TransferManagerUploadToBlockBlobOptions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/URLParser.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/URLParser.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/URLParser.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/URLParser.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/UploadFromNRFBufferPool.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/UploadFromNRFBufferPool.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/UploadFromNRFBufferPool.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/UploadFromNRFBufferPool.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/Utility.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/Utility.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/Utility.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/Utility.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/implementation/ListBlobsIncludeItemWrapper.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/implementation/ListBlobsIncludeItemWrapper.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/implementation/ListBlobsIncludeItemWrapper.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/implementation/ListBlobsIncludeItemWrapper.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/implementation/SignedIdentifierWrapper.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/implementation/SignedIdentifierWrapper.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/implementation/SignedIdentifierWrapper.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/implementation/SignedIdentifierWrapper.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/implementation/SignedIdentifiersWrapper.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/implementation/SignedIdentifiersWrapper.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/implementation/SignedIdentifiersWrapper.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/implementation/SignedIdentifiersWrapper.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/implementation/package-info.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/implementation/package-info.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/implementation/package-info.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/implementation/package-info.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AccessPolicy.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AccessPolicy.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AccessPolicy.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AccessPolicy.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AccessTier.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AccessTier.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AccessTier.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AccessTier.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AccountKind.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AccountKind.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AccountKind.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AccountKind.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockFromUrlResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockFromUrlResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockFromUrlResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockFromUrlResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobAppendBlockResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobCreateHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobCreateHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobCreateHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobCreateHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobCreateResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobCreateResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobCreateResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendBlobCreateResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendPositionAccessConditions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendPositionAccessConditions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/AppendPositionAccessConditions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/AppendPositionAccessConditions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ArchiveStatus.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ArchiveStatus.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ArchiveStatus.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ArchiveStatus.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobAbortCopyFromURLResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobAbortCopyFromURLResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobAbortCopyFromURLResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobAbortCopyFromURLResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobAcquireLeaseHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobAcquireLeaseHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobAcquireLeaseHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobAcquireLeaseHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobAcquireLeaseResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobAcquireLeaseResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobAcquireLeaseResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobAcquireLeaseResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobBreakLeaseHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobBreakLeaseHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobBreakLeaseHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobBreakLeaseHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobBreakLeaseResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobBreakLeaseResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobBreakLeaseResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobBreakLeaseResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobChangeLeaseHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobChangeLeaseHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobChangeLeaseHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobChangeLeaseHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobChangeLeaseResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobChangeLeaseResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobChangeLeaseResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobChangeLeaseResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobCopyFromURLHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobCopyFromURLHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobCopyFromURLHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobCopyFromURLHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobCopyFromURLResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobCopyFromURLResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobCopyFromURLResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobCopyFromURLResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobCreateSnapshotHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobCreateSnapshotHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobCreateSnapshotHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobCreateSnapshotHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobCreateSnapshotResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobCreateSnapshotResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobCreateSnapshotResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobCreateSnapshotResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobDeleteHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobDeleteHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobDeleteHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobDeleteHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobDeleteResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobDeleteResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobDeleteResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobDeleteResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobDownloadHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobDownloadHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobDownloadHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobDownloadHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobDownloadResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobDownloadResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobDownloadResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobDownloadResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobFlatListSegment.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobFlatListSegment.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobFlatListSegment.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobFlatListSegment.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetAccountInfoHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetAccountInfoHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetAccountInfoHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetAccountInfoHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetAccountInfoResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetAccountInfoResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetAccountInfoResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetAccountInfoResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetPropertiesHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetPropertiesHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetPropertiesHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetPropertiesHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetPropertiesResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetPropertiesResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetPropertiesResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetPropertiesResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobHTTPHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobHTTPHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobHTTPHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobHTTPHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobHierarchyListSegment.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobHierarchyListSegment.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobHierarchyListSegment.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobHierarchyListSegment.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobItem.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobItem.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobItem.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobItem.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobPrefix.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobPrefix.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobPrefix.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobPrefix.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobProperties.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobProperties.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobProperties.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobProperties.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobReleaseLeaseHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobReleaseLeaseHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobReleaseLeaseHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobReleaseLeaseHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobReleaseLeaseResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobReleaseLeaseResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobReleaseLeaseResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobReleaseLeaseResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobRenewLeaseHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobRenewLeaseHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobRenewLeaseHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobRenewLeaseHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobRenewLeaseResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobRenewLeaseResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobRenewLeaseResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobRenewLeaseResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetHTTPHeadersResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetHTTPHeadersResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetHTTPHeadersResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetHTTPHeadersResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetMetadataHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetMetadataHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetMetadataHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetMetadataHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetMetadataResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetMetadataResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetMetadataResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetMetadataResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetTierHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetTierHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetTierHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetTierHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetTierResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetTierResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetTierResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobSetTierResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobStartCopyFromURLResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobStartCopyFromURLResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobStartCopyFromURLResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobStartCopyFromURLResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobUndeleteHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobUndeleteHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobUndeleteHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobUndeleteHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobUndeleteResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobUndeleteResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlobUndeleteResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobUndeleteResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/Block.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/Block.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/Block.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/Block.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobCommitBlockListResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobCommitBlockListResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobCommitBlockListResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobCommitBlockListResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobGetBlockListResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobGetBlockListResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobGetBlockListResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobGetBlockListResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockFromURLResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockFromURLResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockFromURLResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockFromURLResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobStageBlockResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobUploadHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobUploadHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobUploadHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobUploadHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobUploadResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobUploadResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobUploadResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockBlobUploadResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockList.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockList.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockList.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockList.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockListType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockListType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockListType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockListType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockLookupList.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockLookupList.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/BlockLookupList.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlockLookupList.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ClearRange.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ClearRange.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ClearRange.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ClearRange.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerAcquireLeaseResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerAcquireLeaseResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerAcquireLeaseResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerAcquireLeaseResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerBreakLeaseHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerBreakLeaseHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerBreakLeaseHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerBreakLeaseHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerBreakLeaseResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerBreakLeaseResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerBreakLeaseResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerBreakLeaseResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerChangeLeaseHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerChangeLeaseHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerChangeLeaseHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerChangeLeaseHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerChangeLeaseResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerChangeLeaseResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerChangeLeaseResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerChangeLeaseResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerCreateHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerCreateHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerCreateHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerCreateHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerCreateResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerCreateResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerCreateResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerCreateResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerDeleteHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerDeleteHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerDeleteHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerDeleteHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerDeleteResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerDeleteResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerDeleteResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerDeleteResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccessPolicyResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccessPolicyResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccessPolicyResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccessPolicyResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccountInfoResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccountInfoResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccountInfoResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetAccountInfoResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetPropertiesHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetPropertiesHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetPropertiesHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetPropertiesHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetPropertiesResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetPropertiesResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetPropertiesResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerGetPropertiesResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerItem.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerItem.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerItem.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerItem.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobFlatSegmentResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobFlatSegmentResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobFlatSegmentResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobFlatSegmentResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobHierarchySegmentResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobHierarchySegmentResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobHierarchySegmentResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerListBlobHierarchySegmentResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerProperties.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerProperties.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerProperties.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerProperties.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerReleaseLeaseResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerReleaseLeaseResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerReleaseLeaseResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerReleaseLeaseResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerRenewLeaseHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerRenewLeaseHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerRenewLeaseHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerRenewLeaseHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerRenewLeaseResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerRenewLeaseResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerRenewLeaseResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerRenewLeaseResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetAccessPolicyResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetAccessPolicyResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetAccessPolicyResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetAccessPolicyResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetMetadataHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetMetadataHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetMetadataHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetMetadataHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetMetadataResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetMetadataResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetMetadataResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ContainerSetMetadataResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/CopyStatusType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/CopyStatusType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/CopyStatusType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/CopyStatusType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/CorsRule.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/CorsRule.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/CorsRule.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/CorsRule.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/CustomHierarchicalListingDeserializer.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/CustomHierarchicalListingDeserializer.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/CustomHierarchicalListingDeserializer.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/CustomHierarchicalListingDeserializer.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/DeleteSnapshotsOptionType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/DeleteSnapshotsOptionType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/DeleteSnapshotsOptionType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/DeleteSnapshotsOptionType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/GeoReplication.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/GeoReplication.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/GeoReplication.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/GeoReplication.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/GeoReplicationStatusType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/GeoReplicationStatusType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/GeoReplicationStatusType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/GeoReplicationStatusType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/KeyInfo.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/KeyInfo.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/KeyInfo.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/KeyInfo.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/LeaseAccessConditions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/LeaseAccessConditions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/LeaseAccessConditions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/LeaseAccessConditions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/LeaseDurationType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/LeaseDurationType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/LeaseDurationType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/LeaseDurationType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/LeaseStateType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/LeaseStateType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/LeaseStateType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/LeaseStateType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/LeaseStatusType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/LeaseStatusType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/LeaseStatusType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/LeaseStatusType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ListBlobsIncludeItem.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ListBlobsIncludeItem.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ListBlobsIncludeItem.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ListBlobsIncludeItem.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ListContainersIncludeType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ListContainersIncludeType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ListContainersIncludeType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ListContainersIncludeType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ListContainersSegmentResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ListContainersSegmentResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ListContainersSegmentResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ListContainersSegmentResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/Logging.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/Logging.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/Logging.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/Logging.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/Metrics.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/Metrics.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/Metrics.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/Metrics.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ModifiedAccessConditions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ModifiedAccessConditions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ModifiedAccessConditions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ModifiedAccessConditions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobClearPagesHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobClearPagesHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobClearPagesHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobClearPagesHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobClearPagesResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobClearPagesResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobClearPagesResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobClearPagesResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCopyIncrementalResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCopyIncrementalResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCopyIncrementalResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCopyIncrementalResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCreateHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCreateHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCreateHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCreateHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCreateResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCreateResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCreateResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobCreateResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesDiffResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesDiffResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesDiffResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesDiffResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobGetPageRangesResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobResizeHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobResizeHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobResizeHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobResizeHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobResizeResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobResizeResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobResizeResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobResizeResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUpdateSequenceNumberResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUpdateSequenceNumberResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUpdateSequenceNumberResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUpdateSequenceNumberResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesFromURLResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesFromURLResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesFromURLResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesFromURLResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageBlobUploadPagesResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageList.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageList.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageList.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageList.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageRange.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageRange.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PageRange.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PageRange.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PublicAccessType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PublicAccessType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/PublicAccessType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/PublicAccessType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/RetentionPolicy.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/RetentionPolicy.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/RetentionPolicy.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/RetentionPolicy.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/SequenceNumberAccessConditions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/SequenceNumberAccessConditions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/SequenceNumberAccessConditions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/SequenceNumberAccessConditions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/SequenceNumberActionType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/SequenceNumberActionType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/SequenceNumberActionType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/SequenceNumberActionType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetAccountInfoResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetAccountInfoResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetAccountInfoResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetAccountInfoResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetPropertiesHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetPropertiesHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetPropertiesHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetPropertiesHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetPropertiesResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetPropertiesResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetPropertiesResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetPropertiesResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetStatisticsHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetStatisticsHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetStatisticsHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetStatisticsHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetStatisticsResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetStatisticsResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetStatisticsResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetStatisticsResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetUserDelegationKeyResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetUserDelegationKeyResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetUserDelegationKeyResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceGetUserDelegationKeyResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceListContainersSegmentResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceListContainersSegmentResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceListContainersSegmentResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceListContainersSegmentResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceSetPropertiesHeaders.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceSetPropertiesHeaders.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceSetPropertiesHeaders.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceSetPropertiesHeaders.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceSetPropertiesResponse.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceSetPropertiesResponse.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/ServiceSetPropertiesResponse.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/ServiceSetPropertiesResponse.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/SignedIdentifier.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/SignedIdentifier.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/SignedIdentifier.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/SignedIdentifier.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/SkuName.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/SkuName.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/SkuName.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/SkuName.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/SourceModifiedAccessConditions.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/SourceModifiedAccessConditions.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/SourceModifiedAccessConditions.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/SourceModifiedAccessConditions.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/StaticWebsite.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/StaticWebsite.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/StaticWebsite.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/StaticWebsite.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/StorageError.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/StorageError.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/StorageError.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/StorageError.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/StorageErrorCode.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/StorageErrorCode.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/StorageErrorCode.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/StorageErrorCode.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/StorageErrorException.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/StorageErrorException.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/StorageErrorException.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/StorageErrorException.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/StorageServiceProperties.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/StorageServiceProperties.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/StorageServiceProperties.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/StorageServiceProperties.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/StorageServiceStats.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/StorageServiceStats.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/StorageServiceStats.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/StorageServiceStats.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/SyncCopyStatusType.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/SyncCopyStatusType.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/SyncCopyStatusType.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/SyncCopyStatusType.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/UserDelegationKey.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/UserDelegationKey.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/UserDelegationKey.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/UserDelegationKey.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/package-info.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/package-info.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/models/package-info.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/package-info.java diff --git a/storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/package-info.java b/sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/package-info.java similarity index 100% rename from storage/data-plane/src/main/java/com/microsoft/azure/storage/blob/package-info.java rename to sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/package-info.java diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/APISpec.groovy b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/APISpec.groovy similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/APISpec.groovy rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/APISpec.groovy diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/AppendBlobAPITest.groovy b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/AppendBlobAPITest.groovy similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/AppendBlobAPITest.groovy rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/AppendBlobAPITest.groovy diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/BlobAPITest.groovy b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/BlobAPITest.groovy similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/BlobAPITest.groovy rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/BlobAPITest.groovy diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/BlockBlobAPITest.groovy b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/BlockBlobAPITest.groovy similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/BlockBlobAPITest.groovy rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/BlockBlobAPITest.groovy diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/ContainerAPITest.groovy b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/ContainerAPITest.groovy similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/ContainerAPITest.groovy rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/ContainerAPITest.groovy diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/PageBlobAPITest.groovy b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/PageBlobAPITest.groovy similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/PageBlobAPITest.groovy rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/PageBlobAPITest.groovy diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/Samples.java b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/Samples.java similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/Samples.java rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/Samples.java diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/ServiceAPITest.groovy b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/ServiceAPITest.groovy similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/ServiceAPITest.groovy rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/ServiceAPITest.groovy diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/TransferManagerTest.groovy b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/TransferManagerTest.groovy similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/TransferManagerTest.groovy rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/TransferManagerTest.groovy diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/DownloadResponseMockFlowable.java b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/DownloadResponseMockFlowable.java similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/DownloadResponseMockFlowable.java rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/DownloadResponseMockFlowable.java diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/DownloadResponseTest.groovy b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/DownloadResponseTest.groovy similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/DownloadResponseTest.groovy rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/DownloadResponseTest.groovy diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/HelperTest.groovy b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/HelperTest.groovy similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/HelperTest.groovy rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/HelperTest.groovy diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/LoggingTest.groovy b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/LoggingTest.groovy similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/LoggingTest.groovy rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/LoggingTest.groovy diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/ProgressReporterTest.groovy b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/ProgressReporterTest.groovy similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/ProgressReporterTest.groovy rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/ProgressReporterTest.groovy diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/RequestRetryTestFactory.java b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/RequestRetryTestFactory.java similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/RequestRetryTestFactory.java rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/RequestRetryTestFactory.java diff --git a/storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/RetryTest.groovy b/sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/RetryTest.groovy similarity index 100% rename from storage/data-plane/src/test/java/com/microsoft/azure/storage/blob/RetryTest.groovy rename to sdk/storage/microsoft-azure-storage-blob/src/test/java/com/microsoft/azure/storage/blob/RetryTest.groovy diff --git a/storage/data-plane/swagger/README.md b/sdk/storage/microsoft-azure-storage-blob/swagger/README.md similarity index 100% rename from storage/data-plane/swagger/README.md rename to sdk/storage/microsoft-azure-storage-blob/swagger/README.md diff --git a/storage/data-plane/swagger/generate.bat b/sdk/storage/microsoft-azure-storage-blob/swagger/generate.bat similarity index 100% rename from storage/data-plane/swagger/generate.bat rename to sdk/storage/microsoft-azure-storage-blob/swagger/generate.bat diff --git a/storage/data-plane/tests.yml b/sdk/storage/microsoft-azure-storage-blob/tests.yml similarity index 100% rename from storage/data-plane/tests.yml rename to sdk/storage/microsoft-azure-storage-blob/tests.yml diff --git a/sdk/storage/pom.service.xml b/sdk/storage/pom.service.xml new file mode 100644 index 000000000000..0eb4b65c2f10 --- /dev/null +++ b/sdk/storage/pom.service.xml @@ -0,0 +1,19 @@ + + + 4.0.0 + com.azure + azure-storage-service + pom + 1.0.0 + + + ../core/azure-core + ../core/azure-core-test + azure-storage-blob + azure-storage-file + azure-storage-queue + + diff --git a/storage/client/tests.yml b/sdk/storage/tests.yml similarity index 80% rename from storage/client/tests.yml rename to sdk/storage/tests.yml index 5e0fa24fa24b..846f46380ee6 100644 --- a/storage/client/tests.yml +++ b/sdk/storage/tests.yml @@ -1,11 +1,9 @@ trigger: none jobs: - # When migrating change path to ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests-pre-sdk.yml + - template: ../../eng/pipelines/templates/jobs/archetype-sdk-tests.yml parameters: - # When migrating use ServiceDirectory - PomFilePath: './storage/client/pom.xml' + ServiceDirectory: storage EnvVars: AZURE_TEST_MODE: RECORD MICROSOFT_AD_TENANT_ID: $(microsoft-active-directory-tenant-id) diff --git a/sdk/tracing/README.md b/sdk/tracing/README.md index 63e6bf28991f..2dcebf573318 100644 --- a/sdk/tracing/README.md +++ b/sdk/tracing/README.md @@ -1,4 +1,5 @@ # Azure Tracing client library for Java +This package contains the OpenTelemetry tracing plugin for Azure SDK Java libraries. ## Getting started @@ -11,3 +12,8 @@ ## Next steps ## Contributing +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. diff --git a/sdk/tracing/ci.yml b/sdk/tracing/ci.yml index 1c4f92929adc..02de6fb1c6ef 100644 --- a/sdk/tracing/ci.yml +++ b/sdk/tracing/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/tracing/ @@ -13,11 +22,17 @@ pr: branches: include: - master + - feature/* + - hotfix/* + - release/* paths: include: - sdk/tracing/ -jobs: - - template: ../../eng/pipelines/templates/jobs/archetype-sdk-client.yml +stages: + - template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml parameters: - ServiceDirectory: tracing \ No newline at end of file + ServiceDirectory: tracing + Artifacts: + - name: tracing-opentelemetry + safeName: tracingopentelemetry \ No newline at end of file diff --git a/sdk/tracing/pom.service.xml b/sdk/tracing/pom.service.xml index 92161704851c..3412e5555ca1 100644 --- a/sdk/tracing/pom.service.xml +++ b/sdk/tracing/pom.service.xml @@ -9,6 +9,6 @@ pom 1.0.0 - azure-tracing-opentelemetry + tracing-opentelemetry diff --git a/sdk/tracing/pom.xml b/sdk/tracing/pom.xml deleted file mode 100644 index 2850e2f2a63b..000000000000 --- a/sdk/tracing/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - 4.0.0 - - - com.azure - azure-client-sdk-parent - 1.1.0 - ../../pom.client.xml - - - com.azure - tracing-parent - 1.0.0-SNAPSHOT - pom - - Microsoft Azure tracing plugins parent - This module contains child plugins for various tracing libraries for use in the Java client libraries. - 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 - - - - UTF-8 - - - - - - microsoft - Microsoft - - - - - - azure-java-build-docs - ${site.url}/site/${project.artifactId} - - - - - azure-tracing-opentelemetry - - diff --git a/sdk/tracing/tracing-opentelemetry/CHANGELOG.md b/sdk/tracing/tracing-opentelemetry/CHANGELOG.md new file mode 100644 index 000000000000..b23006fe5f56 --- /dev/null +++ b/sdk/tracing/tracing-opentelemetry/CHANGELOG.md @@ -0,0 +1,5 @@ +## Version 1.0.0-preview.1: + +Version 1.0.0-preview.1 is the first preview of our efforts to provide low level interfaces and helper methods to support tracing for Java client libraries. This library includes [OpenTelemetry](https://opentelemetry.io/) implementation of the interface, + For more information about this, and preview releases of other Azure SDK libraries, please visit +https://aka.ms/azure-sdk-preview2-java. diff --git a/sdk/tracing/azure-tracing-opentelemetry/README.md b/sdk/tracing/tracing-opentelemetry/README.md similarity index 100% rename from sdk/tracing/azure-tracing-opentelemetry/README.md rename to sdk/tracing/tracing-opentelemetry/README.md diff --git a/sdk/tracing/azure-tracing-opentelemetry/pom.xml b/sdk/tracing/tracing-opentelemetry/pom.xml similarity index 86% rename from sdk/tracing/azure-tracing-opentelemetry/pom.xml rename to sdk/tracing/tracing-opentelemetry/pom.xml index 7f52193bfeaf..08841f561959 100644 --- a/sdk/tracing/azure-tracing-opentelemetry/pom.xml +++ b/sdk/tracing/tracing-opentelemetry/pom.xml @@ -5,14 +5,14 @@ 4.0.0 com.azure - tracing-parent - 1.0.0-SNAPSHOT - ../pom.xml + azure-client-sdk-parent + 1.2.0 + ../../../pom.client.xml com.azure tracing-opentelemetry - 1.0.0-SNAPSHOT + 1.0.0-preview.1 Microsoft Azure OpenTelemetry tracing plugin This package contains the OpenTelemetry tracing plugin for Azure client libraries. @@ -35,7 +35,7 @@ com.azure azure-core - 1.0.0-preview.1 + 1.0.0-preview.3 io.opencensus diff --git a/sdk/tracing/azure-tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/HttpTraceUtil.java b/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/HttpTraceUtil.java similarity index 100% rename from sdk/tracing/azure-tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/HttpTraceUtil.java rename to sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/HttpTraceUtil.java diff --git a/sdk/tracing/azure-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 similarity index 100% rename from sdk/tracing/azure-tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/OpenTelemetryHttpPolicy.java rename to sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/OpenTelemetryHttpPolicy.java diff --git a/sdk/tracing/azure-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 similarity index 91% rename from sdk/tracing/azure-tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/OpenTelemetryTracer.java rename to sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/OpenTelemetryTracer.java index a656b07066d3..5d6058a6ecde 100644 --- a/sdk/tracing/azure-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 @@ -49,14 +49,14 @@ public void end(int responseCode, Throwable throwable, Context context) { span.end(); } else { - logger.asWarning().log("Failed to find span to end it."); + logger.warning("Failed to find span to end it."); } } @Override public void setAttribute(String key, String value, Context context) { if (ImplUtils.isNullOrEmpty(value)) { - logger.asInfo().log("Failed to set span attribute since value is null or empty."); + logger.info("Failed to set span attribute since value is null or empty."); return; } @@ -65,7 +65,7 @@ public void setAttribute(String key, String value, Context context) { Span span = (Span) spanOptional.get(); span.putAttribute(key, AttributeValue.stringAttributeValue(value)); } else { - logger.asWarning().log("Failed to find span to add attribute."); + logger.warning("Failed to find span to add attribute."); } } diff --git a/sdk/tracing/azure-tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/package-info.java b/sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/package-info.java similarity index 100% rename from sdk/tracing/azure-tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/package-info.java rename to sdk/tracing/tracing-opentelemetry/src/main/java/com/azure/tracing/opentelemetry/package-info.java diff --git a/sdk/tracing/azure-tracing-opentelemetry/src/main/resources/META-INF/services/com.azure.core.implementation.http.policy.spi.AfterRetryPolicyProvider b/sdk/tracing/tracing-opentelemetry/src/main/resources/META-INF/services/com.azure.core.implementation.http.policy.spi.AfterRetryPolicyProvider similarity index 100% rename from sdk/tracing/azure-tracing-opentelemetry/src/main/resources/META-INF/services/com.azure.core.implementation.http.policy.spi.AfterRetryPolicyProvider rename to sdk/tracing/tracing-opentelemetry/src/main/resources/META-INF/services/com.azure.core.implementation.http.policy.spi.AfterRetryPolicyProvider diff --git a/sdk/tracing/azure-tracing-opentelemetry/src/main/resources/META-INF/services/com.azure.core.implementation.tracing.Tracer b/sdk/tracing/tracing-opentelemetry/src/main/resources/META-INF/services/com.azure.core.implementation.tracing.Tracer similarity index 100% rename from sdk/tracing/azure-tracing-opentelemetry/src/main/resources/META-INF/services/com.azure.core.implementation.tracing.Tracer rename to sdk/tracing/tracing-opentelemetry/src/main/resources/META-INF/services/com.azure.core.implementation.tracing.Tracer diff --git a/signalr/resource-manager/v2018_10_01/pom.xml b/signalr/resource-manager/v2018_10_01/pom.xml new file mode 100644 index 000000000000..f2043a6e02be --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.signalr.v2018_10_01 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-signalr + 1.0.0-beta + jar + Microsoft Azure SDK for SignalRService Management + This package contains Microsoft SignalRService 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/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/Dimension.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/Dimension.java new file mode 100644 index 000000000000..738629168dc7 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/Dimension.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.signalr.v2018_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifications of the Dimension of metrics. + */ +public class Dimension { + /** + * The public facing name of the dimension. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Localized friendly display name of the dimension. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Name of the dimension as it appears in MDM. + */ + @JsonProperty(value = "internalName") + private String internalName; + + /** + * A Boolean flag indicating whether this dimension should be included for + * the shoebox export scenario. + */ + @JsonProperty(value = "toBeExportedForShoebox") + private Boolean toBeExportedForShoebox; + + /** + * Get the public facing name of the dimension. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the public facing name of the dimension. + * + * @param name the name value to set + * @return the Dimension object itself. + */ + public Dimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get localized friendly display name of the dimension. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set localized friendly display name of the dimension. + * + * @param displayName the displayName value to set + * @return the Dimension object itself. + */ + public Dimension withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get name of the dimension as it appears in MDM. + * + * @return the internalName value + */ + public String internalName() { + return this.internalName; + } + + /** + * Set name of the dimension as it appears in MDM. + * + * @param internalName the internalName value to set + * @return the Dimension object itself. + */ + public Dimension withInternalName(String internalName) { + this.internalName = internalName; + return this; + } + + /** + * Get a Boolean flag indicating whether this dimension should be included for the shoebox export scenario. + * + * @return the toBeExportedForShoebox value + */ + public Boolean toBeExportedForShoebox() { + return this.toBeExportedForShoebox; + } + + /** + * Set a Boolean flag indicating whether this dimension should be included for the shoebox export scenario. + * + * @param toBeExportedForShoebox the toBeExportedForShoebox value to set + * @return the Dimension object itself. + */ + public Dimension withToBeExportedForShoebox(Boolean toBeExportedForShoebox) { + this.toBeExportedForShoebox = toBeExportedForShoebox; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/KeyType.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/KeyType.java new file mode 100644 index 000000000000..c777183b2036 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/KeyType.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.signalr.v2018_10_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for KeyType. + */ +public final class KeyType extends ExpandableStringEnum { + /** Static value Primary for KeyType. */ + public static final KeyType PRIMARY = fromString("Primary"); + + /** Static value Secondary for KeyType. */ + public static final KeyType SECONDARY = fromString("Secondary"); + + /** + * Creates or finds a KeyType from its string representation. + * @param name a name to look for + * @return the corresponding KeyType + */ + @JsonCreator + public static KeyType fromString(String name) { + return fromString(name, KeyType.class); + } + + /** + * @return known KeyType values + */ + public static Collection values() { + return values(KeyType.class); + } +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/MetricSpecification.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/MetricSpecification.java new file mode 100644 index 000000000000..2dbdc5777158 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/MetricSpecification.java @@ -0,0 +1,237 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.signalr.v2018_10_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Specifications of the Metrics for Azure Monitoring. + */ +public class MetricSpecification { + /** + * Name of the metric. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Localized friendly display name of the metric. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Localized friendly description of the metric. + */ + @JsonProperty(value = "displayDescription") + private String displayDescription; + + /** + * The unit that makes sense for the metric. + */ + @JsonProperty(value = "unit") + private String unit; + + /** + * Only provide one value for this field. Valid values: Average, Minimum, + * Maximum, Total, Count. + */ + @JsonProperty(value = "aggregationType") + private String aggregationType; + + /** + * Optional. If set to true, then zero will be returned for time duration + * where no metric is emitted/published. + * Ex. a metric that returns the number of times a particular error code + * was emitted. The error code may not appear + * often, instead of the RP publishing 0, Shoebox can auto fill in 0s for + * time periods where nothing was emitted. + */ + @JsonProperty(value = "fillGapWithZero") + private String fillGapWithZero; + + /** + * The name of the metric category that the metric belongs to. A metric can + * only belong to a single category. + */ + @JsonProperty(value = "category") + private String category; + + /** + * The dimensions of the metrics. + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /** + * Get name of the metric. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the metric. + * + * @param name the name value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get localized friendly display name of the metric. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set localized friendly display name of the metric. + * + * @param displayName the displayName value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get localized friendly description of the metric. + * + * @return the displayDescription value + */ + public String displayDescription() { + return this.displayDescription; + } + + /** + * Set localized friendly description of the metric. + * + * @param displayDescription the displayDescription value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDisplayDescription(String displayDescription) { + this.displayDescription = displayDescription; + return this; + } + + /** + * Get the unit that makes sense for the metric. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit that makes sense for the metric. + * + * @param unit the unit value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. + * + * @return the aggregationType value + */ + public String aggregationType() { + return this.aggregationType; + } + + /** + * Set only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. + * + * @param aggregationType the aggregationType value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withAggregationType(String aggregationType) { + this.aggregationType = aggregationType; + return this; + } + + /** + * Get optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. + Ex. a metric that returns the number of times a particular error code was emitted. The error code may not appear + often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where nothing was emitted. + * + * @return the fillGapWithZero value + */ + public String fillGapWithZero() { + return this.fillGapWithZero; + } + + /** + * Set optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. + Ex. a metric that returns the number of times a particular error code was emitted. The error code may not appear + often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where nothing was emitted. + * + * @param fillGapWithZero the fillGapWithZero value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withFillGapWithZero(String fillGapWithZero) { + this.fillGapWithZero = fillGapWithZero; + return this; + } + + /** + * Get the name of the metric category that the metric belongs to. A metric can only belong to a single category. + * + * @return the category value + */ + public String category() { + return this.category; + } + + /** + * Set the name of the metric category that the metric belongs to. A metric can only belong to a single category. + * + * @param category the category value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get the dimensions of the metrics. + * + * @return the dimensions value + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions of the metrics. + * + * @param dimensions the dimensions value to set + * @return the MetricSpecification object itself. + */ + public MetricSpecification withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/NameAvailability.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/NameAvailability.java new file mode 100644 index 000000000000..001917819772 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/NameAvailability.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.signalr.v2018_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.signalr.v2018_10_01.implementation.SignalRManager; +import com.microsoft.azure.management.signalr.v2018_10_01.implementation.NameAvailabilityInner; + +/** + * Type representing NameAvailability. + */ +public interface NameAvailability extends HasInner, HasManager { + /** + * @return the message value. + */ + String message(); + + /** + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * @return the reason value. + */ + String reason(); + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/NameAvailabilityParameters.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/NameAvailabilityParameters.java new file mode 100644 index 000000000000..6d0d76d1f5d6 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/NameAvailabilityParameters.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.signalr.v2018_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Data POST-ed to the nameAvailability action. + */ +public class NameAvailabilityParameters { + /** + * The resource type. Should be always "Microsoft.SignalRService/SignalR". + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * The SignalR service name to validate. e.g."my-signalR-name-here". + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the resource type. Should be always "Microsoft.SignalRService/SignalR". + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the resource type. Should be always "Microsoft.SignalRService/SignalR". + * + * @param type the type value to set + * @return the NameAvailabilityParameters object itself. + */ + public NameAvailabilityParameters withType(String type) { + this.type = type; + return this; + } + + /** + * Get the SignalR service name to validate. e.g."my-signalR-name-here". + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the SignalR service name to validate. e.g."my-signalR-name-here". + * + * @param name the name value to set + * @return the NameAvailabilityParameters object itself. + */ + public NameAvailabilityParameters withName(String name) { + this.name = name; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/Operation.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/Operation.java new file mode 100644 index 000000000000..04fb47e406b7 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/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.signalr.v2018_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.signalr.v2018_10_01.implementation.SignalRManager; +import com.microsoft.azure.management.signalr.v2018_10_01.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. + */ + OperationProperties properties(); + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/OperationDisplay.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/OperationDisplay.java new file mode 100644 index 000000000000..3c907bb1251a --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_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.signalr.v2018_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that describes a operation. + */ +public class OperationDisplay { + /** + * Friendly name of the resource provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource type on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * The localized friendly name for the operation. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * The localized friendly description for the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get friendly name of the resource provider. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set friendly name of the resource provider. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource type on which the operation is performed. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource type on which the operation is performed. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the localized friendly name for the operation. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set the localized friendly name for the operation. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the localized friendly description for the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the localized friendly description for 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/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/OperationProperties.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/OperationProperties.java new file mode 100644 index 000000000000..cf8e26d552cf --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/OperationProperties.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.signalr.v2018_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Extra Operation properties. + */ +public class OperationProperties { + /** + * The service specifications. + */ + @JsonProperty(value = "serviceSpecification") + private ServiceSpecification serviceSpecification; + + /** + * Get the service specifications. + * + * @return the serviceSpecification value + */ + public ServiceSpecification serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Set the service specifications. + * + * @param serviceSpecification the serviceSpecification value to set + * @return the OperationProperties object itself. + */ + public OperationProperties withServiceSpecification(ServiceSpecification serviceSpecification) { + this.serviceSpecification = serviceSpecification; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/Operations.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/Operations.java new file mode 100644 index 000000000000..a2578ae3c1bd --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_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.signalr.v2018_10_01; + +import rx.Observable; +import com.microsoft.azure.management.signalr.v2018_10_01.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available REST API operations of the Microsoft.SignalRService provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/ProvisioningState.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/ProvisioningState.java new file mode 100644 index 000000000000..7690d6b0f0f4 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/ProvisioningState.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.signalr.v2018_10_01; + +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 Unknown for ProvisioningState. */ + public static final ProvisioningState UNKNOWN = fromString("Unknown"); + + /** 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 Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** 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 Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** 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/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/RegenerateKeyParameters.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/RegenerateKeyParameters.java new file mode 100644 index 000000000000..d619d17aa442 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/RegenerateKeyParameters.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.signalr.v2018_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters describes the request to regenerate access keys. + */ +public class RegenerateKeyParameters { + /** + * The keyType to regenerate. Must be either 'primary' or + * 'secondary'(case-insensitive). Possible values include: 'Primary', + * 'Secondary'. + */ + @JsonProperty(value = "keyType") + private KeyType keyType; + + /** + * Get the keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary'. + * + * @return the keyType value + */ + public KeyType keyType() { + return this.keyType; + } + + /** + * Set the keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary'. + * + * @param keyType the keyType value to set + * @return the RegenerateKeyParameters object itself. + */ + public RegenerateKeyParameters withKeyType(KeyType keyType) { + this.keyType = keyType; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/ResourceSku.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/ResourceSku.java new file mode 100644 index 000000000000..24b062966cb5 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/ResourceSku.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.signalr.v2018_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The billing information of the SignalR resource. + */ +public class ResourceSku { + /** + * The name of the SKU. Required. + * + * Allowed values: Standard_S1, Free_F1. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Optional tier of this particular SKU. 'Standard' or 'Free'. + * + * `Basic` is deprecated, use `Standard` instead. Possible values include: + * 'Free', 'Basic', 'Standard', 'Premium'. + */ + @JsonProperty(value = "tier") + private SignalRSkuTier tier; + + /** + * Optional string. For future use. + */ + @JsonProperty(value = "size") + private String size; + + /** + * Optional string. For future use. + */ + @JsonProperty(value = "family") + private String family; + + /** + * Optional, integer. The unit count of SignalR resource. 1 by default. + * + * If present, following values are allowed: + * Free: 1 + * Standard: 1,2,5,10,20,50,100. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name of the SKU. Required. + Allowed values: Standard_S1, Free_F1. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the SKU. Required. + Allowed values: Standard_S1, Free_F1. + * + * @param name the name value to set + * @return the ResourceSku object itself. + */ + public ResourceSku withName(String name) { + this.name = name; + return this; + } + + /** + * Get optional tier of this particular SKU. 'Standard' or 'Free'. + `Basic` is deprecated, use `Standard` instead. Possible values include: 'Free', 'Basic', 'Standard', 'Premium'. + * + * @return the tier value + */ + public SignalRSkuTier tier() { + return this.tier; + } + + /** + * Set optional tier of this particular SKU. 'Standard' or 'Free'. + `Basic` is deprecated, use `Standard` instead. Possible values include: 'Free', 'Basic', 'Standard', 'Premium'. + * + * @param tier the tier value to set + * @return the ResourceSku object itself. + */ + public ResourceSku withTier(SignalRSkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Get optional string. For future use. + * + * @return the size value + */ + public String size() { + return this.size; + } + + /** + * Set optional string. For future use. + * + * @param size the size value to set + * @return the ResourceSku object itself. + */ + public ResourceSku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get optional string. For future use. + * + * @return the family value + */ + public String family() { + return this.family; + } + + /** + * Set optional string. For future use. + * + * @param family the family value to set + * @return the ResourceSku object itself. + */ + public ResourceSku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get optional, integer. The unit count of SignalR resource. 1 by default. + If present, following values are allowed: + Free: 1 + Standard: 1,2,5,10,20,50,100. + * + * @return the capacity value + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set optional, integer. The unit count of SignalR resource. 1 by default. + If present, following values are allowed: + Free: 1 + Standard: 1,2,5,10,20,50,100. + * + * @param capacity the capacity value to set + * @return the ResourceSku object itself. + */ + public ResourceSku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/ServiceSpecification.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/ServiceSpecification.java new file mode 100644 index 000000000000..91198028db82 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/ServiceSpecification.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.signalr.v2018_10_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * An object that describes a specification. + */ +public class ServiceSpecification { + /** + * Specifications of the Metrics for Azure Monitoring. + */ + @JsonProperty(value = "metricSpecifications") + private List metricSpecifications; + + /** + * Get specifications of the Metrics for Azure Monitoring. + * + * @return the metricSpecifications value + */ + public List metricSpecifications() { + return this.metricSpecifications; + } + + /** + * Set specifications of the Metrics for Azure Monitoring. + * + * @param metricSpecifications the metricSpecifications value to set + * @return the ServiceSpecification object itself. + */ + public ServiceSpecification withMetricSpecifications(List metricSpecifications) { + this.metricSpecifications = metricSpecifications; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRCorsSettings.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRCorsSettings.java new file mode 100644 index 000000000000..64171bec8e9f --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRCorsSettings.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.signalr.v2018_10_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cross-Origin Resource Sharing (CORS) settings. + */ +public class SignalRCorsSettings { + /** + * Gets or sets the list of origins that should be allowed to make + * cross-origin calls (for example: http://example.com:12345). Use "*" to + * allow all. If omitted, allow all by default. + */ + @JsonProperty(value = "allowedOrigins") + private List allowedOrigins; + + /** + * Get gets or sets the list of origins that should be allowed to make cross-origin calls (for example: http://example.com:12345). Use "*" to allow all. If omitted, allow all by default. + * + * @return the allowedOrigins value + */ + public List allowedOrigins() { + return this.allowedOrigins; + } + + /** + * Set gets or sets the list of origins that should be allowed to make cross-origin calls (for example: http://example.com:12345). Use "*" to allow all. If omitted, allow all by default. + * + * @param allowedOrigins the allowedOrigins value to set + * @return the SignalRCorsSettings object itself. + */ + public SignalRCorsSettings withAllowedOrigins(List allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRCreateOrUpdateProperties.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRCreateOrUpdateProperties.java new file mode 100644 index 000000000000..ee94beb048dc --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRCreateOrUpdateProperties.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.signalr.v2018_10_01; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Settings used to provision or configure the resource. + */ +public class SignalRCreateOrUpdateProperties { + /** + * Prefix for the hostName of the SignalR service. Retained for future use. + * The hostname will be of format: + * &lt;hostNamePrefix&gt;.service.signalr.net. + */ + @JsonProperty(value = "hostNamePrefix") + private String hostNamePrefix; + + /** + * List of SignalR featureFlags. e.g. ServiceMode. + * + * FeatureFlags that are not included in the parameters for the update + * operation will not be modified. + * And the response will only include featureFlags that are explicitly set. + * When a featureFlag is not explicitly set, SignalR service will use its + * globally default value. + * But keep in mind, the default value doesn't mean "false". It varies in + * terms of different FeatureFlags. + */ + @JsonProperty(value = "features") + private List features; + + /** + * Cross-Origin Resource Sharing (CORS) settings. + */ + @JsonProperty(value = "cors") + private SignalRCorsSettings cors; + + /** + * Get prefix for the hostName of the SignalR service. Retained for future use. + The hostname will be of format: &lt;hostNamePrefix&gt;.service.signalr.net. + * + * @return the hostNamePrefix value + */ + public String hostNamePrefix() { + return this.hostNamePrefix; + } + + /** + * Set prefix for the hostName of the SignalR service. Retained for future use. + The hostname will be of format: &lt;hostNamePrefix&gt;.service.signalr.net. + * + * @param hostNamePrefix the hostNamePrefix value to set + * @return the SignalRCreateOrUpdateProperties object itself. + */ + public SignalRCreateOrUpdateProperties withHostNamePrefix(String hostNamePrefix) { + this.hostNamePrefix = hostNamePrefix; + return this; + } + + /** + * Get list of SignalR featureFlags. e.g. ServiceMode. + FeatureFlags that are not included in the parameters for the update operation will not be modified. + And the response will only include featureFlags that are explicitly set. + When a featureFlag is not explicitly set, SignalR service will use its globally default value. + But keep in mind, the default value doesn't mean "false". It varies in terms of different FeatureFlags. + * + * @return the features value + */ + public List features() { + return this.features; + } + + /** + * Set list of SignalR featureFlags. e.g. ServiceMode. + FeatureFlags that are not included in the parameters for the update operation will not be modified. + And the response will only include featureFlags that are explicitly set. + When a featureFlag is not explicitly set, SignalR service will use its globally default value. + But keep in mind, the default value doesn't mean "false". It varies in terms of different FeatureFlags. + * + * @param features the features value to set + * @return the SignalRCreateOrUpdateProperties object itself. + */ + public SignalRCreateOrUpdateProperties withFeatures(List features) { + this.features = features; + return this; + } + + /** + * Get cross-Origin Resource Sharing (CORS) settings. + * + * @return the cors value + */ + public SignalRCorsSettings cors() { + return this.cors; + } + + /** + * Set cross-Origin Resource Sharing (CORS) settings. + * + * @param cors the cors value to set + * @return the SignalRCreateOrUpdateProperties object itself. + */ + public SignalRCreateOrUpdateProperties withCors(SignalRCorsSettings cors) { + this.cors = cors; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRCreateParameters.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRCreateParameters.java new file mode 100644 index 000000000000..e73f20492c62 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRCreateParameters.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.signalr.v2018_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for SignalR service create/update operation. + * + * Keep the same schema as AzSignalR.Models.SignalRResource. + */ +public class SignalRCreateParameters extends SignalRUpdateParameters { + /** + * Azure GEO region: e.g. West US | East US | North Central US | South + * Central US | West Europe | North Europe | East Asia | Southeast Asia | + * etc. + * The geo region of a resource never changes after it is created. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Get azure GEO region: e.g. West US | East US | North Central US | South Central US | West Europe | North Europe | East Asia | Southeast Asia | etc. + The geo region of a resource never changes after it is created. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set azure GEO region: e.g. West US | East US | North Central US | South Central US | West Europe | North Europe | East Asia | Southeast Asia | etc. + The geo region of a resource never changes after it is created. + * + * @param location the location value to set + * @return the SignalRCreateParameters object itself. + */ + public SignalRCreateParameters withLocation(String location) { + this.location = location; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRFeature.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRFeature.java new file mode 100644 index 000000000000..5c30b34c063d --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRFeature.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.signalr.v2018_10_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Feature of a SignalR resource, which controls the SignalR runtime behavior. + */ +public class SignalRFeature { + /** + * Kind of feature. Required. + */ + @JsonProperty(value = "flag", required = true) + private String flag; + + /** + * Value of the feature flag. See Azure SignalR service document + * https://docs.microsoft.com/en-us/azure/azure-signalr/ for allowed + * values. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Optional properties related to this feature. + */ + @JsonProperty(value = "properties") + private Map properties; + + /** + * Creates an instance of SignalRFeature class. + * @param value value of the feature flag. See Azure SignalR service document https://docs.microsoft.com/en-us/azure/azure-signalr/ for allowed values. + */ + public SignalRFeature() { + flag = "ServiceMode"; + } + + /** + * Get kind of feature. Required. + * + * @return the flag value + */ + public String flag() { + return this.flag; + } + + /** + * Set kind of feature. Required. + * + * @param flag the flag value to set + * @return the SignalRFeature object itself. + */ + public SignalRFeature withFlag(String flag) { + this.flag = flag; + return this; + } + + /** + * Get value of the feature flag. See Azure SignalR service document https://docs.microsoft.com/en-us/azure/azure-signalr/ for allowed values. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set value of the feature flag. See Azure SignalR service document https://docs.microsoft.com/en-us/azure/azure-signalr/ for allowed values. + * + * @param value the value value to set + * @return the SignalRFeature object itself. + */ + public SignalRFeature withValue(String value) { + this.value = value; + return this; + } + + /** + * Get optional properties related to this feature. + * + * @return the properties value + */ + public Map properties() { + return this.properties; + } + + /** + * Set optional properties related to this feature. + * + * @param properties the properties value to set + * @return the SignalRFeature object itself. + */ + public SignalRFeature withProperties(Map properties) { + this.properties = properties; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRKeys.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRKeys.java new file mode 100644 index 000000000000..4db36385894f --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRKeys.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.signalr.v2018_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.signalr.v2018_10_01.implementation.SignalRManager; +import com.microsoft.azure.management.signalr.v2018_10_01.implementation.SignalRKeysInner; + +/** + * Type representing SignalRKeys. + */ +public interface SignalRKeys extends HasInner, HasManager { + /** + * @return the primaryConnectionString value. + */ + String primaryConnectionString(); + + /** + * @return the primaryKey value. + */ + String primaryKey(); + + /** + * @return the secondaryConnectionString value. + */ + String secondaryConnectionString(); + + /** + * @return the secondaryKey value. + */ + String secondaryKey(); + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRResource.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRResource.java new file mode 100644 index 000000000000..cc3089b85072 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRResource.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.signalr.v2018_10_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.signalr.v2018_10_01.implementation.SignalRManager; +import java.util.List; +import com.microsoft.azure.management.signalr.v2018_10_01.implementation.SignalRResourceInner; + +/** + * Type representing SignalRResource. + */ +public interface SignalRResource extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the cors value. + */ + SignalRCorsSettings cors(); + + /** + * @return the externalIP value. + */ + String externalIP(); + + /** + * @return the features value. + */ + List features(); + + /** + * @return the hostName value. + */ + String hostName(); + + /** + * @return the hostNamePrefix value. + */ + String hostNamePrefix(); + + /** + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * @return the publicPort value. + */ + Integer publicPort(); + + /** + * @return the serverPort value. + */ + Integer serverPort(); + + /** + * @return the sku value. + */ + ResourceSku sku(); + + /** + * @return the version value. + */ + String version(); + + /** + * The entirety of the SignalRResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of SignalRResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SignalRResource definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the SignalRResource definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the signalrresource definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Settings used to provision or configure the resource + * @return the next definition stage + */ + WithCreate withProperties(SignalRCreateOrUpdateProperties properties); + } + + /** + * The stage of the signalrresource definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The billing information of the resource.(e.g. basic vs. standard) + * @return the next definition stage + */ + WithCreate withSku(ResourceSku 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, Resource.DefinitionWithTags, DefinitionStages.WithProperties, DefinitionStages.WithSku { + } + } + /** + * The template for a SignalRResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithProperties, UpdateStages.WithSku { + } + + /** + * Grouping of SignalRResource update stages. + */ + interface UpdateStages { + /** + * The stage of the signalrresource update allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties Settings used to provision or configure the resource + * @return the next update stage + */ + Update withProperties(SignalRCreateOrUpdateProperties properties); + } + + /** + * The stage of the signalrresource update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The billing information of the resource.(e.g. basic vs. standard) + * @return the next update stage + */ + Update withSku(ResourceSku sku); + } + + } +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRSkuTier.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRSkuTier.java new file mode 100644 index 000000000000..420bd3513753 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRSkuTier.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.signalr.v2018_10_01; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SignalRSkuTier. + */ +public final class SignalRSkuTier extends ExpandableStringEnum { + /** Static value Free for SignalRSkuTier. */ + public static final SignalRSkuTier FREE = fromString("Free"); + + /** Static value Basic for SignalRSkuTier. */ + public static final SignalRSkuTier BASIC = fromString("Basic"); + + /** Static value Standard for SignalRSkuTier. */ + public static final SignalRSkuTier STANDARD = fromString("Standard"); + + /** Static value Premium for SignalRSkuTier. */ + public static final SignalRSkuTier PREMIUM = fromString("Premium"); + + /** + * Creates or finds a SignalRSkuTier from its string representation. + * @param name a name to look for + * @return the corresponding SignalRSkuTier + */ + @JsonCreator + public static SignalRSkuTier fromString(String name) { + return fromString(name, SignalRSkuTier.class); + } + + /** + * @return known SignalRSkuTier values + */ + public static Collection values() { + return values(SignalRSkuTier.class); + } +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRUpdateParameters.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRUpdateParameters.java new file mode 100644 index 000000000000..e306b3c0a5dd --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRUpdateParameters.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.signalr.v2018_10_01; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters for SignalR service update operation. + */ +public class SignalRUpdateParameters { + /** + * A list of key value pairs that describe the resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The billing information of the resource.(e.g. basic vs. standard). + */ + @JsonProperty(value = "sku") + private ResourceSku sku; + + /** + * Settings used to provision or configure the resource. + */ + @JsonProperty(value = "properties") + private SignalRCreateOrUpdateProperties properties; + + /** + * Get a list of key value pairs that describe the resource. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set a list of key value pairs that describe the resource. + * + * @param tags the tags value to set + * @return the SignalRUpdateParameters object itself. + */ + public SignalRUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the billing information of the resource.(e.g. basic vs. standard). + * + * @return the sku value + */ + public ResourceSku sku() { + return this.sku; + } + + /** + * Set the billing information of the resource.(e.g. basic vs. standard). + * + * @param sku the sku value to set + * @return the SignalRUpdateParameters object itself. + */ + public SignalRUpdateParameters withSku(ResourceSku sku) { + this.sku = sku; + return this; + } + + /** + * Get settings used to provision or configure the resource. + * + * @return the properties value + */ + public SignalRCreateOrUpdateProperties properties() { + return this.properties; + } + + /** + * Set settings used to provision or configure the resource. + * + * @param properties the properties value to set + * @return the SignalRUpdateParameters object itself. + */ + public SignalRUpdateParameters withProperties(SignalRCreateOrUpdateProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRUsage.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRUsage.java new file mode 100644 index 000000000000..e5ab78e6944f --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRUsage.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.signalr.v2018_10_01; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.signalr.v2018_10_01.implementation.SignalRUsageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.signalr.v2018_10_01.implementation.SignalRManager; + +/** + * Type representing SignalRUsage. + */ +public interface SignalRUsage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Long currentValue(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the limit value. + */ + Long limit(); + + /** + * @return the name value. + */ + SignalRUsageName name(); + + /** + * @return the unit value. + */ + String unit(); + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRUsageName.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRUsageName.java new file mode 100644 index 000000000000..7659ee3bb581 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRUsageName.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.signalr.v2018_10_01; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Localizable String object containing the name and a localized value. + */ +public class SignalRUsageName { + /** + * The identifier of the usage. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Localized name of the usage. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Get the identifier of the usage. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the identifier of the usage. + * + * @param value the value value to set + * @return the SignalRUsageName object itself. + */ + public SignalRUsageName withValue(String value) { + this.value = value; + return this; + } + + /** + * Get localized name of the usage. + * + * @return the localizedValue value + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set localized name of the usage. + * + * @param localizedValue the localizedValue value to set + * @return the SignalRUsageName object itself. + */ + public SignalRUsageName withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRs.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRs.java new file mode 100644 index 000000000000..dbcb36c88c94 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/SignalRs.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.signalr.v2018_10_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.signalr.v2018_10_01.implementation.SignalRsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing SignalRs. + */ +public interface SignalRs extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Get the access keys of the SignalR resource. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String resourceName); + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateKeyAsync(String resourceGroupName, String resourceName); + + /** + * Operation to restart a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable restartAsync(String resourceGroupName, String resourceName); + + /** + * Checks that the SignalR name is valid and is not already in use. + * + * @param location the region + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable checkNameAvailabilityAsync(String location); + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/Usages.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/Usages.java new file mode 100644 index 000000000000..b334c0390547 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/Usages.java @@ -0,0 +1,28 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.signalr.v2018_10_01; + +import rx.Observable; +import com.microsoft.azure.management.signalr.v2018_10_01.implementation.UsagesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Usages. + */ +public interface Usages extends HasInner { + /** + * List usage quotas for Azure SignalR service by location. + * + * @param location the location like "eastus" + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String location); + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/IdParsingUtils.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..7593095d432b --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_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.signalr.v2018_10_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/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/NameAvailabilityImpl.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/NameAvailabilityImpl.java new file mode 100644 index 000000000000..552563a0b4d1 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/NameAvailabilityImpl.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.signalr.v2018_10_01.implementation; + +import com.microsoft.azure.management.signalr.v2018_10_01.NameAvailability; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class NameAvailabilityImpl extends WrapperImpl implements NameAvailability { + private final SignalRManager manager; + NameAvailabilityImpl(NameAvailabilityInner inner, SignalRManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SignalRManager manager() { + return this.manager; + } + + @Override + public String message() { + return this.inner().message(); + } + + @Override + public Boolean nameAvailable() { + return this.inner().nameAvailable(); + } + + @Override + public String reason() { + return this.inner().reason(); + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/NameAvailabilityInner.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/NameAvailabilityInner.java new file mode 100644 index 000000000000..a998a34c77ef --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/NameAvailabilityInner.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.signalr.v2018_10_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Result of the request to check name availability. It contains a flag and + * possible reason of failure. + */ +public class NameAvailabilityInner { + /** + * Indicates whether the name is available or not. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /** + * The reason of the availability. Required if name is not available. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * The message of the operation. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get indicates whether the name is available or not. + * + * @return the nameAvailable value + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set indicates whether the name is available or not. + * + * @param nameAvailable the nameAvailable value to set + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason of the availability. Required if name is not available. + * + * @return the reason value + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason of the availability. Required if name is not available. + * + * @param reason the reason value to set + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the message of the operation. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set the message of the operation. + * + * @param message the message value to set + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/OperationImpl.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/OperationImpl.java new file mode 100644 index 000000000000..74bae25940e9 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/OperationImpl.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.signalr.v2018_10_01.implementation; + +import com.microsoft.azure.management.signalr.v2018_10_01.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.signalr.v2018_10_01.OperationDisplay; +import com.microsoft.azure.management.signalr.v2018_10_01.OperationProperties; + +class OperationImpl extends WrapperImpl implements Operation { + private final SignalRManager manager; + OperationImpl(OperationInner inner, SignalRManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SignalRManager 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 OperationProperties properties() { + return this.inner().properties(); + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/OperationInner.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/OperationInner.java new file mode 100644 index 000000000000..5a92aa05e8f4 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/OperationInner.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.signalr.v2018_10_01.implementation; + +import com.microsoft.azure.management.signalr.v2018_10_01.OperationDisplay; +import com.microsoft.azure.management.signalr.v2018_10_01.OperationProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API operation supported by SignalR resource provider. + */ +public class OperationInner { + /** + * Name of the operation with format: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that describes the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Optional. The intended executor of the operation; governs the display of + * the operation in the RBAC UX and the audit logs UX. + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * Extra properties for the operation. + */ + @JsonProperty(value = "properties") + private OperationProperties properties; + + /** + * Get name of the operation with format: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the operation with 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 object that describes the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that describes the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get optional. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Set optional. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. + * + * @param origin the origin value to set + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get extra properties for the operation. + * + * @return the properties value + */ + public OperationProperties properties() { + return this.properties; + } + + /** + * Set extra properties for the operation. + * + * @param properties the properties value to set + * @return the OperationInner object itself. + */ + public OperationInner withProperties(OperationProperties properties) { + this.properties = properties; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/OperationsImpl.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/OperationsImpl.java new file mode 100644 index 000000000000..4af31a9e5b87 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_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.signalr.v2018_10_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.signalr.v2018_10_01.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.signalr.v2018_10_01.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final SignalRManager manager; + + OperationsImpl(SignalRManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public SignalRManager 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/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/OperationsInner.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/OperationsInner.java new file mode 100644 index 000000000000..14e1c8e375cc --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_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.signalr.v2018_10_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 SignalRManagementClientImpl 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, SignalRManagementClientImpl 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.signalr.v2018_10_01.Operations list" }) + @GET("providers/Microsoft.SignalRService/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.signalr.v2018_10_01.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available REST API operations of the Microsoft.SignalRService 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 all of the available REST API operations of the Microsoft.SignalRService 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 all of the available REST API operations of the Microsoft.SignalRService 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 all of the available REST API operations of the Microsoft.SignalRService 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 all of the available REST API operations of the Microsoft.SignalRService 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 all of the available REST API operations of the Microsoft.SignalRService 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 all of the available REST API operations of the Microsoft.SignalRService 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 all of the available REST API operations of the Microsoft.SignalRService 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 all of the available REST API operations of the Microsoft.SignalRService 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 all of the available REST API operations of the Microsoft.SignalRService 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/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/PageImpl.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/PageImpl.java new file mode 100644 index 000000000000..0e845887c591 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_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.signalr.v2018_10_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/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRKeysImpl.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRKeysImpl.java new file mode 100644 index 000000000000..48874f604771 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRKeysImpl.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.signalr.v2018_10_01.implementation; + +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRKeys; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class SignalRKeysImpl extends WrapperImpl implements SignalRKeys { + private final SignalRManager manager; + SignalRKeysImpl(SignalRKeysInner inner, SignalRManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SignalRManager manager() { + return this.manager; + } + + @Override + public String primaryConnectionString() { + return this.inner().primaryConnectionString(); + } + + @Override + public String primaryKey() { + return this.inner().primaryKey(); + } + + @Override + public String secondaryConnectionString() { + return this.inner().secondaryConnectionString(); + } + + @Override + public String secondaryKey() { + return this.inner().secondaryKey(); + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRKeysInner.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRKeysInner.java new file mode 100644 index 000000000000..6253805f97e4 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRKeysInner.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.signalr.v2018_10_01.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A class represents the access keys of SignalR service. + */ +public class SignalRKeysInner { + /** + * The primary access key. + */ + @JsonProperty(value = "primaryKey") + private String primaryKey; + + /** + * The secondary access key. + */ + @JsonProperty(value = "secondaryKey") + private String secondaryKey; + + /** + * SignalR connection string constructed via the primaryKey. + */ + @JsonProperty(value = "primaryConnectionString") + private String primaryConnectionString; + + /** + * SignalR connection string constructed via the secondaryKey. + */ + @JsonProperty(value = "secondaryConnectionString") + private String secondaryConnectionString; + + /** + * Get the primary access key. + * + * @return the primaryKey value + */ + public String primaryKey() { + return this.primaryKey; + } + + /** + * Set the primary access key. + * + * @param primaryKey the primaryKey value to set + * @return the SignalRKeysInner object itself. + */ + public SignalRKeysInner withPrimaryKey(String primaryKey) { + this.primaryKey = primaryKey; + return this; + } + + /** + * Get the secondary access key. + * + * @return the secondaryKey value + */ + public String secondaryKey() { + return this.secondaryKey; + } + + /** + * Set the secondary access key. + * + * @param secondaryKey the secondaryKey value to set + * @return the SignalRKeysInner object itself. + */ + public SignalRKeysInner withSecondaryKey(String secondaryKey) { + this.secondaryKey = secondaryKey; + return this; + } + + /** + * Get signalR connection string constructed via the primaryKey. + * + * @return the primaryConnectionString value + */ + public String primaryConnectionString() { + return this.primaryConnectionString; + } + + /** + * Set signalR connection string constructed via the primaryKey. + * + * @param primaryConnectionString the primaryConnectionString value to set + * @return the SignalRKeysInner object itself. + */ + public SignalRKeysInner withPrimaryConnectionString(String primaryConnectionString) { + this.primaryConnectionString = primaryConnectionString; + return this; + } + + /** + * Get signalR connection string constructed via the secondaryKey. + * + * @return the secondaryConnectionString value + */ + public String secondaryConnectionString() { + return this.secondaryConnectionString; + } + + /** + * Set signalR connection string constructed via the secondaryKey. + * + * @param secondaryConnectionString the secondaryConnectionString value to set + * @return the SignalRKeysInner object itself. + */ + public SignalRKeysInner withSecondaryConnectionString(String secondaryConnectionString) { + this.secondaryConnectionString = secondaryConnectionString; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRManagementClientImpl.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRManagementClientImpl.java new file mode 100644 index 000000000000..a91761180c80 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRManagementClientImpl.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.signalr.v2018_10_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 SignalRManagementClientImpl class. + */ +public class SignalRManagementClientImpl 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; + } + + /** Client Api Version. */ + private String apiVersion; + + /** + * Gets Client Api Version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets subscription Id which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Gets subscription Id which uniquely identify the 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 Id which uniquely identify the 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 SignalRManagementClientImpl 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 SignalRManagementClientImpl 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 SignalRManagementClientImpl 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 SignalRManagementClientImpl 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 SignalRsInner object to access its operations. + */ + private SignalRsInner signalRs; + + /** + * Gets the SignalRsInner object to access its operations. + * @return the SignalRsInner object. + */ + public SignalRsInner signalRs() { + return this.signalRs; + } + + /** + * The UsagesInner object to access its operations. + */ + private UsagesInner usages; + + /** + * Gets the UsagesInner object to access its operations. + * @return the UsagesInner object. + */ + public UsagesInner usages() { + return this.usages; + } + + /** + * Initializes an instance of SignalRManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public SignalRManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of SignalRManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public SignalRManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of SignalRManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public SignalRManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2018-10-01"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.signalRs = new SignalRsInner(restClient().retrofit(), this); + this.usages = new UsagesInner(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(), "SignalRManagementClient", "2018-10-01"); + } +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRManager.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRManager.java new file mode 100644 index 000000000000..b2cd353ff4c5 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRManager.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.signalr.v2018_10_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.signalr.v2018_10_01.Operations; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRs; +import com.microsoft.azure.management.signalr.v2018_10_01.Usages; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure SignalRService resource management. + */ +public final class SignalRManager extends ManagerCore { + private Operations operations; + private SignalRs signalRs; + private Usages usages; + /** + * Get a Configurable instance that can be used to create SignalRManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new SignalRManager.ConfigurableImpl(); + } + /** + * Creates an instance of SignalRManager that exposes SignalRService resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the SignalRManager + */ + public static SignalRManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new SignalRManager(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 SignalRManager that exposes SignalRService resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the SignalRManager + */ + public static SignalRManager authenticate(RestClient restClient, String subscriptionId) { + return new SignalRManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of SignalRManager that exposes SignalRService management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing SignalRService management API entry points that work across subscriptions + */ + SignalRManager 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 SignalRs. + */ + public SignalRs signalRs() { + if (this.signalRs == null) { + this.signalRs = new SignalRsImpl(this); + } + return this.signalRs; + } + + /** + * @return Entry point to manage Usages. + */ + public Usages usages() { + if (this.usages == null) { + this.usages = new UsagesImpl(this); + } + return this.usages; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public SignalRManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return SignalRManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private SignalRManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new SignalRManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRResourceImpl.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRResourceImpl.java new file mode 100644 index 000000000000..c34adf5b31d7 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRResourceImpl.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.signalr.v2018_10_01.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRResource; +import rx.Observable; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRUpdateParameters; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRCreateParameters; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRCorsSettings; +import java.util.List; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRFeature; +import com.microsoft.azure.management.signalr.v2018_10_01.ProvisioningState; +import com.microsoft.azure.management.signalr.v2018_10_01.ResourceSku; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRCreateOrUpdateProperties; +import rx.functions.Func1; + +class SignalRResourceImpl extends GroupableResourceCoreImpl implements SignalRResource, SignalRResource.Definition, SignalRResource.Update { + private SignalRCreateParameters createParameter; + private SignalRUpdateParameters updateParameter; + SignalRResourceImpl(String name, SignalRResourceInner inner, SignalRManager manager) { + super(name, inner, manager); + this.createParameter = new SignalRCreateParameters(); + this.updateParameter = new SignalRUpdateParameters(); + } + + @Override + public Observable createResourceAsync() { + SignalRsInner client = this.manager().inner().signalRs(); + this.createParameter.withLocation(inner().location()); + this.createParameter.withTags(inner().getTags()); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.createParameter) + .map(new Func1() { + @Override + public SignalRResourceInner call(SignalRResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SignalRsInner client = this.manager().inner().signalRs(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public SignalRResourceInner call(SignalRResourceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SignalRsInner client = this.manager().inner().signalRs(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createParameter = new SignalRCreateParameters(); + this.updateParameter = new SignalRUpdateParameters(); + } + + @Override + public SignalRCorsSettings cors() { + return this.inner().cors(); + } + + @Override + public String externalIP() { + return this.inner().externalIP(); + } + + @Override + public List features() { + return this.inner().features(); + } + + @Override + public String hostName() { + return this.inner().hostName(); + } + + @Override + public String hostNamePrefix() { + return this.inner().hostNamePrefix(); + } + + @Override + public ProvisioningState provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Integer publicPort() { + return this.inner().publicPort(); + } + + @Override + public Integer serverPort() { + return this.inner().serverPort(); + } + + @Override + public ResourceSku sku() { + return this.inner().sku(); + } + + @Override + public String version() { + return this.inner().version(); + } + + @Override + public SignalRResourceImpl withProperties(SignalRCreateOrUpdateProperties properties) { + if (isInCreateMode()) { + this.createParameter.withProperties(properties); + } else { + this.updateParameter.withProperties(properties); + } + return this; + } + + @Override + public SignalRResourceImpl withSku(ResourceSku sku) { + if (isInCreateMode()) { + this.createParameter.withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRResourceInner.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRResourceInner.java new file mode 100644 index 000000000000..8a4abca6dbf8 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRResourceInner.java @@ -0,0 +1,257 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.signalr.v2018_10_01.implementation; + +import com.microsoft.azure.management.signalr.v2018_10_01.ResourceSku; +import java.util.List; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRFeature; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRCorsSettings; +import com.microsoft.azure.management.signalr.v2018_10_01.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * A class represent a SignalR service resource. + */ +@JsonFlatten +@SkipParentValidation +public class SignalRResourceInner extends Resource { + /** + * SKU of the service. + */ + @JsonProperty(value = "sku") + private ResourceSku sku; + + /** + * Prefix for the hostName of the SignalR service. Retained for future use. + * The hostname will be of format: + * &lt;hostNamePrefix&gt;.service.signalr.net. + */ + @JsonProperty(value = "properties.hostNamePrefix") + private String hostNamePrefix; + + /** + * List of SignalR featureFlags. e.g. ServiceMode. + * + * FeatureFlags that are not included in the parameters for the update + * operation will not be modified. + * And the response will only include featureFlags that are explicitly set. + * When a featureFlag is not explicitly set, SignalR service will use its + * globally default value. + * But keep in mind, the default value doesn't mean "false". It varies in + * terms of different FeatureFlags. + */ + @JsonProperty(value = "properties.features") + private List features; + + /** + * Cross-Origin Resource Sharing (CORS) settings. + */ + @JsonProperty(value = "properties.cors") + private SignalRCorsSettings cors; + + /** + * Provisioning state of the resource. Possible values include: 'Unknown', + * 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', + * 'Deleting', 'Moving'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * The publicly accessible IP of the SignalR service. + */ + @JsonProperty(value = "properties.externalIP", access = JsonProperty.Access.WRITE_ONLY) + private String externalIP; + + /** + * FQDN of the SignalR service instance. Format: xxx.service.signalr.net. + */ + @JsonProperty(value = "properties.hostName", access = JsonProperty.Access.WRITE_ONLY) + private String hostName; + + /** + * The publicly accessible port of the SignalR service which is designed + * for browser/client side usage. + */ + @JsonProperty(value = "properties.publicPort", access = JsonProperty.Access.WRITE_ONLY) + private Integer publicPort; + + /** + * The publicly accessible port of the SignalR service which is designed + * for customer server side usage. + */ + @JsonProperty(value = "properties.serverPort", access = JsonProperty.Access.WRITE_ONLY) + private Integer serverPort; + + /** + * Version of the SignalR resource. Probably you need the same or higher + * version of client SDKs. + */ + @JsonProperty(value = "properties.version") + private String version; + + /** + * Get sKU of the service. + * + * @return the sku value + */ + public ResourceSku sku() { + return this.sku; + } + + /** + * Set sKU of the service. + * + * @param sku the sku value to set + * @return the SignalRResourceInner object itself. + */ + public SignalRResourceInner withSku(ResourceSku sku) { + this.sku = sku; + return this; + } + + /** + * Get prefix for the hostName of the SignalR service. Retained for future use. + The hostname will be of format: &lt;hostNamePrefix&gt;.service.signalr.net. + * + * @return the hostNamePrefix value + */ + public String hostNamePrefix() { + return this.hostNamePrefix; + } + + /** + * Set prefix for the hostName of the SignalR service. Retained for future use. + The hostname will be of format: &lt;hostNamePrefix&gt;.service.signalr.net. + * + * @param hostNamePrefix the hostNamePrefix value to set + * @return the SignalRResourceInner object itself. + */ + public SignalRResourceInner withHostNamePrefix(String hostNamePrefix) { + this.hostNamePrefix = hostNamePrefix; + return this; + } + + /** + * Get list of SignalR featureFlags. e.g. ServiceMode. + FeatureFlags that are not included in the parameters for the update operation will not be modified. + And the response will only include featureFlags that are explicitly set. + When a featureFlag is not explicitly set, SignalR service will use its globally default value. + But keep in mind, the default value doesn't mean "false". It varies in terms of different FeatureFlags. + * + * @return the features value + */ + public List features() { + return this.features; + } + + /** + * Set list of SignalR featureFlags. e.g. ServiceMode. + FeatureFlags that are not included in the parameters for the update operation will not be modified. + And the response will only include featureFlags that are explicitly set. + When a featureFlag is not explicitly set, SignalR service will use its globally default value. + But keep in mind, the default value doesn't mean "false". It varies in terms of different FeatureFlags. + * + * @param features the features value to set + * @return the SignalRResourceInner object itself. + */ + public SignalRResourceInner withFeatures(List features) { + this.features = features; + return this; + } + + /** + * Get cross-Origin Resource Sharing (CORS) settings. + * + * @return the cors value + */ + public SignalRCorsSettings cors() { + return this.cors; + } + + /** + * Set cross-Origin Resource Sharing (CORS) settings. + * + * @param cors the cors value to set + * @return the SignalRResourceInner object itself. + */ + public SignalRResourceInner withCors(SignalRCorsSettings cors) { + this.cors = cors; + return this; + } + + /** + * Get provisioning state of the resource. Possible values include: 'Unknown', 'Succeeded', 'Failed', 'Canceled', 'Running', 'Creating', 'Updating', 'Deleting', 'Moving'. + * + * @return the provisioningState value + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the publicly accessible IP of the SignalR service. + * + * @return the externalIP value + */ + public String externalIP() { + return this.externalIP; + } + + /** + * Get fQDN of the SignalR service instance. Format: xxx.service.signalr.net. + * + * @return the hostName value + */ + public String hostName() { + return this.hostName; + } + + /** + * Get the publicly accessible port of the SignalR service which is designed for browser/client side usage. + * + * @return the publicPort value + */ + public Integer publicPort() { + return this.publicPort; + } + + /** + * Get the publicly accessible port of the SignalR service which is designed for customer server side usage. + * + * @return the serverPort value + */ + public Integer serverPort() { + return this.serverPort; + } + + /** + * Get version of the SignalR resource. Probably you need the same or higher version of client SDKs. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set version of the SignalR resource. Probably you need the same or higher version of client SDKs. + * + * @param version the version value to set + * @return the SignalRResourceInner object itself. + */ + public SignalRResourceInner withVersion(String version) { + this.version = version; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRUsageImpl.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRUsageImpl.java new file mode 100644 index 000000000000..4cf9afbc0550 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRUsageImpl.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.signalr.v2018_10_01.implementation; + +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRUsage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRUsageName; + +class SignalRUsageImpl extends WrapperImpl implements SignalRUsage { + private final SignalRManager manager; + + SignalRUsageImpl(SignalRUsageInner inner, SignalRManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public SignalRManager manager() { + return this.manager; + } + + + + @Override + public Long currentValue() { + return this.inner().currentValue(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Long limit() { + return this.inner().limit(); + } + + @Override + public SignalRUsageName name() { + return this.inner().name(); + } + + @Override + public String unit() { + return this.inner().unit(); + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRUsageInner.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRUsageInner.java new file mode 100644 index 000000000000..80c4664d1478 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRUsageInner.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.signalr.v2018_10_01.implementation; + +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRUsageName; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Object that describes a specific usage of SignalR resources. + */ +public class SignalRUsageInner { + /** + * Fully qualified ARM resource id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Current value for the usage quota. + */ + @JsonProperty(value = "currentValue") + private Long currentValue; + + /** + * The maximum permitted value for the usage quota. If there is no limit, + * this value will be -1. + */ + @JsonProperty(value = "limit") + private Long limit; + + /** + * Localizable String object containing the name and a localized value. + */ + @JsonProperty(value = "name") + private SignalRUsageName name; + + /** + * Representing the units of the usage quota. Possible values are: Count, + * Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. + */ + @JsonProperty(value = "unit") + private String unit; + + /** + * Get fully qualified ARM resource id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set fully qualified ARM resource id. + * + * @param id the id value to set + * @return the SignalRUsageInner object itself. + */ + public SignalRUsageInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get current value for the usage quota. + * + * @return the currentValue value + */ + public Long currentValue() { + return this.currentValue; + } + + /** + * Set current value for the usage quota. + * + * @param currentValue the currentValue value to set + * @return the SignalRUsageInner object itself. + */ + public SignalRUsageInner withCurrentValue(Long currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Get the maximum permitted value for the usage quota. If there is no limit, this value will be -1. + * + * @return the limit value + */ + public Long limit() { + return this.limit; + } + + /** + * Set the maximum permitted value for the usage quota. If there is no limit, this value will be -1. + * + * @param limit the limit value to set + * @return the SignalRUsageInner object itself. + */ + public SignalRUsageInner withLimit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Get localizable String object containing the name and a localized value. + * + * @return the name value + */ + public SignalRUsageName name() { + return this.name; + } + + /** + * Set localizable String object containing the name and a localized value. + * + * @param name the name value to set + * @return the SignalRUsageInner object itself. + */ + public SignalRUsageInner withName(SignalRUsageName name) { + this.name = name; + return this; + } + + /** + * Get representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Set representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. + * + * @param unit the unit value to set + * @return the SignalRUsageInner object itself. + */ + public SignalRUsageInner withUnit(String unit) { + this.unit = unit; + return this; + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRsImpl.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRsImpl.java new file mode 100644 index 000000000000..e1aa06a1b2b4 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRsImpl.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. + * def + */ + +package com.microsoft.azure.management.signalr.v2018_10_01.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRs; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRResource; +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.signalr.v2018_10_01.SignalRKeys; +import com.microsoft.azure.management.signalr.v2018_10_01.NameAvailability; + +class SignalRsImpl extends GroupableResourcesCoreImpl implements SignalRs { + protected SignalRsImpl(SignalRManager manager) { + super(manager.inner().signalRs(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + SignalRsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + SignalRsInner 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) { + SignalRsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + SignalRsInner 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 SignalRResource call(SignalRResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + SignalRsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + SignalRsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SignalRResource call(SignalRResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public SignalRResourceImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String resourceName) { + SignalRsInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, resourceName) + .map(new Func1() { + @Override + public SignalRKeys call(SignalRKeysInner inner) { + return new SignalRKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateKeyAsync(String resourceGroupName, String resourceName) { + SignalRsInner client = this.inner(); + return client.regenerateKeyAsync(resourceGroupName, resourceName) + .map(new Func1() { + @Override + public SignalRKeys call(SignalRKeysInner inner) { + return new SignalRKeysImpl(inner, manager()); + } + }); + } + + @Override + public Completable restartAsync(String resourceGroupName, String resourceName) { + SignalRsInner client = this.inner(); + return client.restartAsync(resourceGroupName, resourceName).toCompletable(); + } + + @Override + protected SignalRResourceImpl wrapModel(SignalRResourceInner inner) { + return new SignalRResourceImpl(inner.name(), inner, manager()); + } + + @Override + protected SignalRResourceImpl wrapModel(String name) { + return new SignalRResourceImpl(name, new SignalRResourceInner(), this.manager()); + } + + @Override + public Observable checkNameAvailabilityAsync(String location) { + SignalRsInner client = this.inner(); + return client.checkNameAvailabilityAsync(location) + .map(new Func1() { + @Override + public NameAvailability call(NameAvailabilityInner inner) { + return new NameAvailabilityImpl(inner, manager()); + } + }); + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRsInner.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRsInner.java new file mode 100644 index 000000000000..af45331cea68 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/SignalRsInner.java @@ -0,0 +1,2185 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.signalr.v2018_10_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.signalr.v2018_10_01.KeyType; +import com.microsoft.azure.management.signalr.v2018_10_01.NameAvailabilityParameters; +import com.microsoft.azure.management.signalr.v2018_10_01.RegenerateKeyParameters; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRCreateParameters; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRUpdateParameters; +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; +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 SignalRs. + */ +public class SignalRsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private SignalRsService service; + /** The service client containing this operation class. */ + private SignalRManagementClientImpl client; + + /** + * Initializes an instance of SignalRsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SignalRsInner(Retrofit retrofit, SignalRManagementClientImpl client) { + this.service = retrofit.create(SignalRsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SignalRs to be + * used by Retrofit to perform actually REST calls. + */ + interface SignalRsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.signalr.v2018_10_01.SignalRs checkNameAvailability" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/checkNameAvailability") + Observable> checkNameAvailability(@Path("location") String location, @Path("subscriptionId") String subscriptionId, @Body NameAvailabilityParameters 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.signalr.v2018_10_01.SignalRs list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/SignalR") + 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.signalr.v2018_10_01.SignalRs listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR") + 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.signalr.v2018_10_01.SignalRs listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR/{resourceName}/listKeys") + Observable> listKeys(@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.signalr.v2018_10_01.SignalRs regenerateKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR/{resourceName}/regenerateKey") + Observable> regenerateKey(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegenerateKeyParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.signalr.v2018_10_01.SignalRs beginRegenerateKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR/{resourceName}/regenerateKey") + Observable> beginRegenerateKey(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegenerateKeyParameters parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.signalr.v2018_10_01.SignalRs getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{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.signalr.v2018_10_01.SignalRs createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Body SignalRCreateParameters 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.signalr.v2018_10_01.SignalRs beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Body SignalRCreateParameters 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.signalr.v2018_10_01.SignalRs delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{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.signalr.v2018_10_01.SignalRs beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{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.signalr.v2018_10_01.SignalRs update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Body SignalRUpdateParameters 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.signalr.v2018_10_01.SignalRs beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceName") String resourceName, @Body SignalRUpdateParameters 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.signalr.v2018_10_01.SignalRs restart" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/restart") + Observable> restart(@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.signalr.v2018_10_01.SignalRs beginRestart" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/restart") + Observable> beginRestart(@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.signalr.v2018_10_01.SignalRs 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.signalr.v2018_10_01.SignalRs listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Checks that the SignalR name is valid and is not already in use. + * + * @param location the 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 NameAvailabilityInner object if successful. + */ + public NameAvailabilityInner checkNameAvailability(String location) { + return checkNameAvailabilityWithServiceResponseAsync(location).toBlocking().single().body(); + } + + /** + * Checks that the SignalR name is valid and is not already in use. + * + * @param location the 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 checkNameAvailabilityAsync(String location, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(location), serviceCallback); + } + + /** + * Checks that the SignalR name is valid and is not already in use. + * + * @param location the region + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NameAvailabilityInner object + */ + public Observable checkNameAvailabilityAsync(String location) { + return checkNameAvailabilityWithServiceResponseAsync(location).map(new Func1, NameAvailabilityInner>() { + @Override + public NameAvailabilityInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks that the SignalR name is valid and is not already in use. + * + * @param location the region + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NameAvailabilityInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String location) { + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final NameAvailabilityParameters parameters = null; + return service.checkNameAvailability(location, 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 = checkNameAvailabilityDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Checks that the SignalR name is valid and is not already in use. + * + * @param location the region + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NameAvailabilityInner object if successful. + */ + public NameAvailabilityInner checkNameAvailability(String location, NameAvailabilityParameters parameters) { + return checkNameAvailabilityWithServiceResponseAsync(location, parameters).toBlocking().single().body(); + } + + /** + * Checks that the SignalR name is valid and is not already in use. + * + * @param location the region + * @param parameters Parameters supplied to the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture checkNameAvailabilityAsync(String location, NameAvailabilityParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameAvailabilityWithServiceResponseAsync(location, parameters), serviceCallback); + } + + /** + * Checks that the SignalR name is valid and is not already in use. + * + * @param location the region + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NameAvailabilityInner object + */ + public Observable checkNameAvailabilityAsync(String location, NameAvailabilityParameters parameters) { + return checkNameAvailabilityWithServiceResponseAsync(location, parameters).map(new Func1, NameAvailabilityInner>() { + @Override + public NameAvailabilityInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks that the SignalR name is valid and is not already in use. + * + * @param location the region + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NameAvailabilityInner object + */ + public Observable> checkNameAvailabilityWithServiceResponseAsync(String location, NameAvailabilityParameters parameters) { + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.checkNameAvailability(location, 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 = 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); + } + + /** + * Handles requests to list all resources 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<SignalRResourceInner> 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(); + } + }; + } + + /** + * Handles requests to list all resources 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); + } + + /** + * Handles requests to list all resources in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SignalRResourceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Handles requests to list all resources in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SignalRResourceInner> 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)); + } + }); + } + + /** + * Handles requests to list all resources in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SignalRResourceInner> 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); + } + + /** + * Handles requests to list all resources in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<SignalRResourceInner> 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(); + } + }; + } + + /** + * Handles requests to list all resources in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param serviceCallback 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); + } + + /** + * Handles requests to list all resources in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SignalRResourceInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Handles requests to list all resources in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SignalRResourceInner> 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)); + } + }); + } + + /** + * Handles requests to list all resources in a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SignalRResourceInner> 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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, 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); + } + + /** + * Get the access keys of the SignalR resource. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 SignalRKeysInner object if successful. + */ + public SignalRKeysInner listKeys(String resourceGroupName, String resourceName) { + return listKeysWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Get the access keys of the SignalR resource. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 listKeysAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Get the access keys of the SignalR resource. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRKeysInner object + */ + public Observable listKeysAsync(String resourceGroupName, String resourceName) { + return listKeysWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, SignalRKeysInner>() { + @Override + public SignalRKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the access keys of the SignalR resource. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRKeysInner object + */ + public Observable> listKeysWithServiceResponseAsync(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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listKeys(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listKeysDelegate(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); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 SignalRKeysInner object if successful. + */ + public SignalRKeysInner regenerateKey(String resourceGroupName, String resourceName) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().last().body(); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 regenerateKeyAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable regenerateKeyAsync(String resourceGroupName, String resourceName) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, SignalRKeysInner>() { + @Override + public SignalRKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> regenerateKeyWithServiceResponseAsync(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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final KeyType keyType = null; + RegenerateKeyParameters parameters = new RegenerateKeyParameters(); + parameters.withKeyType(null); + Observable> observable = service.regenerateKey(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); + } + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param keyType The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SignalRKeysInner object if successful. + */ + public SignalRKeysInner regenerateKey(String resourceGroupName, String resourceName, KeyType keyType) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName, keyType).toBlocking().last().body(); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param keyType The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture regenerateKeyAsync(String resourceGroupName, String resourceName, KeyType keyType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName, keyType), serviceCallback); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param keyType The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable regenerateKeyAsync(String resourceGroupName, String resourceName, KeyType keyType) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName, keyType).map(new Func1, SignalRKeysInner>() { + @Override + public SignalRKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param keyType The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String resourceName, KeyType keyType) { + 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + RegenerateKeyParameters parameters = null; + if (keyType != null) { + parameters = new RegenerateKeyParameters(); + parameters.withKeyType(keyType); + } + Observable> observable = service.regenerateKey(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 SignalRKeysInner object if successful. + */ + public SignalRKeysInner beginRegenerateKey(String resourceGroupName, String resourceName) { + return beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 beginRegenerateKeyAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRKeysInner object + */ + public Observable beginRegenerateKeyAsync(String resourceGroupName, String resourceName) { + return beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, SignalRKeysInner>() { + @Override + public SignalRKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRKeysInner object + */ + public Observable> beginRegenerateKeyWithServiceResponseAsync(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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final KeyType keyType = null; + RegenerateKeyParameters parameters = new RegenerateKeyParameters(); + parameters.withKeyType(null); + return service.beginRegenerateKey(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRegenerateKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param keyType The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SignalRKeysInner object if successful. + */ + public SignalRKeysInner beginRegenerateKey(String resourceGroupName, String resourceName, KeyType keyType) { + return beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName, keyType).toBlocking().single().body(); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param keyType The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary' + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginRegenerateKeyAsync(String resourceGroupName, String resourceName, KeyType keyType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName, keyType), serviceCallback); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param keyType The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRKeysInner object + */ + public Observable beginRegenerateKeyAsync(String resourceGroupName, String resourceName, KeyType keyType) { + return beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName, keyType).map(new Func1, SignalRKeysInner>() { + @Override + public SignalRKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param keyType The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Possible values include: 'Primary', 'Secondary' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRKeysInner object + */ + public Observable> beginRegenerateKeyWithServiceResponseAsync(String resourceGroupName, String resourceName, KeyType keyType) { + 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + RegenerateKeyParameters parameters = null; + if (keyType != null) { + parameters = new RegenerateKeyParameters(); + parameters.withKeyType(keyType); + } + return service.beginRegenerateKey(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRegenerateKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRegenerateKeyDelegate(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); + } + + /** + * Get the SignalR service and its properties. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 SignalRResourceInner object if successful. + */ + public SignalRResourceInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Get the SignalR service and its properties. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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); + } + + /** + * Get the SignalR service and its properties. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRResourceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, SignalRResourceInner>() { + @Override + public SignalRResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the SignalR service and its properties. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRResourceInner 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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, resourceName, 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 a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 SignalRResourceInner object if successful. + */ + public SignalRResourceInner createOrUpdate(String resourceGroupName, String resourceName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().last().body(); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 createOrUpdateAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceName) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, SignalRResourceInner>() { + @Override + public SignalRResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final SignalRCreateParameters parameters = null; + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for the create or 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 SignalRResourceInner object if successful. + */ + public SignalRResourceInner createOrUpdate(String resourceGroupName, String resourceName, SignalRCreateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().last().body(); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for the create or 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 createOrUpdateAsync(String resourceGroupName, String resourceName, SignalRCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for the create or update operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String resourceName, SignalRCreateParameters parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, SignalRResourceInner>() { + @Override + public SignalRResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for the create or update operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, SignalRCreateParameters 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 SignalRResourceInner object if successful. + */ + public SignalRResourceInner beginCreateOrUpdate(String resourceGroupName, String resourceName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRResourceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String resourceName) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, SignalRResourceInner>() { + @Override + public SignalRResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRResourceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final SignalRCreateParameters parameters = null; + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, 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); + } + } + }); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for the create or 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 SignalRResourceInner object if successful. + */ + public SignalRResourceInner beginCreateOrUpdate(String resourceGroupName, String resourceName, SignalRCreateParameters parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for the create or 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 beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, SignalRCreateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for the create or update operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRResourceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String resourceName, SignalRCreateParameters parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, SignalRResourceInner>() { + @Override + public SignalRResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create a new SignalR service and update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for the create or update operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRResourceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, SignalRCreateParameters 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, 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(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Operation to delete a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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(); + } + + /** + * Operation to delete a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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); + } + + /** + * Operation to delete a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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(); + } + }); + } + + /** + * Operation to delete a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Operation to delete a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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(); + } + + /** + * Operation to delete a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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); + } + + /** + * Operation to delete a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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(); + } + }); + } + + /** + * Operation to delete a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, resourceName, 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(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 SignalRResourceInner object if successful. + */ + public SignalRResourceInner update(String resourceGroupName, String resourceName) { + return updateWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().last().body(); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 updateAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String resourceName) { + return updateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, SignalRResourceInner>() { + @Override + public SignalRResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final SignalRUpdateParameters parameters = null; + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, resourceName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for 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 SignalRResourceInner object if successful. + */ + public SignalRResourceInner update(String resourceGroupName, String resourceName, SignalRUpdateParameters parameters) { + return updateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().last().body(); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for 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 resourceName, SignalRUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for the update operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String resourceName, SignalRUpdateParameters parameters) { + return updateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, SignalRResourceInner>() { + @Override + public SignalRResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for the update operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String resourceName, SignalRUpdateParameters 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, resourceName, parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 SignalRResourceInner object if successful. + */ + public SignalRResourceInner beginUpdate(String resourceGroupName, String resourceName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 beginUpdateAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRResourceInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String resourceName) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, SignalRResourceInner>() { + @Override + public SignalRResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRResourceInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final SignalRUpdateParameters parameters = null; + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, 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); + } + } + }); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for 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 SignalRResourceInner object if successful. + */ + public SignalRResourceInner beginUpdate(String resourceGroupName, String resourceName, SignalRUpdateParameters parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).toBlocking().single().body(); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for 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 resourceName, SignalRUpdateParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters), serviceCallback); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for the update operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRResourceInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String resourceName, SignalRUpdateParameters parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, resourceName, parameters).map(new Func1, SignalRResourceInner>() { + @Override + public SignalRResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Operation to update an exiting SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @param parameters Parameters for the update operation + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SignalRResourceInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String resourceName, SignalRUpdateParameters 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, resourceName, 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(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Operation to restart a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 restart(String resourceGroupName, String resourceName) { + restartWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().last().body(); + } + + /** + * Operation to restart a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 restartAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(restartWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Operation to restart a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable restartAsync(String resourceGroupName, String resourceName) { + return restartWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Operation to restart a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> restartWithServiceResponseAsync(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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.restart(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.AZURE_ASYNC_OPERATION), new TypeToken() { }.getType()); + } + + /** + * Operation to restart a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 beginRestart(String resourceGroupName, String resourceName) { + beginRestartWithServiceResponseAsync(resourceGroupName, resourceName).toBlocking().single().body(); + } + + /** + * Operation to restart a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR 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 beginRestartAsync(String resourceGroupName, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRestartWithServiceResponseAsync(resourceGroupName, resourceName), serviceCallback); + } + + /** + * Operation to restart a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRestartAsync(String resourceGroupName, String resourceName) { + return beginRestartWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Operation to restart a SignalR service. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + * @param resourceName The name of the SignalR resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRestartWithServiceResponseAsync(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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginRestart(this.client.subscriptionId(), resourceGroupName, resourceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRestartDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRestartDelegate(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); + } + + /** + * Handles requests to list all resources 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<SignalRResourceInner> 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(); + } + }; + } + + /** + * Handles requests to list all resources 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); + } + + /** + * Handles requests to list all resources 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<SignalRResourceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Handles requests to list all resources 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<SignalRResourceInner> 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)); + } + }); + } + + /** + * Handles requests to list all resources 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<SignalRResourceInner> 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); + } + + /** + * Handles requests to list all resources 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<SignalRResourceInner> 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(); + } + }; + } + + /** + * Handles requests to list all resources 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); + } + + /** + * Handles requests to list all resources 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<SignalRResourceInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Handles requests to list all resources 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<SignalRResourceInner> 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)); + } + }); + } + + /** + * Handles requests to list all resources 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<SignalRResourceInner> 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/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/UsagesImpl.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/UsagesImpl.java new file mode 100644 index 000000000000..7d8b34c893b5 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/UsagesImpl.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.signalr.v2018_10_01.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.signalr.v2018_10_01.Usages; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.signalr.v2018_10_01.SignalRUsage; + +class UsagesImpl extends WrapperImpl implements Usages { + private final SignalRManager manager; + + UsagesImpl(SignalRManager manager) { + super(manager.inner().usages()); + this.manager = manager; + } + + public SignalRManager manager() { + return this.manager; + } + + private SignalRUsageImpl wrapModel(SignalRUsageInner inner) { + return new SignalRUsageImpl(inner, manager()); + } + + @Override + public Observable listAsync(final String location) { + UsagesInner client = this.inner(); + return client.listAsync(location) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public SignalRUsage call(SignalRUsageInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/UsagesInner.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/UsagesInner.java new file mode 100644 index 000000000000..475fc7a3ae8a --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/UsagesInner.java @@ -0,0 +1,295 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.signalr.v2018_10_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 Usages. + */ +public class UsagesInner { + /** The Retrofit service to perform REST calls. */ + private UsagesService service; + /** The service client containing this operation class. */ + private SignalRManagementClientImpl client; + + /** + * Initializes an instance of UsagesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UsagesInner(Retrofit retrofit, SignalRManagementClientImpl client) { + this.service = retrofit.create(UsagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Usages to be + * used by Retrofit to perform actually REST calls. + */ + interface UsagesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.signalr.v2018_10_01.Usages list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.SignalRService/locations/{location}/usages") + Observable> list(@Path("location") String location, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.signalr.v2018_10_01.Usages listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List usage quotas for Azure SignalR service by location. + * + * @param location the location like "eastus" + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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<SignalRUsageInner> object if successful. + */ + public PagedList list(final String location) { + ServiceResponse> response = listSinglePageAsync(location).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List usage quotas for Azure SignalR service by location. + * + * @param location the location like "eastus" + * @param serviceCallback 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 location, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(location), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List usage quotas for Azure SignalR service by location. + * + * @param location the location like "eastus" + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SignalRUsageInner> object + */ + public Observable> listAsync(final String location) { + return listWithServiceResponseAsync(location) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List usage quotas for Azure SignalR service by location. + * + * @param location the location like "eastus" + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SignalRUsageInner> object + */ + public Observable>> listWithServiceResponseAsync(final String location) { + return listSinglePageAsync(location) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List usage quotas for Azure SignalR service by location. + * + ServiceResponse> * @param location the location like "eastus" + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SignalRUsageInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String location) { + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(location, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = 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); + } + + /** + * List usage quotas for Azure SignalR service by location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<SignalRUsageInner> 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(); + } + }; + } + + /** + * List usage quotas for Azure SignalR service by location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> 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); + } + + /** + * List usage quotas for Azure SignalR service by location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SignalRUsageInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List usage quotas for Azure SignalR service by location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<SignalRUsageInner> 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)); + } + }); + } + + /** + * List usage quotas for Azure SignalR service by location. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<SignalRUsageInner> 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/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/package-info.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/package-info.java new file mode 100644 index 000000000000..9c1cd75831a0 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_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 SignalRManagementClient. + * REST API for Azure SignalR Service. + */ +package com.microsoft.azure.management.signalr.v2018_10_01.implementation; diff --git a/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/package-info.java b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/package-info.java new file mode 100644 index 000000000000..ec8875797b25 --- /dev/null +++ b/signalr/resource-manager/v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_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 SignalRManagementClient. + * REST API for Azure SignalR Service. + */ +package com.microsoft.azure.management.signalr.v2018_10_01; diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/AnonymousCredentialPolicy.java b/storage/client/blob/src/main/java/com/azure/storage/blob/AnonymousCredentialPolicy.java deleted file mode 100644 index d54b264702f6..000000000000 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/AnonymousCredentialPolicy.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -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 reactor.core.publisher.Mono; - -/** - * Anonymous credentials are to be used with with HTTP(S) requests that read blobs from public containers or requests - * that use a Shared Access Signature (SAS). This is because Anonymous credentials will not set an Authorization header. - * Pass an instance of this class as the credentials parameter when creating a new pipeline (typically with - * {@link StorageClient}). - */ -public final class AnonymousCredentialPolicy implements HttpPipelinePolicy { - - /** - * Returns an empty instance of {@code AnonymousCredentials}. - */ - public AnonymousCredentialPolicy() { - } - - - - @Override - public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - return next.process(); - } -} diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java b/storage/client/blob/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java deleted file mode 100644 index f868d8061d8d..000000000000 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java +++ /dev/null @@ -1,74 +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.BlobAccessConditions; - -import java.time.Duration; - -/** - * HTTPGetterInfo is a passed to the getter function of a reliable download to specify parameters needed for the GET - * request. - */ -final class HTTPGetterInfo { - private long offset = 0; - - private Long count = null; - - private String eTag = null; - - /** - * The start offset that should be used when creating the HTTP GET request's Range header. Defaults to 0. - */ - public long offset() { - return offset; - } - - /** - * The start offset that should be used when creating the HTTP GET request's Range header. Defaults to 0. - */ - public HTTPGetterInfo offset(long offset) { - this.offset = offset; - return this; - } - - /** - * The count of bytes that should be used to calculate the end offset when creating the HTTP GET request's Range - * header. {@code} null is the default and indicates that the entire rest of the blob should be retrieved. - */ - public Long count() { - return count; - } - - /** - * The count of bytes that should be used to calculate the end offset when creating the HTTP GET request's Range - * header. {@code} null is the default and indicates that the entire rest of the blob should be retrieved. - */ - public HTTPGetterInfo count(Long count) { - if (count != null) { - Utility.assertInBounds("count", count, 0, Long.MAX_VALUE); - } - this.count = count; - return this; - } - - /** - * The resource's etag that should be used when creating the HTTP GET request's If-Match header. Note that the - * Etag is returned with any operation that modifies the resource and by a call to {@link - * BlobClient#getProperties(BlobAccessConditions, Duration)}. Defaults to null. - */ - public String eTag() { - return eTag; - } - - /** - * The resource's etag that should be used when creating the HTTP GET request's If-Match header. Note that the - * Etag is returned with any operation that modifies the resource and by a call to {@link - * BlobClient#getProperties(BlobAccessConditions, Duration)}. Defaults to null. - */ - public HTTPGetterInfo eTag(String eTag) { - this.eTag = eTag; - return this; - } -} diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/AadLoginTest.java b/storage/client/blob/src/test/java/com/azure/storage/blob/AadLoginTest.java deleted file mode 100644 index 3c2ee324d196..000000000000 --- a/storage/client/blob/src/test/java/com/azure/storage/blob/AadLoginTest.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.identity.credential.EnvironmentCredential; -import com.azure.storage.blob.models.ContainerItem; -import org.junit.BeforeClass; - -import java.util.Random; - -public class AadLoginTest { - private static final Random RANDOM = new Random(); - private static StorageClient storageClient; - - @BeforeClass - public static void setup() { - storageClient = new StorageClientBuilder() - .endpoint("https://" + System.getenv("ACCOUNT_NAME") + ".blob.core.windows.net") - .credential(new EnvironmentCredential()) -// .httpClient(HttpClient.createDefault().proxy(() -> new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))) - .buildClient(); - } - - //@Test - public void listContainers() { - for (ContainerItem item : storageClient.listContainers()) { - System.out.println(item.name()); - } - } -} diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/LargeFileTest.java b/storage/client/blob/src/test/java/com/azure/storage/blob/LargeFileTest.java deleted file mode 100644 index a692d6d4c3c3..000000000000 --- a/storage/client/blob/src/test/java/com/azure/storage/blob/LargeFileTest.java +++ /dev/null @@ -1,54 +0,0 @@ -// 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 java.io.File; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.Random; - -public class LargeFileTest { - private static final Random RANDOM = new Random(); - private static final String FILE_PATH = "C:\\Users\\jianghlu\\10g.dat"; - private static StorageClient storageClient; - private static ContainerClient containerClient; - - //@BeforeClass - public static void setup() { - storageClient = new StorageClientBuilder() - .credential(new SharedKeyCredential(System.getenv("ACCOUNT_NAME"), System.getenv("ACCOUNT_KEY"))) - .endpoint("https://" + System.getenv("ACCOUNT_NAME") + ".blob.core.windows.net") -// .httpClient(HttpClient.createDefault().proxy(() -> new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))) - .buildClient(); - - containerClient = storageClient.getContainerClient("testcontainer-10g"); - if (!containerClient.exists().value()) { - containerClient.create(); - } - } - - //@Test - public void uploadLargeBlockBlob() throws Exception { - BlockBlobClient blockBlobClient = containerClient.getBlockBlobClient("testblob" + RANDOM.nextInt(1000)); - blockBlobClient.uploadFromFile(FILE_PATH); - } - - //@Test - public void downloadLargeBlockBlob() throws Exception { - OffsetDateTime start = OffsetDateTime.now(); - BlockBlobClient blockBlobClient = containerClient.getBlockBlobClient("testblob-10g"); -// blockBlobClient.uploadFromFile(filePath); -// File uploadedFile = new File(filePath); -// System.out.println("Upload " + uploadedFile.length() + " bytes took " + Duration.between(start, OffsetDateTime.now()).getSeconds() + " seconds"); -// start = OffsetDateTime.now(); - String downloadName = "D:\\10g-downloaded.dat"; - File downloaded = new File(downloadName); - downloaded.createNewFile(); - blockBlobClient.downloadToFile(downloadName); - System.out.println("Download " + downloaded.length() + " bytes took " + Duration.between(start, OffsetDateTime.now()).getSeconds() + " seconds"); - downloaded.delete(); - } -} diff --git a/storage/client/file/src/test/resources/session-records/abortCopy.json b/storage/client/file/src/test/resources/session-records/abortCopy.json deleted file mode 100644 index 44f4caf81358..000000000000 --- a/storage/client/file/src/test/resources/session-records/abortCopy.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "file10519411" ] -} \ No newline at end of file diff --git a/storage/client/file/src/test/resources/session-records/getFileClientFromDirClient.json b/storage/client/file/src/test/resources/session-records/getFileClientFromDirClient.json deleted file mode 100644 index 8fa3f19ff9cd..000000000000 --- a/storage/client/file/src/test/resources/session-records/getFileClientFromDirClient.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "directory877236", "96d7c3acc68d4acc" ] -} \ No newline at end of file diff --git a/storage/client/file/src/test/resources/session-records/getHandlesFromDirClient.json b/storage/client/file/src/test/resources/session-records/getHandlesFromDirClient.json deleted file mode 100644 index 0b31e3f9121c..000000000000 --- a/storage/client/file/src/test/resources/session-records/getHandlesFromDirClient.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "directory12788e" ] -} \ No newline at end of file diff --git a/storage/client/file/src/test/resources/session-records/getSubDirectoryClient.json b/storage/client/file/src/test/resources/session-records/getSubDirectoryClient.json deleted file mode 100644 index 786a8d1614b5..000000000000 --- a/storage/client/file/src/test/resources/session-records/getSubDirectoryClient.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "directory092514" ] -} \ No newline at end of file diff --git a/storage/client/file/src/test/resources/session-records/listFilesAndDirectoriesFromDirClient.json b/storage/client/file/src/test/resources/session-records/listFilesAndDirectoriesFromDirClient.json deleted file mode 100644 index 8102f80f00dd..000000000000 --- a/storage/client/file/src/test/resources/session-records/listFilesAndDirectoriesFromDirClient.json +++ /dev/null @@ -1,212 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/dirsharename/directory601397?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CB5D8325F\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:42:11 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781ece-001a-006b-2475-4192c4000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 23 Jul 2019 16:42:10 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/dirsharename/directory601397%2fdirectory6013970?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CB5E04A24\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:42:11 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781ecf-001a-006b-2575-4192c4000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 23 Jul 2019 16:42:10 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/dirsharename/directory601397%2fsamelayer02223a0", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CB5E83ACF\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:42:11 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781ed0-001a-006b-2675-4192c4000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 23 Jul 2019 16:42:10 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/dirsharename/directory601397%2fdirectory6013970%2fnextlayer57757b0", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CB5F13D27\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:42:11 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781ed1-001a-006b-2775-4192c4000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 23 Jul 2019 16:42:11 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/dirsharename/directory601397%2fdirectory6013971?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CB5F92DCE\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:42:11 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781ed2-001a-006b-2875-4192c4000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 23 Jul 2019 16:42:11 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/dirsharename/directory601397%2fsamelayer02223a01", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CB6011E86\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:42:11 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781ed3-001a-006b-2975-4192c4000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 23 Jul 2019 16:42:11 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/dirsharename/directory601397%2fdirectory6013971%2fnextlayer57757b01", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CB608E814\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:42:12 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781ed4-001a-006b-2a75-4192c4000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 23 Jul 2019 16:42:11 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/dirsharename/directory601397%2fdirectory6013972?restype=directory", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CB610B1B3\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:42:12 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781ed5-001a-006b-2b75-4192c4000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 23 Jul 2019 16:42:11 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/dirsharename/directory601397%2fsamelayer02223a012", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CB618F08D\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:42:12 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781ed6-001a-006b-2c75-4192c4000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 23 Jul 2019 16:42:11 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/dirsharename/directory601397%2fdirectory6013972%2fnextlayer57757b012", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CB620BA31\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:42:12 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781ed7-001a-006b-2d75-4192c4000000", - "x-ms-request-server-encrypted" : "true", - "Date" : "Tue, 23 Jul 2019 16:42:11 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.file.core.windows.net/dirsharename/directory601397?restype=directory&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 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" : "a4781ed8-001a-006b-2e75-4192c4000000", - "Body" : "directory6013970directory6013971directory6013972samelayer02223a01024samelayer02223a011024samelayer02223a0121024", - "Date" : "Tue, 23 Jul 2019 16:42:11 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "directory601397", "samelayer02223a", "nextlayer57757b" ] -} \ No newline at end of file diff --git a/storage/client/file/src/test/resources/session-records/listShares.json b/storage/client/file/src/test/resources/session-records/listShares.json deleted file mode 100644 index 9b4198a90038..000000000000 --- a/storage/client/file/src/test/resources/session-records/listShares.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share334220300?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CEDF8BA1A\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:45 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781f99-001a-006b-0475-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:44 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share334220301?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CEE0083B4\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:45 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781f9c-001a-006b-0675-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:44 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share334220302?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CEE084D4E\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:45 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781f9f-001a-006b-0775-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:44 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.file.core.windows.net?prefix=share33422030&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 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" : "a4781fa2-001a-006b-0875-4192c4000000", - "Body" : "share33422030share334220300Tue, 23 Jul 2019 16:43:45 GMT\"0x8D70F8CEDF8BA1A\"2share334220301Tue, 23 Jul 2019 16:43:45 GMT\"0x8D70F8CEE0083B4\"2share334220302Tue, 23 Jul 2019 16:43:45 GMT\"0x8D70F8CEE084D4E\"2", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.file.core.windows.net?prefix=share33422030&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 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" : "a4781fa3-001a-006b-0975-4192c4000000", - "Body" : "share33422030share334220300Tue, 23 Jul 2019 16:43:45 GMT\"0x8D70F8CEDF8BA1A\"2share334220301Tue, 23 Jul 2019 16:43:45 GMT\"0x8D70F8CEE0083B4\"2share334220302Tue, 23 Jul 2019 16:43:45 GMT\"0x8D70F8CEE084D4E\"2", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share334220300?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781fa4-001a-006b-0a75-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share334220301?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781fa5-001a-006b-0b75-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share334220302?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781fa6-001a-006b-0c75-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT" - } - } ], - "variables" : [ "share33422030" ] -} \ No newline at end of file diff --git a/storage/client/file/src/test/resources/session-records/listSharesIncludeMetadata.json b/storage/client/file/src/test/resources/session-records/listSharesIncludeMetadata.json deleted file mode 100644 index 74e4401568be..000000000000 --- a/storage/client/file/src/test/resources/session-records/listSharesIncludeMetadata.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share116742420?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CEEFF5D8E\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:47 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781fc4-001a-006b-2375-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share116742421?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CEF077557\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:47 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781fc6-001a-006b-2475-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share116742422?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CEF0F3EF5\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:47 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781fc8-001a-006b-2575-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.file.core.windows.net?prefix=share11674242&include=metadata&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 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" : "a4781fca-001a-006b-2675-4192c4000000", - "Body" : "share11674242share116742420Tue, 23 Jul 2019 16:43:47 GMT\"0x8D70F8CEEFF5D8E\"2metadatashare116742421Tue, 23 Jul 2019 16:43:47 GMT\"0x8D70F8CEF077557\"2share116742422Tue, 23 Jul 2019 16:43:47 GMT\"0x8D70F8CEF0F3EF5\"2metadata", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.file.core.windows.net?prefix=share11674242&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 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" : "a4781fcb-001a-006b-2775-4192c4000000", - "Body" : "share11674242share116742420Tue, 23 Jul 2019 16:43:47 GMT\"0x8D70F8CEEFF5D8E\"2share116742421Tue, 23 Jul 2019 16:43:47 GMT\"0x8D70F8CEF077557\"2share116742422Tue, 23 Jul 2019 16:43:47 GMT\"0x8D70F8CEF0F3EF5\"2", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share116742420?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781fcc-001a-006b-2875-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share116742421?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781fcd-001a-006b-2975-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share116742422?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781fce-001a-006b-2a75-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT" - } - } ], - "variables" : [ "share11674242" ] -} \ No newline at end of file diff --git a/storage/client/file/src/test/resources/session-records/listSharesIncludeMetadataAndSnapshots.json b/storage/client/file/src/test/resources/session-records/listSharesIncludeMetadataAndSnapshots.json deleted file mode 100644 index fc52365263ae..000000000000 --- a/storage/client/file/src/test/resources/session-records/listSharesIncludeMetadataAndSnapshots.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share112342ce0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CED6BA295\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:44 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781f84-001a-006b-7375-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:43 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share112342ce0?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-23T16:43:44.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D70F8CED6BA295\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:44 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781f86-001a-006b-7475-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:44 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share112342ce1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CED7C4768\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:45 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781f87-001a-006b-7575-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:44 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share112342ce2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CED8745EA\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:45 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781f89-001a-006b-7675-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:44 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share112342ce2?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-23T16:43:45.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D70F8CED8745EA\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:45 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781f8b-001a-006b-7775-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:44 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.file.core.windows.net?prefix=share112342ce&include=metadata%2csnapshots&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 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" : "a4781f8c-001a-006b-7875-4192c4000000", - "Body" : "share112342ceshare112342ce02019-07-23T16:43:44.0000000ZTue, 23 Jul 2019 16:43:44 GMT\"0x8D70F8CED6BA295\"2metadatashare112342ce0Tue, 23 Jul 2019 16:43:44 GMT\"0x8D70F8CED6BA295\"2metadatashare112342ce1Tue, 23 Jul 2019 16:43:45 GMT\"0x8D70F8CED7C4768\"2share112342ce22019-07-23T16:43:45.0000000ZTue, 23 Jul 2019 16:43:45 GMT\"0x8D70F8CED8745EA\"2metadatashare112342ce2Tue, 23 Jul 2019 16:43:45 GMT\"0x8D70F8CED8745EA\"2metadata", - "Date" : "Tue, 23 Jul 2019 16:43:44 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.file.core.windows.net?prefix=share112342ce&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 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" : "a4781f8d-001a-006b-7975-4192c4000000", - "Body" : "share112342ceshare112342ce0Tue, 23 Jul 2019 16:43:44 GMT\"0x8D70F8CED6BA295\"2share112342ce1Tue, 23 Jul 2019 16:43:45 GMT\"0x8D70F8CED7C4768\"2share112342ce2Tue, 23 Jul 2019 16:43:45 GMT\"0x8D70F8CED8745EA\"2", - "Date" : "Tue, 23 Jul 2019 16:43:44 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share112342ce0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781f8e-001a-006b-7a75-4192c4000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:a4781f8e-001a-006b-7a75-4192c4000000\nTime:2019-07-23T16:43:45.3519776Z", - "Date" : "Tue, 23 Jul 2019 16:43:44 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share112342ce1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781f8f-001a-006b-7b75-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:44 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share112342ce2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781f90-001a-006b-7c75-4192c4000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:a4781f90-001a-006b-7c75-4192c4000000\nTime:2019-07-23T16:43:45.4540500Z", - "Date" : "Tue, 23 Jul 2019 16:43:44 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share112342ce" ] -} \ No newline at end of file diff --git a/storage/client/file/src/test/resources/session-records/listSharesIncludeSnapshots.json b/storage/client/file/src/test/resources/session-records/listSharesIncludeSnapshots.json deleted file mode 100644 index 9274ad655d14..000000000000 --- a/storage/client/file/src/test/resources/session-records/listSharesIncludeSnapshots.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share305309dc0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CEE49A7FE\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:46 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781faa-001a-006b-0f75-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share305309dc0?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-23T16:43:46.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D70F8CEE49A7FE\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:46 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781fac-001a-006b-1075-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share305309dc1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CEE5A4CDF\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:46 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781fad-001a-006b-1175-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share305309dc2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CEE6CC6C8\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:46 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781faf-001a-006b-1275-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share305309dc2?restype=share&comp=snapshot", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-11-09", - "x-ms-snapshot" : "2019-07-23T16:43:46.0000000Z", - "Server" : "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", - "ETag" : "\"0x8D70F8CEE6CC6C8\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:46 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781fb1-001a-006b-1375-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.file.core.windows.net?prefix=share305309dc&include=snapshots&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 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" : "a4781fb2-001a-006b-1475-4192c4000000", - "Body" : "share305309dcshare305309dc02019-07-23T16:43:46.0000000ZTue, 23 Jul 2019 16:43:46 GMT\"0x8D70F8CEE49A7FE\"2share305309dc0Tue, 23 Jul 2019 16:43:46 GMT\"0x8D70F8CEE49A7FE\"2share305309dc1Tue, 23 Jul 2019 16:43:46 GMT\"0x8D70F8CEE5A4CDF\"2share305309dc22019-07-23T16:43:46.0000000ZTue, 23 Jul 2019 16:43:46 GMT\"0x8D70F8CEE6CC6C8\"2share305309dc2Tue, 23 Jul 2019 16:43:46 GMT\"0x8D70F8CEE6CC6C8\"2", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.file.core.windows.net?prefix=share305309dc&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 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" : "a4781fb3-001a-006b-1575-4192c4000000", - "Body" : "share305309dcshare305309dc0Tue, 23 Jul 2019 16:43:46 GMT\"0x8D70F8CEE49A7FE\"2share305309dc1Tue, 23 Jul 2019 16:43:46 GMT\"0x8D70F8CEE5A4CDF\"2share305309dc2Tue, 23 Jul 2019 16:43:46 GMT\"0x8D70F8CEE6CC6C8\"2", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share305309dc0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781fb4-001a-006b-1675-4192c4000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:a4781fb4-001a-006b-1675-4192c4000000\nTime:2019-07-23T16:43:46.8250278Z", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share305309dc1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781fb5-001a-006b-1775-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share305309dc2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781fb6-001a-006b-1875-4192c4000000", - "Body" : "ShareHasSnapshotsThe share has snapshots and the operation requires no snapshots.\nRequestId:a4781fb6-001a-006b-1875-4192c4000000\nTime:2019-07-23T16:43:46.9331058Z", - "Date" : "Tue, 23 Jul 2019 16:43:45 GMT", - "Content-Type" : "application/xml" - } - } ], - "variables" : [ "share305309dc" ] -} \ No newline at end of file diff --git a/storage/client/file/src/test/resources/session-records/listSharesWithLimit.json b/storage/client/file/src/test/resources/session-records/listSharesWithLimit.json deleted file mode 100644 index ba78ebd77bda..000000000000 --- a/storage/client/file/src/test/resources/session-records/listSharesWithLimit.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share058285ff0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CECCDBF15\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:43 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781f6c-001a-006b-6075-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:42 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share058285ff1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CECD62507\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:43 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781f6e-001a-006b-6175-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:42 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share058285ff2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CECDDC795\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:44 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781f70-001a-006b-6275-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:43 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.file.core.windows.net?prefix=share058285ff&maxresults=2&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 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" : "a4781f72-001a-006b-6375-4192c4000000", - "Body" : "share058285ff2share058285ff0Tue, 23 Jul 2019 16:43:43 GMT\"0x8D70F8CECCDBF15\"2share058285ff1Tue, 23 Jul 2019 16:43:43 GMT\"0x8D70F8CECD62507\"2/sima/share058285ff2", - "Date" : "Tue, 23 Jul 2019 16:43:43 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.file.core.windows.net?prefix=share058285ff&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 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" : "a4781f73-001a-006b-6475-4192c4000000", - "Body" : "share058285ffshare058285ff0Tue, 23 Jul 2019 16:43:43 GMT\"0x8D70F8CECCDBF15\"2share058285ff1Tue, 23 Jul 2019 16:43:43 GMT\"0x8D70F8CECD62507\"2share058285ff2Tue, 23 Jul 2019 16:43:44 GMT\"0x8D70F8CECDDC795\"2", - "Date" : "Tue, 23 Jul 2019 16:43:43 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share058285ff0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781f74-001a-006b-6575-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:43 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share058285ff1?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781f75-001a-006b-6675-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:43 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share058285ff2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781f76-001a-006b-6775-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:43 GMT" - } - } ], - "variables" : [ "share058285ff" ] -} \ No newline at end of file diff --git a/storage/client/file/src/test/resources/session-records/listSharesWithPrefix.json b/storage/client/file/src/test/resources/session-records/listSharesWithPrefix.json deleted file mode 100644 index eec9f6affa44..000000000000 --- a/storage/client/file/src/test/resources/session-records/listSharesWithPrefix.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share98599009prefix0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CEEA9B3D7\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:47 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781fb7-001a-006b-1975-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share985990091?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CEEB48B44\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:47 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781fb9-001a-006b-1a75-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.file.core.windows.net/share98599009prefix2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "\"0x8D70F8CEEBC7BF7\"", - "Last-Modified" : "Tue, 23 Jul 2019 16:43:47 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "a4781fbb-001a-006b-1b75-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.file.core.windows.net?prefix=share98599009prefix&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 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" : "a4781fbd-001a-006b-1c75-4192c4000000", - "Body" : "share98599009prefixshare98599009prefix0Tue, 23 Jul 2019 16:43:47 GMT\"0x8D70F8CEEA9B3D7\"2share98599009prefix2Tue, 23 Jul 2019 16:43:47 GMT\"0x8D70F8CEEBC7BF7\"2", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.file.core.windows.net?prefix=share98599009&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 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" : "a4781fbe-001a-006b-1d75-4192c4000000", - "Body" : "share98599009share985990091Tue, 23 Jul 2019 16:43:47 GMT\"0x8D70F8CEEB48B44\"2share98599009prefix0Tue, 23 Jul 2019 16:43:47 GMT\"0x8D70F8CEEA9B3D7\"2share98599009prefix2Tue, 23 Jul 2019 16:43:47 GMT\"0x8D70F8CEEBC7BF7\"2", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share985990091?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781fbf-001a-006b-1e75-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share98599009prefix0?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781fc0-001a-006b-1f75-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.file.core.windows.net/share98599009prefix2?restype=share", - "Headers" : { - "x-ms-version" : "2018-11-09", - "User-Agent" : "azsdk-java-azure-storage-file/12.0.0-preview.1 1.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" : "a4781fc1-001a-006b-2075-4192c4000000", - "Date" : "Tue, 23 Jul 2019 16:43:46 GMT" - } - } ], - "variables" : [ "share98599009" ] -} \ No newline at end of file diff --git a/storage/client/file/src/test/resources/session-records/urlFromDirClient.json b/storage/client/file/src/test/resources/session-records/urlFromDirClient.json deleted file mode 100644 index 11fc90ded8ae..000000000000 --- a/storage/client/file/src/test/resources/session-records/urlFromDirClient.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "networkCallRecords" : [ ], - "variables" : [ "directory100251" ] -} \ No newline at end of file diff --git a/storage/client/pom.xml b/storage/client/pom.xml deleted file mode 100644 index 645574936759..000000000000 --- a/storage/client/pom.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - 4.0.0 - - com.azure - azure-client-sdk-parent - 1.0.0 - ../../pom.client.xml - - - com.azure - azure-storage - 12.0.0 - - Microsoft Azure client library for Storage - This package contains the Microsoft Azure Storage client library. - https://github.com/Azure/azure-sdk-for-java - - - - azure-java-build-docs - ${site.url}/site/${project.artifactId} - - - - - scm:git:https://github.com/Azure/azure-sdk-for-java - scm:git:git@github.com:Azure/azure-sdk-for-java.git - HEAD - - - - - com.azure - azure-core - 1.0.0-preview.1 - - - - - - - org.slf4j - slf4j-api - - - - com.azure - azure-core-test - 1.0.0-preview.1 - test - - - junit - junit - test - - - org.slf4j - slf4j-simple - test - - - io.projectreactor - reactor-test - test - - - com.microsoft.azure - adal4j - test - - - org.spockframework - spock-core - test - - - cglib - cglib-nodep - test - - - uk.org.lidalia - slf4j-test - test - - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - false - false - - - - org.apache.maven.plugins - maven-javadoc-plugin - - false - false - - - - - com.github.spotbugs - spotbugs-maven-plugin - - false - - - - - diff --git a/storage/client/queue/src/test/resources/session-records/clearMessages.json b/storage/client/queue/src/test/resources/session-records/clearMessages.json deleted file mode 100644 index dab05b23fcfd..000000000000 --- a/storage/client/queue/src/test/resources/session-records/clearMessages.json +++ /dev/null @@ -1,161 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue39460410", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dd222863-4003-0028-6775-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue39460410/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd2228a8-4003-0028-1b75-37b82d000000", - "Body" : "23ac390a-a15c-4036-b933-506b593e817aWed, 10 Jul 2019 23:18:01 GMTWed, 17 Jul 2019 23:18:01 GMTAgAAAAMAAAAAAAAAeGrWt3U31QE=Wed, 10 Jul 2019 23:18:01 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue39460410/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd2228d0-4003-0028-3a75-37b82d000000", - "Body" : "0820c842-8ea6-466f-801e-8fdb0240f573Wed, 10 Jul 2019 23:18:01 GMTWed, 17 Jul 2019 23:18:01 GMTAgAAAAMAAAAAAAAARoLet3U31QE=Wed, 10 Jul 2019 23:18:01 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue39460410/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd2228f8-4003-0028-5975-37b82d000000", - "Body" : "1a2b254b-4f28-4dba-8a56-5947173e08faWed, 10 Jul 2019 23:18:01 GMTWed, 17 Jul 2019 23:18:01 GMTAgAAAAMAAAAAAAAA5kvmt3U31QE=Wed, 10 Jul 2019 23:18:01 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue39460410?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.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" : "dd222917-4003-0028-7175-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue39460410/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd22292f-4003-0028-0775-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:00 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue39460410?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.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" : "dd222940-4003-0028-1575-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue39460410/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd22295c-4003-0028-2975-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue39460410", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd222973-4003-0028-3e75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT" - } - } ], - "variables" : [ "queue39460410" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/createQueue.json b/storage/client/queue/src/test/resources/session-records/createQueue.json deleted file mode 100644 index 51d4b6d64f5b..000000000000 --- a/storage/client/queue/src/test/resources/session-records/createQueue.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue09262a67", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "0d29065a-6003-009e-2f76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:47 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue09262a67/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "0d290667-6003-009e-3b76-37b6d5000000", - "Body" : "94fd0809-1708-49c0-91ea-d4cf2141af7fWed, 10 Jul 2019 23:24:47 GMTWed, 17 Jul 2019 23:24:47 GMTAgAAAAMAAAAAAAAAREDwqXY31QE=Wed, 10 Jul 2019 23:24:47 GMT", - "Date" : "Wed, 10 Jul 2019 23:24:47 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net?prefix=queue09262a67&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "0d29067f-6003-009e-5376-37b6d5000000", - "Body" : "queue09262a67queue09262a67", - "Date" : "Wed, 10 Jul 2019 23:24:47 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue09262a67/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290694-6003-009e-6676-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:47 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue09262a67", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d2906a1-6003-009e-7376-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:47 GMT" - } - } ], - "variables" : [ "queue09262a67" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/createQueueTwiceSameMetadata.json b/storage/client/queue/src/test/resources/session-records/createQueueTwiceSameMetadata.json deleted file mode 100644 index 5f637cb224b8..000000000000 --- a/storage/client/queue/src/test/resources/session-records/createQueueTwiceSameMetadata.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue3315117d", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "0d29094b-6003-009e-0a76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue3315117d/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "0d29096a-6003-009e-2176-37b6d5000000", - "Body" : "e59cbb06-dc9a-4fd8-89c9-a62bec05127eWed, 10 Jul 2019 23:24:49 GMTWed, 17 Jul 2019 23:24:49 GMTAgAAAAMAAAAAAAAAh80Wq3Y31QE=Wed, 10 Jul 2019 23:24:49 GMT", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue3315117d", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290979-6003-009e-2d76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue3315117d/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "0d29099f-6003-009e-4b76-37b6d5000000", - "Body" : "e59cbb06-dc9a-4fd8-89c9-a62bec05127eWed, 10 Jul 2019 23:24:49 GMTWed, 17 Jul 2019 23:24:49 GMT0Testing service client creating the same queue twice does not modify the queue", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net?prefix=queue3315117d&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "0d2909d4-6003-009e-7a76-37b6d5000000", - "Body" : "queue3315117dqueue3315117d", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue3315117d/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d2909eb-6003-009e-0e76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue3315117d", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d2909f9-6003-009e-1b76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT" - } - } ], - "variables" : [ "queue3315117d" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/deleteMessage.json b/storage/client/queue/src/test/resources/session-records/deleteMessage.json deleted file mode 100644 index 4682bf4a1a13..000000000000 --- a/storage/client/queue/src/test/resources/session-records/deleteMessage.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue1154048f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dd226162-4003-0028-1e75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue1154048f/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd226172-4003-0028-2a75-37b82d000000", - "Body" : "5d20d094-2ec7-4544-9ad1-86fc3aa14140Wed, 10 Jul 2019 23:18:38 GMTWed, 17 Jul 2019 23:18:38 GMTAgAAAAMAAAAAAAAAskA9znU31QE=Wed, 10 Jul 2019 23:18:38 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue1154048f/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd226183-4003-0028-3675-37b82d000000", - "Body" : "5d20d094-2ec7-4544-9ad1-86fc3aa14140Wed, 10 Jul 2019 23:18:38 GMTWed, 17 Jul 2019 23:18:38 GMTAgAAAAMAAAAAAAAAOIYm4HU31QE=Wed, 10 Jul 2019 23:19:08 GMT1test message", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue1154048f/messages/5d20d094-2ec7-4544-9ad1-86fc3aa14140?popreceipt=AgAAAAMAAAAAAAAAOIYm4HU31QE%3d", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd226190-4003-0028-3f75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue1154048f?comp=metadata", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.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" : "dd2261a5-4003-0028-4e75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue1154048f/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd2261ba-4003-0028-5e75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue1154048f", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd2261ce-4003-0028-6c75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT" - } - } ], - "variables" : [ "queue1154048f" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/deleteMessageInvalidMessageId.json b/storage/client/queue/src/test/resources/session-records/deleteMessageInvalidMessageId.json deleted file mode 100644 index 4eccb534a46f..000000000000 --- a/storage/client/queue/src/test/resources/session-records/deleteMessageInvalidMessageId.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue96938aad", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dd221ea5-4003-0028-1075-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:53 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue96938aad/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd221eb9-4003-0028-2375-37b82d000000", - "Body" : "17aa480c-b8aa-47ce-9fdb-753a00853819Wed, 10 Jul 2019 23:17:54 GMTWed, 17 Jul 2019 23:17:54 GMTAgAAAAMAAAAAAAAALPXXs3U31QE=Wed, 10 Jul 2019 23:17:54 GMT", - "Date" : "Wed, 10 Jul 2019 23:17:54 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue96938aad/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd221ecb-4003-0028-3575-37b82d000000", - "Body" : "17aa480c-b8aa-47ce-9fdb-753a00853819Wed, 10 Jul 2019 23:17:54 GMTWed, 17 Jul 2019 23:17:54 GMTAgAAAAMAAAAAAAAA4IjBxXU31QE=Wed, 10 Jul 2019 23:18:24 GMT1test message", - "Date" : "Wed, 10 Jul 2019 23:17:54 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue96938aad/messages/17aa480c-b8aa-47ce-9fdb-753a00853819random?popreceipt=AgAAAAMAAAAAAAAA4IjBxXU31QE%3d", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.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" : "dd221ee5-4003-0028-4d75-37b82d000000", - "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:dd221ee5-4003-0028-4d75-37b82d000000\nTime:2019-07-10T23:17:54.6327585Z", - "Date" : "Wed, 10 Jul 2019 23:17:54 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue96938aad/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd221ef8-4003-0028-5f75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:54 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue96938aad", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd221f17-4003-0028-7c75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:54 GMT" - } - } ], - "variables" : [ "queue96938aad" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/deleteMessageInvalidPopReceipt.json b/storage/client/queue/src/test/resources/session-records/deleteMessageInvalidPopReceipt.json deleted file mode 100644 index 01154b0b743d..000000000000 --- a/storage/client/queue/src/test/resources/session-records/deleteMessageInvalidPopReceipt.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue67327535", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dd221e11-4003-0028-0575-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:53 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue67327535/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd221e1c-4003-0028-0f75-37b82d000000", - "Body" : "a848cec9-d421-43a6-ac39-6a941d76d21bWed, 10 Jul 2019 23:17:54 GMTWed, 17 Jul 2019 23:17:54 GMTAgAAAAMAAAAAAAAAJDmgs3U31QE=Wed, 10 Jul 2019 23:17:54 GMT", - "Date" : "Wed, 10 Jul 2019 23:17:53 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue67327535/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd221e2b-4003-0028-1e75-37b82d000000", - "Body" : "a848cec9-d421-43a6-ac39-6a941d76d21bWed, 10 Jul 2019 23:17:54 GMTWed, 17 Jul 2019 23:17:54 GMTAgAAAAMAAAAAAAAANWmKxXU31QE=Wed, 10 Jul 2019 23:18:24 GMT1test message", - "Date" : "Wed, 10 Jul 2019 23:17:53 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue67327535/messages/a848cec9-d421-43a6-ac39-6a941d76d21b?popreceipt=AgAAAAMAAAAAAAAANWmKxXU31QE%3drandom", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.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" : "dd221e4c-4003-0028-3c75-37b82d000000", - "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:dd221e4c-4003-0028-3c75-37b82d000000\nTime:2019-07-10T23:17:54.2735030ZpopreceiptAgAAAAMAAAAAAAAANWmKxXU31QE=randomInvalid pop receipt format", - "Date" : "Wed, 10 Jul 2019 23:17:53 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue67327535/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd221e6a-4003-0028-5575-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:53 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue67327535", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd221e7b-4003-0028-6675-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:53 GMT" - } - } ], - "variables" : [ "queue67327535" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/dequeueMessage.json b/storage/client/queue/src/test/resources/session-records/dequeueMessage.json deleted file mode 100644 index 6473031c5a50..000000000000 --- a/storage/client/queue/src/test/resources/session-records/dequeueMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue679346d1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dd221d34-4003-0028-3d75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:52 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue679346d1/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd221d8c-4003-0028-0a75-37b82d000000", - "Body" : "b6c999ca-9091-4109-b579-c4bca39d216dWed, 10 Jul 2019 23:17:53 GMTWed, 17 Jul 2019 23:17:53 GMTAgAAAAMAAAAAAAAA9bc/s3U31QE=Wed, 10 Jul 2019 23:17:53 GMT", - "Date" : "Wed, 10 Jul 2019 23:17:53 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue679346d1/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd221da4-4003-0028-2275-37b82d000000", - "Body" : "b6c999ca-9091-4109-b579-c4bca39d216dWed, 10 Jul 2019 23:17:53 GMTWed, 17 Jul 2019 23:17:53 GMTAgAAAAMAAAAAAAAA11EwxXU31QE=Wed, 10 Jul 2019 23:18:23 GMT1test message", - "Date" : "Wed, 10 Jul 2019 23:17:53 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue679346d1/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd221da9-4003-0028-2775-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:53 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue679346d1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd221db5-4003-0028-3275-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:17:53 GMT" - } - } ], - "variables" : [ "queue679346d1" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/dequeueMultipleMessages.json b/storage/client/queue/src/test/resources/session-records/dequeueMultipleMessages.json deleted file mode 100644 index 104a637b766d..000000000000 --- a/storage/client/queue/src/test/resources/session-records/dequeueMultipleMessages.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue6570759e", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dd226228-4003-0028-2f75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue6570759e/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd22623f-4003-0028-4475-37b82d000000", - "Body" : "3d48ff69-e261-4bea-839c-ca0edfc2af4cWed, 10 Jul 2019 23:18:39 GMTWed, 17 Jul 2019 23:18:39 GMTAgAAAAMAAAAAAAAAYwGHznU31QE=Wed, 10 Jul 2019 23:18:39 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue6570759e/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd226254-4003-0028-5375-37b82d000000", - "Body" : "fd6a25b1-b3d3-4743-b5b3-072add1a4a86Wed, 10 Jul 2019 23:18:39 GMTWed, 17 Jul 2019 23:18:39 GMTAgAAAAMAAAAAAAAAz3yOznU31QE=Wed, 10 Jul 2019 23:18:39 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue6570759e/messages?numofmessages=2&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd226269-4003-0028-6475-37b82d000000", - "Body" : "3d48ff69-e261-4bea-839c-ca0edfc2af4cWed, 10 Jul 2019 23:18:39 GMTWed, 17 Jul 2019 23:18:39 GMTAgAAAAMAAAAAAAAAWsJ34HU31QE=Wed, 10 Jul 2019 23:19:09 GMT1test messagefd6a25b1-b3d3-4743-b5b3-072add1a4a86Wed, 10 Jul 2019 23:18:39 GMTWed, 17 Jul 2019 23:18:39 GMTAgAAAAMAAAAAAAAAWsJ34HU31QE=Wed, 10 Jul 2019 23:19:09 GMT1test message 2", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue6570759e/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd226296-4003-0028-0975-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue6570759e", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd2262a9-4003-0028-1975-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:38 GMT" - } - } ], - "variables" : [ "queue6570759e" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/enqueueEmptyMessage.json b/storage/client/queue/src/test/resources/session-records/enqueueEmptyMessage.json deleted file mode 100644 index ed0aaef6517f..000000000000 --- a/storage/client/queue/src/test/resources/session-records/enqueueEmptyMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue76420ef8", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dd2262ce-4003-0028-3475-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue76420ef8/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd2262e1-4003-0028-4275-37b82d000000", - "Body" : "e1efc34f-03c7-4037-9597-6955381e8889Wed, 10 Jul 2019 23:18:39 GMTWed, 17 Jul 2019 23:18:39 GMTAgAAAAMAAAAAAAAAl6+7znU31QE=Wed, 10 Jul 2019 23:18:39 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue76420ef8/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd2262ef-4003-0028-5075-37b82d000000", - "Body" : "e1efc34f-03c7-4037-9597-6955381e8889Wed, 10 Jul 2019 23:18:39 GMTWed, 17 Jul 2019 23:18:39 GMT0", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue76420ef8/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd2262fe-4003-0028-5e75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue76420ef8", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd22630f-4003-0028-6f75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:39 GMT" - } - } ], - "variables" : [ "queue76420ef8" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/enqueueMessage.json b/storage/client/queue/src/test/resources/session-records/enqueueMessage.json deleted file mode 100644 index ff3e72aedaac..000000000000 --- a/storage/client/queue/src/test/resources/session-records/enqueueMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue17032768", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dd222a23-4003-0028-4b75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue17032768/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd222a4a-4003-0028-6c75-37b82d000000", - "Body" : "7422f1b3-c1b1-4385-a945-6365e2e01caaWed, 10 Jul 2019 23:18:01 GMTWed, 17 Jul 2019 23:18:01 GMTAgAAAAMAAAAAAAAAQm1FuHU31QE=Wed, 10 Jul 2019 23:18:01 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue17032768/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd222a74-4003-0028-1275-37b82d000000", - "Body" : "7422f1b3-c1b1-4385-a945-6365e2e01caaWed, 10 Jul 2019 23:18:01 GMTWed, 17 Jul 2019 23:18:01 GMT0test message", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue17032768/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd222aa3-4003-0028-3975-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue17032768", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd222ac4-4003-0028-5675-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT" - } - } ], - "variables" : [ "queue17032768" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/listQueues.json b/storage/client/queue/src/test/resources/session-records/listQueues.json deleted file mode 100644 index 361f47abd400..000000000000 --- a/storage/client/queue/src/test/resources/session-records/listQueues.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue455724b60", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "0d2907f4-6003-009e-0976-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue455724b61", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "0d290805-6003-009e-1376-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue455724b62", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "0d29080b-6003-009e-1876-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net?prefix=queue455724b6&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "0d290816-6003-009e-2276-37b6d5000000", - "Body" : "queue455724b6queue455724b60queue455724b61queue455724b62", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net?prefix=queue455724b6&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "0d29083e-6003-009e-4676-37b6d5000000", - "Body" : "queue455724b6queue455724b60queue455724b61queue455724b62", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue455724b60/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290871-6003-009e-6e76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue455724b60", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290896-6003-009e-0676-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue455724b61/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d2908bc-6003-009e-2476-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:48 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue455724b61", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d2908df-6003-009e-3e76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue455724b62/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d2908fd-6003-009e-5676-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue455724b62", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d29091f-6003-009e-6a76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:49 GMT" - } - } ], - "variables" : [ "queue455724b6" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/listQueuesIncludeMetadata.json b/storage/client/queue/src/test/resources/session-records/listQueuesIncludeMetadata.json deleted file mode 100644 index a0e836cf2670..000000000000 --- a/storage/client/queue/src/test/resources/session-records/listQueuesIncludeMetadata.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue58738ae80", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "0d290c20-6003-009e-7b76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:51 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue58738ae81", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "0d290c34-6003-009e-0a76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:51 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue58738ae82", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "0d290c4e-6003-009e-1f76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:51 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net?prefix=queue58738ae8&include=metadata&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "0d290c6b-6003-009e-3376-37b6d5000000", - "Body" : "queue58738ae8queue58738ae80value1value2queue58738ae81queue58738ae82value1value2", - "Date" : "Wed, 10 Jul 2019 23:24:51 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net?prefix=queue58738ae8&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "0d290c8e-6003-009e-5176-37b6d5000000", - "Body" : "queue58738ae8queue58738ae80queue58738ae81queue58738ae82", - "Date" : "Wed, 10 Jul 2019 23:24:51 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue58738ae80/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290caa-6003-009e-6876-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:51 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue58738ae80", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290cc1-6003-009e-7a76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:51 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue58738ae81/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290cde-6003-009e-1176-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:51 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue58738ae81", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290cf2-6003-009e-2376-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:51 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue58738ae82/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290d14-6003-009e-4076-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:51 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue58738ae82", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290d2b-6003-009e-5476-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:51 GMT" - } - } ], - "variables" : [ "queue58738ae8" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/listQueuesWithPrefix.json b/storage/client/queue/src/test/resources/session-records/listQueuesWithPrefix.json deleted file mode 100644 index ff107058e29f..000000000000 --- a/storage/client/queue/src/test/resources/session-records/listQueuesWithPrefix.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue423382efprefix0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "0d290acd-6003-009e-5476-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue423382ef1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "0d290ae3-6003-009e-6876-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue423382efprefix2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "0d290afd-6003-009e-8076-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net?prefix=queue423382efprefix&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "0d290b0d-6003-009e-0f76-37b6d5000000", - "Body" : "queue423382efprefixqueue423382efprefix0queue423382efprefix2", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net?prefix=queue423382ef&include=&comp=list", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "0d290b16-6003-009e-1776-37b6d5000000", - "Body" : "queue423382efqueue423382ef1queue423382efprefix0queue423382efprefix2", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue423382ef1/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290b38-6003-009e-3576-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue423382ef1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290b4c-6003-009e-4776-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue423382efprefix0/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290b60-6003-009e-5976-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue423382efprefix0", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290b71-6003-009e-6676-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue423382efprefix2/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290b81-6003-009e-7576-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue423382efprefix2", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "0d290b9a-6003-009e-0b76-37b6d5000000", - "Date" : "Wed, 10 Jul 2019 23:24:50 GMT" - } - } ], - "variables" : [ "queue423382ef" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/peekMessage.json b/storage/client/queue/src/test/resources/session-records/peekMessage.json deleted file mode 100644 index 540c460785a1..000000000000 --- a/storage/client/queue/src/test/resources/session-records/peekMessage.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue54577e60", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dd225fa8-4003-0028-0d75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue54577e60/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd225fb8-4003-0028-1c75-37b82d000000", - "Body" : "53096a37-63bf-45d9-9172-4c8713ff282eWed, 10 Jul 2019 23:18:37 GMTWed, 17 Jul 2019 23:18:37 GMTAgAAAAMAAAAAAAAATsJgzXU31QE=Wed, 10 Jul 2019 23:18:37 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue54577e60/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd225fd2-4003-0028-3375-37b82d000000", - "Body" : "53096a37-63bf-45d9-9172-4c8713ff282eWed, 10 Jul 2019 23:18:37 GMTWed, 17 Jul 2019 23:18:37 GMT0test message", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue54577e60/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd225fe6-4003-0028-4775-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:36 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue54577e60", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd225ff7-4003-0028-5875-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:37 GMT" - } - } ], - "variables" : [ "queue54577e60" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/peekMultipleMessages.json b/storage/client/queue/src/test/resources/session-records/peekMultipleMessages.json deleted file mode 100644 index 5ea0a89b15f9..000000000000 --- a/storage/client/queue/src/test/resources/session-records/peekMultipleMessages.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue17925938", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dd222afc-4003-0028-0875-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue17925938/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd222b1e-4003-0028-2375-37b82d000000", - "Body" : "86c3b192-2c4f-4bd4-89bf-07553c141ac0Wed, 10 Jul 2019 23:18:02 GMTWed, 17 Jul 2019 23:18:02 GMTAgAAAAMAAAAAAAAAI8dyuHU31QE=Wed, 10 Jul 2019 23:18:02 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue17925938/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd222b4a-4003-0028-4775-37b82d000000", - "Body" : "1b2d50b7-3540-4dd4-a480-8549b5207fe7Wed, 10 Jul 2019 23:18:02 GMTWed, 17 Jul 2019 23:18:02 GMTAgAAAAMAAAAAAAAAqWl6uHU31QE=Wed, 10 Jul 2019 23:18:02 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue17925938/messages?numofmessages=2&peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd222b67-4003-0028-6175-37b82d000000", - "Body" : "86c3b192-2c4f-4bd4-89bf-07553c141ac0Wed, 10 Jul 2019 23:18:02 GMTWed, 17 Jul 2019 23:18:02 GMT0test message1b2d50b7-3540-4dd4-a480-8549b5207fe7Wed, 10 Jul 2019 23:18:02 GMTWed, 17 Jul 2019 23:18:02 GMT0test message 2", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue17925938/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd222b7e-4003-0028-7675-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue17925938", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd222b8e-4003-0028-0675-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:01 GMT" - } - } ], - "variables" : [ "queue17925938" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/updateMessage.json b/storage/client/queue/src/test/resources/session-records/updateMessage.json deleted file mode 100644 index 46e184bda045..000000000000 --- a/storage/client/queue/src/test/resources/session-records/updateMessage.json +++ /dev/null @@ -1,128 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue4236461c", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dd222c30-4003-0028-0f75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:02 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue4236461c/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd222c40-4003-0028-1c75-37b82d000000", - "Body" : "c3781181-9103-468e-b645-f6dbb100bd9cWed, 10 Jul 2019 23:18:02 GMTWed, 17 Jul 2019 23:18:02 GMTAgAAAAMAAAAAAAAAjQ/SuHU31QE=Wed, 10 Jul 2019 23:18:02 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue4236461c/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd222c62-4003-0028-3b75-37b82d000000", - "Body" : "c3781181-9103-468e-b645-f6dbb100bd9cWed, 10 Jul 2019 23:18:02 GMTWed, 17 Jul 2019 23:18:02 GMTAgAAAAMAAAAAAAAAEAO9ynU31QE=Wed, 10 Jul 2019 23:18:32 GMT1test message", - "Date" : "Wed, 10 Jul 2019 23:18:02 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue4236461c/messages/c3781181-9103-468e-b645-f6dbb100bd9c?popreceipt=AgAAAAMAAAAAAAAAEAO9ynU31QE%3d&visibilitytimeout=1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "Wed, 10 Jul 2019 23:18:04 GMT", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "204", - "x-ms-request-id" : "dd222c7f-4003-0028-5475-37b82d000000", - "x-ms-popreceipt" : "AwAAAAMAAAAAAAAAZuN9uXU31QEBAAAA", - "Date" : "Wed, 10 Jul 2019 23:18:02 GMT" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue4236461c/messages?peekonly=true", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd2230d0-4003-0028-1b75-37b82d000000", - "Body" : "c3781181-9103-468e-b645-f6dbb100bd9cWed, 10 Jul 2019 23:18:02 GMTWed, 17 Jul 2019 23:18:02 GMT1updated test message", - "Date" : "Wed, 10 Jul 2019 23:18:04 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue4236461c/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd2230e9-4003-0028-2e75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:04 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue4236461c", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd223113-4003-0028-4f75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:04 GMT" - } - } ], - "variables" : [ "queue4236461c" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/updateMessageInvalidMessageId.json b/storage/client/queue/src/test/resources/session-records/updateMessageInvalidMessageId.json deleted file mode 100644 index eae58afb9650..000000000000 --- a/storage/client/queue/src/test/resources/session-records/updateMessageInvalidMessageId.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue10019121", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dd223139-4003-0028-6d75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:04 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue10019121/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd223159-4003-0028-0475-37b82d000000", - "Body" : "e3dbec12-5e3c-47f4-abd9-fbdf6e44746dWed, 10 Jul 2019 23:18:05 GMTWed, 17 Jul 2019 23:18:05 GMTAgAAAAMAAAAAAAAA7UtBunU31QE=Wed, 10 Jul 2019 23:18:05 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:04 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue10019121/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd223169-4003-0028-1475-37b82d000000", - "Body" : "e3dbec12-5e3c-47f4-abd9-fbdf6e44746dWed, 10 Jul 2019 23:18:05 GMTWed, 17 Jul 2019 23:18:05 GMTAgAAAAMAAAAAAAAAc5EqzHU31QE=Wed, 10 Jul 2019 23:18:35 GMT1test message", - "Date" : "Wed, 10 Jul 2019 23:18:04 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue10019121/messages/e3dbec12-5e3c-47f4-abd9-fbdf6e44746drandom?popreceipt=AgAAAAMAAAAAAAAAc5EqzHU31QE%3d&visibilitytimeout=1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd22317f-4003-0028-2775-37b82d000000", - "Body" : "MessageNotFoundThe specified message does not exist.\nRequestId:dd22317f-4003-0028-2775-37b82d000000\nTime:2019-07-10T23:18:05.3974051Z", - "Date" : "Wed, 10 Jul 2019 23:18:04 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue10019121/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd223195-4003-0028-3975-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:04 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue10019121", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd2231a9-4003-0028-4975-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT" - } - } ], - "variables" : [ "queue10019121" ] -} \ No newline at end of file diff --git a/storage/client/queue/src/test/resources/session-records/updateMessageInvalidPopReceipt.json b/storage/client/queue/src/test/resources/session-records/updateMessageInvalidPopReceipt.json deleted file mode 100644 index f7795c878f27..000000000000 --- a/storage/client/queue/src/test/resources/session-records/updateMessageInvalidPopReceipt.json +++ /dev/null @@ -1,110 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue41380e30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "Response" : { - "x-ms-version" : "2018-03-28", - "Server" : "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", - "retry-after" : "0", - "Content-Length" : "0", - "StatusCode" : "201", - "x-ms-request-id" : "dd22326c-4003-0028-6c75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT" - } - }, { - "Method" : "POST", - "Uri" : "https://sima.queue.core.windows.net/queue41380e30/messages?visibilitytimeout=0&messagettl=604800", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd22329c-4003-0028-1475-37b82d000000", - "Body" : "8900ad74-7404-4cd2-8b4b-41e70995dc1fWed, 10 Jul 2019 23:18:06 GMTWed, 17 Jul 2019 23:18:06 GMTAgAAAAMAAAAAAAAA/TyvunU31QE=Wed, 10 Jul 2019 23:18:06 GMT", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "GET", - "Uri" : "https://sima.queue.core.windows.net/queue41380e30/messages?numofmessages=1&visibilitytimeout=30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd2232d5-4003-0028-4575-37b82d000000", - "Body" : "8900ad74-7404-4cd2-8b4b-41e70995dc1fWed, 10 Jul 2019 23:18:06 GMTWed, 17 Jul 2019 23:18:06 GMTAgAAAAMAAAAAAAAA+kWZzHU31QE=Wed, 10 Jul 2019 23:18:36 GMT1test message", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "PUT", - "Uri" : "https://sima.queue.core.windows.net/queue41380e30/messages/8900ad74-7404-4cd2-8b4b-41e70995dc1f?popreceipt=AgAAAAMAAAAAAAAA%2bkWZzHU31QE%3drandom&visibilitytimeout=1", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 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" : "dd2232ff-4003-0028-6d75-37b82d000000", - "Body" : "InvalidQueryParameterValueValue for one of the query parameters specified in the request URI is invalid.\nRequestId:dd2232ff-4003-0028-6d75-37b82d000000\nTime:2019-07-10T23:18:06.1209188ZpopreceiptAgAAAAMAAAAAAAAA+kWZzHU31QE=randomInvalid pop receipt format", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT", - "Content-Type" : "application/xml" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue41380e30/messages", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd22331d-4003-0028-0a75-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT" - } - }, { - "Method" : "DELETE", - "Uri" : "https://sima.queue.core.windows.net/queue41380e30", - "Headers" : { - "x-ms-version" : "2018-03-28", - "User-Agent" : "azsdk-java-storage-queue/1.0.0-SNAPSHOT 1.8.0_201; Windows 10 10.0" - }, - "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" : "dd223333-4003-0028-2075-37b82d000000", - "Date" : "Wed, 10 Jul 2019 23:18:05 GMT" - } - } ], - "variables" : [ "queue41380e30" ] -} \ No newline at end of file