Search in sources :

Example 21 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 22 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)

Example 23 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'
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the ResourceNameAvailabilityInner object
     */
public Observable<ServiceResponse<ResourceNameAvailabilityInner>> checkNameAvailabilityWithServiceResponseAsync(String name, CheckNameResourceTypes type) {
    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";
    final Boolean isFqdn = null;
    ResourceNameAvailabilityRequest request = new ResourceNameAvailabilityRequest();
    request.withName(name);
    request.withType(type);
    request.withIsFqdn(null);
    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) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse)

Example 24 with Observable

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

the class BatchAccountsInner method regenerateKeyWithServiceResponseAsync.

/**
     * Regenerates the specified account key for the Batch account.
     *
     * @param resourceGroupName The name of the resource group that contains the Batch account.
     * @param accountName The name of the Batch account.
     * @param keyName The type of account key to regenerate. Possible values include: 'Primary', 'Secondary'
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the BatchAccountKeysInner object
     */
public Observable<ServiceResponse<BatchAccountKeysInner>> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String accountName, AccountKeyType keyName) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (accountName == null) {
        throw new IllegalArgumentException("Parameter accountName 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 (keyName == null) {
        throw new IllegalArgumentException("Parameter keyName is required and cannot be null.");
    }
    BatchAccountRegenerateKeyParameters parameters = new BatchAccountRegenerateKeyParameters();
    parameters.withKeyName(keyName);
    return service.regenerateKey(resourceGroupName, accountName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<BatchAccountKeysInner>>>() {

        @Override
        public Observable<ServiceResponse<BatchAccountKeysInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<BatchAccountKeysInner> clientResponse = regenerateKeyDelegate(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) BatchAccountRegenerateKeyParameters(com.microsoft.azure.management.batch.BatchAccountRegenerateKeyParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 25 with Observable

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

the class VirtualMachineScaleSetsInner method beginDeallocateWithServiceResponseAsync.

/**
     * Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
     *
     * @param resourceGroupName The name of the resource group.
     * @param vmScaleSetName The name of the VM scale set.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the OperationStatusResponseInner object
     */
public Observable<ServiceResponse<OperationStatusResponseInner>> beginDeallocateWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (vmScaleSetName == null) {
        throw new IllegalArgumentException("Parameter vmScaleSetName 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-04-30-preview";
    final List<String> instanceIds = null;
    VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs();
    vmInstanceIDs.withInstanceIds(null);
    return service.beginDeallocate(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<OperationStatusResponseInner>>>() {

        @Override
        public Observable<ServiceResponse<OperationStatusResponseInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<OperationStatusResponseInner> clientResponse = beginDeallocateDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : VirtualMachineScaleSetVMInstanceIDs(com.microsoft.azure.management.compute.VirtualMachineScaleSetVMInstanceIDs) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody) Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) ServiceResponse(com.microsoft.rest.ServiceResponse)

Aggregations

Observable (rx.Observable)311 ResponseBody (okhttp3.ResponseBody)119 Response (retrofit2.Response)111 ServiceResponse (com.microsoft.rest.ServiceResponse)108 Test (org.junit.Test)59 ArrayList (java.util.ArrayList)57 List (java.util.List)55 IOException (java.io.IOException)46 Subscription (rx.Subscription)34 Func1 (rx.functions.Func1)31 Map (java.util.Map)26 ByteBuf (io.netty.buffer.ByteBuf)24 TimeUnit (java.util.concurrent.TimeUnit)23 Schedulers (rx.schedulers.Schedulers)22 Collections (java.util.Collections)20 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)18 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)18 File (java.io.File)17 HashMap (java.util.HashMap)16 Subscriber (rx.Subscriber)15