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 b4e379f20ccb..5ae0fea3ca09 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 @@ -86,6 +86,10 @@ interface HanaInstancesService { @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 beginRestart" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/restart") + Observable> beginRestart(@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); @@ -611,7 +615,7 @@ private ServiceResponse updateDelegate(Response * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void restart(String resourceGroupName, String hanaInstanceName) { - restartWithServiceResponseAsync(resourceGroupName, hanaInstanceName).toBlocking().single().body(); + restartWithServiceResponseAsync(resourceGroupName, hanaInstanceName).toBlocking().last().body(); } /** @@ -633,7 +637,7 @@ public ServiceFuture restartAsync(String resourceGroupName, String hanaIns * @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. + * @return the observable for the request */ public Observable restartAsync(String resourceGroupName, String hanaInstanceName) { return restartWithServiceResponseAsync(resourceGroupName, hanaInstanceName).map(new Func1, Void>() { @@ -650,7 +654,7 @@ public Void call(ServiceResponse response) { * @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. + * @return the observable for the request */ public Observable> restartWithServiceResponseAsync(String resourceGroupName, String hanaInstanceName) { if (this.client.subscriptionId() == null) { @@ -665,12 +669,80 @@ public Observable> restartWithServiceResponseAsync(String 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()) + Observable> observable = service.restart(this.client.subscriptionId(), resourceGroupName, hanaInstanceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * 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 + * @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 hanaInstanceName) { + beginRestartWithServiceResponseAsync(resourceGroupName, hanaInstanceName).toBlocking().single().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. + * @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 hanaInstanceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRestartWithServiceResponseAsync(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 beginRestartAsync(String resourceGroupName, String hanaInstanceName) { + return beginRestartWithServiceResponseAsync(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> beginRestartWithServiceResponseAsync(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.beginRestart(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); + ServiceResponse clientResponse = beginRestartDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -679,8 +751,9 @@ public Observable> call(Response response) { }); } - private ServiceResponse restartDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse beginRestartDelegate(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);