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);
}
}
});
}
Aggregations