From bef25d92e050819759a27b173a79e0ac7d09d3e2 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 31 Aug 2018 18:35:53 -0700 Subject: [PATCH] Generated from d1446d423e320cce211206a2c7e4230223361674 (#2350) Added HANA instance restart API --- .../v2017_11_03_preview/HanaInstances.java | 11 +++ .../implementation/HanaInstancesImpl.java | 6 ++ .../implementation/HanaInstancesInner.java | 91 +++++++++++++++++++ 3 files changed, 108 insertions(+) diff --git a/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/HanaInstances.java b/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/HanaInstances.java index f33020d09a3a2..68d9482895358 100644 --- a/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/HanaInstances.java +++ b/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/HanaInstances.java @@ -12,6 +12,7 @@ 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.hanaonazure.v2017_11_03_preview.implementation.HanaInstancesInner; import com.microsoft.azure.arm.model.HasInner; @@ -19,4 +20,14 @@ * Type representing HanaInstances. */ public interface HanaInstances extends SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * The operation to restart a SAP HANA instance. + * + * @param resourceGroupName Name of the resource group. + * @param hanaInstanceName Name of the SAP HANA on Azure instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable restartAsync(String resourceGroupName, String hanaInstanceName); + } diff --git a/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaInstancesImpl.java b/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaInstancesImpl.java index 607524c6624cb..e3d2a8beeb235 100644 --- a/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaInstancesImpl.java +++ b/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaInstancesImpl.java @@ -83,6 +83,12 @@ public HanaInstance call(HanaInstanceInner inner) { }); } + @Override + public Completable restartAsync(String resourceGroupName, String hanaInstanceName) { + HanaInstancesInner client = this.inner(); + return client.restartAsync(resourceGroupName, hanaInstanceName).toCompletable(); + } + @Override protected HanaInstanceImpl wrapModel(HanaInstanceInner inner) { return new HanaInstanceImpl(inner.name(), inner, manager()); diff --git a/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaInstancesInner.java b/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaInstancesInner.java index 83bd78fbe85d0..d98285a82fcc7 100644 --- a/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaInstancesInner.java +++ b/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaInstancesInner.java @@ -13,6 +13,7 @@ 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.hanaonazure.v2017_11_03_preview.ErrorResponseException; import com.microsoft.azure.Page; @@ -27,6 +28,7 @@ import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.Path; +import retrofit2.http.POST; import retrofit2.http.Query; import retrofit2.http.Url; import retrofit2.Response; @@ -71,6 +73,10 @@ interface HanaInstancesService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}") Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("hanaInstanceName") String hanaInstanceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.HanaInstances restart" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/restart") + Observable> restart(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("hanaInstanceName") String hanaInstanceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.HanaInstances listNext" }) @GET Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -403,6 +409,91 @@ private ServiceResponse getByResourceGroupDelegate(Response restartAsync(String resourceGroupName, String hanaInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(restartWithServiceResponseAsync(resourceGroupName, hanaInstanceName), serviceCallback); + } + + /** + * The operation to restart a SAP HANA instance. + * + * @param resourceGroupName Name of the resource group. + * @param hanaInstanceName Name of the SAP HANA on Azure instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable restartAsync(String resourceGroupName, String hanaInstanceName) { + return restartWithServiceResponseAsync(resourceGroupName, hanaInstanceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to restart a SAP HANA instance. + * + * @param resourceGroupName Name of the resource group. + * @param hanaInstanceName Name of the SAP HANA on Azure instance. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> restartWithServiceResponseAsync(String resourceGroupName, String hanaInstanceName) { + 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 (hanaInstanceName == null) { + throw new IllegalArgumentException("Parameter hanaInstanceName 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.restart(this.client.subscriptionId(), resourceGroupName, hanaInstanceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = restartDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse restartDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Gets a list of SAP HANA instances in the specified subscription. * Gets a list of SAP HANA instances in the specified subscription. The operations returns various properties of each SAP HANA on Azure instance.