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.
/**
* 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.cdn.implementation;
import retrofit2.Retrofit;
import com.google.common.reflect.TypeToken;
import com.microsoft.azure.AzureServiceFuture;
import com.microsoft.azure.ListOperationCallback;
import com.microsoft.azure.management.cdn.AfdErrorResponseException;
import com.microsoft.azure.management.cdn.ValidateCustomDomainInput;
import com.microsoft.azure.Page;
import com.microsoft.azure.PagedList;
import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.ServiceResponse;
import java.io.IOException;
import java.util.List;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.Headers;
import retrofit2.http.Path;
import retrofit2.http.POST;
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 AFDProfiles.
/**
* An instance of this class provides access to all the operations defined
* in AFDProfiles.
*/
public class AFDProfilesInner {
The Retrofit service to perform REST calls. /** The Retrofit service to perform REST calls. */
private AFDProfilesService service;
The service client containing this operation class. /** The service client containing this operation class. */
private CdnManagementClientImpl client;
Initializes an instance of AFDProfilesInner.
Params: - retrofit – the Retrofit instance built from a Retrofit Builder.
- client – the instance of the service client containing this operation class.
/**
* Initializes an instance of AFDProfilesInner.
*
* @param retrofit the Retrofit instance built from a Retrofit Builder.
* @param client the instance of the service client containing this operation class.
*/
public AFDProfilesInner(Retrofit retrofit, CdnManagementClientImpl client) {
this.service = retrofit.create(AFDProfilesService.class);
this.client = client;
}
The interface defining all the services for AFDProfiles to be
used by Retrofit to perform actually REST calls.
/**
* The interface defining all the services for AFDProfiles to be
* used by Retrofit to perform actually REST calls.
*/
interface AFDProfilesService {
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cdn.AFDProfiles listResourceUsage" })
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/usages")
Observable<Response<ResponseBody>> listResourceUsage(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @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.cdn.AFDProfiles checkHostNameAvailability" })
@POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/checkHostNameAvailability")
Observable<Response<ResponseBody>> checkHostNameAvailability(@Path("resourceGroupName") String resourceGroupName, @Path("profileName") String profileName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body ValidateCustomDomainInput checkHostNameAvailabilityInput, @Header("User-Agent") String userAgent);
@Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cdn.AFDProfiles listResourceUsageNext" })
@GET
Observable<Response<ResponseBody>> listResourceUsageNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent);
}
Checks the quota and actual usage of endpoints under the given CDN profile.
Params: - resourceGroupName – Name of the Resource group within the Azure subscription.
- profileName – Name of the CDN profile which is unique within the resource group.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
- AfdErrorResponseException – thrown if the request is rejected by server
- RuntimeException – all other wrapped checked exceptions if the request fails to be sent
Returns: the PagedList<UsageInner> object if successful.
/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the CDN profile which is unique within the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws AfdErrorResponseException 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<UsageInner> object if successful.
*/
public PagedList<UsageInner> listResourceUsage(final String resourceGroupName, final String profileName) {
ServiceResponse<Page<UsageInner>> response = listResourceUsageSinglePageAsync(resourceGroupName, profileName).toBlocking().single();
return new PagedList<UsageInner>(response.body()) {
@Override
public Page<UsageInner> nextPage(String nextPageLink) {
return listResourceUsageNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
Checks the quota and actual usage of endpoints under the given CDN profile.
Params: - resourceGroupName – Name of the Resource group within the Azure subscription.
- profileName – Name of the CDN profile which is unique within the resource group.
- serviceCallback – the async ServiceCallback to handle successful and failed responses.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the ServiceFuture
object
/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the CDN profile which is unique within the resource group.
* @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<UsageInner>> listResourceUsageAsync(final String resourceGroupName, final String profileName, final ListOperationCallback<UsageInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listResourceUsageSinglePageAsync(resourceGroupName, profileName),
new Func1<String, Observable<ServiceResponse<Page<UsageInner>>>>() {
@Override
public Observable<ServiceResponse<Page<UsageInner>>> call(String nextPageLink) {
return listResourceUsageNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
Checks the quota and actual usage of endpoints under the given CDN profile.
Params: - resourceGroupName – Name of the Resource group within the Azure subscription.
- profileName – Name of the CDN profile which is unique within the resource group.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the observable to the PagedList<UsageInner> object
/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the CDN profile which is unique within the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<UsageInner> object
*/
public Observable<Page<UsageInner>> listResourceUsageAsync(final String resourceGroupName, final String profileName) {
return listResourceUsageWithServiceResponseAsync(resourceGroupName, profileName)
.map(new Func1<ServiceResponse<Page<UsageInner>>, Page<UsageInner>>() {
@Override
public Page<UsageInner> call(ServiceResponse<Page<UsageInner>> response) {
return response.body();
}
});
}
Checks the quota and actual usage of endpoints under the given CDN profile.
Params: - resourceGroupName – Name of the Resource group within the Azure subscription.
- profileName – Name of the CDN profile which is unique within the resource group.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the observable to the PagedList<UsageInner> object
/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the CDN profile which is unique within the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the PagedList<UsageInner> object
*/
public Observable<ServiceResponse<Page<UsageInner>>> listResourceUsageWithServiceResponseAsync(final String resourceGroupName, final String profileName) {
return listResourceUsageSinglePageAsync(resourceGroupName, profileName)
.concatMap(new Func1<ServiceResponse<Page<UsageInner>>, Observable<ServiceResponse<Page<UsageInner>>>>() {
@Override
public Observable<ServiceResponse<Page<UsageInner>>> call(ServiceResponse<Page<UsageInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listResourceUsageNextWithServiceResponseAsync(nextPageLink));
}
});
}
Checks the quota and actual usage of endpoints under the given CDN profile.
ServiceResponse> * @param resourceGroupName Name of the Resource group within the Azure subscription.
ServiceResponse> * @param profileName Name of the CDN profile which is unique within the resource group.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the PagedList<UsageInner> object wrapped in ServiceResponse
if successful.
/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
*
ServiceResponse<PageImpl<UsageInner>> * @param resourceGroupName Name of the Resource group within the Azure subscription.
ServiceResponse<PageImpl<UsageInner>> * @param profileName Name of the CDN profile which is unique within the resource group.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<UsageInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<UsageInner>>> listResourceUsageSinglePageAsync(final String resourceGroupName, final String profileName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (profileName == null) {
throw new IllegalArgumentException("Parameter profileName 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 (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listResourceUsage(resourceGroupName, profileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<UsageInner>>>>() {
@Override
public Observable<ServiceResponse<Page<UsageInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<UsageInner>> result = listResourceUsageDelegate(response);
return Observable.just(new ServiceResponse<Page<UsageInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<PageImpl<UsageInner>> listResourceUsageDelegate(Response<ResponseBody> response) throws AfdErrorResponseException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<PageImpl<UsageInner>, AfdErrorResponseException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<PageImpl<UsageInner>>() { }.getType())
.registerError(AfdErrorResponseException.class)
.build(response);
}
Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.
Params: - resourceGroupName – Name of the Resource group within the Azure subscription.
- profileName – Name of the CDN profile which is unique within the resource group.
- hostName – The host name of the custom domain. Must be a domain name.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
- AfdErrorResponseException – thrown if the request is rejected by server
- RuntimeException – all other wrapped checked exceptions if the request fails to be sent
Returns: the ValidateCustomDomainOutputInner object if successful.
/**
* Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the CDN profile which is unique within the resource group.
* @param hostName The host name of the custom domain. Must be a domain name.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws AfdErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the ValidateCustomDomainOutputInner object if successful.
*/
public ValidateCustomDomainOutputInner checkHostNameAvailability(String resourceGroupName, String profileName, String hostName) {
return checkHostNameAvailabilityWithServiceResponseAsync(resourceGroupName, profileName, hostName).toBlocking().single().body();
}
Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.
Params: - resourceGroupName – Name of the Resource group within the Azure subscription.
- profileName – Name of the CDN profile which is unique within the resource group.
- hostName – The host name of the custom domain. Must be a domain name.
- serviceCallback – the async ServiceCallback to handle successful and failed responses.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the ServiceFuture
object
/**
* Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the CDN profile which is unique within the resource group.
* @param hostName The host name of the custom domain. Must be a domain name.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
public ServiceFuture<ValidateCustomDomainOutputInner> checkHostNameAvailabilityAsync(String resourceGroupName, String profileName, String hostName, final ServiceCallback<ValidateCustomDomainOutputInner> serviceCallback) {
return ServiceFuture.fromResponse(checkHostNameAvailabilityWithServiceResponseAsync(resourceGroupName, profileName, hostName), serviceCallback);
}
Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.
Params: - resourceGroupName – Name of the Resource group within the Azure subscription.
- profileName – Name of the CDN profile which is unique within the resource group.
- hostName – The host name of the custom domain. Must be a domain name.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the observable to the ValidateCustomDomainOutputInner object
/**
* Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the CDN profile which is unique within the resource group.
* @param hostName The host name of the custom domain. Must be a domain name.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ValidateCustomDomainOutputInner object
*/
public Observable<ValidateCustomDomainOutputInner> checkHostNameAvailabilityAsync(String resourceGroupName, String profileName, String hostName) {
return checkHostNameAvailabilityWithServiceResponseAsync(resourceGroupName, profileName, hostName).map(new Func1<ServiceResponse<ValidateCustomDomainOutputInner>, ValidateCustomDomainOutputInner>() {
@Override
public ValidateCustomDomainOutputInner call(ServiceResponse<ValidateCustomDomainOutputInner> response) {
return response.body();
}
});
}
Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.
Params: - resourceGroupName – Name of the Resource group within the Azure subscription.
- profileName – Name of the CDN profile which is unique within the resource group.
- hostName – The host name of the custom domain. Must be a domain name.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the observable to the ValidateCustomDomainOutputInner object
/**
* Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the CDN profile which is unique within the resource group.
* @param hostName The host name of the custom domain. Must be a domain name.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ValidateCustomDomainOutputInner object
*/
public Observable<ServiceResponse<ValidateCustomDomainOutputInner>> checkHostNameAvailabilityWithServiceResponseAsync(String resourceGroupName, String profileName, String hostName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (profileName == null) {
throw new IllegalArgumentException("Parameter profileName 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 (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
if (hostName == null) {
throw new IllegalArgumentException("Parameter hostName is required and cannot be null.");
}
ValidateCustomDomainInput checkHostNameAvailabilityInput = new ValidateCustomDomainInput();
checkHostNameAvailabilityInput.withHostName(hostName);
return service.checkHostNameAvailability(resourceGroupName, profileName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), checkHostNameAvailabilityInput, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ValidateCustomDomainOutputInner>>>() {
@Override
public Observable<ServiceResponse<ValidateCustomDomainOutputInner>> call(Response<ResponseBody> response) {
try {
ServiceResponse<ValidateCustomDomainOutputInner> clientResponse = checkHostNameAvailabilityDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<ValidateCustomDomainOutputInner> checkHostNameAvailabilityDelegate(Response<ResponseBody> response) throws AfdErrorResponseException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<ValidateCustomDomainOutputInner, AfdErrorResponseException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<ValidateCustomDomainOutputInner>() { }.getType())
.registerError(AfdErrorResponseException.class)
.build(response);
}
Checks the quota and actual usage of endpoints under the given CDN profile.
Params: - nextPageLink – The NextLink from the previous successful call to List operation.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
- AfdErrorResponseException – thrown if the request is rejected by server
- RuntimeException – all other wrapped checked exceptions if the request fails to be sent
Returns: the PagedList<UsageInner> object if successful.
/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
*
* @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws AfdErrorResponseException 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<UsageInner> object if successful.
*/
public PagedList<UsageInner> listResourceUsageNext(final String nextPageLink) {
ServiceResponse<Page<UsageInner>> response = listResourceUsageNextSinglePageAsync(nextPageLink).toBlocking().single();
return new PagedList<UsageInner>(response.body()) {
@Override
public Page<UsageInner> nextPage(String nextPageLink) {
return listResourceUsageNextSinglePageAsync(nextPageLink).toBlocking().single().body();
}
};
}
Checks the quota and actual usage of endpoints under the given CDN profile.
Params: - nextPageLink – The NextLink from the previous successful call to List operation.
- serviceFuture – the ServiceFuture object tracking the Retrofit calls
- serviceCallback – the async ServiceCallback to handle successful and failed responses.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the ServiceFuture
object
/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
*
* @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<UsageInner>> listResourceUsageNextAsync(final String nextPageLink, final ServiceFuture<List<UsageInner>> serviceFuture, final ListOperationCallback<UsageInner> serviceCallback) {
return AzureServiceFuture.fromPageResponse(
listResourceUsageNextSinglePageAsync(nextPageLink),
new Func1<String, Observable<ServiceResponse<Page<UsageInner>>>>() {
@Override
public Observable<ServiceResponse<Page<UsageInner>>> call(String nextPageLink) {
return listResourceUsageNextSinglePageAsync(nextPageLink);
}
},
serviceCallback);
}
Checks the quota and actual usage of endpoints under the given CDN profile.
Params: - nextPageLink – The NextLink from the previous successful call to List operation.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the observable to the PagedList<UsageInner> object
/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
*
* @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<UsageInner> object
*/
public Observable<Page<UsageInner>> listResourceUsageNextAsync(final String nextPageLink) {
return listResourceUsageNextWithServiceResponseAsync(nextPageLink)
.map(new Func1<ServiceResponse<Page<UsageInner>>, Page<UsageInner>>() {
@Override
public Page<UsageInner> call(ServiceResponse<Page<UsageInner>> response) {
return response.body();
}
});
}
Checks the quota and actual usage of endpoints under the given CDN profile.
Params: - nextPageLink – The NextLink from the previous successful call to List operation.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the observable to the PagedList<UsageInner> object
/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
*
* @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<UsageInner> object
*/
public Observable<ServiceResponse<Page<UsageInner>>> listResourceUsageNextWithServiceResponseAsync(final String nextPageLink) {
return listResourceUsageNextSinglePageAsync(nextPageLink)
.concatMap(new Func1<ServiceResponse<Page<UsageInner>>, Observable<ServiceResponse<Page<UsageInner>>>>() {
@Override
public Observable<ServiceResponse<Page<UsageInner>>> call(ServiceResponse<Page<UsageInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listResourceUsageNextWithServiceResponseAsync(nextPageLink));
}
});
}
Checks the quota and actual usage of endpoints under the given CDN profile.
ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation.
Throws: - IllegalArgumentException – thrown if parameters fail the validation
Returns: the PagedList<UsageInner> object wrapped in ServiceResponse
if successful.
/**
* Checks the quota and actual usage of endpoints under the given CDN profile.
*
ServiceResponse<PageImpl<UsageInner>> * @param nextPageLink The NextLink from the previous successful call to List operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<UsageInner> object wrapped in {@link ServiceResponse} if successful.
*/
public Observable<ServiceResponse<Page<UsageInner>>> listResourceUsageNextSinglePageAsync(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.listResourceUsageNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<UsageInner>>>>() {
@Override
public Observable<ServiceResponse<Page<UsageInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PageImpl<UsageInner>> result = listResourceUsageNextDelegate(response);
return Observable.just(new ServiceResponse<Page<UsageInner>>(result.body(), result.response()));
} catch (Throwable t) {
return Observable.error(t);
}
}
});
}
private ServiceResponse<PageImpl<UsageInner>> listResourceUsageNextDelegate(Response<ResponseBody> response) throws AfdErrorResponseException, IOException, IllegalArgumentException {
return this.client.restClient().responseBuilderFactory().<PageImpl<UsageInner>, AfdErrorResponseException>newInstance(this.client.serializerAdapter())
.register(200, new TypeToken<PageImpl<UsageInner>>() { }.getType())
.registerError(AfdErrorResponseException.class)
.build(response);
}
}