diff --git a/workloadmonitor/resource-manager/v2018_08_31_preview/pom.xml b/workloadmonitor/resource-manager/v2018_08_31_preview/pom.xml index c36e71c899cf..94809ee55b5a 100644 --- a/workloadmonitor/resource-manager/v2018_08_31_preview/pom.xml +++ b/workloadmonitor/resource-manager/v2018_08_31_preview/pom.xml @@ -11,7 +11,7 @@ com.microsoft.azure azure-arm-parent - 0.0.2-beta + 0.0.3-beta ../../../pom.xml azure-mgmt-workloadmonitor diff --git a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSetting.java b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSetting.java index fb52e7b80550..daabc0b5a14e 100644 --- a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSetting.java +++ b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSetting.java @@ -9,19 +9,22 @@ package com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview; import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.NotificationSettingInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.WorkloadMonitorManager; -import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.NotificationSettingInner; import java.util.List; /** * Type representing NotificationSetting. */ -public interface NotificationSetting extends HasInner, HasManager { +public interface NotificationSetting extends HasInner, Indexable, Updatable, HasManager { /** - * @return the actionGroups value. + * @return the actionGroupResourceIds value. */ - List actionGroups(); + List actionGroupResourceIds(); /** * @return the etag value. @@ -43,4 +46,15 @@ public interface NotificationSetting extends HasInner, */ String type(); + /** + * The template for a NotificationSetting update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of NotificationSetting update stages. + */ + interface UpdateStages { + } } diff --git a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSettingProperties.java b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSettingProperties.java new file mode 100644 index 000000000000..fc3946383349 --- /dev/null +++ b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSettingProperties.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Model for properties of a NotificationSetting. + */ +public class NotificationSettingProperties { + /** + * List of action group resource ids to be notified. + */ + @JsonProperty(value = "actionGroupResourceIds", access = JsonProperty.Access.WRITE_ONLY) + private List actionGroupResourceIds; + + /** + * Get list of action group resource ids to be notified. + * + * @return the actionGroupResourceIds value + */ + public List actionGroupResourceIds() { + return this.actionGroupResourceIds; + } + +} diff --git a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSettings.java b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSettings.java index 3dfbadcdfe13..de4cf0523d1b 100644 --- a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSettings.java +++ b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSettings.java @@ -9,11 +9,13 @@ package com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview; import rx.Observable; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.NotificationSettingsInner; +import com.microsoft.azure.arm.model.HasInner; /** * Type representing NotificationSettings. */ -public interface NotificationSettings { +public interface NotificationSettings extends HasInner { /** * Get list of notification settings for a resource. * @@ -26,4 +28,16 @@ public interface NotificationSettings { */ Observable listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName); + /** + * Get a of notification setting for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + } diff --git a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSettingsCollection.java b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSettingsCollection.java new file mode 100644 index 000000000000..d1125550bdab --- /dev/null +++ b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSettingsCollection.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.WorkloadMonitorManager; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.NotificationSettingsCollectionInner; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.NotificationSettingInner; +import java.util.List; + +/** + * Type representing NotificationSettingsCollection. + */ +public interface NotificationSettingsCollection extends HasInner, HasManager { + /** + * @return the value value. + */ + List value(); + +} diff --git a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingImpl.java b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingImpl.java index c46f54adef59..04b4ab16a721 100644 --- a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingImpl.java +++ b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingImpl.java @@ -9,14 +9,36 @@ package com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation; import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.NotificationSetting; -import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; import java.util.List; -class NotificationSettingImpl extends WrapperImpl implements NotificationSetting { +class NotificationSettingImpl extends CreatableUpdatableImpl implements NotificationSetting, NotificationSetting.Update { private final WorkloadMonitorManager manager; + private String resourceGroupName; + private String resourceNamespace; + private String resourceType; + private String resourceName; + + NotificationSettingImpl(String name, WorkloadMonitorManager manager) { + super(name, new NotificationSettingInner()); + this.manager = manager; + // Set resource name + this.resourceNamespace = name; + // + } + NotificationSettingImpl(NotificationSettingInner inner, WorkloadMonitorManager manager) { - super(inner); + super(inner.name(), inner); this.manager = manager; + // Set resource name + this.resourceNamespace = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.resourceNamespace = IdParsingUtils.getValueFromIdByName(inner.id(), "providers"); + this.resourceType = IdParsingUtils.getValueFromIdByPosition(inner.id(), 6); + this.resourceName = IdParsingUtils.getValueFromIdByPosition(inner.id(), 7); + // } @Override @@ -25,8 +47,33 @@ public WorkloadMonitorManager manager() { } @Override - public List actionGroups() { - return this.inner().actionGroups(); + public Observable createResourceAsync() { + NotificationSettingsInner client = this.manager().inner().notificationSettings(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + NotificationSettingsInner client = this.manager().inner().notificationSettings(); + return client.updateAsync(this.resourceGroupName, this.resourceNamespace, this.resourceType, this.resourceName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NotificationSettingsInner client = this.manager().inner().notificationSettings(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List actionGroupResourceIds() { + return this.inner().actionGroupResourceIds(); } @Override diff --git a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingInner.java b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingInner.java index c5f7bad0a797..005a232c8b35 100644 --- a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingInner.java +++ b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingInner.java @@ -14,7 +14,7 @@ import com.microsoft.azure.ProxyResource; /** - * Model for component. + * Model for NotificationSetting. */ @JsonFlatten public class NotificationSettingInner extends ProxyResource { @@ -27,8 +27,8 @@ public class NotificationSettingInner extends ProxyResource { /** * List of action group resource ids to be notified. */ - @JsonProperty(value = "properties.actionGroups", access = JsonProperty.Access.WRITE_ONLY) - private List actionGroups; + @JsonProperty(value = "properties.actionGroupResourceIds", access = JsonProperty.Access.WRITE_ONLY) + private List actionGroupResourceIds; /** * Get for optimistic concurrency control. @@ -42,10 +42,10 @@ public String etag() { /** * Get list of action group resource ids to be notified. * - * @return the actionGroups value + * @return the actionGroupResourceIds value */ - public List actionGroups() { - return this.actionGroups; + public List actionGroupResourceIds() { + return this.actionGroupResourceIds; } } diff --git a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsCollectionImpl.java b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsCollectionImpl.java new file mode 100644 index 000000000000..b024c0927c8d --- /dev/null +++ b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsCollectionImpl.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.NotificationSettingsCollection; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class NotificationSettingsCollectionImpl extends WrapperImpl implements NotificationSettingsCollection { + private final WorkloadMonitorManager manager; + NotificationSettingsCollectionImpl(NotificationSettingsCollectionInner inner, WorkloadMonitorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsCollectionInner.java b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsCollectionInner.java new file mode 100644 index 000000000000..22cd10172565 --- /dev/null +++ b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsCollectionInner.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Model for collection of notificationSettings. + */ +public class NotificationSettingsCollectionInner { + /** + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value value. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the NotificationSettingsCollectionInner object itself. + */ + public NotificationSettingsCollectionInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsImpl.java b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsImpl.java index 6f1021164104..360d22bfcf25 100644 --- a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsImpl.java +++ b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsImpl.java @@ -4,7 +4,7 @@ * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * abc + * */ package com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation; @@ -28,6 +28,10 @@ public WorkloadMonitorManager manager() { return this.manager; } + private NotificationSettingImpl wrapModel(NotificationSettingInner inner) { + return new NotificationSettingImpl(inner, manager()); + } + @Override public Observable listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { NotificationSettingsInner client = this.inner(); @@ -46,4 +50,16 @@ public NotificationSetting call(NotificationSettingInner inner) { }); } + @Override + public Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + NotificationSettingsInner client = this.inner(); + return client.getAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) + .map(new Func1() { + @Override + public NotificationSetting call(NotificationSettingInner inner) { + return new NotificationSettingImpl(inner, manager()); + } + }); + } + } diff --git a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsInner.java b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsInner.java index 755d7b933ed0..35f6ad3cf673 100644 --- a/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsInner.java +++ b/workloadmonitor/resource-manager/v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsInner.java @@ -15,15 +15,18 @@ import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.ErrorResponseException; import com.microsoft.azure.Page; import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; import java.io.IOException; import java.util.List; import okhttp3.ResponseBody; +import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.Path; +import retrofit2.http.PUT; import retrofit2.http.Query; import retrofit2.http.Url; import retrofit2.Response; @@ -60,6 +63,14 @@ interface NotificationSettingsService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/notificationSettings") Observable> listByResource(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceNamespace") String resourceNamespace, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Query("$skiptoken") String skiptoken, @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.workloadmonitor.v2018_08_31_preview.NotificationSettings get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/notificationSettings/{notificationSettingName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceNamespace") String resourceNamespace, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("notificationSettingName") String notificationSettingName, @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.workloadmonitor.v2018_08_31_preview.NotificationSettings update" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/notificationSettings/{notificationSettingName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceNamespace") String resourceNamespace, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("notificationSettingName") String notificationSettingName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body NotificationSettingInner body, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.NotificationSettings listByResourceNext" }) @GET Observable> listByResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -337,6 +348,202 @@ private ServiceResponse> listByResourceDelega .build(response); } + /** + * Get a of notification setting for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NotificationSettingInner object if successful. + */ + public NotificationSettingInner get(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).toBlocking().single().body(); + } + + /** + * Get a of notification setting for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @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 getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName), serviceCallback); + } + + /** + * Get a of notification setting for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationSettingInner object + */ + public Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).map(new Func1, NotificationSettingInner>() { + @Override + public NotificationSettingInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a of notification setting for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationSettingInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + 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 (resourceNamespace == null) { + throw new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String notificationSettingName = "default"; + return service.get(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, notificationSettingName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Update notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NotificationSettingInner object if successful. + */ + public NotificationSettingInner update(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return updateWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).toBlocking().single().body(); + } + + /** + * Update notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @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 updateAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName), serviceCallback); + } + + /** + * Update notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationSettingInner object + */ + public Observable updateAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return updateWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).map(new Func1, NotificationSettingInner>() { + @Override + public NotificationSettingInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationSettingInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + 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 (resourceNamespace == null) { + throw new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String notificationSettingName = "default"; + return service.update(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, notificationSettingName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + /** * Get list of notification settings for a resource. *