From dd95cbe75b8696d21a00cdef4866b35fcc965e33 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 23 Mar 2018 19:15:08 +0000 Subject: [PATCH 1/4] Generated from 346651741dcafd1a91d0741d726aef7cdac29c4d Adding BillingMeters API --- .../web/ManagedServiceIdentity.java | 9 +- .../implementation/RecommendationInner.java | 47 +- .../RecommendationRuleInner.java | 49 +- .../implementation/RecommendationsInner.java | 1059 ++++++++++++++--- 4 files changed, 970 insertions(+), 194 deletions(-) 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/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); + } + } From dc07048b459e6e42e3fdd35ec67a26405b2849b6 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 23 Mar 2018 21:11:32 +0000 Subject: [PATCH 2/4] Generated from 2c9ced71b2b53f7039ec9ddbcbe4f23f05897e89 Adding reference to readme.md --- .../web/implementation/BillingMeterInner.java | 147 ++++++++++++++++++ .../web/implementation/GlobalsInner.java | 142 +++++++++++++++++ .../WebSiteManagementClientImpl.java | 14 ++ 3 files changed, 303 insertions(+) create mode 100644 azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/BillingMeterInner.java create mode 100644 azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/GlobalsInner.java 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..f07015d7bd1 --- /dev/null +++ b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/BillingMeterInner.java @@ -0,0 +1,147 @@ +/** + * 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; + +/** + * Billing meter. + */ +public class BillingMeterInner { + /** + * Meter GUID onboarded in Commerce. + */ + @JsonProperty(value = "meterId") + private String meterId; + + /** + * CSM Location. + */ + @JsonProperty(value = "billingLocation") + private String billingLocation; + + /** + * Short Name from Azure pricing Page. + */ + @JsonProperty(value = "shortName") + private String shortName; + + /** + * Meter Resource Name. + */ + @JsonProperty(value = "friendlyName") + private String friendlyName; + + /** + * ResourceType meter used for. + */ + @JsonProperty(value = "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/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/WebSiteManagementClientImpl.java b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/WebSiteManagementClientImpl.java index a4871917d26..21f3504880b 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 @@ -254,6 +254,19 @@ public DiagnosticsInner diagnostics() { return this.diagnostics; } + /** + * The GlobalsInner object to access its operations. + */ + private GlobalsInner globals; + + /** + * Gets the GlobalsInner object to access its operations. + * @return the GlobalsInner object. + */ + public GlobalsInner globals() { + return this.globals; + } + /** * The ProvidersInner object to access its operations. */ @@ -374,6 +387,7 @@ protected void initialize() { this.certificates = new CertificatesInner(restClient().retrofit(), this); this.deletedWebApps = new DeletedWebAppsInner(restClient().retrofit(), this); this.diagnostics = new DiagnosticsInner(restClient().retrofit(), this); + this.globals = new GlobalsInner(restClient().retrofit(), this); this.providers = new ProvidersInner(restClient().retrofit(), this); this.recommendations = new RecommendationsInner(restClient().retrofit(), this); this.resourceHealthMetadatas = new ResourceHealthMetadatasInner(restClient().retrofit(), this); From 2c3d9c132e168ea4b1904ac2f744ffeabd8674ce Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 30 Mar 2018 00:25:28 +0000 Subject: [PATCH 3/4] Generated from 1723dbe3e971a273cd0d143700e69c20912f9bce Merge branch 'master' of https://github.com/andreyse/azure-rest-api-specs --- .../web/implementation/BillingMeterInner.java | 26 +- .../implementation/BillingMetersInner.java | 404 ++++++++++++++++++ .../web/implementation/WebAppsInner.java | 365 +--------------- .../WebSiteManagementClientImpl.java | 28 +- 4 files changed, 449 insertions(+), 374 deletions(-) create mode 100644 azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/BillingMetersInner.java 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 index f07015d7bd1..72feb74806e 100644 --- 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 @@ -9,39 +9,43 @@ 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; /** - * Billing meter. + * App Service billing entity that contains information about meter which the + * Azure billing system utilizes to charge users for services. */ -public class BillingMeterInner { +@JsonFlatten +public class BillingMeterInner extends ProxyOnlyResource { /** * Meter GUID onboarded in Commerce. */ - @JsonProperty(value = "meterId") + @JsonProperty(value = "properties.meterId") private String meterId; /** - * CSM Location. + * Azure Location of billable resource. */ - @JsonProperty(value = "billingLocation") + @JsonProperty(value = "properties.billingLocation") private String billingLocation; /** - * Short Name from Azure pricing Page. + * Short Name from App Service Azure pricing Page. */ - @JsonProperty(value = "shortName") + @JsonProperty(value = "properties.shortName") private String shortName; /** - * Meter Resource Name. + * Friendly name of the meter. */ - @JsonProperty(value = "friendlyName") + @JsonProperty(value = "properties.friendlyName") private String friendlyName; /** - * ResourceType meter used for. + * App Service resource type meter used for. */ - @JsonProperty(value = "resourceType") + @JsonProperty(value = "properties.resourceType") private String resourceType; /** 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/WebAppsInner.java b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/WebAppsInner.java index c9ce727a47d..65e6692b580 100644 --- a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/WebAppsInner.java +++ b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/WebAppsInner.java @@ -84,19 +84,19 @@ interface WebAppsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.web.WebApps createOrUpdate" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}") - Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body SiteInner siteEnvelope, @Query("skipDnsRegistration") Boolean skipDnsRegistration, @Query("skipCustomDomainVerification") Boolean skipCustomDomainVerification, @Query("forceDnsRegistration") Boolean forceDnsRegistration, @Query("ttlInSeconds") String ttlInSeconds, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body SiteInner siteEnvelope, @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.WebApps beginCreateOrUpdate" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}") - Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body SiteInner siteEnvelope, @Query("skipDnsRegistration") Boolean skipDnsRegistration, @Query("skipCustomDomainVerification") Boolean skipCustomDomainVerification, @Query("forceDnsRegistration") Boolean forceDnsRegistration, @Query("ttlInSeconds") String ttlInSeconds, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body SiteInner siteEnvelope, @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.WebApps delete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", method = "DELETE", hasBody = true) - Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("deleteMetrics") Boolean deleteMetrics, @Query("deleteEmptyServerFarm") Boolean deleteEmptyServerFarm, @Query("skipDnsRegistration") Boolean skipDnsRegistration, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("deleteMetrics") Boolean deleteMetrics, @Query("deleteEmptyServerFarm") Boolean deleteEmptyServerFarm, @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.WebApps update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}") - Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body SitePatchResourceInner siteEnvelope, @Query("skipDnsRegistration") Boolean skipDnsRegistration, @Query("skipCustomDomainVerification") Boolean skipCustomDomainVerification, @Query("forceDnsRegistration") Boolean forceDnsRegistration, @Query("ttlInSeconds") String ttlInSeconds, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body SitePatchResourceInner siteEnvelope, @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.WebApps analyzeCustomHostname" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname") @@ -2143,109 +2143,7 @@ public Observable> createOrUpdateWithServiceResponseA } Validator.validate(siteEnvelope); final String apiVersion = "2016-08-01"; - final Boolean skipDnsRegistration = null; - final Boolean skipCustomDomainVerification = null; - final Boolean forceDnsRegistration = null; - final String ttlInSeconds = null; - Observable> observable = service.createOrUpdate(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); - } - /** - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * - * @param resourceGroupName Name of the resource group to which the resource belongs. - * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. - * @param siteEnvelope A JSON representation of the app properties. See example. - * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is - only used for app creation. - * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. - * @param forceDnsRegistration If true, web app hostname is force registered with DNS. - * @param ttlInSeconds Time to live in seconds for web app's default domain 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 - * @return the SiteInner object if successful. - */ - public SiteInner createOrUpdate(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { - return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds).toBlocking().last().body(); - } - - /** - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * - * @param resourceGroupName Name of the resource group to which the resource belongs. - * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. - * @param siteEnvelope A JSON representation of the app properties. See example. - * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is - only used for app creation. - * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. - * @param forceDnsRegistration If true, web app hostname is force registered with DNS. - * @param ttlInSeconds Time to live in seconds for web app's default domain 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 createOrUpdateAsync(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds), serviceCallback); - } - - /** - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * - * @param resourceGroupName Name of the resource group to which the resource belongs. - * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. - * @param siteEnvelope A JSON representation of the app properties. See example. - * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is - only used for app creation. - * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. - * @param forceDnsRegistration If true, web app hostname is force registered with DNS. - * @param ttlInSeconds Time to live in seconds for web app's default domain name. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable createOrUpdateAsync(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { - return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds).map(new Func1, SiteInner>() { - @Override - public SiteInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * - * @param resourceGroupName Name of the resource group to which the resource belongs. - * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. - * @param siteEnvelope A JSON representation of the app properties. See example. - * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is - only used for app creation. - * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. - * @param forceDnsRegistration If true, web app hostname is force registered with DNS. - * @param ttlInSeconds Time to live in seconds for web app's default domain name. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName 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."); - } - if (siteEnvelope == null) { - throw new IllegalArgumentException("Parameter siteEnvelope is required and cannot be null."); - } - Validator.validate(siteEnvelope); - final String apiVersion = "2016-08-01"; - Observable> observable = service.createOrUpdate(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + Observable> observable = service.createOrUpdate(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } @@ -2324,120 +2222,7 @@ public Observable> beginCreateOrUpdateWithServiceResp } Validator.validate(siteEnvelope); final String apiVersion = "2016-08-01"; - final Boolean skipDnsRegistration = null; - final Boolean skipCustomDomainVerification = null; - final Boolean forceDnsRegistration = null; - final String ttlInSeconds = null; - return service.beginCreateOrUpdate(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - /** - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * - * @param resourceGroupName Name of the resource group to which the resource belongs. - * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. - * @param siteEnvelope A JSON representation of the app properties. See example. - * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is - only used for app creation. - * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. - * @param forceDnsRegistration If true, web app hostname is force registered with DNS. - * @param ttlInSeconds Time to live in seconds for web app's default domain 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 - * @return the SiteInner object if successful. - */ - public SiteInner beginCreateOrUpdate(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { - return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds).toBlocking().single().body(); - } - - /** - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * - * @param resourceGroupName Name of the resource group to which the resource belongs. - * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. - * @param siteEnvelope A JSON representation of the app properties. See example. - * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is - only used for app creation. - * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. - * @param forceDnsRegistration If true, web app hostname is force registered with DNS. - * @param ttlInSeconds Time to live in seconds for web app's default domain 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 beginCreateOrUpdateAsync(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds), serviceCallback); - } - - /** - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * - * @param resourceGroupName Name of the resource group to which the resource belongs. - * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. - * @param siteEnvelope A JSON representation of the app properties. See example. - * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is - only used for app creation. - * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. - * @param forceDnsRegistration If true, web app hostname is force registered with DNS. - * @param ttlInSeconds Time to live in seconds for web app's default domain name. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the SiteInner object - */ - public Observable beginCreateOrUpdateAsync(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { - return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds).map(new Func1, SiteInner>() { - @Override - public SiteInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * - * @param resourceGroupName Name of the resource group to which the resource belongs. - * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. - * @param siteEnvelope A JSON representation of the app properties. See example. - * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is - only used for app creation. - * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. - * @param forceDnsRegistration If true, web app hostname is force registered with DNS. - * @param ttlInSeconds Time to live in seconds for web app's default domain name. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the SiteInner object - */ - public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName 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."); - } - if (siteEnvelope == null) { - throw new IllegalArgumentException("Parameter siteEnvelope is required and cannot be null."); - } - Validator.validate(siteEnvelope); - final String apiVersion = "2016-08-01"; - return service.beginCreateOrUpdate(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.beginCreateOrUpdate(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2527,8 +2312,7 @@ public Observable> deleteWithServiceResponseAsync(String r final String apiVersion = "2016-08-01"; final Boolean deleteMetrics = null; final Boolean deleteEmptyServerFarm = null; - final Boolean skipDnsRegistration = null; - return service.delete(resourceGroupName, name, this.client.subscriptionId(), deleteMetrics, deleteEmptyServerFarm, skipDnsRegistration, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.delete(resourceGroupName, name, this.client.subscriptionId(), deleteMetrics, deleteEmptyServerFarm, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2550,13 +2334,12 @@ public Observable> call(Response response) { * @param name Name of the app to delete. * @param deleteMetrics If true, web app metrics are also deleted. * @param deleteEmptyServerFarm Specify true if the App Service plan will be empty after app deletion and you want to delete the empty App Service plan. By default, the empty App Service plan is not deleted. - * @param skipDnsRegistration If true, DNS registration is skipped. * @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 delete(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm, Boolean skipDnsRegistration) { - deleteWithServiceResponseAsync(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm, skipDnsRegistration).toBlocking().single().body(); + public void delete(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm) { + deleteWithServiceResponseAsync(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm).toBlocking().single().body(); } /** @@ -2567,13 +2350,12 @@ public void delete(String resourceGroupName, String name, Boolean deleteMetrics, * @param name Name of the app to delete. * @param deleteMetrics If true, web app metrics are also deleted. * @param deleteEmptyServerFarm Specify true if the App Service plan will be empty after app deletion and you want to delete the empty App Service plan. By default, the empty App Service plan is not deleted. - * @param skipDnsRegistration If true, DNS registration is skipped. * @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 deleteAsync(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm, Boolean skipDnsRegistration, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm, skipDnsRegistration), serviceCallback); + public ServiceFuture deleteAsync(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm), serviceCallback); } /** @@ -2584,12 +2366,11 @@ public ServiceFuture deleteAsync(String resourceGroupName, String name, Bo * @param name Name of the app to delete. * @param deleteMetrics If true, web app metrics are also deleted. * @param deleteEmptyServerFarm Specify true if the App Service plan will be empty after app deletion and you want to delete the empty App Service plan. By default, the empty App Service plan is not deleted. - * @param skipDnsRegistration If true, DNS registration is skipped. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ - public Observable deleteAsync(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm, Boolean skipDnsRegistration) { - return deleteWithServiceResponseAsync(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm, skipDnsRegistration).map(new Func1, Void>() { + public Observable deleteAsync(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm) { + return deleteWithServiceResponseAsync(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { return response.body(); @@ -2605,11 +2386,10 @@ public Void call(ServiceResponse response) { * @param name Name of the app to delete. * @param deleteMetrics If true, web app metrics are also deleted. * @param deleteEmptyServerFarm Specify true if the App Service plan will be empty after app deletion and you want to delete the empty App Service plan. By default, the empty App Service plan is not deleted. - * @param skipDnsRegistration If true, DNS registration is skipped. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ - public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm, Boolean skipDnsRegistration) { + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -2620,7 +2400,7 @@ public Observable> deleteWithServiceResponseAsync(String r throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2016-08-01"; - return service.delete(resourceGroupName, name, this.client.subscriptionId(), deleteMetrics, deleteEmptyServerFarm, skipDnsRegistration, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.delete(resourceGroupName, name, this.client.subscriptionId(), deleteMetrics, deleteEmptyServerFarm, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2718,120 +2498,7 @@ public Observable> updateWithServiceResponseAsync(Str } Validator.validate(siteEnvelope); final String apiVersion = "2016-08-01"; - final Boolean skipDnsRegistration = null; - final Boolean skipCustomDomainVerification = null; - final Boolean forceDnsRegistration = null; - final String ttlInSeconds = null; - return service.update(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = updateDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - /** - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * - * @param resourceGroupName Name of the resource group to which the resource belongs. - * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. - * @param siteEnvelope A JSON representation of the app properties. See example. - * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is - only used for app creation. - * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. - * @param forceDnsRegistration If true, web app hostname is force registered with DNS. - * @param ttlInSeconds Time to live in seconds for web app's default domain 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 - * @return the SiteInner object if successful. - */ - public SiteInner update(String resourceGroupName, String name, SitePatchResourceInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { - return updateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds).toBlocking().single().body(); - } - - /** - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * - * @param resourceGroupName Name of the resource group to which the resource belongs. - * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. - * @param siteEnvelope A JSON representation of the app properties. See example. - * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is - only used for app creation. - * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. - * @param forceDnsRegistration If true, web app hostname is force registered with DNS. - * @param ttlInSeconds Time to live in seconds for web app's default domain 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 updateAsync(String resourceGroupName, String name, SitePatchResourceInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds), serviceCallback); - } - - /** - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * - * @param resourceGroupName Name of the resource group to which the resource belongs. - * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. - * @param siteEnvelope A JSON representation of the app properties. See example. - * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is - only used for app creation. - * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. - * @param forceDnsRegistration If true, web app hostname is force registered with DNS. - * @param ttlInSeconds Time to live in seconds for web app's default domain name. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the SiteInner object - */ - public Observable updateAsync(String resourceGroupName, String name, SitePatchResourceInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { - return updateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds).map(new Func1, SiteInner>() { - @Override - public SiteInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. - * - * @param resourceGroupName Name of the resource group to which the resource belongs. - * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. - * @param siteEnvelope A JSON representation of the app properties. See example. - * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is - only used for app creation. - * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. - * @param forceDnsRegistration If true, web app hostname is force registered with DNS. - * @param ttlInSeconds Time to live in seconds for web app's default domain name. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the SiteInner object - */ - public Observable> updateWithServiceResponseAsync(String resourceGroupName, String name, SitePatchResourceInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { - if (resourceGroupName == null) { - throw new IllegalArgumentException("Parameter resourceGroupName 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."); - } - if (siteEnvelope == null) { - throw new IllegalArgumentException("Parameter siteEnvelope is required and cannot be null."); - } - Validator.validate(siteEnvelope); - final String apiVersion = "2016-08-01"; - return service.update(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.update(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response 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 21f3504880b..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 @@ -254,19 +254,6 @@ public DiagnosticsInner diagnostics() { return this.diagnostics; } - /** - * The GlobalsInner object to access its operations. - */ - private GlobalsInner globals; - - /** - * Gets the GlobalsInner object to access its operations. - * @return the GlobalsInner object. - */ - public GlobalsInner globals() { - return this.globals; - } - /** * The ProvidersInner object to access its operations. */ @@ -306,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. */ @@ -387,10 +387,10 @@ protected void initialize() { this.certificates = new CertificatesInner(restClient().retrofit(), this); this.deletedWebApps = new DeletedWebAppsInner(restClient().retrofit(), this); this.diagnostics = new DiagnosticsInner(restClient().retrofit(), this); - this.globals = new GlobalsInner(restClient().retrofit(), this); 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); From 1dfa3c1e9b840cf612cd968183349ddfa3dfe8af Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Fri, 30 Mar 2018 01:24:49 +0000 Subject: [PATCH 4/4] Generated from 1723dbe3e971a273cd0d143700e69c20912f9bce Merge branch 'master' of https://github.com/andreyse/azure-rest-api-specs --- .../web/implementation/WebAppsInner.java | 365 +++++++++++++++++- 1 file changed, 349 insertions(+), 16 deletions(-) diff --git a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/WebAppsInner.java b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/WebAppsInner.java index 65e6692b580..c9ce727a47d 100644 --- a/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/WebAppsInner.java +++ b/azure-mgmt-web/src/main/java/com/microsoft/azure/management/web/implementation/WebAppsInner.java @@ -84,19 +84,19 @@ interface WebAppsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.web.WebApps createOrUpdate" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}") - Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body SiteInner siteEnvelope, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body SiteInner siteEnvelope, @Query("skipDnsRegistration") Boolean skipDnsRegistration, @Query("skipCustomDomainVerification") Boolean skipCustomDomainVerification, @Query("forceDnsRegistration") Boolean forceDnsRegistration, @Query("ttlInSeconds") String ttlInSeconds, @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.WebApps beginCreateOrUpdate" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}") - Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body SiteInner siteEnvelope, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body SiteInner siteEnvelope, @Query("skipDnsRegistration") Boolean skipDnsRegistration, @Query("skipCustomDomainVerification") Boolean skipCustomDomainVerification, @Query("forceDnsRegistration") Boolean forceDnsRegistration, @Query("ttlInSeconds") String ttlInSeconds, @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.WebApps delete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}", method = "DELETE", hasBody = true) - Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("deleteMetrics") Boolean deleteMetrics, @Query("deleteEmptyServerFarm") Boolean deleteEmptyServerFarm, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("deleteMetrics") Boolean deleteMetrics, @Query("deleteEmptyServerFarm") Boolean deleteEmptyServerFarm, @Query("skipDnsRegistration") Boolean skipDnsRegistration, @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.WebApps update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}") - Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body SitePatchResourceInner siteEnvelope, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body SitePatchResourceInner siteEnvelope, @Query("skipDnsRegistration") Boolean skipDnsRegistration, @Query("skipCustomDomainVerification") Boolean skipCustomDomainVerification, @Query("forceDnsRegistration") Boolean forceDnsRegistration, @Query("ttlInSeconds") String ttlInSeconds, @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.WebApps analyzeCustomHostname" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/analyzeCustomHostname") @@ -2143,7 +2143,109 @@ public Observable> createOrUpdateWithServiceResponseA } Validator.validate(siteEnvelope); final String apiVersion = "2016-08-01"; - Observable> observable = service.createOrUpdate(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + final Boolean skipDnsRegistration = null; + final Boolean skipCustomDomainVerification = null; + final Boolean forceDnsRegistration = null; + final String ttlInSeconds = null; + Observable> observable = service.createOrUpdate(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. + * @param siteEnvelope A JSON representation of the app properties. See example. + * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is + only used for app creation. + * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. + * @param forceDnsRegistration If true, web app hostname is force registered with DNS. + * @param ttlInSeconds Time to live in seconds for web app's default domain 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 + * @return the SiteInner object if successful. + */ + public SiteInner createOrUpdate(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds).toBlocking().last().body(); + } + + /** + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. + * @param siteEnvelope A JSON representation of the app properties. See example. + * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is + only used for app creation. + * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. + * @param forceDnsRegistration If true, web app hostname is force registered with DNS. + * @param ttlInSeconds Time to live in seconds for web app's default domain 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 createOrUpdateAsync(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds), serviceCallback); + } + + /** + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. + * @param siteEnvelope A JSON representation of the app properties. See example. + * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is + only used for app creation. + * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. + * @param forceDnsRegistration If true, web app hostname is force registered with DNS. + * @param ttlInSeconds Time to live in seconds for web app's default domain name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds).map(new Func1, SiteInner>() { + @Override + public SiteInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. + * @param siteEnvelope A JSON representation of the app properties. See example. + * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is + only used for app creation. + * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. + * @param forceDnsRegistration If true, web app hostname is force registered with DNS. + * @param ttlInSeconds Time to live in seconds for web app's default domain name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName 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."); + } + if (siteEnvelope == null) { + throw new IllegalArgumentException("Parameter siteEnvelope is required and cannot be null."); + } + Validator.validate(siteEnvelope); + final String apiVersion = "2016-08-01"; + Observable> observable = service.createOrUpdate(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } @@ -2222,7 +2324,120 @@ public Observable> beginCreateOrUpdateWithServiceResp } Validator.validate(siteEnvelope); final String apiVersion = "2016-08-01"; - return service.beginCreateOrUpdate(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + final Boolean skipDnsRegistration = null; + final Boolean skipCustomDomainVerification = null; + final Boolean forceDnsRegistration = null; + final String ttlInSeconds = null; + return service.beginCreateOrUpdate(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. + * @param siteEnvelope A JSON representation of the app properties. See example. + * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is + only used for app creation. + * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. + * @param forceDnsRegistration If true, web app hostname is force registered with DNS. + * @param ttlInSeconds Time to live in seconds for web app's default domain 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 + * @return the SiteInner object if successful. + */ + public SiteInner beginCreateOrUpdate(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds).toBlocking().single().body(); + } + + /** + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. + * @param siteEnvelope A JSON representation of the app properties. See example. + * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is + only used for app creation. + * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. + * @param forceDnsRegistration If true, web app hostname is force registered with DNS. + * @param ttlInSeconds Time to live in seconds for web app's default domain 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 beginCreateOrUpdateAsync(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds), serviceCallback); + } + + /** + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. + * @param siteEnvelope A JSON representation of the app properties. See example. + * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is + only used for app creation. + * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. + * @param forceDnsRegistration If true, web app hostname is force registered with DNS. + * @param ttlInSeconds Time to live in seconds for web app's default domain name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SiteInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds).map(new Func1, SiteInner>() { + @Override + public SiteInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. + * @param siteEnvelope A JSON representation of the app properties. See example. + * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is + only used for app creation. + * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. + * @param forceDnsRegistration If true, web app hostname is force registered with DNS. + * @param ttlInSeconds Time to live in seconds for web app's default domain name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SiteInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String name, SiteInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName 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."); + } + if (siteEnvelope == null) { + throw new IllegalArgumentException("Parameter siteEnvelope is required and cannot be null."); + } + Validator.validate(siteEnvelope); + final String apiVersion = "2016-08-01"; + return service.beginCreateOrUpdate(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2312,7 +2527,8 @@ public Observable> deleteWithServiceResponseAsync(String r final String apiVersion = "2016-08-01"; final Boolean deleteMetrics = null; final Boolean deleteEmptyServerFarm = null; - return service.delete(resourceGroupName, name, this.client.subscriptionId(), deleteMetrics, deleteEmptyServerFarm, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + final Boolean skipDnsRegistration = null; + return service.delete(resourceGroupName, name, this.client.subscriptionId(), deleteMetrics, deleteEmptyServerFarm, skipDnsRegistration, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2334,12 +2550,13 @@ public Observable> call(Response response) { * @param name Name of the app to delete. * @param deleteMetrics If true, web app metrics are also deleted. * @param deleteEmptyServerFarm Specify true if the App Service plan will be empty after app deletion and you want to delete the empty App Service plan. By default, the empty App Service plan is not deleted. + * @param skipDnsRegistration If true, DNS registration is skipped. * @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 delete(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm) { - deleteWithServiceResponseAsync(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm).toBlocking().single().body(); + public void delete(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm, Boolean skipDnsRegistration) { + deleteWithServiceResponseAsync(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm, skipDnsRegistration).toBlocking().single().body(); } /** @@ -2350,12 +2567,13 @@ public void delete(String resourceGroupName, String name, Boolean deleteMetrics, * @param name Name of the app to delete. * @param deleteMetrics If true, web app metrics are also deleted. * @param deleteEmptyServerFarm Specify true if the App Service plan will be empty after app deletion and you want to delete the empty App Service plan. By default, the empty App Service plan is not deleted. + * @param skipDnsRegistration If true, DNS registration is skipped. * @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 deleteAsync(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm), serviceCallback); + public ServiceFuture deleteAsync(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm, Boolean skipDnsRegistration, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm, skipDnsRegistration), serviceCallback); } /** @@ -2366,11 +2584,12 @@ public ServiceFuture deleteAsync(String resourceGroupName, String name, Bo * @param name Name of the app to delete. * @param deleteMetrics If true, web app metrics are also deleted. * @param deleteEmptyServerFarm Specify true if the App Service plan will be empty after app deletion and you want to delete the empty App Service plan. By default, the empty App Service plan is not deleted. + * @param skipDnsRegistration If true, DNS registration is skipped. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ - public Observable deleteAsync(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm) { - return deleteWithServiceResponseAsync(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm).map(new Func1, Void>() { + public Observable deleteAsync(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm, Boolean skipDnsRegistration) { + return deleteWithServiceResponseAsync(resourceGroupName, name, deleteMetrics, deleteEmptyServerFarm, skipDnsRegistration).map(new Func1, Void>() { @Override public Void call(ServiceResponse response) { return response.body(); @@ -2386,10 +2605,11 @@ public Void call(ServiceResponse response) { * @param name Name of the app to delete. * @param deleteMetrics If true, web app metrics are also deleted. * @param deleteEmptyServerFarm Specify true if the App Service plan will be empty after app deletion and you want to delete the empty App Service plan. By default, the empty App Service plan is not deleted. + * @param skipDnsRegistration If true, DNS registration is skipped. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ - public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm) { + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String name, Boolean deleteMetrics, Boolean deleteEmptyServerFarm, Boolean skipDnsRegistration) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -2400,7 +2620,7 @@ public Observable> deleteWithServiceResponseAsync(String r throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2016-08-01"; - return service.delete(resourceGroupName, name, this.client.subscriptionId(), deleteMetrics, deleteEmptyServerFarm, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + return service.delete(resourceGroupName, name, this.client.subscriptionId(), deleteMetrics, deleteEmptyServerFarm, skipDnsRegistration, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { @@ -2498,7 +2718,120 @@ public Observable> updateWithServiceResponseAsync(Str } Validator.validate(siteEnvelope); final String apiVersion = "2016-08-01"; - return service.update(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + final Boolean skipDnsRegistration = null; + final Boolean skipCustomDomainVerification = null; + final Boolean forceDnsRegistration = null; + final String ttlInSeconds = null; + return service.update(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. + * @param siteEnvelope A JSON representation of the app properties. See example. + * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is + only used for app creation. + * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. + * @param forceDnsRegistration If true, web app hostname is force registered with DNS. + * @param ttlInSeconds Time to live in seconds for web app's default domain 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 + * @return the SiteInner object if successful. + */ + public SiteInner update(String resourceGroupName, String name, SitePatchResourceInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { + return updateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds).toBlocking().single().body(); + } + + /** + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. + * @param siteEnvelope A JSON representation of the app properties. See example. + * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is + only used for app creation. + * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. + * @param forceDnsRegistration If true, web app hostname is force registered with DNS. + * @param ttlInSeconds Time to live in seconds for web app's default domain 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 updateAsync(String resourceGroupName, String name, SitePatchResourceInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds), serviceCallback); + } + + /** + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. + * @param siteEnvelope A JSON representation of the app properties. See example. + * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is + only used for app creation. + * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. + * @param forceDnsRegistration If true, web app hostname is force registered with DNS. + * @param ttlInSeconds Time to live in seconds for web app's default domain name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SiteInner object + */ + public Observable updateAsync(String resourceGroupName, String name, SitePatchResourceInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { + return updateWithServiceResponseAsync(resourceGroupName, name, siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds).map(new Func1, SiteInner>() { + @Override + public SiteInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * Creates a new web, mobile, or API app in an existing resource group, or updates an existing app. + * + * @param resourceGroupName Name of the resource group to which the resource belongs. + * @param name Unique name of the app to create or update. To create or update a deployment slot, use the {slot} parameter. + * @param siteEnvelope A JSON representation of the app properties. See example. + * @param skipDnsRegistration If true web app hostname is not registered with DNS on creation. This parameter is + only used for app creation. + * @param skipCustomDomainVerification If true, custom (non *.azurewebsites.net) domains associated with web app are not verified. + * @param forceDnsRegistration If true, web app hostname is force registered with DNS. + * @param ttlInSeconds Time to live in seconds for web app's default domain name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SiteInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String name, SitePatchResourceInner siteEnvelope, Boolean skipDnsRegistration, Boolean skipCustomDomainVerification, Boolean forceDnsRegistration, String ttlInSeconds) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName 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."); + } + if (siteEnvelope == null) { + throw new IllegalArgumentException("Parameter siteEnvelope is required and cannot be null."); + } + Validator.validate(siteEnvelope); + final String apiVersion = "2016-08-01"; + return service.update(resourceGroupName, name, this.client.subscriptionId(), siteEnvelope, skipDnsRegistration, skipCustomDomainVerification, forceDnsRegistration, ttlInSeconds, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) {