Search in sources :

Example 61 with Response

use of retrofit2.Response in project azure-sdk-for-java by Azure.

the class VirtualMachineScaleSetsInner method beginStartWithServiceResponseAsync.

/**
     * Starts one or more virtual machines in a VM scale set.
     *
     * @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>> beginStartWithServiceResponseAsync(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.beginStart(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 = beginStartDelegate(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)

Example 62 with Response

use of retrofit2.Response in project azure-sdk-for-java by Azure.

the class VirtualMachineScaleSetsInner method beginRestartWithServiceResponseAsync.

/**
     * Restarts one or more virtual machines in a VM scale set.
     *
     * @param resourceGroupName The name of the resource group.
     * @param vmScaleSetName The name of the VM scale set.
     * @param instanceIds The virtual machine scale set instance ids.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the OperationStatusResponseInner object
     */
public Observable<ServiceResponse<OperationStatusResponseInner>> beginRestartWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) {
    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.");
    }
    Validator.validate(instanceIds);
    final String apiVersion = "2016-04-30-preview";
    VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null;
    if (instanceIds != null) {
        vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs();
        vmInstanceIDs.withInstanceIds(instanceIds);
    }
    return service.beginRestart(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 = beginRestartDelegate(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) VirtualMachineScaleSetVMInstanceIDs(com.microsoft.azure.management.compute.VirtualMachineScaleSetVMInstanceIDs) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 63 with Response

use of retrofit2.Response in project azure-sdk-for-java by Azure.

the class NetworkWatchersInner method getFlowLogStatusWithServiceResponseAsync.

/**
     * Queries status of flow log on a specified resource.
     *
     * @param resourceGroupName The name of the network watcher resource group.
     * @param networkWatcherName The name of the network watcher resource.
     * @param targetResourceId The target resource where getting the flow logging status.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable for the request
     */
public Observable<ServiceResponse<FlowLogInformationInner>> getFlowLogStatusWithServiceResponseAsync(String resourceGroupName, String networkWatcherName, String targetResourceId) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (networkWatcherName == null) {
        throw new IllegalArgumentException("Parameter networkWatcherName 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 (targetResourceId == null) {
        throw new IllegalArgumentException("Parameter targetResourceId is required and cannot be null.");
    }
    final String apiVersion = "2016-12-01";
    FlowLogStatusParameters parameters = new FlowLogStatusParameters();
    parameters.withTargetResourceId(targetResourceId);
    Observable<Response<ResponseBody>> observable = service.getFlowLogStatus(resourceGroupName, networkWatcherName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<FlowLogInformationInner>() {
    }.getType());
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) TypeToken(com.google.common.reflect.TypeToken) FlowLogStatusParameters(com.microsoft.azure.management.network.FlowLogStatusParameters)

Example 64 with Response

use of retrofit2.Response in project azure-sdk-for-java by Azure.

the class VirtualNetworkGatewaysInner method generatevpnclientpackageWithServiceResponseAsync.

/**
     * Generates VPN client package for P2S client of the virtual network gateway in the specified resource group.
     *
     * @param resourceGroupName The name of the resource group.
     * @param virtualNetworkGatewayName The name of the virtual network gateway.
     * @param processorArchitecture VPN client Processor Architecture. Possible values are: 'AMD64' and 'X86'. Possible values include: 'Amd64', 'X86'
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the String object
     */
public Observable<ServiceResponse<String>> generatevpnclientpackageWithServiceResponseAsync(String resourceGroupName, String virtualNetworkGatewayName, ProcessorArchitecture processorArchitecture) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (virtualNetworkGatewayName == null) {
        throw new IllegalArgumentException("Parameter virtualNetworkGatewayName 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 (processorArchitecture == null) {
        throw new IllegalArgumentException("Parameter processorArchitecture is required and cannot be null.");
    }
    final String apiVersion = "2016-12-01";
    VpnClientParameters parameters = new VpnClientParameters();
    parameters.withProcessorArchitecture(processorArchitecture);
    return service.generatevpnclientpackage(resourceGroupName, virtualNetworkGatewayName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<String>>>() {

        @Override
        public Observable<ServiceResponse<String>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<String> clientResponse = generatevpnclientpackageDelegate(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) VpnClientParameters(com.microsoft.azure.management.network.VpnClientParameters) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 65 with Response

use of retrofit2.Response in project azure-sdk-for-java by Azure.

the class NetworkWatchersInner method getTopologyWithServiceResponseAsync.

/**
     * Gets the current network topology by resource group.
     *
     * @param resourceGroupName The name of the resource group.
     * @param networkWatcherName The name of the network watcher.
     * @param targetResourceGroupName The name of the target resource group to perform topology on.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the TopologyInner object
     */
public Observable<ServiceResponse<TopologyInner>> getTopologyWithServiceResponseAsync(String resourceGroupName, String networkWatcherName, String targetResourceGroupName) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (networkWatcherName == null) {
        throw new IllegalArgumentException("Parameter networkWatcherName 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 (targetResourceGroupName == null) {
        throw new IllegalArgumentException("Parameter targetResourceGroupName is required and cannot be null.");
    }
    final String apiVersion = "2016-12-01";
    TopologyParameters parameters = new TopologyParameters();
    parameters.withTargetResourceGroupName(targetResourceGroupName);
    return service.getTopology(resourceGroupName, networkWatcherName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), parameters, this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<TopologyInner>>>() {

        @Override
        public Observable<ServiceResponse<TopologyInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<TopologyInner> clientResponse = getTopologyDelegate(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) Observable(rx.Observable) TopologyParameters(com.microsoft.azure.management.network.TopologyParameters) ResponseBody(okhttp3.ResponseBody)

Aggregations

Response (okhttp3.Response)1402 Request (okhttp3.Request)1000 IOException (java.io.IOException)548 Test (org.junit.Test)456 Response (retrofit2.Response)337 OkHttpClient (okhttp3.OkHttpClient)294 Call (okhttp3.Call)274 ResponseBody (okhttp3.ResponseBody)273 ServiceResponse (com.microsoft.rest.ServiceResponse)179 MockResponse (okhttp3.mockwebserver.MockResponse)175 RequestBody (okhttp3.RequestBody)145 Callback (okhttp3.Callback)123 List (java.util.List)120 Observable (rx.Observable)114 Retrofit (retrofit2.Retrofit)100 HttpUrl (okhttp3.HttpUrl)89 AtomicReference (java.util.concurrent.atomic.AtomicReference)88 ArrayList (java.util.ArrayList)87 JSONObject (org.json.JSONObject)86 ANResponse (com.androidnetworking.common.ANResponse)84