Search in sources :

Example 1 with CheckNameAvailabilityInput

use of com.microsoft.azure.management.cdn.CheckNameAvailabilityInput in project azure-sdk-for-java by Azure.

the class CdnManagementClientImpl method checkNameAvailabilityWithServiceResponseAsync.

/**
     * Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint.
     *
     * @param name The resource name to validate.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the CheckNameAvailabilityOutputInner object
     */
public Observable<ServiceResponse<CheckNameAvailabilityOutputInner>> checkNameAvailabilityWithServiceResponseAsync(String name) {
    if (this.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
    }
    if (name == null) {
        throw new IllegalArgumentException("Parameter name is required and cannot be null.");
    }
    CheckNameAvailabilityInput checkNameAvailabilityInput = new CheckNameAvailabilityInput();
    checkNameAvailabilityInput.withName(name);
    return service.checkNameAvailability(this.apiVersion(), this.acceptLanguage(), checkNameAvailabilityInput, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CheckNameAvailabilityOutputInner>>>() {

        @Override
        public Observable<ServiceResponse<CheckNameAvailabilityOutputInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<CheckNameAvailabilityOutputInner> clientResponse = checkNameAvailabilityDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) CheckNameAvailabilityInput(com.microsoft.azure.management.cdn.CheckNameAvailabilityInput) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Aggregations

CheckNameAvailabilityInput (com.microsoft.azure.management.cdn.CheckNameAvailabilityInput)1 ServiceResponse (com.microsoft.rest.ServiceResponse)1 ResponseBody (okhttp3.ResponseBody)1 Response (retrofit2.Response)1 Observable (rx.Observable)1