diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEncryptionProtectors.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEncryptionProtectors.java index 228e27215ed8..b40ae963ac4c 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEncryptionProtectors.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/ManagedInstanceEncryptionProtectors.java @@ -8,6 +8,7 @@ package com.microsoft.azure.management.sql.v2017_10_01_preview; +import rx.Completable; import rx.Observable; import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ManagedInstanceEncryptionProtectorInner; import com.microsoft.azure.management.sql.v2017_10_01_preview.implementation.ManagedInstanceEncryptionProtectorsInner; @@ -17,6 +18,16 @@ * Type representing ManagedInstanceEncryptionProtectors. */ public interface ManagedInstanceEncryptionProtectors extends HasInner { + /** + * Revalidates an existing encryption protector. + * + * @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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable revalidateAsync(String resourceGroupName, String managedInstanceName); + /** * Gets a list of managed instance encryption protectors. * diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsImpl.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsImpl.java index f5e79e61090b..68cdd241e22e 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsImpl.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsImpl.java @@ -11,6 +11,7 @@ import com.microsoft.azure.arm.model.implementation.WrapperImpl; import com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtectors; +import rx.Completable; import rx.functions.Func1; import rx.Observable; import com.microsoft.azure.Page; @@ -28,6 +29,12 @@ public SqlManager manager() { return this.manager; } + @Override + public Completable revalidateAsync(String resourceGroupName, String managedInstanceName) { + ManagedInstanceEncryptionProtectorsInner client = this.inner(); + return client.revalidateAsync(resourceGroupName, managedInstanceName).toCompletable(); + } + @Override public Observable listByInstanceAsync(final String resourceGroupName, final String managedInstanceName) { ManagedInstanceEncryptionProtectorsInner client = this.inner(); diff --git a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java index 303c257a8ea7..6958f4560f42 100644 --- a/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java +++ b/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java @@ -27,6 +27,7 @@ import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.Path; +import retrofit2.http.POST; import retrofit2.http.PUT; import retrofit2.http.Query; import retrofit2.http.Url; @@ -60,6 +61,14 @@ public ManagedInstanceEncryptionProtectorsInner(Retrofit retrofit, SqlManagement * used by Retrofit to perform actually REST calls. */ interface ManagedInstanceEncryptionProtectorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtectors revalidate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}/revalidate") + Observable> revalidate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("encryptionProtectorName") String encryptionProtectorName, @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.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtectors beginRevalidate" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector/{encryptionProtectorName}/revalidate") + Observable> beginRevalidate(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("encryptionProtectorName") String encryptionProtectorName, @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.sql.v2017_10_01_preview.ManagedInstanceEncryptionProtectors listByInstance" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/encryptionProtector") Observable> listByInstance(@Path("resourceGroupName") String resourceGroupName, @Path("managedInstanceName") String managedInstanceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -82,6 +91,162 @@ interface ManagedInstanceEncryptionProtectorsService { } + /** + * Revalidates an existing encryption protector. + * + * @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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 revalidate(String resourceGroupName, String managedInstanceName) { + revalidateWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().last().body(); + } + + /** + * Revalidates an existing encryption protector. + * + * @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 managedInstanceName The name of the managed instance. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture revalidateAsync(String resourceGroupName, String managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(revalidateWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Revalidates an existing encryption protector. + * + * @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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable revalidateAsync(String resourceGroupName, String managedInstanceName) { + return revalidateWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Revalidates an existing encryption protector. + * + * @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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> revalidateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String encryptionProtectorName = "current"; + Observable> observable = service.revalidate(resourceGroupName, managedInstanceName, encryptionProtectorName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Revalidates an existing encryption protector. + * + * @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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 beginRevalidate(String resourceGroupName, String managedInstanceName) { + beginRevalidateWithServiceResponseAsync(resourceGroupName, managedInstanceName).toBlocking().single().body(); + } + + /** + * Revalidates an existing encryption protector. + * + * @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 managedInstanceName The name of the managed instance. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginRevalidateAsync(String resourceGroupName, String managedInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRevalidateWithServiceResponseAsync(resourceGroupName, managedInstanceName), serviceCallback); + } + + /** + * Revalidates an existing encryption protector. + * + * @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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRevalidateAsync(String resourceGroupName, String managedInstanceName) { + return beginRevalidateWithServiceResponseAsync(resourceGroupName, managedInstanceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Revalidates an existing encryption protector. + * + * @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 managedInstanceName The name of the managed instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRevalidateWithServiceResponseAsync(String resourceGroupName, String managedInstanceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (managedInstanceName == null) { + throw new IllegalArgumentException("Parameter managedInstanceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String encryptionProtectorName = "current"; + return service.beginRevalidate(resourceGroupName, managedInstanceName, encryptionProtectorName, 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 = beginRevalidateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRevalidateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Gets a list of managed instance encryption protectors. *