Search in sources :

Example 1 with RegistryNameCheckRequest

use of com.microsoft.azure.management.containerregistry.RegistryNameCheckRequest in project azure-sdk-for-java by Azure.

the class RegistriesInner method checkNameAvailabilityWithServiceResponseAsync.

/**
     * Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally unique, and between 5 and 60 characters in length.
     *
     * @param name The name of the container registry.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the RegistryNameStatusInner object
     */
public Observable<ServiceResponse<RegistryNameStatusInner>> checkNameAvailabilityWithServiceResponseAsync(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.");
    }
    RegistryNameCheckRequest registryNameCheckRequest = new RegistryNameCheckRequest();
    registryNameCheckRequest.withName(name);
    return service.checkNameAvailability(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), registryNameCheckRequest, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<RegistryNameStatusInner>>>() {

        @Override
        public Observable<ServiceResponse<RegistryNameStatusInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<RegistryNameStatusInner> 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) RegistryNameCheckRequest(com.microsoft.azure.management.containerregistry.RegistryNameCheckRequest) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Aggregations

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