diff --git a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/ManagedServiceIdentity.java b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/ManagedServiceIdentity.java index fbd0ccc6cb4..3210f092a79 100644 --- a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/ManagedServiceIdentity.java +++ b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/ManagedServiceIdentity.java @@ -15,10 +15,11 @@ */ public class ManagedServiceIdentity { /** - * Type of managed service identity. + * Type of managed service identity. Possible values include: + * 'SystemAssigned'. */ @JsonProperty(value = "type") - private Object type; + private ManagedServiceIdentityType type; /** * Tenant of managed service identity. @@ -37,7 +38,7 @@ public class ManagedServiceIdentity { * * @return the type value */ - public Object type() { + public ManagedServiceIdentityType type() { return this.type; } @@ -47,7 +48,7 @@ public Object type() { * @param type the type value to set * @return the ManagedServiceIdentity object itself. */ - public ManagedServiceIdentity withType(Object type) { + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { this.type = type; return this; } diff --git a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/BillingMeterInner.java b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/BillingMeterInner.java new file mode 100644 index 00000000000..72feb74806e --- /dev/null +++ b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/BillingMeterInner.java @@ -0,0 +1,151 @@ +/** + * 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.web.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.web.ProxyOnlyResource; + +/** + * App Service billing entity that contains information about meter which the + * Azure billing system utilizes to charge users for services. + */ +@JsonFlatten +public class BillingMeterInner extends ProxyOnlyResource { + /** + * Meter GUID onboarded in Commerce. + */ + @JsonProperty(value = "properties.meterId") + private String meterId; + + /** + * Azure Location of billable resource. + */ + @JsonProperty(value = "properties.billingLocation") + private String billingLocation; + + /** + * Short Name from App Service Azure pricing Page. + */ + @JsonProperty(value = "properties.shortName") + private String shortName; + + /** + * Friendly name of the meter. + */ + @JsonProperty(value = "properties.friendlyName") + private String friendlyName; + + /** + * App Service resource type meter used for. + */ + @JsonProperty(value = "properties.resourceType") + private String resourceType; + + /** + * Get the meterId value. + * + * @return the meterId value + */ + public String meterId() { + return this.meterId; + } + + /** + * Set the meterId value. + * + * @param meterId the meterId value to set + * @return the BillingMeterInner object itself. + */ + public BillingMeterInner withMeterId(String meterId) { + this.meterId = meterId; + return this; + } + + /** + * Get the billingLocation value. + * + * @return the billingLocation value + */ + public String billingLocation() { + return this.billingLocation; + } + + /** + * Set the billingLocation value. + * + * @param billingLocation the billingLocation value to set + * @return the BillingMeterInner object itself. + */ + public BillingMeterInner withBillingLocation(String billingLocation) { + this.billingLocation = billingLocation; + return this; + } + + /** + * Get the shortName value. + * + * @return the shortName value + */ + public String shortName() { + return this.shortName; + } + + /** + * Set the shortName value. + * + * @param shortName the shortName value to set + * @return the BillingMeterInner object itself. + */ + public BillingMeterInner withShortName(String shortName) { + this.shortName = shortName; + return this; + } + + /** + * Get the friendlyName value. + * + * @return the friendlyName value + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName value. + * + * @param friendlyName the friendlyName value to set + * @return the BillingMeterInner object itself. + */ + public BillingMeterInner withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the resourceType value. + * + * @return the resourceType value + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType value. + * + * @param resourceType the resourceType value to set + * @return the BillingMeterInner object itself. + */ + public BillingMeterInner withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + +} diff --git a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/BillingMetersInner.java b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/BillingMetersInner.java new file mode 100644 index 00000000000..dbd6d905b71 --- /dev/null +++ b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/BillingMetersInner.java @@ -0,0 +1,404 @@ +/** + * 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.web.implementation; + +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.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in BillingMeters. + */ +public class BillingMetersInner { + /** The Retrofit service to perform REST calls. */ + private BillingMetersService service; + /** The service client containing this operation class. */ + private WebSiteManagementClientImpl client; + + /** + * Initializes an instance of BillingMetersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public BillingMetersInner(Retrofit retrofit, WebSiteManagementClientImpl client) { + this.service = retrofit.create(BillingMetersService.class); + this.client = client; + } + + /** + * The interface defining all the services for BillingMeters to be + * used by Retrofit to perform actually REST calls. + */ + interface BillingMetersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.web.BillingMeters list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("billingLocation") String billingLocation, @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.web.BillingMeters listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @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 + * @return the PagedList<BillingMeterInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @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> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingMeterInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingMeterInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingMeterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + final String billingLocation = null; + return service.list(this.client.subscriptionId(), billingLocation, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @param billingLocation Azure Location of billable resource + * @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 + * @return the PagedList<BillingMeterInner> object if successful. + */ + public PagedList list(final String billingLocation) { + ServiceResponse> response = listSinglePageAsync(billingLocation).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @param billingLocation Azure Location of billable 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> listAsync(final String billingLocation, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(billingLocation), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @param billingLocation Azure Location of billable resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingMeterInner> object + */ + public Observable> listAsync(final String billingLocation) { + return listWithServiceResponseAsync(billingLocation) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @param billingLocation Azure Location of billable resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingMeterInner> object + */ + public Observable>> listWithServiceResponseAsync(final String billingLocation) { + return listSinglePageAsync(billingLocation) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + ServiceResponse> * @param billingLocation Azure Location of billable resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingMeterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String billingLocation) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + return service.list(this.client.subscriptionId(), billingLocation, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 + * @return the PagedList<BillingMeterInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingMeterInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<BillingMeterInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<BillingMeterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/GlobalsInner.java b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/GlobalsInner.java new file mode 100644 index 00000000000..0ce10aa9eae --- /dev/null +++ b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/GlobalsInner.java @@ -0,0 +1,142 @@ +/** + * 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.web.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +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.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Globals. + */ +public class GlobalsInner { + /** The Retrofit service to perform REST calls. */ + private GlobalsService service; + /** The service client containing this operation class. */ + private WebSiteManagementClientImpl client; + + /** + * Initializes an instance of GlobalsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GlobalsInner(Retrofit retrofit, WebSiteManagementClientImpl client) { + this.service = retrofit.create(GlobalsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Globals to be + * used by Retrofit to perform actually REST calls. + */ + interface GlobalsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.web.Globals list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Web/billingMeters") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl1 page = new PageImpl1<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @return the observable to the List<BillingMeterInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl1 page = new PageImpl1<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Gets a list of meters for a given location. + * Gets a list of meters for a given location. + * + * @return the observable to the List<BillingMeterInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/RecommendationInner.java b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/RecommendationInner.java index e07ce8a4588..7dabbc8253f 100644 --- a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/RecommendationInner.java +++ b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/RecommendationInner.java @@ -15,28 +15,31 @@ import com.microsoft.azure.management.web.Channels; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.web.ProxyOnlyResource; /** * Represents a recommendation result generated by the recommendation engine. */ -public class RecommendationInner { +@JsonFlatten +public class RecommendationInner extends ProxyOnlyResource { /** * Timestamp when this instance was created. */ - @JsonProperty(value = "creationTime") + @JsonProperty(value = "properties.creationTime") private DateTime creationTime; /** * A GUID value that each recommendation object is associated with. */ - @JsonProperty(value = "recommendationId") + @JsonProperty(value = "properties.recommendationId") private UUID recommendationId; /** * Full ARM resource ID string that this recommendation object is * associated with. */ - @JsonProperty(value = "resourceId") + @JsonProperty(value = "properties.resourceId") private String resourceId; /** @@ -44,25 +47,25 @@ public class RecommendationInner { * ServerFarm, Site. Possible values include: 'ServerFarm', 'Subscription', * 'WebSite'. */ - @JsonProperty(value = "resourceScope") + @JsonProperty(value = "properties.resourceScope") private ResourceScopeType resourceScope; /** * Unique name of the rule. */ - @JsonProperty(value = "ruleName") + @JsonProperty(value = "properties.ruleName") private String ruleName; /** * UI friendly name of the rule (may not be unique). */ - @JsonProperty(value = "displayName") + @JsonProperty(value = "properties.displayName") private String displayName; /** * Recommendation text. */ - @JsonProperty(value = "message") + @JsonProperty(value = "properties.message") private String message; /** @@ -70,88 +73,88 @@ public class RecommendationInner { * values include: 'Critical', 'Warning', 'Information', * 'NonUrgentSuggestion'. */ - @JsonProperty(value = "level") + @JsonProperty(value = "properties.level") private NotificationLevel level; /** * List of channels that this recommendation can apply. Possible values * include: 'Notification', 'Api', 'Email', 'Webhook', 'All'. */ - @JsonProperty(value = "channels") + @JsonProperty(value = "properties.channels") private Channels channels; /** * The list of category tags that this recommendation belongs to. */ - @JsonProperty(value = "tags") + @JsonProperty(value = "properties.tags") private List tags; /** * Name of action recommended by this object. */ - @JsonProperty(value = "actionName") + @JsonProperty(value = "properties.actionName") private String actionName; /** * The beginning time in UTC of a range that the recommendation refers to. */ - @JsonProperty(value = "startTime") + @JsonProperty(value = "properties.startTime") private DateTime startTime; /** * The end time in UTC of a range that the recommendation refers to. */ - @JsonProperty(value = "endTime") + @JsonProperty(value = "properties.endTime") private DateTime endTime; /** * When to notify this recommendation next in UTC. Null means that this * will never be notified anymore. */ - @JsonProperty(value = "nextNotificationTime") + @JsonProperty(value = "properties.nextNotificationTime") private DateTime nextNotificationTime; /** * Date and time in UTC when this notification expires. */ - @JsonProperty(value = "notificationExpirationTime") + @JsonProperty(value = "properties.notificationExpirationTime") private DateTime notificationExpirationTime; /** * Last timestamp in UTC this instance was actually notified. Null means * that this recommendation hasn't been notified yet. */ - @JsonProperty(value = "notifiedTime") + @JsonProperty(value = "properties.notifiedTime") private DateTime notifiedTime; /** * A metric value measured by the rule. */ - @JsonProperty(value = "score") + @JsonProperty(value = "properties.score") private Double score; /** * True if this is associated with a dynamically added rule. */ - @JsonProperty(value = "isDynamic") + @JsonProperty(value = "properties.isDynamic") private Boolean isDynamic; /** * Extension name of the portal if exists. */ - @JsonProperty(value = "extensionName") + @JsonProperty(value = "properties.extensionName") private String extensionName; /** * Deep link to a blade on the portal. */ - @JsonProperty(value = "bladeName") + @JsonProperty(value = "properties.bladeName") private String bladeName; /** * Forward link to an external document associated with the rule. */ - @JsonProperty(value = "forwardLink") + @JsonProperty(value = "properties.forwardLink") private String forwardLink; /** diff --git a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/RecommendationRuleInner.java b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/RecommendationRuleInner.java index ebda65a55c5..20b7d412ddd 100644 --- a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/RecommendationRuleInner.java +++ b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/RecommendationRuleInner.java @@ -13,27 +13,30 @@ import com.microsoft.azure.management.web.Channels; import java.util.List; import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.web.ProxyOnlyResource; /** * Represents a recommendation rule that the recommendation engine can perform. */ -public class RecommendationRuleInner { +@JsonFlatten +public class RecommendationRuleInner extends ProxyOnlyResource { /** * Unique name of the rule. */ - @JsonProperty(value = "name") - private String name; + @JsonProperty(value = "properties.name") + private String recommendationRuleName; /** * UI friendly name of the rule. */ - @JsonProperty(value = "displayName") + @JsonProperty(value = "properties.displayName") private String displayName; /** * Localized name of the rule (Good for UI). */ - @JsonProperty(value = "message") + @JsonProperty(value = "properties.message") private String message; /** @@ -41,83 +44,83 @@ public class RecommendationRuleInner { * rule, if exists. * If such an object doesn't exist, it is set to null. */ - @JsonProperty(value = "recommendationId") + @JsonProperty(value = "properties.recommendationId") private UUID recommendationId; /** * Localized detailed description of the rule. */ - @JsonProperty(value = "description") + @JsonProperty(value = "properties.description") private String description; /** * Name of action that is recommended by this rule in string. */ - @JsonProperty(value = "actionName") + @JsonProperty(value = "properties.actionName") private String actionName; /** * Level of impact indicating how critical this rule is. Possible values * include: 'Critical', 'Warning', 'Information', 'NonUrgentSuggestion'. */ - @JsonProperty(value = "level") + @JsonProperty(value = "properties.level") private NotificationLevel level; /** * List of available channels that this rule applies. Possible values * include: 'Notification', 'Api', 'Email', 'Webhook', 'All'. */ - @JsonProperty(value = "channels") + @JsonProperty(value = "properties.channels") private Channels channels; /** * An array of category tags that the rule contains. */ - @JsonProperty(value = "tags") + @JsonProperty(value = "properties.tags") private List tags; /** * True if this is associated with a dynamically added rule. */ - @JsonProperty(value = "isDynamic") + @JsonProperty(value = "properties.isDynamic") private Boolean isDynamic; /** * Extension name of the portal if exists. Applicable to dynamic rule only. */ - @JsonProperty(value = "extensionName") + @JsonProperty(value = "properties.extensionName") private String extensionName; /** * Deep link to a blade on the portal. Applicable to dynamic rule only. */ - @JsonProperty(value = "bladeName") + @JsonProperty(value = "properties.bladeName") private String bladeName; /** * Forward link to an external document associated with the rule. * Applicable to dynamic rule only. */ - @JsonProperty(value = "forwardLink") + @JsonProperty(value = "properties.forwardLink") private String forwardLink; /** - * Get the name value. + * Get the recommendationRuleName value. * - * @return the name value + * @return the recommendationRuleName value */ - public String name() { - return this.name; + public String recommendationRuleName() { + return this.recommendationRuleName; } /** - * Set the name value. + * Set the recommendationRuleName value. * - * @param name the name value to set + * @param recommendationRuleName the recommendationRuleName value to set * @return the RecommendationRuleInner object itself. */ - public RecommendationRuleInner withName(String name) { - this.name = name; + public RecommendationRuleInner withRecommendationRuleName(String recommendationRuleName) { + this.recommendationRuleName = recommendationRuleName; return this; } diff --git a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/RecommendationsInner.java b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/RecommendationsInner.java index 65565799b6f..489f62d4c17 100644 --- a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/RecommendationsInner.java +++ b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/RecommendationsInner.java @@ -10,7 +10,9 @@ 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.Page; import com.microsoft.azure.PagedList; import com.microsoft.rest.ServiceCallback; @@ -25,6 +27,7 @@ import retrofit2.http.Path; import retrofit2.http.POST; import retrofit2.http.Query; +import retrofit2.http.Url; import retrofit2.Response; import rx.functions.Func1; import rx.Observable; @@ -63,6 +66,10 @@ interface RecommendationsService { @POST("subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset") Observable> resetAllFilters(@Path("subscriptionId") String subscriptionId, @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.web.Recommendations disableRecommendationForSubscription" }) + @POST("subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/{name}/disable") + Observable> disableRecommendationForSubscription(@Path("name") String name, @Path("subscriptionId") String subscriptionId, @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.web.Recommendations listHistoryForWebApp" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory") Observable> listHistoryForWebApp(@Path("resourceGroupName") String resourceGroupName, @Path("siteName") String siteName, @Path("subscriptionId") String subscriptionId, @Query(value = "$filter", encoded = true) String filter, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -81,7 +88,23 @@ interface RecommendationsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.web.Recommendations getRuleDetailsByWebApp" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}") - Observable> getRuleDetailsByWebApp(@Path("resourceGroupName") String resourceGroupName, @Path("siteName") String siteName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("updateSeen") Boolean updateSeen, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> getRuleDetailsByWebApp(@Path("resourceGroupName") String resourceGroupName, @Path("siteName") String siteName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("updateSeen") Boolean updateSeen, @Query("recommendationId") String recommendationId, @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.web.Recommendations disableRecommendationForSite" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}/disable") + Observable> disableRecommendationForSite(@Path("resourceGroupName") String resourceGroupName, @Path("siteName") String siteName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @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.web.Recommendations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @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.web.Recommendations listHistoryForWebAppNext" }) + @GET + Observable> listHistoryForWebAppNext(@Url String nextUrl, @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.web.Recommendations listRecommendedRulesForWebAppNext" }) + @GET + Observable> listRecommendedRulesForWebAppNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } @@ -89,16 +112,17 @@ interface RecommendationsService { * List all recommendations for a subscription. * List all recommendations for a subscription. * - * @return the PagedList object if successful. + * @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 + * @return the PagedList<RecommendationInner> object if successful. */ public PagedList list() { - PageImpl1 page = new PageImpl1<>(); - page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); - page.setNextPageLink(null); - return new PagedList(page) { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return null; + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -108,36 +132,67 @@ public Page nextPage(String nextPageLink) { * List all recommendations for a subscription. * * @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> listAsync(final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** * List all recommendations for a subscription. * List all recommendations for a subscription. * - * @return the observable to the List<RecommendationInner> object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RecommendationInner> object */ public Observable> listAsync() { - return listWithServiceResponseAsync().map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - PageImpl1 page = new PageImpl1<>(); - page.setItems(response.body()); - return page; - } - }); + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all recommendations for a subscription. + * List all recommendations for a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RecommendationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** * List all recommendations for a subscription. * List all recommendations for a subscription. * - * @return the observable to the List<RecommendationInner> object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RecommendationInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listWithServiceResponseAsync() { + public Observable>> listSinglePageAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } @@ -145,13 +200,12 @@ public Observable>> listWithServiceRes final Boolean featured = null; final String filter = null; return service.list(this.client.subscriptionId(), featured, filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); - return Observable.just(clientResponse); + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -165,16 +219,17 @@ public Observable>> call(Response object if successful. + * @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 + * @return the PagedList<RecommendationInner> object if successful. */ - public PagedList list(Boolean featured, String filter) { - PageImpl1 page = new PageImpl1<>(); - page.setItems(listWithServiceResponseAsync(featured, filter).toBlocking().single().body()); - page.setNextPageLink(null); - return new PagedList(page) { + public PagedList list(final Boolean featured, final String filter) { + ServiceResponse> response = listSinglePageAsync(featured, filter).toBlocking().single(); + return new PagedList(response.body()) { @Override public Page nextPage(String nextPageLink) { - return null; + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } @@ -186,10 +241,19 @@ public Page nextPage(String nextPageLink) { * @param featured Specify <code>true</code> to return only the most critical recommendations. The default is <code>false</code>, which returns all recommendations. * @param filter Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D] * @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> listAsync(Boolean featured, String filter, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listWithServiceResponseAsync(featured, filter), serviceCallback); + public ServiceFuture> listAsync(final Boolean featured, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(featured, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -198,17 +262,17 @@ public ServiceFuture> listAsync(Boolean featured, Stri * * @param featured Specify <code>true</code> to return only the most critical recommendations. The default is <code>false</code>, which returns all recommendations. * @param filter Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D] - * @return the observable to the List<RecommendationInner> object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RecommendationInner> object */ - public Observable> listAsync(Boolean featured, String filter) { - return listWithServiceResponseAsync(featured, filter).map(new Func1>, Page>() { - @Override - public Page call(ServiceResponse> response) { - PageImpl1 page = new PageImpl1<>(); - page.setItems(response.body()); - return page; - } - }); + public Observable> listAsync(final Boolean featured, final String filter) { + return listWithServiceResponseAsync(featured, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -217,21 +281,44 @@ public Page call(ServiceResponse> * * @param featured Specify <code>true</code> to return only the most critical recommendations. The default is <code>false</code>, which returns all recommendations. * @param filter Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D] - * @return the observable to the List<RecommendationInner> object + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RecommendationInner> object */ - public Observable>> listWithServiceResponseAsync(Boolean featured, String filter) { + public Observable>> listWithServiceResponseAsync(final Boolean featured, final String filter) { + return listSinglePageAsync(featured, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List all recommendations for a subscription. + * List all recommendations for a subscription. + * + ServiceResponse> * @param featured Specify <code>true</code> to return only the most critical recommendations. The default is <code>false</code>, which returns all recommendations. + ServiceResponse> * @param filter Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D] + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RecommendationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final Boolean featured, final String filter) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2016-03-01"; return service.list(this.client.subscriptionId(), featured, filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> result = listDelegate(response); - ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); - return Observable.just(clientResponse); + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -239,9 +326,9 @@ public Observable>> call(Response> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -319,6 +406,86 @@ private ServiceResponse resetAllFiltersDelegate(Response res .build(response); } + /** + * Disables the specified rule so it will not apply to a subscription in the future. + * Disables the specified rule so it will not apply to a subscription in the future. + * + * @param name Rule name + * @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 disableRecommendationForSubscription(String name) { + disableRecommendationForSubscriptionWithServiceResponseAsync(name).toBlocking().single().body(); + } + + /** + * Disables the specified rule so it will not apply to a subscription in the future. + * Disables the specified rule so it will not apply to a subscription in the future. + * + * @param name Rule name + * @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 disableRecommendationForSubscriptionAsync(String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(disableRecommendationForSubscriptionWithServiceResponseAsync(name), serviceCallback); + } + + /** + * Disables the specified rule so it will not apply to a subscription in the future. + * Disables the specified rule so it will not apply to a subscription in the future. + * + * @param name Rule name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable disableRecommendationForSubscriptionAsync(String name) { + return disableRecommendationForSubscriptionWithServiceResponseAsync(name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Disables the specified rule so it will not apply to a subscription in the future. + * Disables the specified rule so it will not apply to a subscription in the future. + * + * @param name Rule name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> disableRecommendationForSubscriptionWithServiceResponseAsync(String name) { + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + return service.disableRecommendationForSubscription(name, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = disableRecommendationForSubscriptionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse disableRecommendationForSubscriptionDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Get past recommendations for an app, optionally specified by the time range. * Get past recommendations for an app, optionally specified by the time range. @@ -328,10 +495,16 @@ private ServiceResponse resetAllFiltersDelegate(Response res * @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 - * @return the List<RecommendationInner> object if successful. + * @return the PagedList<RecommendationInner> object if successful. */ - public List listHistoryForWebApp(String resourceGroupName, String siteName) { - return listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName).toBlocking().single().body(); + public PagedList listHistoryForWebApp(final String resourceGroupName, final String siteName) { + ServiceResponse> response = listHistoryForWebAppSinglePageAsync(resourceGroupName, siteName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listHistoryForWebAppNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -344,8 +517,16 @@ public List listHistoryForWebApp(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listHistoryForWebAppAsync(String resourceGroupName, String siteName, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName), serviceCallback); + public ServiceFuture> listHistoryForWebAppAsync(final String resourceGroupName, final String siteName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listHistoryForWebAppSinglePageAsync(resourceGroupName, siteName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listHistoryForWebAppNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -355,15 +536,16 @@ public ServiceFuture> listHistoryForWebAppAsync(String * @param resourceGroupName Name of the resource group to which the resource belongs. * @param siteName Name of the app. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<RecommendationInner> object + * @return the observable to the PagedList<RecommendationInner> object */ - public Observable> listHistoryForWebAppAsync(String resourceGroupName, String siteName) { - return listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1>, List>() { - @Override - public List call(ServiceResponse> response) { - return response.body(); - } - }); + public Observable> listHistoryForWebAppAsync(final String resourceGroupName, final String siteName) { + return listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -373,9 +555,32 @@ public List call(ServiceResponse> * @param resourceGroupName Name of the resource group to which the resource belongs. * @param siteName Name of the app. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<RecommendationInner> object + * @return the observable to the PagedList<RecommendationInner> object */ - public Observable>> listHistoryForWebAppWithServiceResponseAsync(String resourceGroupName, String siteName) { + public Observable>> listHistoryForWebAppWithServiceResponseAsync(final String resourceGroupName, final String siteName) { + return listHistoryForWebAppSinglePageAsync(resourceGroupName, siteName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listHistoryForWebAppNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get past recommendations for an app, optionally specified by the time range. + * Get past recommendations for an app, optionally specified by the time range. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param siteName Name of the app. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RecommendationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listHistoryForWebAppSinglePageAsync(final String resourceGroupName, final String siteName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -388,12 +593,12 @@ public Observable>> listHistoryForWebA final String apiVersion = "2016-03-01"; final String filter = null; return service.listHistoryForWebApp(resourceGroupName, siteName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> clientResponse = listHistoryForWebAppDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listHistoryForWebAppDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -411,10 +616,16 @@ public Observable>> call(Response listHistoryForWebApp(String resourceGroupName, String siteName, String filter) { - return listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName, filter).toBlocking().single().body(); + public PagedList listHistoryForWebApp(final String resourceGroupName, final String siteName, final String filter) { + ServiceResponse> response = listHistoryForWebAppSinglePageAsync(resourceGroupName, siteName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listHistoryForWebAppNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -428,8 +639,16 @@ public List listHistoryForWebApp(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listHistoryForWebAppAsync(String resourceGroupName, String siteName, String filter, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName, filter), serviceCallback); + public ServiceFuture> listHistoryForWebAppAsync(final String resourceGroupName, final String siteName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listHistoryForWebAppSinglePageAsync(resourceGroupName, siteName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listHistoryForWebAppNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -440,15 +659,16 @@ public ServiceFuture> listHistoryForWebAppAsync(String * @param siteName Name of the app. * @param filter Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D] * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<RecommendationInner> object + * @return the observable to the PagedList<RecommendationInner> object */ - public Observable> listHistoryForWebAppAsync(String resourceGroupName, String siteName, String filter) { - return listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName, filter).map(new Func1>, List>() { - @Override - public List call(ServiceResponse> response) { - return response.body(); - } - }); + public Observable> listHistoryForWebAppAsync(final String resourceGroupName, final String siteName, final String filter) { + return listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -459,9 +679,33 @@ public List call(ServiceResponse> * @param siteName Name of the app. * @param filter Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D] * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<RecommendationInner> object + * @return the observable to the PagedList<RecommendationInner> object + */ + public Observable>> listHistoryForWebAppWithServiceResponseAsync(final String resourceGroupName, final String siteName, final String filter) { + return listHistoryForWebAppSinglePageAsync(resourceGroupName, siteName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listHistoryForWebAppNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get past recommendations for an app, optionally specified by the time range. + * Get past recommendations for an app, optionally specified by the time range. + * + ServiceResponse> * @param resourceGroupName Name of the resource group to which the resource belongs. + ServiceResponse> * @param siteName Name of the app. + ServiceResponse> * @param filter Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[PT1H|PT1M|P1D] + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RecommendationInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listHistoryForWebAppWithServiceResponseAsync(String resourceGroupName, String siteName, String filter) { + public Observable>> listHistoryForWebAppSinglePageAsync(final String resourceGroupName, final String siteName, final String filter) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -473,12 +717,12 @@ public Observable>> listHistoryForWebA } final String apiVersion = "2016-03-01"; return service.listHistoryForWebApp(resourceGroupName, siteName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> clientResponse = listHistoryForWebAppDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listHistoryForWebAppDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -486,9 +730,9 @@ public Observable>> call(Response> listHistoryForWebAppDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listHistoryForWebAppDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -502,10 +746,16 @@ private ServiceResponse> listHistoryForWebAppDelegate( * @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 - * @return the List<RecommendationInner> object if successful. + * @return the PagedList<RecommendationInner> object if successful. */ - public List listRecommendedRulesForWebApp(String resourceGroupName, String siteName) { - return listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName).toBlocking().single().body(); + public PagedList listRecommendedRulesForWebApp(final String resourceGroupName, final String siteName) { + ServiceResponse> response = listRecommendedRulesForWebAppSinglePageAsync(resourceGroupName, siteName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listRecommendedRulesForWebAppNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -518,8 +768,16 @@ public List listRecommendedRulesForWebApp(String resourceGr * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listRecommendedRulesForWebAppAsync(String resourceGroupName, String siteName, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName), serviceCallback); + public ServiceFuture> listRecommendedRulesForWebAppAsync(final String resourceGroupName, final String siteName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listRecommendedRulesForWebAppSinglePageAsync(resourceGroupName, siteName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listRecommendedRulesForWebAppNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -529,15 +787,39 @@ public ServiceFuture> listRecommendedRulesForWebAppAsy * @param resourceGroupName Name of the resource group to which the resource belongs. * @param siteName Name of the app. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<RecommendationInner> object + * @return the observable to the PagedList<RecommendationInner> object */ - public Observable> listRecommendedRulesForWebAppAsync(String resourceGroupName, String siteName) { - return listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1>, List>() { - @Override - public List call(ServiceResponse> response) { - return response.body(); - } - }); + public Observable> listRecommendedRulesForWebAppAsync(final String resourceGroupName, final String siteName) { + return listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all recommendations for an app. + * Get all recommendations for an app. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param siteName Name of the app. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RecommendationInner> object + */ + public Observable>> listRecommendedRulesForWebAppWithServiceResponseAsync(final String resourceGroupName, final String siteName) { + return listRecommendedRulesForWebAppSinglePageAsync(resourceGroupName, siteName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listRecommendedRulesForWebAppNextWithServiceResponseAsync(nextPageLink)); + } + }); } /** @@ -547,9 +829,9 @@ public List call(ServiceResponse> * @param resourceGroupName Name of the resource group to which the resource belongs. * @param siteName Name of the app. * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<RecommendationInner> object + * @return the PagedList<RecommendationInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listRecommendedRulesForWebAppWithServiceResponseAsync(String resourceGroupName, String siteName) { + public Observable>> listRecommendedRulesForWebAppSinglePageAsync(final String resourceGroupName, final String siteName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -563,12 +845,12 @@ public Observable>> listRecommendedRul final Boolean featured = null; final String filter = null; return service.listRecommendedRulesForWebApp(resourceGroupName, siteName, this.client.subscriptionId(), featured, filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> clientResponse = listRecommendedRulesForWebAppDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listRecommendedRulesForWebAppDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -587,10 +869,16 @@ public Observable>> call(Response listRecommendedRulesForWebApp(String resourceGroupName, String siteName, Boolean featured, String filter) { - return listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName, featured, filter).toBlocking().single().body(); + public PagedList listRecommendedRulesForWebApp(final String resourceGroupName, final String siteName, final Boolean featured, final String filter) { + ServiceResponse> response = listRecommendedRulesForWebAppSinglePageAsync(resourceGroupName, siteName, featured, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listRecommendedRulesForWebAppNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; } /** @@ -605,8 +893,16 @@ public List listRecommendedRulesForWebApp(String resourceGr * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture> listRecommendedRulesForWebAppAsync(String resourceGroupName, String siteName, Boolean featured, String filter, final ServiceCallback> serviceCallback) { - return ServiceFuture.fromResponse(listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName, featured, filter), serviceCallback); + public ServiceFuture> listRecommendedRulesForWebAppAsync(final String resourceGroupName, final String siteName, final Boolean featured, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listRecommendedRulesForWebAppSinglePageAsync(resourceGroupName, siteName, featured, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listRecommendedRulesForWebAppNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); } /** @@ -618,15 +914,16 @@ public ServiceFuture> listRecommendedRulesForWebAppAsy * @param featured Specify <code>true</code> to return only the most critical recommendations. The default is <code>false</code>, which returns all recommendations. * @param filter Return only channels specified in the filter. Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<RecommendationInner> object + * @return the observable to the PagedList<RecommendationInner> object */ - public Observable> listRecommendedRulesForWebAppAsync(String resourceGroupName, String siteName, Boolean featured, String filter) { - return listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName, featured, filter).map(new Func1>, List>() { - @Override - public List call(ServiceResponse> response) { - return response.body(); - } - }); + public Observable> listRecommendedRulesForWebAppAsync(final String resourceGroupName, final String siteName, final Boolean featured, final String filter) { + return listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName, featured, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); } /** @@ -638,9 +935,34 @@ public List call(ServiceResponse> * @param featured Specify <code>true</code> to return only the most critical recommendations. The default is <code>false</code>, which returns all recommendations. * @param filter Return only channels specified in the filter. Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the List<RecommendationInner> object + * @return the observable to the PagedList<RecommendationInner> object + */ + public Observable>> listRecommendedRulesForWebAppWithServiceResponseAsync(final String resourceGroupName, final String siteName, final Boolean featured, final String filter) { + return listRecommendedRulesForWebAppSinglePageAsync(resourceGroupName, siteName, featured, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listRecommendedRulesForWebAppNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all recommendations for an app. + * Get all recommendations for an app. + * + ServiceResponse> * @param resourceGroupName Name of the resource group to which the resource belongs. + ServiceResponse> * @param siteName Name of the app. + ServiceResponse> * @param featured Specify <code>true</code> to return only the most critical recommendations. The default is <code>false</code>, which returns all recommendations. + ServiceResponse> * @param filter Return only channels specified in the filter. Filter is specified by using OData syntax. Example: $filter=channels eq 'Api' or channel eq 'Notification' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RecommendationInner> object wrapped in {@link ServiceResponse} if successful. */ - public Observable>> listRecommendedRulesForWebAppWithServiceResponseAsync(String resourceGroupName, String siteName, Boolean featured, String filter) { + public Observable>> listRecommendedRulesForWebAppSinglePageAsync(final String resourceGroupName, final String siteName, final Boolean featured, final String filter) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -652,12 +974,12 @@ public Observable>> listRecommendedRul } final String apiVersion = "2016-03-01"; return service.listRecommendedRulesForWebApp(resourceGroupName, siteName, this.client.subscriptionId(), featured, filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>>() { + .flatMap(new Func1, Observable>>>() { @Override - public Observable>> call(Response response) { + public Observable>> call(Response response) { try { - ServiceResponse> clientResponse = listRecommendedRulesForWebAppDelegate(response); - return Observable.just(clientResponse); + ServiceResponse> result = listRecommendedRulesForWebAppDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } @@ -665,9 +987,9 @@ public Observable>> call(Response> listRecommendedRulesForWebAppDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken>() { }.getType()) + private ServiceResponse> listRecommendedRulesForWebAppDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) .registerError(CloudException.class) .build(response); } @@ -921,7 +1243,8 @@ public Observable> getRuleDetailsByWebA } final String apiVersion = "2016-03-01"; final Boolean updateSeen = null; - return service.getRuleDetailsByWebApp(resourceGroupName, siteName, name, this.client.subscriptionId(), updateSeen, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + final String recommendationId = null; + return service.getRuleDetailsByWebApp(resourceGroupName, siteName, name, this.client.subscriptionId(), updateSeen, recommendationId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -943,13 +1266,14 @@ public Observable> call(Response getRuleDetailsByWebAppAsync(String resourceGroupName, String siteName, String name, Boolean updateSeen, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name, updateSeen), serviceCallback); + public ServiceFuture getRuleDetailsByWebAppAsync(String resourceGroupName, String siteName, String name, Boolean updateSeen, String recommendationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name, updateSeen, recommendationId), serviceCallback); } /** @@ -976,11 +1301,12 @@ public ServiceFuture getRuleDetailsByWebAppAsync(String * @param siteName Name of the app. * @param name Name of the recommendation. * @param updateSeen Specify <code>true</code> to update the last-seen timestamp of the recommendation object. + * @param recommendationId The GUID of the recommedation object if you query an expired one. You don't need to specify it to query an active entry. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the RecommendationRuleInner object */ - public Observable getRuleDetailsByWebAppAsync(String resourceGroupName, String siteName, String name, Boolean updateSeen) { - return getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name, updateSeen).map(new Func1, RecommendationRuleInner>() { + public Observable getRuleDetailsByWebAppAsync(String resourceGroupName, String siteName, String name, Boolean updateSeen, String recommendationId) { + return getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name, updateSeen, recommendationId).map(new Func1, RecommendationRuleInner>() { @Override public RecommendationRuleInner call(ServiceResponse response) { return response.body(); @@ -996,10 +1322,11 @@ public RecommendationRuleInner call(ServiceResponse res * @param siteName Name of the app. * @param name Name of the recommendation. * @param updateSeen Specify <code>true</code> to update the last-seen timestamp of the recommendation object. + * @param recommendationId The GUID of the recommedation object if you query an expired one. You don't need to specify it to query an active entry. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the RecommendationRuleInner object */ - public Observable> getRuleDetailsByWebAppWithServiceResponseAsync(String resourceGroupName, String siteName, String name, Boolean updateSeen) { + public Observable> getRuleDetailsByWebAppWithServiceResponseAsync(String resourceGroupName, String siteName, String name, Boolean updateSeen, String recommendationId) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -1013,7 +1340,7 @@ public Observable> getRuleDetailsByWebA throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2016-03-01"; - return service.getRuleDetailsByWebApp(resourceGroupName, siteName, name, this.client.subscriptionId(), updateSeen, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.getRuleDetailsByWebApp(resourceGroupName, siteName, name, this.client.subscriptionId(), updateSeen, recommendationId, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -1034,4 +1361,446 @@ private ServiceResponse getRuleDetailsByWebAppDelegate( .build(response); } + /** + * Disables the specific rule for a web site permanently. + * Disables the specific rule for a web site permanently. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param siteName Site name + * @param name Rule name + * @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 disableRecommendationForSite(String resourceGroupName, String siteName, String name) { + disableRecommendationForSiteWithServiceResponseAsync(resourceGroupName, siteName, name).toBlocking().single().body(); + } + + /** + * Disables the specific rule for a web site permanently. + * Disables the specific rule for a web site permanently. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param siteName Site name + * @param name Rule name + * @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 disableRecommendationForSiteAsync(String resourceGroupName, String siteName, String name, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(disableRecommendationForSiteWithServiceResponseAsync(resourceGroupName, siteName, name), serviceCallback); + } + + /** + * Disables the specific rule for a web site permanently. + * Disables the specific rule for a web site permanently. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param siteName Site name + * @param name Rule name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable disableRecommendationForSiteAsync(String resourceGroupName, String siteName, String name) { + return disableRecommendationForSiteWithServiceResponseAsync(resourceGroupName, siteName, name).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Disables the specific rule for a web site permanently. + * Disables the specific rule for a web site permanently. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param siteName Site name + * @param name Rule name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> disableRecommendationForSiteWithServiceResponseAsync(String resourceGroupName, String siteName, String name) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (siteName == null) { + throw new IllegalArgumentException("Parameter siteName is required and cannot be null."); + } + if (name == null) { + throw new IllegalArgumentException("Parameter name is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2016-03-01"; + return service.disableRecommendationForSite(resourceGroupName, siteName, name, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = disableRecommendationForSiteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse disableRecommendationForSiteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * List all recommendations for a subscription. + * List all recommendations for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 + * @return the PagedList<RecommendationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * List all recommendations for a subscription. + * List all recommendations for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * List all recommendations for a subscription. + * List all recommendations for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RecommendationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all recommendations for a subscription. + * List all recommendations for a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RecommendationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * List all recommendations for a subscription. + * List all recommendations for a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RecommendationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get past recommendations for an app, optionally specified by the time range. + * Get past recommendations for an app, optionally specified by the time range. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 + * @return the PagedList<RecommendationInner> object if successful. + */ + public PagedList listHistoryForWebAppNext(final String nextPageLink) { + ServiceResponse> response = listHistoryForWebAppNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listHistoryForWebAppNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get past recommendations for an app, optionally specified by the time range. + * Get past recommendations for an app, optionally specified by the time range. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listHistoryForWebAppNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listHistoryForWebAppNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listHistoryForWebAppNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get past recommendations for an app, optionally specified by the time range. + * Get past recommendations for an app, optionally specified by the time range. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RecommendationInner> object + */ + public Observable> listHistoryForWebAppNextAsync(final String nextPageLink) { + return listHistoryForWebAppNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get past recommendations for an app, optionally specified by the time range. + * Get past recommendations for an app, optionally specified by the time range. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RecommendationInner> object + */ + public Observable>> listHistoryForWebAppNextWithServiceResponseAsync(final String nextPageLink) { + return listHistoryForWebAppNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listHistoryForWebAppNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get past recommendations for an app, optionally specified by the time range. + * Get past recommendations for an app, optionally specified by the time range. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RecommendationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listHistoryForWebAppNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listHistoryForWebAppNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listHistoryForWebAppNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listHistoryForWebAppNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Get all recommendations for an app. + * Get all recommendations for an app. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @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 + * @return the PagedList<RecommendationInner> object if successful. + */ + public PagedList listRecommendedRulesForWebAppNext(final String nextPageLink) { + ServiceResponse> response = listRecommendedRulesForWebAppNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listRecommendedRulesForWebAppNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get all recommendations for an app. + * Get all recommendations for an app. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> listRecommendedRulesForWebAppNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listRecommendedRulesForWebAppNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listRecommendedRulesForWebAppNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get all recommendations for an app. + * Get all recommendations for an app. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RecommendationInner> object + */ + public Observable> listRecommendedRulesForWebAppNextAsync(final String nextPageLink) { + return listRecommendedRulesForWebAppNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get all recommendations for an app. + * Get all recommendations for an app. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<RecommendationInner> object + */ + public Observable>> listRecommendedRulesForWebAppNextWithServiceResponseAsync(final String nextPageLink) { + return listRecommendedRulesForWebAppNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listRecommendedRulesForWebAppNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get all recommendations for an app. + * Get all recommendations for an app. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<RecommendationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listRecommendedRulesForWebAppNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listRecommendedRulesForWebAppNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listRecommendedRulesForWebAppNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listRecommendedRulesForWebAppNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + } diff --git a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/WebSiteManagementClientImpl.java b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/WebSiteManagementClientImpl.java index a4871917d26..6388d28bda3 100644 --- a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/WebSiteManagementClientImpl.java +++ b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/WebSiteManagementClientImpl.java @@ -293,6 +293,19 @@ public ResourceHealthMetadatasInner resourceHealthMetadatas() { return this.resourceHealthMetadatas; } + /** + * The BillingMetersInner object to access its operations. + */ + private BillingMetersInner billingMeters; + + /** + * Gets the BillingMetersInner object to access its operations. + * @return the BillingMetersInner object. + */ + public BillingMetersInner billingMeters() { + return this.billingMeters; + } + /** * The WebAppsInner object to access its operations. */ @@ -377,6 +390,7 @@ protected void initialize() { this.providers = new ProvidersInner(restClient().retrofit(), this); this.recommendations = new RecommendationsInner(restClient().retrofit(), this); this.resourceHealthMetadatas = new ResourceHealthMetadatasInner(restClient().retrofit(), this); + this.billingMeters = new BillingMetersInner(restClient().retrofit(), this); this.webApps = new WebAppsInner(restClient().retrofit(), this); this.appServiceEnvironments = new AppServiceEnvironmentsInner(restClient().retrofit(), this); this.appServicePlans = new AppServicePlansInner(restClient().retrofit(), this);