From 3f03d8f7306f4ceeb897aef822bd6954a0629aa7 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 16 Nov 2018 14:16:31 -0800 Subject: [PATCH] Generated from de07e1b451ebc32e2150c85225702957853cccaf (#2596) [HDInsight] - Support KV URL --- .../ClusterCreateProperties.java | 26 +++ .../ClusterDiskEncryptionParameters.java | 96 ++++++++++ .../ClusterGetProperties.java | 26 +++ .../v2015_03_01_preview/Clusters.java | 11 ++ .../DiskEncryptionProperties.java | 149 +++++++++++++++ .../JsonWebKeyEncryptionAlgorithm.java | 44 +++++ .../implementation/ClustersImpl.java | 7 + .../implementation/ClustersInner.java | 179 ++++++++++++++++++ .../ClusterCreateProperties.java | 26 +++ .../ClusterDiskEncryptionParameters.java | 96 ++++++++++ .../ClusterGetProperties.java | 26 +++ .../v2018_06_01_preview/Clusters.java | 11 ++ .../DiskEncryptionProperties.java | 149 +++++++++++++++ .../JsonWebKeyEncryptionAlgorithm.java | 44 +++++ .../implementation/ClustersImpl.java | 7 + .../implementation/ClustersInner.java | 179 ++++++++++++++++++ 16 files changed, 1076 insertions(+) create mode 100644 hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/ClusterDiskEncryptionParameters.java create mode 100644 hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/DiskEncryptionProperties.java create mode 100644 hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/JsonWebKeyEncryptionAlgorithm.java create mode 100644 hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ClusterDiskEncryptionParameters.java create mode 100644 hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/DiskEncryptionProperties.java create mode 100644 hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/JsonWebKeyEncryptionAlgorithm.java diff --git a/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/ClusterCreateProperties.java b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/ClusterCreateProperties.java index 9ca2b6a9d2afd..d89e9dae041bb 100644 --- a/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/ClusterCreateProperties.java +++ b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/ClusterCreateProperties.java @@ -57,6 +57,12 @@ public class ClusterCreateProperties { @JsonProperty(value = "storageProfile") private StorageProfile storageProfile; + /** + * The disk encryption properties. + */ + @JsonProperty(value = "diskEncryptionProperties") + private DiskEncryptionProperties diskEncryptionProperties; + /** * Get the version of the cluster. * @@ -197,4 +203,24 @@ public ClusterCreateProperties withStorageProfile(StorageProfile storageProfile) return this; } + /** + * Get the disk encryption properties. + * + * @return the diskEncryptionProperties value + */ + public DiskEncryptionProperties diskEncryptionProperties() { + return this.diskEncryptionProperties; + } + + /** + * Set the disk encryption properties. + * + * @param diskEncryptionProperties the diskEncryptionProperties value to set + * @return the ClusterCreateProperties object itself. + */ + public ClusterCreateProperties withDiskEncryptionProperties(DiskEncryptionProperties diskEncryptionProperties) { + this.diskEncryptionProperties = diskEncryptionProperties; + return this; + } + } diff --git a/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/ClusterDiskEncryptionParameters.java b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/ClusterDiskEncryptionParameters.java new file mode 100644 index 0000000000000..5f932508239fa --- /dev/null +++ b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/ClusterDiskEncryptionParameters.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.v2015_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Disk Encryption Cluster request parameters. + */ +public class ClusterDiskEncryptionParameters { + /** + * Base key vault URI where the customers key is located eg. + * https://myvault.vault.azure.net. + */ + @JsonProperty(value = "vaultUri") + private String vaultUri; + + /** + * Key name that is used for enabling disk encryption. + */ + @JsonProperty(value = "keyName") + private String keyName; + + /** + * Specific key version that is used for enabling disk encryption. + */ + @JsonProperty(value = "keyVersion") + private String keyVersion; + + /** + * Get base key vault URI where the customers key is located eg. https://myvault.vault.azure.net. + * + * @return the vaultUri value + */ + public String vaultUri() { + return this.vaultUri; + } + + /** + * Set base key vault URI where the customers key is located eg. https://myvault.vault.azure.net. + * + * @param vaultUri the vaultUri value to set + * @return the ClusterDiskEncryptionParameters object itself. + */ + public ClusterDiskEncryptionParameters withVaultUri(String vaultUri) { + this.vaultUri = vaultUri; + return this; + } + + /** + * Get key name that is used for enabling disk encryption. + * + * @return the keyName value + */ + public String keyName() { + return this.keyName; + } + + /** + * Set key name that is used for enabling disk encryption. + * + * @param keyName the keyName value to set + * @return the ClusterDiskEncryptionParameters object itself. + */ + public ClusterDiskEncryptionParameters withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get specific key version that is used for enabling disk encryption. + * + * @return the keyVersion value + */ + public String keyVersion() { + return this.keyVersion; + } + + /** + * Set specific key version that is used for enabling disk encryption. + * + * @param keyVersion the keyVersion value to set + * @return the ClusterDiskEncryptionParameters object itself. + */ + public ClusterDiskEncryptionParameters withKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/ClusterGetProperties.java b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/ClusterGetProperties.java index 0326f67f19d4f..bd3ba6f48c0f6 100644 --- a/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/ClusterGetProperties.java +++ b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/ClusterGetProperties.java @@ -90,6 +90,12 @@ public class ClusterGetProperties { @JsonProperty(value = "connectivityEndpoints") private List connectivityEndpoints; + /** + * The disk encryption properties. + */ + @JsonProperty(value = "diskEncryptionProperties") + private DiskEncryptionProperties diskEncryptionProperties; + /** * Get the version of the cluster. * @@ -330,4 +336,24 @@ public ClusterGetProperties withConnectivityEndpoints(List return this; } + /** + * Get the disk encryption properties. + * + * @return the diskEncryptionProperties value + */ + public DiskEncryptionProperties diskEncryptionProperties() { + return this.diskEncryptionProperties; + } + + /** + * Set the disk encryption properties. + * + * @param diskEncryptionProperties the diskEncryptionProperties value to set + * @return the ClusterGetProperties object itself. + */ + public ClusterGetProperties withDiskEncryptionProperties(DiskEncryptionProperties diskEncryptionProperties) { + this.diskEncryptionProperties = diskEncryptionProperties; + return this; + } + } diff --git a/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/Clusters.java b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/Clusters.java index b7bf37ff22595..e30176473c835 100644 --- a/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/Clusters.java +++ b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/Clusters.java @@ -23,6 +23,17 @@ * Type representing Clusters. */ public interface Clusters extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable rotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters); + /** * Executes script actions on the specified HDInsight cluster. * diff --git a/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/DiskEncryptionProperties.java b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/DiskEncryptionProperties.java new file mode 100644 index 0000000000000..8ee53b980237c --- /dev/null +++ b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/DiskEncryptionProperties.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.hdinsight.v2015_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The disk encryption properties. + */ +public class DiskEncryptionProperties { + /** + * Base key vault URI where the customers key is located eg. + * https://myvault.vault.azure.net. + */ + @JsonProperty(value = "vaultUri") + private String vaultUri; + + /** + * Key name that is used for enabling disk encryption. + */ + @JsonProperty(value = "keyName") + private String keyName; + + /** + * Specific key version that is used for enabling disk encryption. + */ + @JsonProperty(value = "keyVersion") + private String keyVersion; + + /** + * Algorithm identifier for encryption, default RSA-OAEP. Possible values + * include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'. + */ + @JsonProperty(value = "encryptionAlgorithm") + private JsonWebKeyEncryptionAlgorithm encryptionAlgorithm; + + /** + * Resource ID of Managed Identity that is used to access the key vault. + */ + @JsonProperty(value = "msiResourceId") + private String msiResourceId; + + /** + * Get base key vault URI where the customers key is located eg. https://myvault.vault.azure.net. + * + * @return the vaultUri value + */ + public String vaultUri() { + return this.vaultUri; + } + + /** + * Set base key vault URI where the customers key is located eg. https://myvault.vault.azure.net. + * + * @param vaultUri the vaultUri value to set + * @return the DiskEncryptionProperties object itself. + */ + public DiskEncryptionProperties withVaultUri(String vaultUri) { + this.vaultUri = vaultUri; + return this; + } + + /** + * Get key name that is used for enabling disk encryption. + * + * @return the keyName value + */ + public String keyName() { + return this.keyName; + } + + /** + * Set key name that is used for enabling disk encryption. + * + * @param keyName the keyName value to set + * @return the DiskEncryptionProperties object itself. + */ + public DiskEncryptionProperties withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get specific key version that is used for enabling disk encryption. + * + * @return the keyVersion value + */ + public String keyVersion() { + return this.keyVersion; + } + + /** + * Set specific key version that is used for enabling disk encryption. + * + * @param keyVersion the keyVersion value to set + * @return the DiskEncryptionProperties object itself. + */ + public DiskEncryptionProperties withKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + + /** + * Get algorithm identifier for encryption, default RSA-OAEP. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'. + * + * @return the encryptionAlgorithm value + */ + public JsonWebKeyEncryptionAlgorithm encryptionAlgorithm() { + return this.encryptionAlgorithm; + } + + /** + * Set algorithm identifier for encryption, default RSA-OAEP. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'. + * + * @param encryptionAlgorithm the encryptionAlgorithm value to set + * @return the DiskEncryptionProperties object itself. + */ + public DiskEncryptionProperties withEncryptionAlgorithm(JsonWebKeyEncryptionAlgorithm encryptionAlgorithm) { + this.encryptionAlgorithm = encryptionAlgorithm; + return this; + } + + /** + * Get resource ID of Managed Identity that is used to access the key vault. + * + * @return the msiResourceId value + */ + public String msiResourceId() { + return this.msiResourceId; + } + + /** + * Set resource ID of Managed Identity that is used to access the key vault. + * + * @param msiResourceId the msiResourceId value to set + * @return the DiskEncryptionProperties object itself. + */ + public DiskEncryptionProperties withMsiResourceId(String msiResourceId) { + this.msiResourceId = msiResourceId; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/JsonWebKeyEncryptionAlgorithm.java b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/JsonWebKeyEncryptionAlgorithm.java new file mode 100644 index 0000000000000..5d5965be7fcef --- /dev/null +++ b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/JsonWebKeyEncryptionAlgorithm.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.v2015_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JsonWebKeyEncryptionAlgorithm. + */ +public final class JsonWebKeyEncryptionAlgorithm extends ExpandableStringEnum { + /** Static value RSA-OAEP for JsonWebKeyEncryptionAlgorithm. */ + public static final JsonWebKeyEncryptionAlgorithm RSA_OAEP = fromString("RSA-OAEP"); + + /** Static value RSA-OAEP-256 for JsonWebKeyEncryptionAlgorithm. */ + public static final JsonWebKeyEncryptionAlgorithm RSA_OAEP_256 = fromString("RSA-OAEP-256"); + + /** Static value RSA1_5 for JsonWebKeyEncryptionAlgorithm. */ + public static final JsonWebKeyEncryptionAlgorithm RSA1_5 = fromString("RSA1_5"); + + /** + * Creates or finds a JsonWebKeyEncryptionAlgorithm from its string representation. + * @param name a name to look for + * @return the corresponding JsonWebKeyEncryptionAlgorithm + */ + @JsonCreator + public static JsonWebKeyEncryptionAlgorithm fromString(String name) { + return fromString(name, JsonWebKeyEncryptionAlgorithm.class); + } + + /** + * @return known JsonWebKeyEncryptionAlgorithm values + */ + public static Collection values() { + return values(JsonWebKeyEncryptionAlgorithm.class); + } +} diff --git a/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/implementation/ClustersImpl.java b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/implementation/ClustersImpl.java index e3684e84d790d..1434567280168 100644 --- a/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/implementation/ClustersImpl.java +++ b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/implementation/ClustersImpl.java @@ -22,6 +22,7 @@ import rx.functions.Func1; import com.microsoft.azure.PagedList; import com.microsoft.azure.Page; +import com.microsoft.azure.management.hdinsight.v2015_03_01_preview.ClusterDiskEncryptionParameters; import com.microsoft.azure.management.hdinsight.v2015_03_01_preview.ExecuteScriptActionParameters; class ClustersImpl extends GroupableResourcesCoreImpl implements Clusters { @@ -126,6 +127,12 @@ public ClusterImpl define(String name) { return wrapModel(name); } + @Override + public Completable rotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { + ClustersInner client = this.inner(); + return client.rotateDiskEncryptionKeyAsync(resourceGroupName, clusterName, parameters).toCompletable(); + } + @Override public Completable executeScriptActionsAsync(String resourceGroupName, String clusterName, ExecuteScriptActionParameters parameters) { ClustersInner client = this.inner(); diff --git a/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/implementation/ClustersInner.java b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/implementation/ClustersInner.java index e75b8f8cb623a..09b5e2cb5b036 100644 --- a/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/implementation/ClustersInner.java +++ b/hdinsight/resource-manager/v2015_03_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2015_03_01_preview/implementation/ClustersInner.java @@ -16,6 +16,7 @@ import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.hdinsight.v2015_03_01_preview.ClusterCreateParametersExtended; +import com.microsoft.azure.management.hdinsight.v2015_03_01_preview.ClusterDiskEncryptionParameters; import com.microsoft.azure.management.hdinsight.v2015_03_01_preview.ClusterPatchParameters; import com.microsoft.azure.management.hdinsight.v2015_03_01_preview.ClusterResizeParameters; import com.microsoft.azure.management.hdinsight.v2015_03_01_preview.ErrorResponseException; @@ -111,6 +112,14 @@ interface ClustersService { @GET("subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters") Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hdinsight.v2015_03_01_preview.Clusters rotateDiskEncryptionKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey") + Observable> rotateDiskEncryptionKey(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body ClusterDiskEncryptionParameters parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hdinsight.v2015_03_01_preview.Clusters beginRotateDiskEncryptionKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey") + Observable> beginRotateDiskEncryptionKey(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body ClusterDiskEncryptionParameters parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hdinsight.v2015_03_01_preview.Clusters executeScriptActions" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions") Observable> executeScriptActions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body ExecuteScriptActionParameters parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -1258,6 +1267,176 @@ private ServiceResponse> listDelegate(Response rotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(rotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters), serviceCallback); + } + + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable rotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { + return rotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> rotateDiskEncryptionKeyWithServiceResponseAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters 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 (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.rotateDiskEncryptionKey(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption 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 + */ + public void beginRotateDiskEncryptionKey(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { + beginRotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body(); + } + + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption 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 beginRotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters), serviceCallback); + } + + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { + return beginRotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRotateDiskEncryptionKeyWithServiceResponseAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters 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 (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginRotateDiskEncryptionKey(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRotateDiskEncryptionKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRotateDiskEncryptionKeyDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + /** * Executes script actions on the specified HDInsight cluster. * diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ClusterCreateProperties.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ClusterCreateProperties.java index f967ee308913a..9f3802b039b44 100644 --- a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ClusterCreateProperties.java +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ClusterCreateProperties.java @@ -57,6 +57,12 @@ public class ClusterCreateProperties { @JsonProperty(value = "storageProfile") private StorageProfile storageProfile; + /** + * The disk encryption properties. + */ + @JsonProperty(value = "diskEncryptionProperties") + private DiskEncryptionProperties diskEncryptionProperties; + /** * Get the version of the cluster. * @@ -197,4 +203,24 @@ public ClusterCreateProperties withStorageProfile(StorageProfile storageProfile) return this; } + /** + * Get the disk encryption properties. + * + * @return the diskEncryptionProperties value + */ + public DiskEncryptionProperties diskEncryptionProperties() { + return this.diskEncryptionProperties; + } + + /** + * Set the disk encryption properties. + * + * @param diskEncryptionProperties the diskEncryptionProperties value to set + * @return the ClusterCreateProperties object itself. + */ + public ClusterCreateProperties withDiskEncryptionProperties(DiskEncryptionProperties diskEncryptionProperties) { + this.diskEncryptionProperties = diskEncryptionProperties; + return this; + } + } diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ClusterDiskEncryptionParameters.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ClusterDiskEncryptionParameters.java new file mode 100644 index 0000000000000..7357adcf1e2ef --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ClusterDiskEncryptionParameters.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 Encryption Cluster request parameters. + */ +public class ClusterDiskEncryptionParameters { + /** + * Base key vault URI where the customers key is located eg. + * https://myvault.vault.azure.net. + */ + @JsonProperty(value = "vaultUri") + private String vaultUri; + + /** + * Key name that is used for enabling disk encryption. + */ + @JsonProperty(value = "keyName") + private String keyName; + + /** + * Specific key version that is used for enabling disk encryption. + */ + @JsonProperty(value = "keyVersion") + private String keyVersion; + + /** + * Get base key vault URI where the customers key is located eg. https://myvault.vault.azure.net. + * + * @return the vaultUri value + */ + public String vaultUri() { + return this.vaultUri; + } + + /** + * Set base key vault URI where the customers key is located eg. https://myvault.vault.azure.net. + * + * @param vaultUri the vaultUri value to set + * @return the ClusterDiskEncryptionParameters object itself. + */ + public ClusterDiskEncryptionParameters withVaultUri(String vaultUri) { + this.vaultUri = vaultUri; + return this; + } + + /** + * Get key name that is used for enabling disk encryption. + * + * @return the keyName value + */ + public String keyName() { + return this.keyName; + } + + /** + * Set key name that is used for enabling disk encryption. + * + * @param keyName the keyName value to set + * @return the ClusterDiskEncryptionParameters object itself. + */ + public ClusterDiskEncryptionParameters withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get specific key version that is used for enabling disk encryption. + * + * @return the keyVersion value + */ + public String keyVersion() { + return this.keyVersion; + } + + /** + * Set specific key version that is used for enabling disk encryption. + * + * @param keyVersion the keyVersion value to set + * @return the ClusterDiskEncryptionParameters object itself. + */ + public ClusterDiskEncryptionParameters withKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ClusterGetProperties.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ClusterGetProperties.java index b525caac90900..ece9225eb6509 100644 --- a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ClusterGetProperties.java +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/ClusterGetProperties.java @@ -90,6 +90,12 @@ public class ClusterGetProperties { @JsonProperty(value = "connectivityEndpoints") private List connectivityEndpoints; + /** + * The disk encryption properties. + */ + @JsonProperty(value = "diskEncryptionProperties") + private DiskEncryptionProperties diskEncryptionProperties; + /** * Get the version of the cluster. * @@ -330,4 +336,24 @@ public ClusterGetProperties withConnectivityEndpoints(List return this; } + /** + * Get the disk encryption properties. + * + * @return the diskEncryptionProperties value + */ + public DiskEncryptionProperties diskEncryptionProperties() { + return this.diskEncryptionProperties; + } + + /** + * Set the disk encryption properties. + * + * @param diskEncryptionProperties the diskEncryptionProperties value to set + * @return the ClusterGetProperties object itself. + */ + public ClusterGetProperties withDiskEncryptionProperties(DiskEncryptionProperties diskEncryptionProperties) { + this.diskEncryptionProperties = diskEncryptionProperties; + return this; + } + } diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Clusters.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Clusters.java index 0fad80b77e2e6..a274bdc9e05d8 100644 --- a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Clusters.java +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/Clusters.java @@ -23,6 +23,17 @@ * Type representing Clusters. */ public interface Clusters extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable rotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters); + /** * Executes script actions on the specified HDInsight cluster. * diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/DiskEncryptionProperties.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/DiskEncryptionProperties.java new file mode 100644 index 0000000000000..102087c739507 --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/DiskEncryptionProperties.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.hdinsight.v2018_06_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The disk encryption properties. + */ +public class DiskEncryptionProperties { + /** + * Base key vault URI where the customers key is located eg. + * https://myvault.vault.azure.net. + */ + @JsonProperty(value = "vaultUri") + private String vaultUri; + + /** + * Key name that is used for enabling disk encryption. + */ + @JsonProperty(value = "keyName") + private String keyName; + + /** + * Specific key version that is used for enabling disk encryption. + */ + @JsonProperty(value = "keyVersion") + private String keyVersion; + + /** + * Algorithm identifier for encryption, default RSA-OAEP. Possible values + * include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'. + */ + @JsonProperty(value = "encryptionAlgorithm") + private JsonWebKeyEncryptionAlgorithm encryptionAlgorithm; + + /** + * Resource ID of Managed Identity that is used to access the key vault. + */ + @JsonProperty(value = "msiResourceId") + private String msiResourceId; + + /** + * Get base key vault URI where the customers key is located eg. https://myvault.vault.azure.net. + * + * @return the vaultUri value + */ + public String vaultUri() { + return this.vaultUri; + } + + /** + * Set base key vault URI where the customers key is located eg. https://myvault.vault.azure.net. + * + * @param vaultUri the vaultUri value to set + * @return the DiskEncryptionProperties object itself. + */ + public DiskEncryptionProperties withVaultUri(String vaultUri) { + this.vaultUri = vaultUri; + return this; + } + + /** + * Get key name that is used for enabling disk encryption. + * + * @return the keyName value + */ + public String keyName() { + return this.keyName; + } + + /** + * Set key name that is used for enabling disk encryption. + * + * @param keyName the keyName value to set + * @return the DiskEncryptionProperties object itself. + */ + public DiskEncryptionProperties withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get specific key version that is used for enabling disk encryption. + * + * @return the keyVersion value + */ + public String keyVersion() { + return this.keyVersion; + } + + /** + * Set specific key version that is used for enabling disk encryption. + * + * @param keyVersion the keyVersion value to set + * @return the DiskEncryptionProperties object itself. + */ + public DiskEncryptionProperties withKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + + /** + * Get algorithm identifier for encryption, default RSA-OAEP. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'. + * + * @return the encryptionAlgorithm value + */ + public JsonWebKeyEncryptionAlgorithm encryptionAlgorithm() { + return this.encryptionAlgorithm; + } + + /** + * Set algorithm identifier for encryption, default RSA-OAEP. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'. + * + * @param encryptionAlgorithm the encryptionAlgorithm value to set + * @return the DiskEncryptionProperties object itself. + */ + public DiskEncryptionProperties withEncryptionAlgorithm(JsonWebKeyEncryptionAlgorithm encryptionAlgorithm) { + this.encryptionAlgorithm = encryptionAlgorithm; + return this; + } + + /** + * Get resource ID of Managed Identity that is used to access the key vault. + * + * @return the msiResourceId value + */ + public String msiResourceId() { + return this.msiResourceId; + } + + /** + * Set resource ID of Managed Identity that is used to access the key vault. + * + * @param msiResourceId the msiResourceId value to set + * @return the DiskEncryptionProperties object itself. + */ + public DiskEncryptionProperties withMsiResourceId(String msiResourceId) { + this.msiResourceId = msiResourceId; + return this; + } + +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/JsonWebKeyEncryptionAlgorithm.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/JsonWebKeyEncryptionAlgorithm.java new file mode 100644 index 0000000000000..bde234e1c5ffe --- /dev/null +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/JsonWebKeyEncryptionAlgorithm.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.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for JsonWebKeyEncryptionAlgorithm. + */ +public final class JsonWebKeyEncryptionAlgorithm extends ExpandableStringEnum { + /** Static value RSA-OAEP for JsonWebKeyEncryptionAlgorithm. */ + public static final JsonWebKeyEncryptionAlgorithm RSA_OAEP = fromString("RSA-OAEP"); + + /** Static value RSA-OAEP-256 for JsonWebKeyEncryptionAlgorithm. */ + public static final JsonWebKeyEncryptionAlgorithm RSA_OAEP_256 = fromString("RSA-OAEP-256"); + + /** Static value RSA1_5 for JsonWebKeyEncryptionAlgorithm. */ + public static final JsonWebKeyEncryptionAlgorithm RSA1_5 = fromString("RSA1_5"); + + /** + * Creates or finds a JsonWebKeyEncryptionAlgorithm from its string representation. + * @param name a name to look for + * @return the corresponding JsonWebKeyEncryptionAlgorithm + */ + @JsonCreator + public static JsonWebKeyEncryptionAlgorithm fromString(String name) { + return fromString(name, JsonWebKeyEncryptionAlgorithm.class); + } + + /** + * @return known JsonWebKeyEncryptionAlgorithm values + */ + public static Collection values() { + return values(JsonWebKeyEncryptionAlgorithm.class); + } +} diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersImpl.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersImpl.java index 22cb91adc2911..c516f1fe7453f 100644 --- a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersImpl.java +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersImpl.java @@ -22,6 +22,7 @@ import rx.functions.Func1; import com.microsoft.azure.PagedList; import com.microsoft.azure.Page; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.ClusterDiskEncryptionParameters; import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.ExecuteScriptActionParameters; class ClustersImpl extends GroupableResourcesCoreImpl implements Clusters { @@ -126,6 +127,12 @@ public ClusterImpl define(String name) { return wrapModel(name); } + @Override + public Completable rotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { + ClustersInner client = this.inner(); + return client.rotateDiskEncryptionKeyAsync(resourceGroupName, clusterName, parameters).toCompletable(); + } + @Override public Completable executeScriptActionsAsync(String resourceGroupName, String clusterName, ExecuteScriptActionParameters parameters) { ClustersInner client = this.inner(); diff --git a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java index 250355e95795e..b942b02bab602 100644 --- a/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java +++ b/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java @@ -16,6 +16,7 @@ import com.microsoft.azure.AzureServiceFuture; import com.microsoft.azure.ListOperationCallback; import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.ClusterCreateParametersExtended; +import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.ClusterDiskEncryptionParameters; import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.ClusterPatchParameters; import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.ClusterResizeParameters; import com.microsoft.azure.management.hdinsight.v2018_06_01_preview.ErrorResponseException; @@ -111,6 +112,14 @@ interface ClustersService { @GET("subscriptions/{subscriptionId}/providers/Microsoft.HDInsight/clusters") Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hdinsight.v2018_06_01_preview.Clusters rotateDiskEncryptionKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey") + Observable> rotateDiskEncryptionKey(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body ClusterDiskEncryptionParameters parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hdinsight.v2018_06_01_preview.Clusters beginRotateDiskEncryptionKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/rotatediskencryptionkey") + Observable> beginRotateDiskEncryptionKey(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body ClusterDiskEncryptionParameters parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hdinsight.v2018_06_01_preview.Clusters executeScriptActions" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HDInsight/clusters/{clusterName}/executeScriptActions") Observable> executeScriptActions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body ExecuteScriptActionParameters parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -1258,6 +1267,176 @@ private ServiceResponse> listDelegate(Response rotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(rotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters), serviceCallback); + } + + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable rotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { + return rotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> rotateDiskEncryptionKeyWithServiceResponseAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters 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 (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.rotateDiskEncryptionKey(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption 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 + */ + public void beginRotateDiskEncryptionKey(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { + beginRotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body(); + } + + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption 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 beginRotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters), serviceCallback); + } + + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRotateDiskEncryptionKeyAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters parameters) { + return beginRotateDiskEncryptionKeyWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Rotate disk encryption key of the specified HDInsight cluster. + * + * @param resourceGroupName The name of the resource group. + * @param clusterName The name of the cluster. + * @param parameters The parameters for the disk encryption operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRotateDiskEncryptionKeyWithServiceResponseAsync(String resourceGroupName, String clusterName, ClusterDiskEncryptionParameters 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 (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginRotateDiskEncryptionKey(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRotateDiskEncryptionKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRotateDiskEncryptionKeyDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + /** * Executes script actions on the specified HDInsight cluster. *