/** * 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 com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsGet; import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsDelete; import com.microsoft.azure.management.resources.fluentcore.collection.InnerSupportsListing; 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; import com.microsoft.rest.ServiceFuture; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator; import java.io.IOException; import java.util.List; import okhttp3.ResponseBody; import retrofit2.http.Body; import retrofit2.http.GET; import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.HTTP; import retrofit2.http.PATCH; import retrofit2.http.Path; import retrofit2.http.POST; import retrofit2.http.PUT; 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 AppServicePlans. */ public class AppServicePlansInner implements InnerSupportsGet<AppServicePlanInner>, InnerSupportsDelete<Void>, InnerSupportsListing<AppServicePlanInner> { /** The Retrofit service to perform REST calls. */ private AppServicePlansService service; /** The service client containing this operation class. */ private WebSiteManagementClientImpl client; /** * Initializes an instance of AppServicePlansInner. * * @param retrofit the Retrofit instance built from a Retrofit Builder. * @param client the instance of the service client containing this operation class. */ public AppServicePlansInner(Retrofit retrofit, WebSiteManagementClientImpl client) { this.service = retrofit.create(AppServicePlansService.class); this.client = client; } /** * The interface defining all the services for AppServicePlans to be * used by Retrofit to perform actually REST calls. */ interface AppServicePlansService { @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.appservice.AppServicePlans list" }) @GET("subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms") Observable<Response<ResponseBody>> list(@Path("subscriptionId") String subscriptionId, @Query("detailed") Boolean detailed, @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.AppServicePlans listByResourceGroup" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms") Observable<Response<ResponseBody>> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @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.AppServicePlans getByResourceGroup" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}") Observable<Response<ResponseBody>> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @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.appservice.AppServicePlans createOrUpdate" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}") Observable<Response<ResponseBody>> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body AppServicePlanInner appServicePlan, @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.AppServicePlans beginCreateOrUpdate" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}") Observable<Response<ResponseBody>> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Body AppServicePlanInner appServicePlan, @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.AppServicePlans delete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}", method = "DELETE", hasBody = true) Observable<Response<ResponseBody>> delete(@Path("resourceGroupName") String resourceGroupName, @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.appservice.AppServicePlans listCapabilities" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities") Observable<Response<ResponseBody>> listCapabilities(@Path("resourceGroupName") String resourceGroupName, @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.appservice.AppServicePlans getHybridConnection" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}") Observable<Response<ResponseBody>> getHybridConnection(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.AppServicePlans deleteHybridConnection" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}", method = "DELETE", hasBody = true) Observable<Response<ResponseBody>> deleteHybridConnection(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.AppServicePlans listHybridConnectionKeys" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys") Observable<Response<ResponseBody>> listHybridConnectionKeys(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.AppServicePlans listWebAppsByHybridConnection" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites") Observable<Response<ResponseBody>> listWebAppsByHybridConnection(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("namespaceName") String namespaceName, @Path("relayName") String relayName, @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.AppServicePlans getHybridConnectionPlanLimit" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit") Observable<Response<ResponseBody>> getHybridConnectionPlanLimit(@Path("resourceGroupName") String resourceGroupName, @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.appservice.AppServicePlans listHybridConnections" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays") Observable<Response<ResponseBody>> listHybridConnections(@Path("resourceGroupName") String resourceGroupName, @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.appservice.AppServicePlans listMetricDefintions" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metricdefinitions") Observable<Response<ResponseBody>> listMetricDefintions(@Path("resourceGroupName") String resourceGroupName, @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.appservice.AppServicePlans listMetrics" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metrics") Observable<Response<ResponseBody>> listMetrics(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("details") Boolean details, @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.AppServicePlans restartWebApps" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites") Observable<Response<ResponseBody>> restartWebApps(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("softRestart") Boolean softRestart, @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.AppServicePlans listWebApps" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites") Observable<Response<ResponseBody>> listWebApps(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("subscriptionId") String subscriptionId, @Query("$skipToken") String skipToken, @Query(value = "$filter", encoded = true) String filter, @Query("$top") String top, @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.AppServicePlans listVnets" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections") Observable<Response<ResponseBody>> listVnets(@Path("resourceGroupName") String resourceGroupName, @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.appservice.AppServicePlans getVnetFromServerFarm" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}") Observable<Response<ResponseBody>> getVnetFromServerFarm(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("vnetName") String vnetName, @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.AppServicePlans getVnetGateway" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}") Observable<Response<ResponseBody>> getVnetGateway(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("vnetName") String vnetName, @Path("gatewayName") String gatewayName, @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.AppServicePlans updateVnetGateway" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}") Observable<Response<ResponseBody>> updateVnetGateway(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("vnetName") String vnetName, @Path("gatewayName") String gatewayName, @Path("subscriptionId") String subscriptionId, @Body VnetGatewayInner connectionEnvelope, @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.AppServicePlans listRoutesForVnet" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes") Observable<Response<ResponseBody>> listRoutesForVnet(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("vnetName") String vnetName, @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.AppServicePlans getRouteForVnet" }) @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}") Observable<Response<ResponseBody>> getRouteForVnet(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("vnetName") String vnetName, @Path("routeName") String routeName, @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.AppServicePlans createOrUpdateVnetRoute" }) @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}") Observable<Response<ResponseBody>> createOrUpdateVnetRoute(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("vnetName") String vnetName, @Path("routeName") String routeName, @Path("subscriptionId") String subscriptionId, @Body VnetRouteInner route, @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.AppServicePlans deleteVnetRoute" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}", method = "DELETE", hasBody = true) Observable<Response<ResponseBody>> deleteVnetRoute(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("vnetName") String vnetName, @Path("routeName") String routeName, @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.AppServicePlans updateVnetRoute" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}") Observable<Response<ResponseBody>> updateVnetRoute(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("vnetName") String vnetName, @Path("routeName") String routeName, @Path("subscriptionId") String subscriptionId, @Body VnetRouteInner route, @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.AppServicePlans rebootWorker" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot") Observable<Response<ResponseBody>> rebootWorker(@Path("resourceGroupName") String resourceGroupName, @Path("name") String name, @Path("workerName") String workerName, @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.AppServicePlans listNext" }) @GET Observable<Response<ResponseBody>> 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.appservice.AppServicePlans listByResourceGroupNext" }) @GET Observable<Response<ResponseBody>> listByResourceGroupNext(@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.appservice.AppServicePlans listWebAppsByHybridConnectionNext" }) @GET Observable<Response<ResponseBody>> listWebAppsByHybridConnectionNext(@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.appservice.AppServicePlans listHybridConnectionsNext" }) @GET Observable<Response<ResponseBody>> listHybridConnectionsNext(@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.appservice.AppServicePlans listMetricDefintionsNext" }) @GET Observable<Response<ResponseBody>> listMetricDefintionsNext(@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.appservice.AppServicePlans listMetricsNext" }) @GET Observable<Response<ResponseBody>> listMetricsNext(@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.appservice.AppServicePlans listWebAppsNext" }) @GET Observable<Response<ResponseBody>> listWebAppsNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * * @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<AppServicePlanInner> object if successful. */ public PagedList<AppServicePlanInner> list() { ServiceResponse<Page<AppServicePlanInner>> response = listSinglePageAsync().toBlocking().single(); return new PagedList<AppServicePlanInner>(response.body()) { @Override public Page<AppServicePlanInner> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * * @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<AppServicePlanInner>> listAsync(final ListOperationCallback<AppServicePlanInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listSinglePageAsync(), new Func1<String, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<AppServicePlanInner> object */ public Observable<Page<AppServicePlanInner>> listAsync() { return listWithServiceResponseAsync() .map(new Func1<ServiceResponse<Page<AppServicePlanInner>>, Page<AppServicePlanInner>>() { @Override public Page<AppServicePlanInner> call(ServiceResponse<Page<AppServicePlanInner>> response) { return response.body(); } }); } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<AppServicePlanInner> object */ public Observable<ServiceResponse<Page<AppServicePlanInner>>> listWithServiceResponseAsync() { return listSinglePageAsync() .concatMap(new Func1<ServiceResponse<Page<AppServicePlanInner>>, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(ServiceResponse<Page<AppServicePlanInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<AppServicePlanInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<AppServicePlanInner>>> listSinglePageAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2016-09-01"; final Boolean detailed = null; return service.list(this.client.subscriptionId(), detailed, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<AppServicePlanInner>> result = listDelegate(response); return Observable.just(new ServiceResponse<Page<AppServicePlanInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * * @param detailed Specify <code>true</code> to return all App Service plan properties. The default is <code>false</code>, which returns a subset of the properties. Retrieval of all properties may increase the API latency. * @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<AppServicePlanInner> object if successful. */ public PagedList<AppServicePlanInner> list(final Boolean detailed) { ServiceResponse<Page<AppServicePlanInner>> response = listSinglePageAsync(detailed).toBlocking().single(); return new PagedList<AppServicePlanInner>(response.body()) { @Override public Page<AppServicePlanInner> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * * @param detailed Specify <code>true</code> to return all App Service plan properties. The default is <code>false</code>, which returns a subset of the properties. Retrieval of all properties may increase the API latency. * @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<AppServicePlanInner>> listAsync(final Boolean detailed, final ListOperationCallback<AppServicePlanInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listSinglePageAsync(detailed), new Func1<String, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * * @param detailed Specify <code>true</code> to return all App Service plan properties. The default is <code>false</code>, which returns a subset of the properties. Retrieval of all properties may increase the API latency. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<AppServicePlanInner> object */ public Observable<Page<AppServicePlanInner>> listAsync(final Boolean detailed) { return listWithServiceResponseAsync(detailed) .map(new Func1<ServiceResponse<Page<AppServicePlanInner>>, Page<AppServicePlanInner>>() { @Override public Page<AppServicePlanInner> call(ServiceResponse<Page<AppServicePlanInner>> response) { return response.body(); } }); } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * * @param detailed Specify <code>true</code> to return all App Service plan properties. The default is <code>false</code>, which returns a subset of the properties. Retrieval of all properties may increase the API latency. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<AppServicePlanInner> object */ public Observable<ServiceResponse<Page<AppServicePlanInner>>> listWithServiceResponseAsync(final Boolean detailed) { return listSinglePageAsync(detailed) .concatMap(new Func1<ServiceResponse<Page<AppServicePlanInner>>, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(ServiceResponse<Page<AppServicePlanInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * ServiceResponse<PageImpl<AppServicePlanInner>> * @param detailed Specify <code>true</code> to return all App Service plan properties. The default is <code>false</code>, which returns a subset of the properties. Retrieval of all properties may increase the API latency. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<AppServicePlanInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<AppServicePlanInner>>> listSinglePageAsync(final Boolean detailed) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2016-09-01"; return service.list(this.client.subscriptionId(), detailed, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<AppServicePlanInner>> result = listDelegate(response); return Observable.just(new ServiceResponse<Page<AppServicePlanInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<AppServicePlanInner>> listDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<AppServicePlanInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<AppServicePlanInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get all App Service plans in a resource group. * Get all App Service plans in a resource group. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @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<AppServicePlanInner> object if successful. */ public PagedList<AppServicePlanInner> listByResourceGroup(final String resourceGroupName) { ServiceResponse<Page<AppServicePlanInner>> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); return new PagedList<AppServicePlanInner>(response.body()) { @Override public Page<AppServicePlanInner> nextPage(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get all App Service plans in a resource group. * Get all App Service plans in a resource group. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @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<AppServicePlanInner>> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback<AppServicePlanInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listByResourceGroupSinglePageAsync(resourceGroupName), new Func1<String, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get all App Service plans in a resource group. * Get all App Service plans in a resource group. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<AppServicePlanInner> object */ public Observable<Page<AppServicePlanInner>> listByResourceGroupAsync(final String resourceGroupName) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName) .map(new Func1<ServiceResponse<Page<AppServicePlanInner>>, Page<AppServicePlanInner>>() { @Override public Page<AppServicePlanInner> call(ServiceResponse<Page<AppServicePlanInner>> response) { return response.body(); } }); } /** * Get all App Service plans in a resource group. * Get all App Service plans in a resource group. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<AppServicePlanInner> object */ public Observable<ServiceResponse<Page<AppServicePlanInner>>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { return listByResourceGroupSinglePageAsync(resourceGroupName) .concatMap(new Func1<ServiceResponse<Page<AppServicePlanInner>>, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(ServiceResponse<Page<AppServicePlanInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get all App Service plans in a resource group. * Get all App Service plans in a resource group. * ServiceResponse<PageImpl<AppServicePlanInner>> * @param resourceGroupName Name of the resource group to which the resource belongs. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<AppServicePlanInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<AppServicePlanInner>>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName 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-09-01"; return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<AppServicePlanInner>> result = listByResourceGroupDelegate(response); return Observable.just(new ServiceResponse<Page<AppServicePlanInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<AppServicePlanInner>> listByResourceGroupDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<AppServicePlanInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<AppServicePlanInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get an App Service plan. * Get an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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 AppServicePlanInner object if successful. */ public AppServicePlanInner getByResourceGroup(String resourceGroupName, String name) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); } /** * Get an App Service plan. * Get an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<AppServicePlanInner> getByResourceGroupAsync(String resourceGroupName, String name, final ServiceCallback<AppServicePlanInner> serviceCallback) { return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, name), serviceCallback); } /** * Get an App Service plan. * Get an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the AppServicePlanInner object */ public Observable<AppServicePlanInner> getByResourceGroupAsync(String resourceGroupName, String name) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<AppServicePlanInner>, AppServicePlanInner>() { @Override public AppServicePlanInner call(ServiceResponse<AppServicePlanInner> response) { return response.body(); } }); } /** * Get an App Service plan. * Get an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the AppServicePlanInner object */ public Observable<ServiceResponse<AppServicePlanInner>> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String name) { 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."); } final String apiVersion = "2016-09-01"; return service.getByResourceGroup(resourceGroupName, name, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<AppServicePlanInner>>>() { @Override public Observable<ServiceResponse<AppServicePlanInner>> call(Response<ResponseBody> response) { try { ServiceResponse<AppServicePlanInner> clientResponse = getByResourceGroupDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<AppServicePlanInner> getByResourceGroupDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<AppServicePlanInner, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<AppServicePlanInner>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Creates or updates an App Service Plan. * Creates or updates an App Service Plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param appServicePlan Details of the App Service plan. * @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 AppServicePlanInner object if successful. */ public AppServicePlanInner createOrUpdate(String resourceGroupName, String name, AppServicePlanInner appServicePlan) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, appServicePlan).toBlocking().last().body(); } /** * Creates or updates an App Service Plan. * Creates or updates an App Service Plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param appServicePlan Details of the App Service plan. * @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<AppServicePlanInner> createOrUpdateAsync(String resourceGroupName, String name, AppServicePlanInner appServicePlan, final ServiceCallback<AppServicePlanInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, name, appServicePlan), serviceCallback); } /** * Creates or updates an App Service Plan. * Creates or updates an App Service Plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param appServicePlan Details of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ public Observable<AppServicePlanInner> createOrUpdateAsync(String resourceGroupName, String name, AppServicePlanInner appServicePlan) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, name, appServicePlan).map(new Func1<ServiceResponse<AppServicePlanInner>, AppServicePlanInner>() { @Override public AppServicePlanInner call(ServiceResponse<AppServicePlanInner> response) { return response.body(); } }); } /** * Creates or updates an App Service Plan. * Creates or updates an App Service Plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param appServicePlan Details of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ public Observable<ServiceResponse<AppServicePlanInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String name, AppServicePlanInner appServicePlan) { 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 (appServicePlan == null) { throw new IllegalArgumentException("Parameter appServicePlan is required and cannot be null."); } Validator.validate(appServicePlan); final String apiVersion = "2016-09-01"; Observable<Response<ResponseBody>> observable = service.createOrUpdate(resourceGroupName, name, this.client.subscriptionId(), appServicePlan, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<AppServicePlanInner>() { }.getType()); } /** * Creates or updates an App Service Plan. * Creates or updates an App Service Plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param appServicePlan Details of the App Service plan. * @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 AppServicePlanInner object if successful. */ public AppServicePlanInner beginCreateOrUpdate(String resourceGroupName, String name, AppServicePlanInner appServicePlan) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, appServicePlan).toBlocking().single().body(); } /** * Creates or updates an App Service Plan. * Creates or updates an App Service Plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param appServicePlan Details of the App Service plan. * @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<AppServicePlanInner> beginCreateOrUpdateAsync(String resourceGroupName, String name, AppServicePlanInner appServicePlan, final ServiceCallback<AppServicePlanInner> serviceCallback) { return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, appServicePlan), serviceCallback); } /** * Creates or updates an App Service Plan. * Creates or updates an App Service Plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param appServicePlan Details of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the AppServicePlanInner object */ public Observable<AppServicePlanInner> beginCreateOrUpdateAsync(String resourceGroupName, String name, AppServicePlanInner appServicePlan) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, name, appServicePlan).map(new Func1<ServiceResponse<AppServicePlanInner>, AppServicePlanInner>() { @Override public AppServicePlanInner call(ServiceResponse<AppServicePlanInner> response) { return response.body(); } }); } /** * Creates or updates an App Service Plan. * Creates or updates an App Service Plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param appServicePlan Details of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the AppServicePlanInner object */ public Observable<ServiceResponse<AppServicePlanInner>> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String name, AppServicePlanInner appServicePlan) { 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 (appServicePlan == null) { throw new IllegalArgumentException("Parameter appServicePlan is required and cannot be null."); } Validator.validate(appServicePlan); final String apiVersion = "2016-09-01"; return service.beginCreateOrUpdate(resourceGroupName, name, this.client.subscriptionId(), appServicePlan, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<AppServicePlanInner>>>() { @Override public Observable<ServiceResponse<AppServicePlanInner>> call(Response<ResponseBody> response) { try { ServiceResponse<AppServicePlanInner> clientResponse = beginCreateOrUpdateDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<AppServicePlanInner> beginCreateOrUpdateDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<AppServicePlanInner, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<AppServicePlanInner>() { }.getType()) .register(202, new TypeToken<AppServicePlanInner>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Delete an App Service plan. * Delete an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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) { deleteWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); } /** * Delete an App Service plan. * Delete an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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> deleteAsync(String resourceGroupName, String name, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, name), serviceCallback); } /** * Delete an App Service plan. * Delete an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> deleteAsync(String resourceGroupName, String name) { return deleteWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Delete an App Service plan. * Delete an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> deleteWithServiceResponseAsync(String resourceGroupName, String name) { 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."); } final String apiVersion = "2016-09-01"; return service.delete(resourceGroupName, name, 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 = deleteDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> deleteDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * List all capabilities of an App Service plan. * List all capabilities of an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<CapabilityInner> object if successful. */ public List<CapabilityInner> listCapabilities(String resourceGroupName, String name) { return listCapabilitiesWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); } /** * List all capabilities of an App Service plan. * List all capabilities of an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<CapabilityInner>> listCapabilitiesAsync(String resourceGroupName, String name, final ServiceCallback<List<CapabilityInner>> serviceCallback) { return ServiceFuture.fromResponse(listCapabilitiesWithServiceResponseAsync(resourceGroupName, name), serviceCallback); } /** * List all capabilities of an App Service plan. * List all capabilities of an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<CapabilityInner> object */ public Observable<List<CapabilityInner>> listCapabilitiesAsync(String resourceGroupName, String name) { return listCapabilitiesWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<List<CapabilityInner>>, List<CapabilityInner>>() { @Override public List<CapabilityInner> call(ServiceResponse<List<CapabilityInner>> response) { return response.body(); } }); } /** * List all capabilities of an App Service plan. * List all capabilities of an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<CapabilityInner> object */ public Observable<ServiceResponse<List<CapabilityInner>>> listCapabilitiesWithServiceResponseAsync(String resourceGroupName, String name) { 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."); } final String apiVersion = "2016-09-01"; return service.listCapabilities(resourceGroupName, name, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<CapabilityInner>>>>() { @Override public Observable<ServiceResponse<List<CapabilityInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<CapabilityInner>> clientResponse = listCapabilitiesDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<List<CapabilityInner>> listCapabilitiesDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<List<CapabilityInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<List<CapabilityInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Retrieve a Hybrid Connection in use in an App Service plan. * Retrieve a Hybrid Connection in use in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName Name of the Service Bus namespace. * @param relayName Name of the Service Bus relay. * @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 HybridConnectionInner object if successful. */ public HybridConnectionInner getHybridConnection(String resourceGroupName, String name, String namespaceName, String relayName) { return getHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName).toBlocking().single().body(); } /** * Retrieve a Hybrid Connection in use in an App Service plan. * Retrieve a Hybrid Connection in use in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName Name of the Service Bus namespace. * @param relayName Name of the Service Bus relay. * @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<HybridConnectionInner> getHybridConnectionAsync(String resourceGroupName, String name, String namespaceName, String relayName, final ServiceCallback<HybridConnectionInner> serviceCallback) { return ServiceFuture.fromResponse(getHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName), serviceCallback); } /** * Retrieve a Hybrid Connection in use in an App Service plan. * Retrieve a Hybrid Connection in use in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName Name of the Service Bus namespace. * @param relayName Name of the Service Bus relay. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the HybridConnectionInner object */ public Observable<HybridConnectionInner> getHybridConnectionAsync(String resourceGroupName, String name, String namespaceName, String relayName) { return getHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName).map(new Func1<ServiceResponse<HybridConnectionInner>, HybridConnectionInner>() { @Override public HybridConnectionInner call(ServiceResponse<HybridConnectionInner> response) { return response.body(); } }); } /** * Retrieve a Hybrid Connection in use in an App Service plan. * Retrieve a Hybrid Connection in use in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName Name of the Service Bus namespace. * @param relayName Name of the Service Bus relay. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the HybridConnectionInner object */ public Observable<ServiceResponse<HybridConnectionInner>> getHybridConnectionWithServiceResponseAsync(String resourceGroupName, String name, String namespaceName, String relayName) { 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 (namespaceName == null) { throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); } if (relayName == null) { throw new IllegalArgumentException("Parameter relayName 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-09-01"; return service.getHybridConnection(resourceGroupName, name, namespaceName, relayName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<HybridConnectionInner>>>() { @Override public Observable<ServiceResponse<HybridConnectionInner>> call(Response<ResponseBody> response) { try { ServiceResponse<HybridConnectionInner> clientResponse = getHybridConnectionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<HybridConnectionInner> getHybridConnectionDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<HybridConnectionInner, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<HybridConnectionInner>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Delete a Hybrid Connection in use in an App Service plan. * Delete a Hybrid Connection in use in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName Name of the Service Bus namespace. * @param relayName Name of the Service Bus relay. * @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 deleteHybridConnection(String resourceGroupName, String name, String namespaceName, String relayName) { deleteHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName).toBlocking().single().body(); } /** * Delete a Hybrid Connection in use in an App Service plan. * Delete a Hybrid Connection in use in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName Name of the Service Bus namespace. * @param relayName Name of the Service Bus relay. * @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> deleteHybridConnectionAsync(String resourceGroupName, String name, String namespaceName, String relayName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName), serviceCallback); } /** * Delete a Hybrid Connection in use in an App Service plan. * Delete a Hybrid Connection in use in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName Name of the Service Bus namespace. * @param relayName Name of the Service Bus relay. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> deleteHybridConnectionAsync(String resourceGroupName, String name, String namespaceName, String relayName) { return deleteHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Delete a Hybrid Connection in use in an App Service plan. * Delete a Hybrid Connection in use in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName Name of the Service Bus namespace. * @param relayName Name of the Service Bus relay. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> deleteHybridConnectionWithServiceResponseAsync(String resourceGroupName, String name, String namespaceName, String relayName) { 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 (namespaceName == null) { throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); } if (relayName == null) { throw new IllegalArgumentException("Parameter relayName 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-09-01"; return service.deleteHybridConnection(resourceGroupName, name, namespaceName, relayName, 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 = deleteHybridConnectionDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> deleteHybridConnectionDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .register(204, new TypeToken<Void>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get the send key name and value of a Hybrid Connection. * Get the send key name and value of a Hybrid Connection. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName The name of the Service Bus namespace. * @param relayName The name of the Service Bus relay. * @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 HybridConnectionKeyInner object if successful. */ public HybridConnectionKeyInner listHybridConnectionKeys(String resourceGroupName, String name, String namespaceName, String relayName) { return listHybridConnectionKeysWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName).toBlocking().single().body(); } /** * Get the send key name and value of a Hybrid Connection. * Get the send key name and value of a Hybrid Connection. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName The name of the Service Bus namespace. * @param relayName The name of the Service Bus relay. * @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<HybridConnectionKeyInner> listHybridConnectionKeysAsync(String resourceGroupName, String name, String namespaceName, String relayName, final ServiceCallback<HybridConnectionKeyInner> serviceCallback) { return ServiceFuture.fromResponse(listHybridConnectionKeysWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName), serviceCallback); } /** * Get the send key name and value of a Hybrid Connection. * Get the send key name and value of a Hybrid Connection. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName The name of the Service Bus namespace. * @param relayName The name of the Service Bus relay. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the HybridConnectionKeyInner object */ public Observable<HybridConnectionKeyInner> listHybridConnectionKeysAsync(String resourceGroupName, String name, String namespaceName, String relayName) { return listHybridConnectionKeysWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName).map(new Func1<ServiceResponse<HybridConnectionKeyInner>, HybridConnectionKeyInner>() { @Override public HybridConnectionKeyInner call(ServiceResponse<HybridConnectionKeyInner> response) { return response.body(); } }); } /** * Get the send key name and value of a Hybrid Connection. * Get the send key name and value of a Hybrid Connection. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName The name of the Service Bus namespace. * @param relayName The name of the Service Bus relay. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the HybridConnectionKeyInner object */ public Observable<ServiceResponse<HybridConnectionKeyInner>> listHybridConnectionKeysWithServiceResponseAsync(String resourceGroupName, String name, String namespaceName, String relayName) { 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 (namespaceName == null) { throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); } if (relayName == null) { throw new IllegalArgumentException("Parameter relayName 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-09-01"; return service.listHybridConnectionKeys(resourceGroupName, name, namespaceName, relayName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<HybridConnectionKeyInner>>>() { @Override public Observable<ServiceResponse<HybridConnectionKeyInner>> call(Response<ResponseBody> response) { try { ServiceResponse<HybridConnectionKeyInner> clientResponse = listHybridConnectionKeysDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<HybridConnectionKeyInner> listHybridConnectionKeysDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<HybridConnectionKeyInner, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<HybridConnectionKeyInner>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get all apps that use a Hybrid Connection in an App Service Plan. * Get all apps that use a Hybrid Connection in an App Service Plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName Name of the Hybrid Connection namespace. * @param relayName Name of the Hybrid Connection relay. * @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<String> object if successful. */ public PagedList<String> listWebAppsByHybridConnection(final String resourceGroupName, final String name, final String namespaceName, final String relayName) { ServiceResponse<Page<String>> response = listWebAppsByHybridConnectionSinglePageAsync(resourceGroupName, name, namespaceName, relayName).toBlocking().single(); return new PagedList<String>(response.body()) { @Override public Page<String> nextPage(String nextPageLink) { return listWebAppsByHybridConnectionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get all apps that use a Hybrid Connection in an App Service Plan. * Get all apps that use a Hybrid Connection in an App Service Plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName Name of the Hybrid Connection namespace. * @param relayName Name of the Hybrid Connection relay. * @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<String>> listWebAppsByHybridConnectionAsync(final String resourceGroupName, final String name, final String namespaceName, final String relayName, final ListOperationCallback<String> serviceCallback) { return AzureServiceFuture.fromPageResponse( listWebAppsByHybridConnectionSinglePageAsync(resourceGroupName, name, namespaceName, relayName), new Func1<String, Observable<ServiceResponse<Page<String>>>>() { @Override public Observable<ServiceResponse<Page<String>>> call(String nextPageLink) { return listWebAppsByHybridConnectionNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get all apps that use a Hybrid Connection in an App Service Plan. * Get all apps that use a Hybrid Connection in an App Service Plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName Name of the Hybrid Connection namespace. * @param relayName Name of the Hybrid Connection relay. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<String> object */ public Observable<Page<String>> listWebAppsByHybridConnectionAsync(final String resourceGroupName, final String name, final String namespaceName, final String relayName) { return listWebAppsByHybridConnectionWithServiceResponseAsync(resourceGroupName, name, namespaceName, relayName) .map(new Func1<ServiceResponse<Page<String>>, Page<String>>() { @Override public Page<String> call(ServiceResponse<Page<String>> response) { return response.body(); } }); } /** * Get all apps that use a Hybrid Connection in an App Service Plan. * Get all apps that use a Hybrid Connection in an App Service Plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param namespaceName Name of the Hybrid Connection namespace. * @param relayName Name of the Hybrid Connection relay. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<String> object */ public Observable<ServiceResponse<Page<String>>> listWebAppsByHybridConnectionWithServiceResponseAsync(final String resourceGroupName, final String name, final String namespaceName, final String relayName) { return listWebAppsByHybridConnectionSinglePageAsync(resourceGroupName, name, namespaceName, relayName) .concatMap(new Func1<ServiceResponse<Page<String>>, Observable<ServiceResponse<Page<String>>>>() { @Override public Observable<ServiceResponse<Page<String>>> call(ServiceResponse<Page<String>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listWebAppsByHybridConnectionNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get all apps that use a Hybrid Connection in an App Service Plan. * Get all apps that use a Hybrid Connection in an App Service Plan. * ServiceResponse<PageImpl<String>> * @param resourceGroupName Name of the resource group to which the resource belongs. ServiceResponse<PageImpl<String>> * @param name Name of the App Service plan. ServiceResponse<PageImpl<String>> * @param namespaceName Name of the Hybrid Connection namespace. ServiceResponse<PageImpl<String>> * @param relayName Name of the Hybrid Connection relay. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<String> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<String>>> listWebAppsByHybridConnectionSinglePageAsync(final String resourceGroupName, final String name, final String namespaceName, final String relayName) { 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 (namespaceName == null) { throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null."); } if (relayName == null) { throw new IllegalArgumentException("Parameter relayName 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-09-01"; return service.listWebAppsByHybridConnection(resourceGroupName, name, namespaceName, relayName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<String>>>>() { @Override public Observable<ServiceResponse<Page<String>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<String>> result = listWebAppsByHybridConnectionDelegate(response); return Observable.just(new ServiceResponse<Page<String>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<String>> listWebAppsByHybridConnectionDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<String>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<String>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get the maximum number of Hybrid Connections allowed in an App Service plan. * Get the maximum number of Hybrid Connections allowed in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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 HybridConnectionLimitsInner object if successful. */ public HybridConnectionLimitsInner getHybridConnectionPlanLimit(String resourceGroupName, String name) { return getHybridConnectionPlanLimitWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); } /** * Get the maximum number of Hybrid Connections allowed in an App Service plan. * Get the maximum number of Hybrid Connections allowed in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<HybridConnectionLimitsInner> getHybridConnectionPlanLimitAsync(String resourceGroupName, String name, final ServiceCallback<HybridConnectionLimitsInner> serviceCallback) { return ServiceFuture.fromResponse(getHybridConnectionPlanLimitWithServiceResponseAsync(resourceGroupName, name), serviceCallback); } /** * Get the maximum number of Hybrid Connections allowed in an App Service plan. * Get the maximum number of Hybrid Connections allowed in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the HybridConnectionLimitsInner object */ public Observable<HybridConnectionLimitsInner> getHybridConnectionPlanLimitAsync(String resourceGroupName, String name) { return getHybridConnectionPlanLimitWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<HybridConnectionLimitsInner>, HybridConnectionLimitsInner>() { @Override public HybridConnectionLimitsInner call(ServiceResponse<HybridConnectionLimitsInner> response) { return response.body(); } }); } /** * Get the maximum number of Hybrid Connections allowed in an App Service plan. * Get the maximum number of Hybrid Connections allowed in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the HybridConnectionLimitsInner object */ public Observable<ServiceResponse<HybridConnectionLimitsInner>> getHybridConnectionPlanLimitWithServiceResponseAsync(String resourceGroupName, String name) { 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."); } final String apiVersion = "2016-09-01"; return service.getHybridConnectionPlanLimit(resourceGroupName, name, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<HybridConnectionLimitsInner>>>() { @Override public Observable<ServiceResponse<HybridConnectionLimitsInner>> call(Response<ResponseBody> response) { try { ServiceResponse<HybridConnectionLimitsInner> clientResponse = getHybridConnectionPlanLimitDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<HybridConnectionLimitsInner> getHybridConnectionPlanLimitDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<HybridConnectionLimitsInner, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<HybridConnectionLimitsInner>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Retrieve all Hybrid Connections in use in an App Service plan. * Retrieve all Hybrid Connections in use in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<HybridConnectionInner> object if successful. */ public PagedList<HybridConnectionInner> listHybridConnections(final String resourceGroupName, final String name) { ServiceResponse<Page<HybridConnectionInner>> response = listHybridConnectionsSinglePageAsync(resourceGroupName, name).toBlocking().single(); return new PagedList<HybridConnectionInner>(response.body()) { @Override public Page<HybridConnectionInner> nextPage(String nextPageLink) { return listHybridConnectionsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Retrieve all Hybrid Connections in use in an App Service plan. * Retrieve all Hybrid Connections in use in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<HybridConnectionInner>> listHybridConnectionsAsync(final String resourceGroupName, final String name, final ListOperationCallback<HybridConnectionInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listHybridConnectionsSinglePageAsync(resourceGroupName, name), new Func1<String, Observable<ServiceResponse<Page<HybridConnectionInner>>>>() { @Override public Observable<ServiceResponse<Page<HybridConnectionInner>>> call(String nextPageLink) { return listHybridConnectionsNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Retrieve all Hybrid Connections in use in an App Service plan. * Retrieve all Hybrid Connections in use in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<HybridConnectionInner> object */ public Observable<Page<HybridConnectionInner>> listHybridConnectionsAsync(final String resourceGroupName, final String name) { return listHybridConnectionsWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<HybridConnectionInner>>, Page<HybridConnectionInner>>() { @Override public Page<HybridConnectionInner> call(ServiceResponse<Page<HybridConnectionInner>> response) { return response.body(); } }); } /** * Retrieve all Hybrid Connections in use in an App Service plan. * Retrieve all Hybrid Connections in use in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<HybridConnectionInner> object */ public Observable<ServiceResponse<Page<HybridConnectionInner>>> listHybridConnectionsWithServiceResponseAsync(final String resourceGroupName, final String name) { return listHybridConnectionsSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<HybridConnectionInner>>, Observable<ServiceResponse<Page<HybridConnectionInner>>>>() { @Override public Observable<ServiceResponse<Page<HybridConnectionInner>>> call(ServiceResponse<Page<HybridConnectionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listHybridConnectionsNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Retrieve all Hybrid Connections in use in an App Service plan. * Retrieve all Hybrid Connections in use in an App Service plan. * ServiceResponse<PageImpl<HybridConnectionInner>> * @param resourceGroupName Name of the resource group to which the resource belongs. ServiceResponse<PageImpl<HybridConnectionInner>> * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<HybridConnectionInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<HybridConnectionInner>>> listHybridConnectionsSinglePageAsync(final String resourceGroupName, final String name) { 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."); } final String apiVersion = "2016-09-01"; return service.listHybridConnections(resourceGroupName, name, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<HybridConnectionInner>>>>() { @Override public Observable<ServiceResponse<Page<HybridConnectionInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<HybridConnectionInner>> result = listHybridConnectionsDelegate(response); return Observable.just(new ServiceResponse<Page<HybridConnectionInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<HybridConnectionInner>> listHybridConnectionsDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<HybridConnectionInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<HybridConnectionInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get metrics that can be queried for an App Service plan, and their definitions. * Get metrics that can be queried for an App Service plan, and their definitions. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<ResourceMetricDefinitionInner> object if successful. */ public PagedList<ResourceMetricDefinitionInner> listMetricDefintions(final String resourceGroupName, final String name) { ServiceResponse<Page<ResourceMetricDefinitionInner>> response = listMetricDefintionsSinglePageAsync(resourceGroupName, name).toBlocking().single(); return new PagedList<ResourceMetricDefinitionInner>(response.body()) { @Override public Page<ResourceMetricDefinitionInner> nextPage(String nextPageLink) { return listMetricDefintionsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get metrics that can be queried for an App Service plan, and their definitions. * Get metrics that can be queried for an App Service plan, and their definitions. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<ResourceMetricDefinitionInner>> listMetricDefintionsAsync(final String resourceGroupName, final String name, final ListOperationCallback<ResourceMetricDefinitionInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listMetricDefintionsSinglePageAsync(resourceGroupName, name), new Func1<String, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(String nextPageLink) { return listMetricDefintionsNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get metrics that can be queried for an App Service plan, and their definitions. * Get metrics that can be queried for an App Service plan, and their definitions. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ResourceMetricDefinitionInner> object */ public Observable<Page<ResourceMetricDefinitionInner>> listMetricDefintionsAsync(final String resourceGroupName, final String name) { return listMetricDefintionsWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Page<ResourceMetricDefinitionInner>>() { @Override public Page<ResourceMetricDefinitionInner> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> response) { return response.body(); } }); } /** * Get metrics that can be queried for an App Service plan, and their definitions. * Get metrics that can be queried for an App Service plan, and their definitions. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ResourceMetricDefinitionInner> object */ public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listMetricDefintionsWithServiceResponseAsync(final String resourceGroupName, final String name) { return listMetricDefintionsSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMetricDefintionsNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get metrics that can be queried for an App Service plan, and their definitions. * Get metrics that can be queried for an App Service plan, and their definitions. * ServiceResponse<PageImpl<ResourceMetricDefinitionInner>> * @param resourceGroupName Name of the resource group to which the resource belongs. ServiceResponse<PageImpl<ResourceMetricDefinitionInner>> * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ResourceMetricDefinitionInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listMetricDefintionsSinglePageAsync(final String resourceGroupName, final String name) { 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."); } final String apiVersion = "2016-09-01"; return service.listMetricDefintions(resourceGroupName, name, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<ResourceMetricDefinitionInner>> result = listMetricDefintionsDelegate(response); return Observable.just(new ServiceResponse<Page<ResourceMetricDefinitionInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<ResourceMetricDefinitionInner>> listMetricDefintionsDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<ResourceMetricDefinitionInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<ResourceMetricDefinitionInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<ResourceMetricInner> object if successful. */ public PagedList<ResourceMetricInner> listMetrics(final String resourceGroupName, final String name) { ServiceResponse<Page<ResourceMetricInner>> response = listMetricsSinglePageAsync(resourceGroupName, name).toBlocking().single(); return new PagedList<ResourceMetricInner>(response.body()) { @Override public Page<ResourceMetricInner> nextPage(String nextPageLink) { return listMetricsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<ResourceMetricInner>> listMetricsAsync(final String resourceGroupName, final String name, final ListOperationCallback<ResourceMetricInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listMetricsSinglePageAsync(resourceGroupName, name), new Func1<String, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(String nextPageLink) { return listMetricsNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ResourceMetricInner> object */ public Observable<Page<ResourceMetricInner>> listMetricsAsync(final String resourceGroupName, final String name) { return listMetricsWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Page<ResourceMetricInner>>() { @Override public Page<ResourceMetricInner> call(ServiceResponse<Page<ResourceMetricInner>> response) { return response.body(); } }); } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ResourceMetricInner> object */ public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMetricsWithServiceResponseAsync(final String resourceGroupName, final String name) { return listMetricsSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMetricsNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ResourceMetricInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMetricsSinglePageAsync(final String resourceGroupName, final String name) { 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."); } final String apiVersion = "2016-09-01"; final Boolean details = null; final String filter = null; return service.listMetrics(resourceGroupName, name, this.client.subscriptionId(), details, filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<ResourceMetricInner>> result = listMetricsDelegate(response); return Observable.just(new ServiceResponse<Page<ResourceMetricInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param details Specify <code>true</code> to include instance details. The default is <code>false</code>. * @param filter Return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. * @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<ResourceMetricInner> object if successful. */ public PagedList<ResourceMetricInner> listMetrics(final String resourceGroupName, final String name, final Boolean details, final String filter) { ServiceResponse<Page<ResourceMetricInner>> response = listMetricsSinglePageAsync(resourceGroupName, name, details, filter).toBlocking().single(); return new PagedList<ResourceMetricInner>(response.body()) { @Override public Page<ResourceMetricInner> nextPage(String nextPageLink) { return listMetricsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param details Specify <code>true</code> to include instance details. The default is <code>false</code>. * @param filter Return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. * @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<ResourceMetricInner>> listMetricsAsync(final String resourceGroupName, final String name, final Boolean details, final String filter, final ListOperationCallback<ResourceMetricInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listMetricsSinglePageAsync(resourceGroupName, name, details, filter), new Func1<String, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(String nextPageLink) { return listMetricsNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param details Specify <code>true</code> to include instance details. The default is <code>false</code>. * @param filter Return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ResourceMetricInner> object */ public Observable<Page<ResourceMetricInner>> listMetricsAsync(final String resourceGroupName, final String name, final Boolean details, final String filter) { return listMetricsWithServiceResponseAsync(resourceGroupName, name, details, filter) .map(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Page<ResourceMetricInner>>() { @Override public Page<ResourceMetricInner> call(ServiceResponse<Page<ResourceMetricInner>> response) { return response.body(); } }); } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param details Specify <code>true</code> to include instance details. The default is <code>false</code>. * @param filter Return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<ResourceMetricInner> object */ public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMetricsWithServiceResponseAsync(final String resourceGroupName, final String name, final Boolean details, final String filter) { return listMetricsSinglePageAsync(resourceGroupName, name, details, filter) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMetricsNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * ServiceResponse<PageImpl<ResourceMetricInner>> * @param resourceGroupName Name of the resource group to which the resource belongs. ServiceResponse<PageImpl<ResourceMetricInner>> * @param name Name of the App Service plan. ServiceResponse<PageImpl<ResourceMetricInner>> * @param details Specify <code>true</code> to include instance details. The default is <code>false</code>. ServiceResponse<PageImpl<ResourceMetricInner>> * @param filter Return only usages/metrics specified in the filter. Filter conforms to odata syntax. Example: $filter=(name.value eq 'Metric1' or name.value eq 'Metric2') and startTime eq '2014-01-01T00:00:00Z' and endTime eq '2014-12-31T23:59:59Z' and timeGrain eq duration'[Hour|Minute|Day]'. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ResourceMetricInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMetricsSinglePageAsync(final String resourceGroupName, final String name, final Boolean details, final String filter) { 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."); } final String apiVersion = "2016-09-01"; return service.listMetrics(resourceGroupName, name, this.client.subscriptionId(), details, filter, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<ResourceMetricInner>> result = listMetricsDelegate(response); return Observable.just(new ServiceResponse<Page<ResourceMetricInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<ResourceMetricInner>> listMetricsDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<ResourceMetricInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<ResourceMetricInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Restart all apps in an App Service plan. * Restart all apps in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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 restartWebApps(String resourceGroupName, String name) { restartWebAppsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); } /** * Restart all apps in an App Service plan. * Restart all apps in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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> restartWebAppsAsync(String resourceGroupName, String name, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(restartWebAppsWithServiceResponseAsync(resourceGroupName, name), serviceCallback); } /** * Restart all apps in an App Service plan. * Restart all apps in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> restartWebAppsAsync(String resourceGroupName, String name) { return restartWebAppsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Restart all apps in an App Service plan. * Restart all apps in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> restartWebAppsWithServiceResponseAsync(String resourceGroupName, String name) { 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."); } final String apiVersion = "2016-09-01"; final Boolean softRestart = null; return service.restartWebApps(resourceGroupName, name, this.client.subscriptionId(), softRestart, 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 = restartWebAppsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Restart all apps in an App Service plan. * Restart all apps in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param softRestart Specify <code>true</code> to performa a soft restart, applies the configuration settings and restarts the apps if necessary. The default is <code>false</code>, which always restarts and reprovisions the apps * @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 restartWebApps(String resourceGroupName, String name, Boolean softRestart) { restartWebAppsWithServiceResponseAsync(resourceGroupName, name, softRestart).toBlocking().single().body(); } /** * Restart all apps in an App Service plan. * Restart all apps in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param softRestart Specify <code>true</code> to performa a soft restart, applies the configuration settings and restarts the apps if necessary. The default is <code>false</code>, which always restarts and reprovisions the apps * @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> restartWebAppsAsync(String resourceGroupName, String name, Boolean softRestart, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(restartWebAppsWithServiceResponseAsync(resourceGroupName, name, softRestart), serviceCallback); } /** * Restart all apps in an App Service plan. * Restart all apps in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param softRestart Specify <code>true</code> to performa a soft restart, applies the configuration settings and restarts the apps if necessary. The default is <code>false</code>, which always restarts and reprovisions the apps * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> restartWebAppsAsync(String resourceGroupName, String name, Boolean softRestart) { return restartWebAppsWithServiceResponseAsync(resourceGroupName, name, softRestart).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Restart all apps in an App Service plan. * Restart all apps in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param softRestart Specify <code>true</code> to performa a soft restart, applies the configuration settings and restarts the apps if necessary. The default is <code>false</code>, which always restarts and reprovisions the apps * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> restartWebAppsWithServiceResponseAsync(String resourceGroupName, String name, Boolean softRestart) { 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."); } final String apiVersion = "2016-09-01"; return service.restartWebApps(resourceGroupName, name, this.client.subscriptionId(), softRestart, 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 = restartWebAppsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> restartWebAppsDelegate(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 all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<SiteInner> object if successful. */ public PagedList<SiteInner> listWebApps(final String resourceGroupName, final String name) { ServiceResponse<Page<SiteInner>> response = listWebAppsSinglePageAsync(resourceGroupName, name).toBlocking().single(); return new PagedList<SiteInner>(response.body()) { @Override public Page<SiteInner> nextPage(String nextPageLink) { return listWebAppsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<SiteInner>> listWebAppsAsync(final String resourceGroupName, final String name, final ListOperationCallback<SiteInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listWebAppsSinglePageAsync(resourceGroupName, name), new Func1<String, Observable<ServiceResponse<Page<SiteInner>>>>() { @Override public Observable<ServiceResponse<Page<SiteInner>>> call(String nextPageLink) { return listWebAppsNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<SiteInner> object */ public Observable<Page<SiteInner>> listWebAppsAsync(final String resourceGroupName, final String name) { return listWebAppsWithServiceResponseAsync(resourceGroupName, name) .map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() { @Override public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) { return response.body(); } }); } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<SiteInner> object */ public Observable<ServiceResponse<Page<SiteInner>>> listWebAppsWithServiceResponseAsync(final String resourceGroupName, final String name) { return listWebAppsSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() { @Override public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listWebAppsNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<SiteInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<SiteInner>>> listWebAppsSinglePageAsync(final String resourceGroupName, final String name) { 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."); } final String apiVersion = "2016-09-01"; final String skipToken = null; final String filter = null; final String top = null; return service.listWebApps(resourceGroupName, name, this.client.subscriptionId(), skipToken, filter, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<SiteInner>>>>() { @Override public Observable<ServiceResponse<Page<SiteInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<SiteInner>> result = listWebAppsDelegate(response); return Observable.just(new ServiceResponse<Page<SiteInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param skipToken Skip to a web app in the list of webapps associated with app service plan. If specified, the resulting list will contain web apps starting from (including) the skipToken. Otherwise, the resulting list contains web apps from the start of the list * @param filter Supported filter: $filter=state eq running. Returns only web apps that are currently running * @param top List page size. If specified, results are paged. * @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<SiteInner> object if successful. */ public PagedList<SiteInner> listWebApps(final String resourceGroupName, final String name, final String skipToken, final String filter, final String top) { ServiceResponse<Page<SiteInner>> response = listWebAppsSinglePageAsync(resourceGroupName, name, skipToken, filter, top).toBlocking().single(); return new PagedList<SiteInner>(response.body()) { @Override public Page<SiteInner> nextPage(String nextPageLink) { return listWebAppsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param skipToken Skip to a web app in the list of webapps associated with app service plan. If specified, the resulting list will contain web apps starting from (including) the skipToken. Otherwise, the resulting list contains web apps from the start of the list * @param filter Supported filter: $filter=state eq running. Returns only web apps that are currently running * @param top List page size. If specified, results are paged. * @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<SiteInner>> listWebAppsAsync(final String resourceGroupName, final String name, final String skipToken, final String filter, final String top, final ListOperationCallback<SiteInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listWebAppsSinglePageAsync(resourceGroupName, name, skipToken, filter, top), new Func1<String, Observable<ServiceResponse<Page<SiteInner>>>>() { @Override public Observable<ServiceResponse<Page<SiteInner>>> call(String nextPageLink) { return listWebAppsNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param skipToken Skip to a web app in the list of webapps associated with app service plan. If specified, the resulting list will contain web apps starting from (including) the skipToken. Otherwise, the resulting list contains web apps from the start of the list * @param filter Supported filter: $filter=state eq running. Returns only web apps that are currently running * @param top List page size. If specified, results are paged. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<SiteInner> object */ public Observable<Page<SiteInner>> listWebAppsAsync(final String resourceGroupName, final String name, final String skipToken, final String filter, final String top) { return listWebAppsWithServiceResponseAsync(resourceGroupName, name, skipToken, filter, top) .map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() { @Override public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) { return response.body(); } }); } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param skipToken Skip to a web app in the list of webapps associated with app service plan. If specified, the resulting list will contain web apps starting from (including) the skipToken. Otherwise, the resulting list contains web apps from the start of the list * @param filter Supported filter: $filter=state eq running. Returns only web apps that are currently running * @param top List page size. If specified, results are paged. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the PagedList<SiteInner> object */ public Observable<ServiceResponse<Page<SiteInner>>> listWebAppsWithServiceResponseAsync(final String resourceGroupName, final String name, final String skipToken, final String filter, final String top) { return listWebAppsSinglePageAsync(resourceGroupName, name, skipToken, filter, top) .concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() { @Override public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listWebAppsNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * ServiceResponse<PageImpl<SiteInner>> * @param resourceGroupName Name of the resource group to which the resource belongs. ServiceResponse<PageImpl<SiteInner>> * @param name Name of the App Service plan. ServiceResponse<PageImpl<SiteInner>> * @param skipToken Skip to a web app in the list of webapps associated with app service plan. If specified, the resulting list will contain web apps starting from (including) the skipToken. Otherwise, the resulting list contains web apps from the start of the list ServiceResponse<PageImpl<SiteInner>> * @param filter Supported filter: $filter=state eq running. Returns only web apps that are currently running ServiceResponse<PageImpl<SiteInner>> * @param top List page size. If specified, results are paged. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<SiteInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<SiteInner>>> listWebAppsSinglePageAsync(final String resourceGroupName, final String name, final String skipToken, final String filter, final String top) { 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."); } final String apiVersion = "2016-09-01"; return service.listWebApps(resourceGroupName, name, this.client.subscriptionId(), skipToken, filter, top, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<SiteInner>>>>() { @Override public Observable<ServiceResponse<Page<SiteInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<SiteInner>> result = listWebAppsDelegate(response); return Observable.just(new ServiceResponse<Page<SiteInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<SiteInner>> listWebAppsDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<SiteInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<SiteInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get all Virtual Networks associated with an App Service plan. * Get all Virtual Networks associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<VnetInfoInner> object if successful. */ public List<VnetInfoInner> listVnets(String resourceGroupName, String name) { return listVnetsWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body(); } /** * Get all Virtual Networks associated with an App Service plan. * Get all Virtual Networks associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @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<VnetInfoInner>> listVnetsAsync(String resourceGroupName, String name, final ServiceCallback<List<VnetInfoInner>> serviceCallback) { return ServiceFuture.fromResponse(listVnetsWithServiceResponseAsync(resourceGroupName, name), serviceCallback); } /** * Get all Virtual Networks associated with an App Service plan. * Get all Virtual Networks associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<VnetInfoInner> object */ public Observable<List<VnetInfoInner>> listVnetsAsync(String resourceGroupName, String name) { return listVnetsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<List<VnetInfoInner>>, List<VnetInfoInner>>() { @Override public List<VnetInfoInner> call(ServiceResponse<List<VnetInfoInner>> response) { return response.body(); } }); } /** * Get all Virtual Networks associated with an App Service plan. * Get all Virtual Networks associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<VnetInfoInner> object */ public Observable<ServiceResponse<List<VnetInfoInner>>> listVnetsWithServiceResponseAsync(String resourceGroupName, String name) { 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."); } final String apiVersion = "2016-09-01"; return service.listVnets(resourceGroupName, name, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<VnetInfoInner>>>>() { @Override public Observable<ServiceResponse<List<VnetInfoInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<VnetInfoInner>> clientResponse = listVnetsDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<List<VnetInfoInner>> listVnetsDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<List<VnetInfoInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<List<VnetInfoInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get a Virtual Network associated with an App Service plan. * Get a Virtual Network associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @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 VnetInfoInner object if successful. */ public VnetInfoInner getVnetFromServerFarm(String resourceGroupName, String name, String vnetName) { return getVnetFromServerFarmWithServiceResponseAsync(resourceGroupName, name, vnetName).toBlocking().single().body(); } /** * Get a Virtual Network associated with an App Service plan. * Get a Virtual Network associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @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<VnetInfoInner> getVnetFromServerFarmAsync(String resourceGroupName, String name, String vnetName, final ServiceCallback<VnetInfoInner> serviceCallback) { return ServiceFuture.fromResponse(getVnetFromServerFarmWithServiceResponseAsync(resourceGroupName, name, vnetName), serviceCallback); } /** * Get a Virtual Network associated with an App Service plan. * Get a Virtual Network associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VnetInfoInner object */ public Observable<VnetInfoInner> getVnetFromServerFarmAsync(String resourceGroupName, String name, String vnetName) { return getVnetFromServerFarmWithServiceResponseAsync(resourceGroupName, name, vnetName).map(new Func1<ServiceResponse<VnetInfoInner>, VnetInfoInner>() { @Override public VnetInfoInner call(ServiceResponse<VnetInfoInner> response) { return response.body(); } }); } /** * Get a Virtual Network associated with an App Service plan. * Get a Virtual Network associated with an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VnetInfoInner object */ public Observable<ServiceResponse<VnetInfoInner>> getVnetFromServerFarmWithServiceResponseAsync(String resourceGroupName, String name, String vnetName) { 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 (vnetName == null) { throw new IllegalArgumentException("Parameter vnetName 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-09-01"; return service.getVnetFromServerFarm(resourceGroupName, name, vnetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<VnetInfoInner>>>() { @Override public Observable<ServiceResponse<VnetInfoInner>> call(Response<ResponseBody> response) { try { ServiceResponse<VnetInfoInner> clientResponse = getVnetFromServerFarmDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<VnetInfoInner> getVnetFromServerFarmDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<VnetInfoInner, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<VnetInfoInner>() { }.getType()) .register(404, new TypeToken<Void>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get a Virtual Network gateway. * Get a Virtual Network gateway. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param gatewayName Name of the gateway. Only the 'primary' gateway is supported. * @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 VnetGatewayInner object if successful. */ public VnetGatewayInner getVnetGateway(String resourceGroupName, String name, String vnetName, String gatewayName) { return getVnetGatewayWithServiceResponseAsync(resourceGroupName, name, vnetName, gatewayName).toBlocking().single().body(); } /** * Get a Virtual Network gateway. * Get a Virtual Network gateway. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param gatewayName Name of the gateway. Only the 'primary' gateway is supported. * @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<VnetGatewayInner> getVnetGatewayAsync(String resourceGroupName, String name, String vnetName, String gatewayName, final ServiceCallback<VnetGatewayInner> serviceCallback) { return ServiceFuture.fromResponse(getVnetGatewayWithServiceResponseAsync(resourceGroupName, name, vnetName, gatewayName), serviceCallback); } /** * Get a Virtual Network gateway. * Get a Virtual Network gateway. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param gatewayName Name of the gateway. Only the 'primary' gateway is supported. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VnetGatewayInner object */ public Observable<VnetGatewayInner> getVnetGatewayAsync(String resourceGroupName, String name, String vnetName, String gatewayName) { return getVnetGatewayWithServiceResponseAsync(resourceGroupName, name, vnetName, gatewayName).map(new Func1<ServiceResponse<VnetGatewayInner>, VnetGatewayInner>() { @Override public VnetGatewayInner call(ServiceResponse<VnetGatewayInner> response) { return response.body(); } }); } /** * Get a Virtual Network gateway. * Get a Virtual Network gateway. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param gatewayName Name of the gateway. Only the 'primary' gateway is supported. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VnetGatewayInner object */ public Observable<ServiceResponse<VnetGatewayInner>> getVnetGatewayWithServiceResponseAsync(String resourceGroupName, String name, String vnetName, String gatewayName) { 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 (vnetName == null) { throw new IllegalArgumentException("Parameter vnetName is required and cannot be null."); } if (gatewayName == null) { throw new IllegalArgumentException("Parameter gatewayName 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-09-01"; return service.getVnetGateway(resourceGroupName, name, vnetName, gatewayName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<VnetGatewayInner>>>() { @Override public Observable<ServiceResponse<VnetGatewayInner>> call(Response<ResponseBody> response) { try { ServiceResponse<VnetGatewayInner> clientResponse = getVnetGatewayDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<VnetGatewayInner> getVnetGatewayDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<VnetGatewayInner, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<VnetGatewayInner>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Update a Virtual Network gateway. * Update a Virtual Network gateway. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param gatewayName Name of the gateway. Only the 'primary' gateway is supported. * @param connectionEnvelope Definition of the gateway. * @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 VnetGatewayInner object if successful. */ public VnetGatewayInner updateVnetGateway(String resourceGroupName, String name, String vnetName, String gatewayName, VnetGatewayInner connectionEnvelope) { return updateVnetGatewayWithServiceResponseAsync(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope).toBlocking().single().body(); } /** * Update a Virtual Network gateway. * Update a Virtual Network gateway. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param gatewayName Name of the gateway. Only the 'primary' gateway is supported. * @param connectionEnvelope Definition of the gateway. * @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<VnetGatewayInner> updateVnetGatewayAsync(String resourceGroupName, String name, String vnetName, String gatewayName, VnetGatewayInner connectionEnvelope, final ServiceCallback<VnetGatewayInner> serviceCallback) { return ServiceFuture.fromResponse(updateVnetGatewayWithServiceResponseAsync(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope), serviceCallback); } /** * Update a Virtual Network gateway. * Update a Virtual Network gateway. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param gatewayName Name of the gateway. Only the 'primary' gateway is supported. * @param connectionEnvelope Definition of the gateway. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VnetGatewayInner object */ public Observable<VnetGatewayInner> updateVnetGatewayAsync(String resourceGroupName, String name, String vnetName, String gatewayName, VnetGatewayInner connectionEnvelope) { return updateVnetGatewayWithServiceResponseAsync(resourceGroupName, name, vnetName, gatewayName, connectionEnvelope).map(new Func1<ServiceResponse<VnetGatewayInner>, VnetGatewayInner>() { @Override public VnetGatewayInner call(ServiceResponse<VnetGatewayInner> response) { return response.body(); } }); } /** * Update a Virtual Network gateway. * Update a Virtual Network gateway. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param gatewayName Name of the gateway. Only the 'primary' gateway is supported. * @param connectionEnvelope Definition of the gateway. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VnetGatewayInner object */ public Observable<ServiceResponse<VnetGatewayInner>> updateVnetGatewayWithServiceResponseAsync(String resourceGroupName, String name, String vnetName, String gatewayName, VnetGatewayInner connectionEnvelope) { 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 (vnetName == null) { throw new IllegalArgumentException("Parameter vnetName is required and cannot be null."); } if (gatewayName == null) { throw new IllegalArgumentException("Parameter gatewayName 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 (connectionEnvelope == null) { throw new IllegalArgumentException("Parameter connectionEnvelope is required and cannot be null."); } Validator.validate(connectionEnvelope); final String apiVersion = "2016-09-01"; return service.updateVnetGateway(resourceGroupName, name, vnetName, gatewayName, this.client.subscriptionId(), connectionEnvelope, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<VnetGatewayInner>>>() { @Override public Observable<ServiceResponse<VnetGatewayInner>> call(Response<ResponseBody> response) { try { ServiceResponse<VnetGatewayInner> clientResponse = updateVnetGatewayDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<VnetGatewayInner> updateVnetGatewayDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<VnetGatewayInner, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<VnetGatewayInner>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get all routes that are associated with a Virtual Network in an App Service plan. * Get all routes that are associated with a Virtual Network in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @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<VnetRouteInner> object if successful. */ public List<VnetRouteInner> listRoutesForVnet(String resourceGroupName, String name, String vnetName) { return listRoutesForVnetWithServiceResponseAsync(resourceGroupName, name, vnetName).toBlocking().single().body(); } /** * Get all routes that are associated with a Virtual Network in an App Service plan. * Get all routes that are associated with a Virtual Network in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @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<VnetRouteInner>> listRoutesForVnetAsync(String resourceGroupName, String name, String vnetName, final ServiceCallback<List<VnetRouteInner>> serviceCallback) { return ServiceFuture.fromResponse(listRoutesForVnetWithServiceResponseAsync(resourceGroupName, name, vnetName), serviceCallback); } /** * Get all routes that are associated with a Virtual Network in an App Service plan. * Get all routes that are associated with a Virtual Network in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<VnetRouteInner> object */ public Observable<List<VnetRouteInner>> listRoutesForVnetAsync(String resourceGroupName, String name, String vnetName) { return listRoutesForVnetWithServiceResponseAsync(resourceGroupName, name, vnetName).map(new Func1<ServiceResponse<List<VnetRouteInner>>, List<VnetRouteInner>>() { @Override public List<VnetRouteInner> call(ServiceResponse<List<VnetRouteInner>> response) { return response.body(); } }); } /** * Get all routes that are associated with a Virtual Network in an App Service plan. * Get all routes that are associated with a Virtual Network in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<VnetRouteInner> object */ public Observable<ServiceResponse<List<VnetRouteInner>>> listRoutesForVnetWithServiceResponseAsync(String resourceGroupName, String name, String vnetName) { 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 (vnetName == null) { throw new IllegalArgumentException("Parameter vnetName 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-09-01"; return service.listRoutesForVnet(resourceGroupName, name, vnetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<VnetRouteInner>>>>() { @Override public Observable<ServiceResponse<List<VnetRouteInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<VnetRouteInner>> clientResponse = listRoutesForVnetDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<List<VnetRouteInner>> listRoutesForVnetDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<List<VnetRouteInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<List<VnetRouteInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get a Virtual Network route in an App Service plan. * Get a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @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<VnetRouteInner> object if successful. */ public List<VnetRouteInner> getRouteForVnet(String resourceGroupName, String name, String vnetName, String routeName) { return getRouteForVnetWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName).toBlocking().single().body(); } /** * Get a Virtual Network route in an App Service plan. * Get a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @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<VnetRouteInner>> getRouteForVnetAsync(String resourceGroupName, String name, String vnetName, String routeName, final ServiceCallback<List<VnetRouteInner>> serviceCallback) { return ServiceFuture.fromResponse(getRouteForVnetWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName), serviceCallback); } /** * Get a Virtual Network route in an App Service plan. * Get a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<VnetRouteInner> object */ public Observable<List<VnetRouteInner>> getRouteForVnetAsync(String resourceGroupName, String name, String vnetName, String routeName) { return getRouteForVnetWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName).map(new Func1<ServiceResponse<List<VnetRouteInner>>, List<VnetRouteInner>>() { @Override public List<VnetRouteInner> call(ServiceResponse<List<VnetRouteInner>> response) { return response.body(); } }); } /** * Get a Virtual Network route in an App Service plan. * Get a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the List<VnetRouteInner> object */ public Observable<ServiceResponse<List<VnetRouteInner>>> getRouteForVnetWithServiceResponseAsync(String resourceGroupName, String name, String vnetName, String routeName) { 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 (vnetName == null) { throw new IllegalArgumentException("Parameter vnetName is required and cannot be null."); } if (routeName == null) { throw new IllegalArgumentException("Parameter routeName 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-09-01"; return service.getRouteForVnet(resourceGroupName, name, vnetName, routeName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<VnetRouteInner>>>>() { @Override public Observable<ServiceResponse<List<VnetRouteInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<List<VnetRouteInner>> clientResponse = getRouteForVnetDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<List<VnetRouteInner>> getRouteForVnetDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<List<VnetRouteInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<List<VnetRouteInner>>() { }.getType()) .register(404, new TypeToken<Void>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Create or update a Virtual Network route in an App Service plan. * Create or update a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @param route Definition of the Virtual Network route. * @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 VnetRouteInner object if successful. */ public VnetRouteInner createOrUpdateVnetRoute(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route) { return createOrUpdateVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName, route).toBlocking().single().body(); } /** * Create or update a Virtual Network route in an App Service plan. * Create or update a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @param route Definition of the Virtual Network route. * @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<VnetRouteInner> createOrUpdateVnetRouteAsync(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route, final ServiceCallback<VnetRouteInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName, route), serviceCallback); } /** * Create or update a Virtual Network route in an App Service plan. * Create or update a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @param route Definition of the Virtual Network route. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VnetRouteInner object */ public Observable<VnetRouteInner> createOrUpdateVnetRouteAsync(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route) { return createOrUpdateVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName, route).map(new Func1<ServiceResponse<VnetRouteInner>, VnetRouteInner>() { @Override public VnetRouteInner call(ServiceResponse<VnetRouteInner> response) { return response.body(); } }); } /** * Create or update a Virtual Network route in an App Service plan. * Create or update a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @param route Definition of the Virtual Network route. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VnetRouteInner object */ public Observable<ServiceResponse<VnetRouteInner>> createOrUpdateVnetRouteWithServiceResponseAsync(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route) { 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 (vnetName == null) { throw new IllegalArgumentException("Parameter vnetName is required and cannot be null."); } if (routeName == null) { throw new IllegalArgumentException("Parameter routeName 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 (route == null) { throw new IllegalArgumentException("Parameter route is required and cannot be null."); } Validator.validate(route); final String apiVersion = "2016-09-01"; return service.createOrUpdateVnetRoute(resourceGroupName, name, vnetName, routeName, this.client.subscriptionId(), route, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<VnetRouteInner>>>() { @Override public Observable<ServiceResponse<VnetRouteInner>> call(Response<ResponseBody> response) { try { ServiceResponse<VnetRouteInner> clientResponse = createOrUpdateVnetRouteDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<VnetRouteInner> createOrUpdateVnetRouteDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<VnetRouteInner, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<VnetRouteInner>() { }.getType()) .register(400, new TypeToken<Void>() { }.getType()) .register(404, new TypeToken<Void>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Delete a Virtual Network route in an App Service plan. * Delete a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @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 deleteVnetRoute(String resourceGroupName, String name, String vnetName, String routeName) { deleteVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName).toBlocking().single().body(); } /** * Delete a Virtual Network route in an App Service plan. * Delete a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @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> deleteVnetRouteAsync(String resourceGroupName, String name, String vnetName, String routeName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName), serviceCallback); } /** * Delete a Virtual Network route in an App Service plan. * Delete a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> deleteVnetRouteAsync(String resourceGroupName, String name, String vnetName, String routeName) { return deleteVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Delete a Virtual Network route in an App Service plan. * Delete a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> deleteVnetRouteWithServiceResponseAsync(String resourceGroupName, String name, String vnetName, String routeName) { 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 (vnetName == null) { throw new IllegalArgumentException("Parameter vnetName is required and cannot be null."); } if (routeName == null) { throw new IllegalArgumentException("Parameter routeName 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-09-01"; return service.deleteVnetRoute(resourceGroupName, name, vnetName, routeName, 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 = deleteVnetRouteDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> deleteVnetRouteDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<Void, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<Void>() { }.getType()) .register(404, new TypeToken<Void>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Create or update a Virtual Network route in an App Service plan. * Create or update a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @param route Definition of the Virtual Network route. * @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 VnetRouteInner object if successful. */ public VnetRouteInner updateVnetRoute(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route) { return updateVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName, route).toBlocking().single().body(); } /** * Create or update a Virtual Network route in an App Service plan. * Create or update a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @param route Definition of the Virtual Network route. * @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<VnetRouteInner> updateVnetRouteAsync(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route, final ServiceCallback<VnetRouteInner> serviceCallback) { return ServiceFuture.fromResponse(updateVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName, route), serviceCallback); } /** * Create or update a Virtual Network route in an App Service plan. * Create or update a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @param route Definition of the Virtual Network route. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VnetRouteInner object */ public Observable<VnetRouteInner> updateVnetRouteAsync(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route) { return updateVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName, route).map(new Func1<ServiceResponse<VnetRouteInner>, VnetRouteInner>() { @Override public VnetRouteInner call(ServiceResponse<VnetRouteInner> response) { return response.body(); } }); } /** * Create or update a Virtual Network route in an App Service plan. * Create or update a Virtual Network route in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param vnetName Name of the Virtual Network. * @param routeName Name of the Virtual Network route. * @param route Definition of the Virtual Network route. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VnetRouteInner object */ public Observable<ServiceResponse<VnetRouteInner>> updateVnetRouteWithServiceResponseAsync(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route) { 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 (vnetName == null) { throw new IllegalArgumentException("Parameter vnetName is required and cannot be null."); } if (routeName == null) { throw new IllegalArgumentException("Parameter routeName 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 (route == null) { throw new IllegalArgumentException("Parameter route is required and cannot be null."); } Validator.validate(route); final String apiVersion = "2016-09-01"; return service.updateVnetRoute(resourceGroupName, name, vnetName, routeName, this.client.subscriptionId(), route, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<VnetRouteInner>>>() { @Override public Observable<ServiceResponse<VnetRouteInner>> call(Response<ResponseBody> response) { try { ServiceResponse<VnetRouteInner> clientResponse = updateVnetRouteDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<VnetRouteInner> updateVnetRouteDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<VnetRouteInner, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<VnetRouteInner>() { }.getType()) .register(400, new TypeToken<Void>() { }.getType()) .register(404, new TypeToken<Void>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Reboot a worker machine in an App Service plan. * Reboot a worker machine in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param workerName Name of worker machine, which typically starts with RD. * @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 rebootWorker(String resourceGroupName, String name, String workerName) { rebootWorkerWithServiceResponseAsync(resourceGroupName, name, workerName).toBlocking().single().body(); } /** * Reboot a worker machine in an App Service plan. * Reboot a worker machine in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param workerName Name of worker machine, which typically starts with RD. * @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> rebootWorkerAsync(String resourceGroupName, String name, String workerName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(rebootWorkerWithServiceResponseAsync(resourceGroupName, name, workerName), serviceCallback); } /** * Reboot a worker machine in an App Service plan. * Reboot a worker machine in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param workerName Name of worker machine, which typically starts with RD. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<Void> rebootWorkerAsync(String resourceGroupName, String name, String workerName) { return rebootWorkerWithServiceResponseAsync(resourceGroupName, name, workerName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); } /** * Reboot a worker machine in an App Service plan. * Reboot a worker machine in an App Service plan. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service plan. * @param workerName Name of worker machine, which typically starts with RD. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */ public Observable<ServiceResponse<Void>> rebootWorkerWithServiceResponseAsync(String resourceGroupName, String name, String workerName) { 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 (workerName == null) { throw new IllegalArgumentException("Parameter workerName 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-09-01"; return service.rebootWorker(resourceGroupName, name, workerName, 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 = rebootWorkerDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<Void> rebootWorkerDelegate(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 all App Service plans for a subcription. * Get all App Service plans for a subcription. * * @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<AppServicePlanInner> object if successful. */ public PagedList<AppServicePlanInner> listNext(final String nextPageLink) { ServiceResponse<Page<AppServicePlanInner>> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<AppServicePlanInner>(response.body()) { @Override public Page<AppServicePlanInner> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * * @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<List<AppServicePlanInner>> listNextAsync(final String nextPageLink, final ServiceFuture<List<AppServicePlanInner>> serviceFuture, final ListOperationCallback<AppServicePlanInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listNextSinglePageAsync(nextPageLink), new Func1<String, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(String nextPageLink) { return listNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * * @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<AppServicePlanInner> object */ public Observable<Page<AppServicePlanInner>> listNextAsync(final String nextPageLink) { return listNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<AppServicePlanInner>>, Page<AppServicePlanInner>>() { @Override public Page<AppServicePlanInner> call(ServiceResponse<Page<AppServicePlanInner>> response) { return response.body(); } }); } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * * @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<AppServicePlanInner> object */ public Observable<ServiceResponse<Page<AppServicePlanInner>>> listNextWithServiceResponseAsync(final String nextPageLink) { return listNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<AppServicePlanInner>>, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(ServiceResponse<Page<AppServicePlanInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get all App Service plans for a subcription. * Get all App Service plans for a subcription. * ServiceResponse<PageImpl<AppServicePlanInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<AppServicePlanInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<AppServicePlanInner>>> 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<Response<ResponseBody>, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<AppServicePlanInner>> result = listNextDelegate(response); return Observable.just(new ServiceResponse<Page<AppServicePlanInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<AppServicePlanInner>> listNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<AppServicePlanInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<AppServicePlanInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get all App Service plans in a resource group. * Get all App Service plans in a resource group. * * @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<AppServicePlanInner> object if successful. */ public PagedList<AppServicePlanInner> listByResourceGroupNext(final String nextPageLink) { ServiceResponse<Page<AppServicePlanInner>> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<AppServicePlanInner>(response.body()) { @Override public Page<AppServicePlanInner> nextPage(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get all App Service plans in a resource group. * Get all App Service plans in a resource group. * * @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<List<AppServicePlanInner>> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture<List<AppServicePlanInner>> serviceFuture, final ListOperationCallback<AppServicePlanInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listByResourceGroupNextSinglePageAsync(nextPageLink), new Func1<String, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get all App Service plans in a resource group. * Get all App Service plans in a resource group. * * @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<AppServicePlanInner> object */ public Observable<Page<AppServicePlanInner>> listByResourceGroupNextAsync(final String nextPageLink) { return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<AppServicePlanInner>>, Page<AppServicePlanInner>>() { @Override public Page<AppServicePlanInner> call(ServiceResponse<Page<AppServicePlanInner>> response) { return response.body(); } }); } /** * Get all App Service plans in a resource group. * Get all App Service plans in a resource group. * * @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<AppServicePlanInner> object */ public Observable<ServiceResponse<Page<AppServicePlanInner>>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { return listByResourceGroupNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<AppServicePlanInner>>, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(ServiceResponse<Page<AppServicePlanInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get all App Service plans in a resource group. * Get all App Service plans in a resource group. * ServiceResponse<PageImpl<AppServicePlanInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<AppServicePlanInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<AppServicePlanInner>>> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<AppServicePlanInner>>>>() { @Override public Observable<ServiceResponse<Page<AppServicePlanInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<AppServicePlanInner>> result = listByResourceGroupNextDelegate(response); return Observable.just(new ServiceResponse<Page<AppServicePlanInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<AppServicePlanInner>> listByResourceGroupNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<AppServicePlanInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<AppServicePlanInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get all apps that use a Hybrid Connection in an App Service Plan. * Get all apps that use a Hybrid Connection in an App Service Plan. * * @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<String> object if successful. */ public PagedList<String> listWebAppsByHybridConnectionNext(final String nextPageLink) { ServiceResponse<Page<String>> response = listWebAppsByHybridConnectionNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<String>(response.body()) { @Override public Page<String> nextPage(String nextPageLink) { return listWebAppsByHybridConnectionNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get all apps that use a Hybrid Connection in an App Service Plan. * Get all apps that use a Hybrid Connection in an App Service Plan. * * @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<List<String>> listWebAppsByHybridConnectionNextAsync(final String nextPageLink, final ServiceFuture<List<String>> serviceFuture, final ListOperationCallback<String> serviceCallback) { return AzureServiceFuture.fromPageResponse( listWebAppsByHybridConnectionNextSinglePageAsync(nextPageLink), new Func1<String, Observable<ServiceResponse<Page<String>>>>() { @Override public Observable<ServiceResponse<Page<String>>> call(String nextPageLink) { return listWebAppsByHybridConnectionNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get all apps that use a Hybrid Connection in an App Service Plan. * Get all apps that use a Hybrid Connection in an App Service Plan. * * @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<String> object */ public Observable<Page<String>> listWebAppsByHybridConnectionNextAsync(final String nextPageLink) { return listWebAppsByHybridConnectionNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<String>>, Page<String>>() { @Override public Page<String> call(ServiceResponse<Page<String>> response) { return response.body(); } }); } /** * Get all apps that use a Hybrid Connection in an App Service Plan. * Get all apps that use a Hybrid Connection in an App Service Plan. * * @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<String> object */ public Observable<ServiceResponse<Page<String>>> listWebAppsByHybridConnectionNextWithServiceResponseAsync(final String nextPageLink) { return listWebAppsByHybridConnectionNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<String>>, Observable<ServiceResponse<Page<String>>>>() { @Override public Observable<ServiceResponse<Page<String>>> call(ServiceResponse<Page<String>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listWebAppsByHybridConnectionNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get all apps that use a Hybrid Connection in an App Service Plan. * Get all apps that use a Hybrid Connection in an App Service Plan. * ServiceResponse<PageImpl<String>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<String> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<String>>> listWebAppsByHybridConnectionNextSinglePageAsync(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.listWebAppsByHybridConnectionNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<String>>>>() { @Override public Observable<ServiceResponse<Page<String>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<String>> result = listWebAppsByHybridConnectionNextDelegate(response); return Observable.just(new ServiceResponse<Page<String>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<String>> listWebAppsByHybridConnectionNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<String>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<String>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Retrieve all Hybrid Connections in use in an App Service plan. * Retrieve all Hybrid Connections in use in an App Service plan. * * @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<HybridConnectionInner> object if successful. */ public PagedList<HybridConnectionInner> listHybridConnectionsNext(final String nextPageLink) { ServiceResponse<Page<HybridConnectionInner>> response = listHybridConnectionsNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<HybridConnectionInner>(response.body()) { @Override public Page<HybridConnectionInner> nextPage(String nextPageLink) { return listHybridConnectionsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Retrieve all Hybrid Connections in use in an App Service plan. * Retrieve all Hybrid Connections in use in an App Service plan. * * @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<List<HybridConnectionInner>> listHybridConnectionsNextAsync(final String nextPageLink, final ServiceFuture<List<HybridConnectionInner>> serviceFuture, final ListOperationCallback<HybridConnectionInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listHybridConnectionsNextSinglePageAsync(nextPageLink), new Func1<String, Observable<ServiceResponse<Page<HybridConnectionInner>>>>() { @Override public Observable<ServiceResponse<Page<HybridConnectionInner>>> call(String nextPageLink) { return listHybridConnectionsNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Retrieve all Hybrid Connections in use in an App Service plan. * Retrieve all Hybrid Connections in use in an App Service plan. * * @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<HybridConnectionInner> object */ public Observable<Page<HybridConnectionInner>> listHybridConnectionsNextAsync(final String nextPageLink) { return listHybridConnectionsNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<HybridConnectionInner>>, Page<HybridConnectionInner>>() { @Override public Page<HybridConnectionInner> call(ServiceResponse<Page<HybridConnectionInner>> response) { return response.body(); } }); } /** * Retrieve all Hybrid Connections in use in an App Service plan. * Retrieve all Hybrid Connections in use in an App Service plan. * * @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<HybridConnectionInner> object */ public Observable<ServiceResponse<Page<HybridConnectionInner>>> listHybridConnectionsNextWithServiceResponseAsync(final String nextPageLink) { return listHybridConnectionsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<HybridConnectionInner>>, Observable<ServiceResponse<Page<HybridConnectionInner>>>>() { @Override public Observable<ServiceResponse<Page<HybridConnectionInner>>> call(ServiceResponse<Page<HybridConnectionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listHybridConnectionsNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Retrieve all Hybrid Connections in use in an App Service plan. * Retrieve all Hybrid Connections in use in an App Service plan. * ServiceResponse<PageImpl<HybridConnectionInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<HybridConnectionInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<HybridConnectionInner>>> listHybridConnectionsNextSinglePageAsync(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.listHybridConnectionsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<HybridConnectionInner>>>>() { @Override public Observable<ServiceResponse<Page<HybridConnectionInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<HybridConnectionInner>> result = listHybridConnectionsNextDelegate(response); return Observable.just(new ServiceResponse<Page<HybridConnectionInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<HybridConnectionInner>> listHybridConnectionsNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<HybridConnectionInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<HybridConnectionInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get metrics that can be queried for an App Service plan, and their definitions. * Get metrics that can be queried for an App Service plan, and their definitions. * * @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<ResourceMetricDefinitionInner> object if successful. */ public PagedList<ResourceMetricDefinitionInner> listMetricDefintionsNext(final String nextPageLink) { ServiceResponse<Page<ResourceMetricDefinitionInner>> response = listMetricDefintionsNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<ResourceMetricDefinitionInner>(response.body()) { @Override public Page<ResourceMetricDefinitionInner> nextPage(String nextPageLink) { return listMetricDefintionsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get metrics that can be queried for an App Service plan, and their definitions. * Get metrics that can be queried for an App Service plan, and their definitions. * * @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<List<ResourceMetricDefinitionInner>> listMetricDefintionsNextAsync(final String nextPageLink, final ServiceFuture<List<ResourceMetricDefinitionInner>> serviceFuture, final ListOperationCallback<ResourceMetricDefinitionInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listMetricDefintionsNextSinglePageAsync(nextPageLink), new Func1<String, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(String nextPageLink) { return listMetricDefintionsNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get metrics that can be queried for an App Service plan, and their definitions. * Get metrics that can be queried for an App Service plan, and their definitions. * * @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<ResourceMetricDefinitionInner> object */ public Observable<Page<ResourceMetricDefinitionInner>> listMetricDefintionsNextAsync(final String nextPageLink) { return listMetricDefintionsNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Page<ResourceMetricDefinitionInner>>() { @Override public Page<ResourceMetricDefinitionInner> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> response) { return response.body(); } }); } /** * Get metrics that can be queried for an App Service plan, and their definitions. * Get metrics that can be queried for an App Service plan, and their definitions. * * @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<ResourceMetricDefinitionInner> object */ public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listMetricDefintionsNextWithServiceResponseAsync(final String nextPageLink) { return listMetricDefintionsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMetricDefintionsNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get metrics that can be queried for an App Service plan, and their definitions. * Get metrics that can be queried for an App Service plan, and their definitions. * ServiceResponse<PageImpl<ResourceMetricDefinitionInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ResourceMetricDefinitionInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listMetricDefintionsNextSinglePageAsync(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.listMetricDefintionsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<ResourceMetricDefinitionInner>> result = listMetricDefintionsNextDelegate(response); return Observable.just(new ServiceResponse<Page<ResourceMetricDefinitionInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<ResourceMetricDefinitionInner>> listMetricDefintionsNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<ResourceMetricDefinitionInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<ResourceMetricDefinitionInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * * @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<ResourceMetricInner> object if successful. */ public PagedList<ResourceMetricInner> listMetricsNext(final String nextPageLink) { ServiceResponse<Page<ResourceMetricInner>> response = listMetricsNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<ResourceMetricInner>(response.body()) { @Override public Page<ResourceMetricInner> nextPage(String nextPageLink) { return listMetricsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * * @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<List<ResourceMetricInner>> listMetricsNextAsync(final String nextPageLink, final ServiceFuture<List<ResourceMetricInner>> serviceFuture, final ListOperationCallback<ResourceMetricInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listMetricsNextSinglePageAsync(nextPageLink), new Func1<String, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(String nextPageLink) { return listMetricsNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * * @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<ResourceMetricInner> object */ public Observable<Page<ResourceMetricInner>> listMetricsNextAsync(final String nextPageLink) { return listMetricsNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Page<ResourceMetricInner>>() { @Override public Page<ResourceMetricInner> call(ServiceResponse<Page<ResourceMetricInner>> response) { return response.body(); } }); } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * * @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<ResourceMetricInner> object */ public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMetricsNextWithServiceResponseAsync(final String nextPageLink) { return listMetricsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricInner>>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(ServiceResponse<Page<ResourceMetricInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMetricsNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get metrics for an App Serice plan. * Get metrics for an App Serice plan. * ServiceResponse<PageImpl<ResourceMetricInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<ResourceMetricInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<ResourceMetricInner>>> listMetricsNextSinglePageAsync(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.listMetricsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<ResourceMetricInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<ResourceMetricInner>> result = listMetricsNextDelegate(response); return Observable.just(new ServiceResponse<Page<ResourceMetricInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<ResourceMetricInner>> listMetricsNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<ResourceMetricInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<ResourceMetricInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * * @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<SiteInner> object if successful. */ public PagedList<SiteInner> listWebAppsNext(final String nextPageLink) { ServiceResponse<Page<SiteInner>> response = listWebAppsNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<SiteInner>(response.body()) { @Override public Page<SiteInner> nextPage(String nextPageLink) { return listWebAppsNextSinglePageAsync(nextPageLink).toBlocking().single().body(); } }; } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * * @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<List<SiteInner>> listWebAppsNextAsync(final String nextPageLink, final ServiceFuture<List<SiteInner>> serviceFuture, final ListOperationCallback<SiteInner> serviceCallback) { return AzureServiceFuture.fromPageResponse( listWebAppsNextSinglePageAsync(nextPageLink), new Func1<String, Observable<ServiceResponse<Page<SiteInner>>>>() { @Override public Observable<ServiceResponse<Page<SiteInner>>> call(String nextPageLink) { return listWebAppsNextSinglePageAsync(nextPageLink); } }, serviceCallback); } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * * @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<SiteInner> object */ public Observable<Page<SiteInner>> listWebAppsNextAsync(final String nextPageLink) { return listWebAppsNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<SiteInner>>, Page<SiteInner>>() { @Override public Page<SiteInner> call(ServiceResponse<Page<SiteInner>> response) { return response.body(); } }); } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * * @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<SiteInner> object */ public Observable<ServiceResponse<Page<SiteInner>>> listWebAppsNextWithServiceResponseAsync(final String nextPageLink) { return listWebAppsNextSinglePageAsync(nextPageLink) .concatMap(new Func1<ServiceResponse<Page<SiteInner>>, Observable<ServiceResponse<Page<SiteInner>>>>() { @Override public Observable<ServiceResponse<Page<SiteInner>>> call(ServiceResponse<Page<SiteInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listWebAppsNextWithServiceResponseAsync(nextPageLink)); } }); } /** * Get all apps associated with an App Service plan. * Get all apps associated with an App Service plan. * ServiceResponse<PageImpl<SiteInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList<SiteInner> object wrapped in {@link ServiceResponse} if successful. */ public Observable<ServiceResponse<Page<SiteInner>>> listWebAppsNextSinglePageAsync(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.listWebAppsNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<SiteInner>>>>() { @Override public Observable<ServiceResponse<Page<SiteInner>>> call(Response<ResponseBody> response) { try { ServiceResponse<PageImpl<SiteInner>> result = listWebAppsNextDelegate(response); return Observable.just(new ServiceResponse<Page<SiteInner>>(result.body(), result.response())); } catch (Throwable t) { return Observable.error(t); } } }); } private ServiceResponse<PageImpl<SiteInner>> listWebAppsNextDelegate(Response<ResponseBody> response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().<PageImpl<SiteInner>, CloudException>newInstance(this.client.serializerAdapter()) .register(200, new TypeToken<PageImpl<SiteInner>>() { }.getType()) .registerError(CloudException.class) .build(response); } }