/** * 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.appservice.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.POST; 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 Recommendations. */ public class RecommendationsInner { /** The Retrofit service to perform REST calls. */ private RecommendationsService service; /** The service client containing this operation class. */ private WebSiteManagementClientImpl client; /** * Initializes an instance of RecommendationsInner. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ public RecommendationsInner(Retrofit retrofit, WebSiteManagementClientImpl client) { this.service = retrofit.create(RecommendationsService.class); this.client = client; } /** * The interface defining all the services for Recommendations to be * used by Retrofit to perform actually REST calls. */ interface RecommendationsService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appservice.Recommendations list" }) @GET("subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations") Observable<Response<ResponseBody>> list(@Path("subscriptionId") String subscriptionId, @Query("featured") Boolean featured, @Query(value = "$filter", encoded = true) String filter, @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.appservice.Recommendations resetAllFilters" }) @POST("subscriptions/{subscriptionId}/providers/Microsoft.Web/recommendations/reset") Observable<Response<ResponseBody>> 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.appservice.Recommendations listHistoryForWebApp" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendationHistory") Observable<Response<ResponseBody>> 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); @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appservice.Recommendations listRecommendedRulesForWebApp" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations") Observable<Response<ResponseBody>> listRecommendedRulesForWebApp(@Path("resourceGroupName") String resourceGroupName, @Path("siteName") String siteName, @Path("subscriptionId") String subscriptionId, @Query("featured") Boolean featured, @Query(value = "$filter", encoded = true) String filter, @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.appservice.Recommendations disableAllForWebApp" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/disable") Observable<Response<ResponseBody>> disableAllForWebApp(@Path("resourceGroupName") String resourceGroupName, @Path("siteName") String siteName, @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.appservice.Recommendations resetAllFiltersForWebApp" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/reset") Observable<Response<ResponseBody>> resetAllFiltersForWebApp(@Path("resourceGroupName") String resourceGroupName, @Path("siteName") String siteName, @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.appservice.Recommendations getRuleDetailsByWebApp" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/recommendations/{name}") Observable<Response<ResponseBody>> 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); } /** * List all recommendations for a subscription. * List all recommendations for a subscription. * * @return the PagedList<RecommendationInner> object if successful. */ public PagedList<RecommendationInner> list() { PageImpl1<RecommendationInner> page = new PageImpl1<>(); page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); page.setNextPageLink(null); return new PagedList<RecommendationInner>(page) { @Override public Page<RecommendationInner> nextPage(String nextPageLink) { return null; } }; } /** * List all recommendations for a subscription. * List all recommendations for a subscription. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceFuture} object */ public ServiceFuture<List<RecommendationInner>> listAsync(final ServiceCallback<List<RecommendationInner>> serviceCallback) { return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); } /** * List all recommendations for a subscription. * List all recommendations for a subscription. * * @return the observable to the List<RecommendationInner> object */ public Observable<Page<RecommendationInner>> listAsync() { return listWithServiceResponseAsync().map(new Func1<ServiceResponse<List<RecommendationInner>>, Page<RecommendationInner>>() { @Override public Page<RecommendationInner> call(ServiceResponse<List<RecommendationInner>> response) { PageImpl1<RecommendationInner> page = new PageImpl1<>(); page.setItems(response.body()); return page; } }); } /** * List all recommendations for a subscription. * List all recommendations for a subscription. * * @return the observable to the List<RecommendationInner> object */ public Observable<ServiceResponse<List<RecommendationInner>>> 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"; 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<Response<ResponseBody>, Observable<ServiceResponse<List<RecommendationInner>>>>() { @Override public Observable<ServiceResponse<List<RecommendationInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl1<RecommendationInner>> result = listDelegate(response); ServiceResponse<List<RecommendationInner>> clientResponse = new ServiceResponse<List<RecommendationInner>>(result.body().items(), result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * List all recommendations for a subscription. * List all recommendations for a subscription. * * @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 PagedList<RecommendationInner> object if successful. */ public PagedList<RecommendationInner> list(Boolean featured, String filter) { PageImpl1<RecommendationInner> page = new PageImpl1<>(); page.setItems(listWithServiceResponseAsync(featured, filter).toBlocking().single().body()); page.setNextPageLink(null); return new PagedList<RecommendationInner>(page) { @Override public Page<RecommendationInner> nextPage(String nextPageLink) { return null; } }; } /** * List all recommendations for a subscription. * List all recommendations for a subscription. * * @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. * @return the {@link ServiceFuture} object */ public ServiceFuture<List<RecommendationInner>> listAsync(Boolean featured, String filter, final ServiceCallback<List<RecommendationInner>> serviceCallback) { return ServiceFuture.fromResponse(listWithServiceResponseAsync(featured, filter), serviceCallback); } /** * List all recommendations for a subscription. * List all recommendations for a subscription. * * @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 */ public Observable<Page<RecommendationInner>> listAsync(Boolean featured, String filter) { return listWithServiceResponseAsync(featured, filter).map(new Func1<ServiceResponse<List<RecommendationInner>>, Page<RecommendationInner>>() { @Override public Page<RecommendationInner> call(ServiceResponse<List<RecommendationInner>> response) { PageImpl1<RecommendationInner> page = new PageImpl1<>(); page.setItems(response.body()); return page; } }); } /** * List all recommendations for a subscription. * List all recommendations for a subscription. * * @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 */ public Observable<ServiceResponse<List<RecommendationInner>>> listWithServiceResponseAsync(Boolean featured, 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<Response<ResponseBody>, Observable<ServiceResponse<List<RecommendationInner>>>>() { @Override public Observable<ServiceResponse<List<RecommendationInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl1<RecommendationInner>> result = listDelegate(response); ServiceResponse<List<RecommendationInner>> clientResponse = new ServiceResponse<List<RecommendationInner>>(result.body().items(), result.response()); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl1<RecommendationInner>> listDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl1<RecommendationInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl1<RecommendationInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Reset all recommendation opt-out settings for a subscription. * Reset all recommendation opt-out settings for a subscription. * * @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 resetAllFilters() { resetAllFiltersWithServiceResponseAsync().toBlocking().single().body(); } /** * Reset all recommendation opt-out settings for a subscription. * Reset all recommendation opt-out settings 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<Void> resetAllFiltersAsync(final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(resetAllFiltersWithServiceResponseAsync(), serviceCallback); } /** * Reset all recommendation opt-out settings for a subscription. * Reset all recommendation opt-out settings for a subscription. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> resetAllFiltersAsync() { return resetAllFiltersWithServiceResponseAsync().map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Reset all recommendation opt-out settings for a subscription. * Reset all recommendation opt-out settings for a subscription. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> resetAllFiltersWithServiceResponseAsync() { 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.resetAllFilters(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = resetAllFiltersDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> resetAllFiltersDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter()) .register(204, new TypeToken<Void>() { }.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 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 * @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. */ public List<RecommendationInner> listHistoryForWebApp(String resourceGroupName, String siteName) { return listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName).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 resourceGroupName Name of the resource group to which the resource belongs. * @param siteName Name of the app. * @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<List<RecommendationInner>> listHistoryForWebAppAsync(String resourceGroupName, String siteName, final ServiceCallback<List<RecommendationInner>> serviceCallback) { return ServiceFuture.fromResponse(listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName), 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 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 */ public Observable<List<RecommendationInner>> listHistoryForWebAppAsync(String resourceGroupName, String siteName) { return listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1<ServiceResponse<List<RecommendationInner>>, List<RecommendationInner>>() { @Override public List<RecommendationInner> call(ServiceResponse<List<RecommendationInner>> 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 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 */ public Observable<ServiceResponse<List<RecommendationInner>>> listHistoryForWebAppWithServiceResponseAsync(String resourceGroupName, String siteName) { 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 (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 filter = null; return service.listHistoryForWebApp(resourceGroupName, siteName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<RecommendationInner>>>>() { @Override public Observable<ServiceResponse<List<RecommendationInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<RecommendationInner>> clientResponse = listHistoryForWebAppDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * 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. * @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 * @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. */ public List<RecommendationInner> listHistoryForWebApp(String resourceGroupName, String siteName, String filter) { return listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName, filter).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 resourceGroupName Name of the resource group to which the resource belongs. * @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] * @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<List<RecommendationInner>> listHistoryForWebAppAsync(String resourceGroupName, String siteName, String filter, final ServiceCallback<List<RecommendationInner>> serviceCallback) { return ServiceFuture.fromResponse(listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName, filter), 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 resourceGroupName Name of the resource group to which the resource belongs. * @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 */ public Observable<List<RecommendationInner>> listHistoryForWebAppAsync(String resourceGroupName, String siteName, String filter) { return listHistoryForWebAppWithServiceResponseAsync(resourceGroupName, siteName, filter).map(new Func1<ServiceResponse<List<RecommendationInner>>, List<RecommendationInner>>() { @Override public List<RecommendationInner> call(ServiceResponse<List<RecommendationInner>> 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 resourceGroupName Name of the resource group to which the resource belongs. * @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 */ public Observable<ServiceResponse<List<RecommendationInner>>> listHistoryForWebAppWithServiceResponseAsync(String resourceGroupName, String siteName, String filter) { 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 (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.listHistoryForWebApp(resourceGroupName, siteName, this.client.subscriptionId(), filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<RecommendationInner>>>>() { @Override public Observable<ServiceResponse<List<RecommendationInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<RecommendationInner>> clientResponse = listHistoryForWebAppDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<List<RecommendationInner>> listHistoryForWebAppDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<List<RecommendationInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<List<RecommendationInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * 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 * @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. */ public List<RecommendationInner> listRecommendedRulesForWebApp(String resourceGroupName, String siteName) { return listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName).toBlocking().single().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. * @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<List<RecommendationInner>> listRecommendedRulesForWebAppAsync(String resourceGroupName, String siteName, final ServiceCallback<List<RecommendationInner>> serviceCallback) { return ServiceFuture.fromResponse(listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName), serviceCallback); } /** * 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 List<RecommendationInner> object */ public Observable<List<RecommendationInner>> listRecommendedRulesForWebAppAsync(String resourceGroupName, String siteName) { return listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1<ServiceResponse<List<RecommendationInner>>, List<RecommendationInner>>() { @Override public List<RecommendationInner> call(ServiceResponse<List<RecommendationInner>> 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 List<RecommendationInner> object */ public Observable<ServiceResponse<List<RecommendationInner>>> listRecommendedRulesForWebAppWithServiceResponseAsync(String resourceGroupName, String siteName) { 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 (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2016-03-01"; 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<Response<ResponseBody>, Observable<ServiceResponse<List<RecommendationInner>>>>() { @Override public Observable<ServiceResponse<List<RecommendationInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<RecommendationInner>> clientResponse = listRecommendedRulesForWebAppDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * 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. * @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 * @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. */ public List<RecommendationInner> listRecommendedRulesForWebApp(String resourceGroupName, String siteName, Boolean featured, String filter) { return listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName, featured, filter).toBlocking().single().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. * @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' * @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<List<RecommendationInner>> listRecommendedRulesForWebAppAsync(String resourceGroupName, String siteName, Boolean featured, String filter, final ServiceCallback<List<RecommendationInner>> serviceCallback) { return ServiceFuture.fromResponse(listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName, featured, filter), serviceCallback); } /** * 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. * @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 */ public Observable<List<RecommendationInner>> listRecommendedRulesForWebAppAsync(String resourceGroupName, String siteName, Boolean featured, String filter) { return listRecommendedRulesForWebAppWithServiceResponseAsync(resourceGroupName, siteName, featured, filter).map(new Func1<ServiceResponse<List<RecommendationInner>>, List<RecommendationInner>>() { @Override public List<RecommendationInner> call(ServiceResponse<List<RecommendationInner>> 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. * @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 */ public Observable<ServiceResponse<List<RecommendationInner>>> listRecommendedRulesForWebAppWithServiceResponseAsync(String resourceGroupName, String siteName, Boolean featured, String filter) { 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 (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.listRecommendedRulesForWebApp(resourceGroupName, siteName, this.client.subscriptionId(), featured, filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<RecommendationInner>>>>() { @Override public Observable<ServiceResponse<List<RecommendationInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<RecommendationInner>> clientResponse = listRecommendedRulesForWebAppDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<List<RecommendationInner>> listRecommendedRulesForWebAppDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<List<RecommendationInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<List<RecommendationInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Disable all recommendations for an app. * Disable 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 * @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 disableAllForWebApp(String resourceGroupName, String siteName) { disableAllForWebAppWithServiceResponseAsync(resourceGroupName, siteName).toBlocking().single().body(); } /** * Disable all recommendations for an app. * Disable all recommendations for an app. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param siteName Name of the app. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> disableAllForWebAppAsync(String resourceGroupName, String siteName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(disableAllForWebAppWithServiceResponseAsync(resourceGroupName, siteName), serviceCallback); } /** * Disable all recommendations for an app. * Disable 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 {@link ServiceResponse} object if successful. */ public Observable<Void> disableAllForWebAppAsync(String resourceGroupName, String siteName) { return disableAllForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Disable all recommendations for an app. * Disable 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 {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> disableAllForWebAppWithServiceResponseAsync(String resourceGroupName, String siteName) { 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 (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.disableAllForWebApp(resourceGroupName, siteName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = disableAllForWebAppDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> disableAllForWebAppDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter()) .register(204, new TypeToken<Void>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Reset all recommendation opt-out settings for an app. * Reset all recommendation opt-out settings 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 * @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 resetAllFiltersForWebApp(String resourceGroupName, String siteName) { resetAllFiltersForWebAppWithServiceResponseAsync(resourceGroupName, siteName).toBlocking().single().body(); } /** * Reset all recommendation opt-out settings for an app. * Reset all recommendation opt-out settings for an app. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param siteName Name of the app. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ public ServiceFuture<Void> resetAllFiltersForWebAppAsync(String resourceGroupName, String siteName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(resetAllFiltersForWebAppWithServiceResponseAsync(resourceGroupName, siteName), serviceCallback); } /** * Reset all recommendation opt-out settings for an app. * Reset all recommendation opt-out settings 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 {@link ServiceResponse} object if successful. */ public Observable<Void> resetAllFiltersForWebAppAsync(String resourceGroupName, String siteName) { return resetAllFiltersForWebAppWithServiceResponseAsync(resourceGroupName, siteName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Reset all recommendation opt-out settings for an app. * Reset all recommendation opt-out settings 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 {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> resetAllFiltersForWebAppWithServiceResponseAsync(String resourceGroupName, String siteName) { 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 (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.resetAllFiltersForWebApp(resourceGroupName, siteName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Void>>>() { @Override public Observable<ServiceResponse<Void>> call(Response<ResponseBody> response) { try { ServiceResponse<Void> clientResponse = resetAllFiltersForWebAppDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> resetAllFiltersForWebAppDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter()) .register(204, new TypeToken<Void>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get a recommendation rule for an app. * Get a recommendation rule for an app. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param siteName Name of the app. * @param name Name of the recommendation. * @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 RecommendationRuleInner object if successful. */ public RecommendationRuleInner getRuleDetailsByWebApp(String resourceGroupName, String siteName, String name) { return getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name).toBlocking().single().body(); } /** * Get a recommendation rule for an app. * Get a recommendation rule for an app. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param siteName Name of the app. * @param name Name of the recommendation. * @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<RecommendationRuleInner> getRuleDetailsByWebAppAsync(String resourceGroupName, String siteName, String name, final ServiceCallback<RecommendationRuleInner> serviceCallback) { return ServiceFuture.fromResponse(getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name), serviceCallback); } /** * Get a recommendation rule for an app. * Get a recommendation rule for an app. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param siteName Name of the app. * @param name Name of the recommendation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the RecommendationRuleInner object */ public Observable<RecommendationRuleInner> getRuleDetailsByWebAppAsync(String resourceGroupName, String siteName, String name) { return getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name).map(new Func1<ServiceResponse<RecommendationRuleInner>, RecommendationRuleInner>() { @Override public RecommendationRuleInner call(ServiceResponse<RecommendationRuleInner> response) { return response.body(); } }); } /** * Get a recommendation rule for an app. * Get a recommendation rule for an app. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param siteName Name of the app. * @param name Name of the recommendation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the RecommendationRuleInner object */ public Observable<ServiceResponse<RecommendationRuleInner>> getRuleDetailsByWebAppWithServiceResponseAsync(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"; final Boolean updateSeen = null; return service.getRuleDetailsByWebApp(resourceGroupName, siteName, name, this.client.subscriptionId(), updateSeen, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RecommendationRuleInner>>>() { @Override public Observable<ServiceResponse<RecommendationRuleInner>> call(Response<ResponseBody> response) { try { ServiceResponse<RecommendationRuleInner> clientResponse = getRuleDetailsByWebAppDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get a recommendation rule for an app. * Get a recommendation rule for an app. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @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. * @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 RecommendationRuleInner object if successful. */ public RecommendationRuleInner getRuleDetailsByWebApp(String resourceGroupName, String siteName, String name, Boolean updateSeen) { return getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name, updateSeen).toBlocking().single().body(); } /** * Get a recommendation rule for an app. * Get a recommendation rule for an app. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @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 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<RecommendationRuleInner> getRuleDetailsByWebAppAsync(String resourceGroupName, String siteName, String name, Boolean updateSeen, final ServiceCallback<RecommendationRuleInner> serviceCallback) { return ServiceFuture.fromResponse(getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name, updateSeen), serviceCallback); } /** * Get a recommendation rule for an app. * Get a recommendation rule for an app. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @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. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the RecommendationRuleInner object */ public Observable<RecommendationRuleInner> getRuleDetailsByWebAppAsync(String resourceGroupName, String siteName, String name, Boolean updateSeen) { return getRuleDetailsByWebAppWithServiceResponseAsync(resourceGroupName, siteName, name, updateSeen).map(new Func1<ServiceResponse<RecommendationRuleInner>, RecommendationRuleInner>() { @Override public RecommendationRuleInner call(ServiceResponse<RecommendationRuleInner> response) { return response.body(); } }); } /** * Get a recommendation rule for an app. * Get a recommendation rule for an app. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @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. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the RecommendationRuleInner object */ public Observable<ServiceResponse<RecommendationRuleInner>> getRuleDetailsByWebAppWithServiceResponseAsync(String resourceGroupName, String siteName, String name, Boolean updateSeen) { 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.getRuleDetailsByWebApp(resourceGroupName, siteName, name, this.client.subscriptionId(), updateSeen, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RecommendationRuleInner>>>() { @Override public Observable<ServiceResponse<RecommendationRuleInner>> call(Response<ResponseBody> response) { try { ServiceResponse<RecommendationRuleInner> clientResponse = getRuleDetailsByWebAppDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<RecommendationRuleInner> getRuleDetailsByWebAppDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<RecommendationRuleInner, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<RecommendationRuleInner>() { }.getType()) .registerError(CloudException.class) .build(response); } }