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 68d948289535..2466cff7bf37 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 @@ -30,4 +30,15 @@ public interface HanaInstances extends SupportsGettingByResourceGroup implements HanaInstances { protected HanaInstancesImpl(HanaOnAzureManager manager) { @@ -89,6 +90,12 @@ public Completable restartAsync(String resourceGroupName, String hanaInstanceNam return client.restartAsync(resourceGroupName, hanaInstanceName).toCompletable(); } + @Override + public Completable enableMonitoringAsync(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter) { + HanaInstancesInner client = this.inner(); + return client.enableMonitoringAsync(resourceGroupName, hanaInstanceName, monitoringParameter).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 5ae0fea3ca09..7a76373cbf0e 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 @@ -16,6 +16,7 @@ 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.management.hanaonazure.v2017_11_03_preview.MonitoringDetails; import com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.Tags; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; @@ -90,6 +91,14 @@ interface HanaInstancesService { @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 enableMonitoring" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/monitoring") + Observable> enableMonitoring(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("hanaInstanceName") String hanaInstanceName, @Query("api-version") String apiVersion, @Body MonitoringDetails monitoringParameter, @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 beginEnableMonitoring" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/monitoring") + Observable> beginEnableMonitoring(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("hanaInstanceName") String hanaInstanceName, @Query("api-version") String apiVersion, @Body MonitoringDetails monitoringParameter, @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); @@ -759,6 +768,176 @@ private ServiceResponse beginRestartDelegate(Response respon .build(response); } + /** + * The operation to add a monitor to an SAP HANA instance. + * + * @param resourceGroupName Name of the resource group. + * @param hanaInstanceName Name of the SAP HANA on Azure instance. + * @param monitoringParameter Request body that only contains monitoring attributes + * @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 enableMonitoring(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter) { + enableMonitoringWithServiceResponseAsync(resourceGroupName, hanaInstanceName, monitoringParameter).toBlocking().last().body(); + } + + /** + * The operation to add a monitor to an SAP HANA instance. + * + * @param resourceGroupName Name of the resource group. + * @param hanaInstanceName Name of the SAP HANA on Azure instance. + * @param monitoringParameter Request body that only contains monitoring attributes + * @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 enableMonitoringAsync(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(enableMonitoringWithServiceResponseAsync(resourceGroupName, hanaInstanceName, monitoringParameter), serviceCallback); + } + + /** + * The operation to add a monitor to an SAP HANA instance. + * + * @param resourceGroupName Name of the resource group. + * @param hanaInstanceName Name of the SAP HANA on Azure instance. + * @param monitoringParameter Request body that only contains monitoring attributes + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable enableMonitoringAsync(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter) { + return enableMonitoringWithServiceResponseAsync(resourceGroupName, hanaInstanceName, monitoringParameter).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to add a monitor to an SAP HANA instance. + * + * @param resourceGroupName Name of the resource group. + * @param hanaInstanceName Name of the SAP HANA on Azure instance. + * @param monitoringParameter Request body that only contains monitoring attributes + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> enableMonitoringWithServiceResponseAsync(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter) { + 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."); + } + if (monitoringParameter == null) { + throw new IllegalArgumentException("Parameter monitoringParameter is required and cannot be null."); + } + Validator.validate(monitoringParameter); + Observable> observable = service.enableMonitoring(this.client.subscriptionId(), resourceGroupName, hanaInstanceName, this.client.apiVersion(), monitoringParameter, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * The operation to add a monitor to an SAP HANA instance. + * + * @param resourceGroupName Name of the resource group. + * @param hanaInstanceName Name of the SAP HANA on Azure instance. + * @param monitoringParameter Request body that only contains monitoring attributes + * @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 beginEnableMonitoring(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter) { + beginEnableMonitoringWithServiceResponseAsync(resourceGroupName, hanaInstanceName, monitoringParameter).toBlocking().single().body(); + } + + /** + * The operation to add a monitor to an SAP HANA instance. + * + * @param resourceGroupName Name of the resource group. + * @param hanaInstanceName Name of the SAP HANA on Azure instance. + * @param monitoringParameter Request body that only contains monitoring attributes + * @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 beginEnableMonitoringAsync(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginEnableMonitoringWithServiceResponseAsync(resourceGroupName, hanaInstanceName, monitoringParameter), serviceCallback); + } + + /** + * The operation to add a monitor to an SAP HANA instance. + * + * @param resourceGroupName Name of the resource group. + * @param hanaInstanceName Name of the SAP HANA on Azure instance. + * @param monitoringParameter Request body that only contains monitoring attributes + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginEnableMonitoringAsync(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter) { + return beginEnableMonitoringWithServiceResponseAsync(resourceGroupName, hanaInstanceName, monitoringParameter).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to add a monitor to an SAP HANA instance. + * + * @param resourceGroupName Name of the resource group. + * @param hanaInstanceName Name of the SAP HANA on Azure instance. + * @param monitoringParameter Request body that only contains monitoring attributes + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginEnableMonitoringWithServiceResponseAsync(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter) { + 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."); + } + if (monitoringParameter == null) { + throw new IllegalArgumentException("Parameter monitoringParameter is required and cannot be null."); + } + Validator.validate(monitoringParameter); + return service.beginEnableMonitoring(this.client.subscriptionId(), resourceGroupName, hanaInstanceName, this.client.apiVersion(), monitoringParameter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginEnableMonitoringDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginEnableMonitoringDelegate(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 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. diff --git a/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaManagementClientImpl.java b/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaManagementClientImpl.java index 74f169ec1927..cca459ef451c 100644 --- a/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaManagementClientImpl.java +++ b/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaManagementClientImpl.java @@ -158,19 +158,6 @@ public HanaInstancesInner hanaInstances() { return this.hanaInstances; } - /** - * The MonitoringsInner object to access its operations. - */ - private MonitoringsInner monitorings; - - /** - * Gets the MonitoringsInner object to access its operations. - * @return the MonitoringsInner object. - */ - public MonitoringsInner monitorings() { - return this.monitorings; - } - /** * Initializes an instance of HanaManagementClient client. * @@ -208,7 +195,6 @@ protected void initialize() { this.generateClientRequestId = true; this.operations = new OperationsInner(restClient().retrofit(), this); this.hanaInstances = new HanaInstancesInner(restClient().retrofit(), this); - this.monitorings = new MonitoringsInner(restClient().retrofit(), this); this.azureClient = new AzureClient(this); } diff --git a/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaOnAzureManager.java b/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaOnAzureManager.java index 4f1de3320a4a..f5492b95bf7e 100644 --- a/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaOnAzureManager.java +++ b/hanaonazure/resource-manager/v2017_11_03_preview/src/main/java/com/microsoft/azure/management/hanaonazure/v2017_11_03_preview/implementation/HanaOnAzureManager.java @@ -18,7 +18,6 @@ import com.microsoft.rest.RestClient; import com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.Operations; import com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.HanaInstances; -import com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.Monitorings; import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; import com.microsoft.azure.arm.resources.implementation.ManagerCore; @@ -28,7 +27,6 @@ public final class HanaOnAzureManager extends ManagerCore { private Operations operations; private HanaInstances hanaInstances; - private Monitorings monitorings; /** * Get a Configurable instance that can be used to create HanaOnAzureManager with optional configuration. * @@ -96,16 +94,6 @@ public HanaInstances hanaInstances() { return this.hanaInstances; } - /** - * @return Entry point to manage Monitorings. - */ - public Monitorings monitorings() { - if (this.monitorings == null) { - this.monitorings = new MonitoringsImpl(this); - } - return this.monitorings; - } - /** * The implementation for Configurable interface. */