Search in sources :

Example 1 with CustomDomainParameters

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

the class CustomDomainsInner method beginCreateWithServiceResponseAsync.

/**
     * Creates a new custom domain within an endpoint.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param profileName Name of the CDN profile which is unique within the resource group.
     * @param endpointName Name of the endpoint under the profile which is unique globally.
     * @param customDomainName Name of the custom domain within an endpoint.
     * @param hostName The host name of the custom domain. Must be a domain name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the CustomDomainInner object
     */
public Observable<ServiceResponse<CustomDomainInner>> beginCreateWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName, String hostName) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (profileName == null) {
        throw new IllegalArgumentException("Parameter profileName is required and cannot be null.");
    }
    if (endpointName == null) {
        throw new IllegalArgumentException("Parameter endpointName is required and cannot be null.");
    }
    if (customDomainName == null) {
        throw new IllegalArgumentException("Parameter customDomainName is required and cannot be null.");
    }
    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 (hostName == null) {
        throw new IllegalArgumentException("Parameter hostName is required and cannot be null.");
    }
    CustomDomainParameters customDomainProperties = new CustomDomainParameters();
    customDomainProperties.withHostName(hostName);
    return service.beginCreate(resourceGroupName, profileName, endpointName, customDomainName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), customDomainProperties, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CustomDomainInner>>>() {

        @Override
        public Observable<ServiceResponse<CustomDomainInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<CustomDomainInner> clientResponse = beginCreateDelegate(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) CustomDomainParameters(com.microsoft.azure.management.cdn.CustomDomainParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 2 with CustomDomainParameters

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

the class CustomDomainsInner method createWithServiceResponseAsync.

/**
     * Creates a new custom domain within an endpoint.
     *
     * @param resourceGroupName Name of the Resource group within the Azure subscription.
     * @param profileName Name of the CDN profile which is unique within the resource group.
     * @param endpointName Name of the endpoint under the profile which is unique globally.
     * @param customDomainName Name of the custom domain within an endpoint.
     * @param hostName The host name of the custom domain. Must be a domain name.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable for the request
     */
public Observable<ServiceResponse<CustomDomainInner>> createWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, String customDomainName, String hostName) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (profileName == null) {
        throw new IllegalArgumentException("Parameter profileName is required and cannot be null.");
    }
    if (endpointName == null) {
        throw new IllegalArgumentException("Parameter endpointName is required and cannot be null.");
    }
    if (customDomainName == null) {
        throw new IllegalArgumentException("Parameter customDomainName is required and cannot be null.");
    }
    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 (hostName == null) {
        throw new IllegalArgumentException("Parameter hostName is required and cannot be null.");
    }
    CustomDomainParameters customDomainProperties = new CustomDomainParameters();
    customDomainProperties.withHostName(hostName);
    Observable<Response<ResponseBody>> observable = service.create(resourceGroupName, profileName, endpointName, customDomainName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), customDomainProperties, this.client.userAgent());
    return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<CustomDomainInner>() {
    }.getType());
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) TypeToken(com.google.common.reflect.TypeToken) CustomDomainParameters(com.microsoft.azure.management.cdn.CustomDomainParameters)

Aggregations

CustomDomainParameters (com.microsoft.azure.management.cdn.CustomDomainParameters)2 ServiceResponse (com.microsoft.rest.ServiceResponse)2 Response (retrofit2.Response)2 TypeToken (com.google.common.reflect.TypeToken)1 ResponseBody (okhttp3.ResponseBody)1 Observable (rx.Observable)1