Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,15 @@ public interface HanaInstances extends SupportsGettingByResourceGroup<HanaInstan
*/
Completable restartAsync(String resourceGroupName, String hanaInstanceName);

/**
* 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
*/
Completable enableMonitoringAsync(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter);

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import rx.functions.Func1;
import com.microsoft.azure.PagedList;
import com.microsoft.azure.Page;
import com.microsoft.azure.management.hanaonazure.v2017_11_03_preview.MonitoringDetails;

class HanaInstancesImpl extends GroupableResourcesCoreImpl<HanaInstance, HanaInstanceImpl, HanaInstanceInner, HanaInstancesInner, HanaOnAzureManager> implements HanaInstances {
protected HanaInstancesImpl(HanaOnAzureManager manager) {
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -90,6 +91,14 @@ interface HanaInstancesService {
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HanaOnAzure/hanaInstances/{hanaInstanceName}/restart")
Observable<Response<ResponseBody>> 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<Response<ResponseBody>> 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<Response<ResponseBody>> 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<Response<ResponseBody>> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
Expand Down Expand Up @@ -759,6 +768,176 @@ private ServiceResponse<Void> beginRestartDelegate(Response<ResponseBody> 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<Void> enableMonitoringAsync(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter, final ServiceCallback<Void> 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<Void> enableMonitoringAsync(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter) {
return enableMonitoringWithServiceResponseAsync(resourceGroupName, hanaInstanceName, monitoringParameter).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> 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<ServiceResponse<Void>> 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<Response<ResponseBody>> 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<Void>() { }.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<Void> beginEnableMonitoringAsync(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter, final ServiceCallback<Void> 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<Void> beginEnableMonitoringAsync(String resourceGroupName, String hanaInstanceName, MonitoringDetails monitoringParameter) {
return beginEnableMonitoringWithServiceResponseAsync(resourceGroupName, hanaInstanceName, monitoringParameter).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> 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<ServiceResponse<Void>> 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<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() {
@Override
public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Void> clientResponse = beginEnableMonitoringDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}

private ServiceResponse<Void> beginEnableMonitoringDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<Void>() { }.getType())
.register(202, new TypeToken<Void>() { }.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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -28,7 +27,6 @@
public final class HanaOnAzureManager extends ManagerCore<HanaOnAzureManager, HanaManagementClientImpl> {
private Operations operations;
private HanaInstances hanaInstances;
private Monitorings monitorings;
/**
* Get a Configurable instance that can be used to create HanaOnAzureManager with optional configuration.
*
Expand Down Expand Up @@ -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.
*/
Expand Down