Search in sources :

Example 1 with TopLevelDomainAgreementOption

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

the class TopLevelDomainsInner method listAgreementsSinglePageAsync.

/**
     * Gets all legal agreements that user needs to accept before purchasing a domain.
     * Gets all legal agreements that user needs to accept before purchasing a domain.
     *
     * @param name Name of the top-level domain.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList<TldLegalAgreementInner> object wrapped in {@link ServiceResponse} if successful.
     */
public Observable<ServiceResponse<Page<TldLegalAgreementInner>>> listAgreementsSinglePageAsync(final String name) {
    if (name == null) {
        throw new IllegalArgumentException("Parameter name is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    final String apiVersion = "2015-04-01";
    final Boolean includePrivacy = null;
    TopLevelDomainAgreementOption agreementOption = new TopLevelDomainAgreementOption();
    agreementOption.withIncludePrivacy(null);
    return service.listAgreements(name, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), agreementOption, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<TldLegalAgreementInner>>>>() {

        @Override
        public Observable<ServiceResponse<Page<TldLegalAgreementInner>>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<PageImpl<TldLegalAgreementInner>> result = listAgreementsDelegate(response);
                return Observable.just(new ServiceResponse<Page<TldLegalAgreementInner>>(result.body(), result.response()));
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Page(com.microsoft.azure.Page) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) TopLevelDomainAgreementOption(com.microsoft.azure.management.appservice.TopLevelDomainAgreementOption)

Example 2 with TopLevelDomainAgreementOption

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

the class TopLevelDomainsInner method listAgreementsSinglePageAsync.

/**
     * Gets all legal agreements that user needs to accept before purchasing a domain.
     * Gets all legal agreements that user needs to accept before purchasing a domain.
     *
    ServiceResponse<PageImpl<TldLegalAgreementInner>> * @param name Name of the top-level domain.
    ServiceResponse<PageImpl<TldLegalAgreementInner>> * @param includePrivacy If &lt;code&gt;true&lt;/code&gt;, then the list of agreements will include agreements for domain privacy as well; otherwise, &lt;code&gt;false&lt;/code&gt;.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;TldLegalAgreementInner&gt; object wrapped in {@link ServiceResponse} if successful.
     */
public Observable<ServiceResponse<Page<TldLegalAgreementInner>>> listAgreementsSinglePageAsync(final String name, final Boolean includePrivacy) {
    if (name == null) {
        throw new IllegalArgumentException("Parameter name is required and cannot be null.");
    }
    if (this.client.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
    }
    final String apiVersion = "2015-04-01";
    TopLevelDomainAgreementOption agreementOption = new TopLevelDomainAgreementOption();
    agreementOption.withIncludePrivacy(includePrivacy);
    return service.listAgreements(name, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), agreementOption, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<TldLegalAgreementInner>>>>() {

        @Override
        public Observable<ServiceResponse<Page<TldLegalAgreementInner>>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<PageImpl<TldLegalAgreementInner>> result = listAgreementsDelegate(response);
                return Observable.just(new ServiceResponse<Page<TldLegalAgreementInner>>(result.body(), result.response()));
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Page(com.microsoft.azure.Page) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse) TopLevelDomainAgreementOption(com.microsoft.azure.management.appservice.TopLevelDomainAgreementOption)

Aggregations

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