Search in sources :

Example 51 with Observable

use of rx.Observable in project azure-sdk-for-java by Azure.

the class KeyVaultClientImpl method updateCertificateWithServiceResponseAsync.

/**
     * Updates the specified attributes associated with the given certificate.
     *
     * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
     * @param certificateName The name of the certificate in the given key vault.
     * @param certificateVersion The version of the certificate.
     * @param certificatePolicy The management policy for the certificate.
     * @param certificateAttributes The attributes of the certificate (optional).
     * @param tags Application specific metadata in the form of key-value pairs.
     * @return the observable to the CertificateBundle object
     */
public Observable<ServiceResponse<CertificateBundle>> updateCertificateWithServiceResponseAsync(String vaultBaseUrl, String certificateName, String certificateVersion, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags) {
    if (vaultBaseUrl == null) {
        throw new IllegalArgumentException("Parameter vaultBaseUrl is required and cannot be null.");
    }
    if (certificateName == null) {
        throw new IllegalArgumentException("Parameter certificateName is required and cannot be null.");
    }
    if (certificateVersion == null) {
        throw new IllegalArgumentException("Parameter certificateVersion is required and cannot be null.");
    }
    if (this.apiVersion() == null) {
        throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
    }
    Validator.validate(certificatePolicy);
    Validator.validate(certificateAttributes);
    Validator.validate(tags);
    CertificateUpdateParameters parameters = new CertificateUpdateParameters();
    parameters.withCertificatePolicy(certificatePolicy);
    parameters.withCertificateAttributes(certificateAttributes);
    parameters.withTags(tags);
    String parameterizedHost = Joiner.on(", ").join("{vaultBaseUrl}", vaultBaseUrl);
    return service.updateCertificate(certificateName, certificateVersion, this.apiVersion(), this.acceptLanguage(), parameters, parameterizedHost, this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<CertificateBundle>>>() {

        @Override
        public Observable<ServiceResponse<CertificateBundle>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<CertificateBundle> clientResponse = updateCertificateDelegate(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) CertificateBundle(com.microsoft.azure.keyvault.models.CertificateBundle) Observable(rx.Observable) CertificateUpdateParameters(com.microsoft.azure.keyvault.models.CertificateUpdateParameters) ResponseBody(okhttp3.ResponseBody)

Example 52 with Observable

use of rx.Observable in project azure-sdk-for-java by Azure.

the class WebAppsInner method listPublishingProfileXmlWithSecretsSlotWithServiceResponseAsync.

/**
     * Gets the publishing profile for an app (or deployment slot, if specified).
     * Gets the publishing profile for an app (or deployment slot, if specified).
     *
     * @param resourceGroupName Name of the resource group to which the resource belongs.
     * @param name Name of the app.
     * @param slot Name of the deployment slot. If a slot is not specified, the API will get the publishing profile for the production slot.
     * @param format Name of the format. Valid values are:
      FileZilla3
      WebDeploy -- default
      Ftp. Possible values include: 'FileZilla3', 'WebDeploy', 'Ftp'
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the InputStream object
     */
public Observable<ServiceResponse<InputStream>> listPublishingProfileXmlWithSecretsSlotWithServiceResponseAsync(String resourceGroupName, String name, String slot, PublishingProfileFormat format) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (name == null) {
        throw new IllegalArgumentException("Parameter name is required and cannot be null.");
    }
    if (slot == null) {
        throw new IllegalArgumentException("Parameter slot 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 = "2016-08-01";
    CsmPublishingProfileOptions publishingProfileOptions = new CsmPublishingProfileOptions();
    publishingProfileOptions.withFormat(format);
    return service.listPublishingProfileXmlWithSecretsSlot(resourceGroupName, name, slot, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), publishingProfileOptions, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<InputStream>>>() {

        @Override
        public Observable<ServiceResponse<InputStream>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<InputStream> clientResponse = listPublishingProfileXmlWithSecretsSlotDelegate(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) InputStream(java.io.InputStream) Observable(rx.Observable) CsmPublishingProfileOptions(com.microsoft.azure.management.appservice.CsmPublishingProfileOptions) ResponseBody(okhttp3.ResponseBody)

Example 53 with Observable

use of rx.Observable in project azure-sdk-for-java by Azure.

the class WebAppsInner method listPublishingProfileXmlWithSecretsWithServiceResponseAsync.

/**
     * Gets the publishing profile for an app (or deployment slot, if specified).
     * Gets the publishing profile for an app (or deployment slot, if specified).
     *
     * @param resourceGroupName Name of the resource group to which the resource belongs.
     * @param name Name of the app.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the InputStream object
     */
public Observable<ServiceResponse<InputStream>> listPublishingProfileXmlWithSecretsWithServiceResponseAsync(String resourceGroupName, String name) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    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 = "2016-08-01";
    final PublishingProfileFormat format = null;
    CsmPublishingProfileOptions publishingProfileOptions = new CsmPublishingProfileOptions();
    publishingProfileOptions.withFormat(null);
    return service.listPublishingProfileXmlWithSecrets(resourceGroupName, name, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), publishingProfileOptions, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<InputStream>>>() {

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

Example 54 with Observable

use of rx.Observable 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 55 with Observable

use of rx.Observable in project azure-sdk-for-java by Azure.

the class WebSiteManagementClientImpl method listGeoRegionsSinglePageAsync.

/**
     * Get a list of available geographical regions.
     * Get a list of available geographical regions.
     *
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the PagedList&lt;GeoRegionInner&gt; object wrapped in {@link ServiceResponse} if successful.
     */
public Observable<ServiceResponse<Page<GeoRegionInner>>> listGeoRegionsSinglePageAsync() {
    if (this.subscriptionId() == null) {
        throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
    }
    final String apiVersion = "2016-03-01";
    final SkuName sku = null;
    final Boolean linuxWorkersEnabled = null;
    return service.listGeoRegions(this.subscriptionId(), sku, linuxWorkersEnabled, apiVersion, this.acceptLanguage(), this.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Page<GeoRegionInner>>>>() {

        @Override
        public Observable<ServiceResponse<Page<GeoRegionInner>>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<PageImpl<GeoRegionInner>> result = listGeoRegionsDelegate(response);
                return Observable.just(new ServiceResponse<Page<GeoRegionInner>>(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) SkuName(com.microsoft.azure.management.appservice.SkuName)

Aggregations

Observable (rx.Observable)210 ResponseBody (okhttp3.ResponseBody)97 Response (retrofit2.Response)93 ServiceResponse (com.microsoft.rest.ServiceResponse)92 ArrayList (java.util.ArrayList)39 Test (org.junit.Test)34 List (java.util.List)33 Func1 (rx.functions.Func1)26 IOException (java.io.IOException)16 Subscription (rx.Subscription)14 Action1 (rx.functions.Action1)13 Context (android.content.Context)12 Schedulers (rx.schedulers.Schedulers)12 ByteBuf (io.netty.buffer.ByteBuf)10 NonNull (android.support.annotation.NonNull)9 Collections (java.util.Collections)9 Intent (android.content.Intent)8 SharedPreferences (android.content.SharedPreferences)8 UnsupportedEncodingException (java.io.UnsupportedEncodingException)8 PreferenceManager (android.preference.PreferenceManager)7