Search in sources :

Example 1 with ResourceNameAvailabilityRequest

use of com.microsoft.azure.management.appservice.ResourceNameAvailabilityRequest in project azure-sdk-for-java by Azure.

the class WebSiteManagementClientImpl method checkNameAvailabilityWithServiceResponseAsync.

/**
     * Check if a resource name is available.
     * Check if a resource name is available.
     *
     * @param name Resource name to verify.
     * @param type Resource type used for verification. Possible values include: 'Site', 'Slot', 'HostingEnvironment'
     * @param isFqdn Is fully qualified domain name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the ResourceNameAvailabilityInner object
     */
public Observable<ServiceResponse<ResourceNameAvailabilityInner>> checkNameAvailabilityWithServiceResponseAsync(String name, CheckNameResourceTypes type, Boolean isFqdn) {
    if (this.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
    }
    if (name == null) {
        throw new IllegalArgumentException("Parameter name is required and cannot be null.");
    }
    if (type == null) {
        throw new IllegalArgumentException("Parameter type is required and cannot be null.");
    }
    final String apiVersion = "2016-03-01";
    ResourceNameAvailabilityRequest request = new ResourceNameAvailabilityRequest();
    request.withName(name);
    request.withType(type);
    request.withIsFqdn(isFqdn);
    return service.checkNameAvailability(this.subscriptionId(), apiVersion, this.acceptLanguage(), request, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ResourceNameAvailabilityInner>>>() {

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

Example 2 with ResourceNameAvailabilityRequest

use of com.microsoft.azure.management.appservice.ResourceNameAvailabilityRequest in project azure-sdk-for-java by Azure.

the class WebSiteManagementClientImpl method checkNameAvailabilityWithServiceResponseAsync.

/**
     * Check if a resource name is available.
     * Check if a resource name is available.
     *
     * @param name Resource name to verify.
     * @param type Resource type used for verification. Possible values include: 'Site', 'Slot', 'HostingEnvironment'
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the ResourceNameAvailabilityInner object
     */
public Observable<ServiceResponse<ResourceNameAvailabilityInner>> checkNameAvailabilityWithServiceResponseAsync(String name, CheckNameResourceTypes type) {
    if (this.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
    }
    if (name == null) {
        throw new IllegalArgumentException("Parameter name is required and cannot be null.");
    }
    if (type == null) {
        throw new IllegalArgumentException("Parameter type is required and cannot be null.");
    }
    final String apiVersion = "2016-03-01";
    final Boolean isFqdn = null;
    ResourceNameAvailabilityRequest request = new ResourceNameAvailabilityRequest();
    request.withName(name);
    request.withType(type);
    request.withIsFqdn(null);
    return service.checkNameAvailability(this.subscriptionId(), apiVersion, this.acceptLanguage(), request, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<ResourceNameAvailabilityInner>>>() {

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

Aggregations

ResourceNameAvailabilityRequest (com.microsoft.azure.management.appservice.ResourceNameAvailabilityRequest)2 ServiceResponse (com.microsoft.rest.ServiceResponse)2 ResponseBody (okhttp3.ResponseBody)2 Response (retrofit2.Response)2 Observable (rx.Observable)2