Search in sources :

Example 1 with CheckNameAvailability

use of com.microsoft.azure.management.servicebus.CheckNameAvailability in project azure-sdk-for-java by Azure.

the class NamespacesInner method checkNameAvailabilityMethodWithServiceResponseAsync.

/**
     * Check the give namespace name availability.
     *
     * @param name The Name to check the namespce name availability and The namespace name can contain only letters, numbers, and hyphens. The namespace must start with a letter, and it must end with a letter or number.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the CheckNameAvailabilityResultInner object
     */
public Observable<ServiceResponse<CheckNameAvailabilityResultInner>> checkNameAvailabilityMethodWithServiceResponseAsync(String name) {
    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 (name == null) {
        throw new IllegalArgumentException("Parameter name is required and cannot be null.");
    }
    CheckNameAvailability parameters = new CheckNameAvailability();
    parameters.withName(name);
    return service.checkNameAvailabilityMethod(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CheckNameAvailabilityResultInner>>>() {

        @Override
        public Observable<ServiceResponse<CheckNameAvailabilityResultInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<CheckNameAvailabilityResultInner> clientResponse = checkNameAvailabilityMethodDelegate(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) CheckNameAvailability(com.microsoft.azure.management.servicebus.CheckNameAvailability) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Aggregations

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