Search in sources :

Example 1 with InstanceViewTypes

use of com.microsoft.azure.management.compute.InstanceViewTypes in project azure-sdk-for-java by Azure.

the class VirtualMachinesInner method getByResourceGroupWithServiceResponseAsync.

/**
     * Retrieves information about the model view or the instance view of a virtual machine.
     *
     * @param resourceGroupName The name of the resource group.
     * @param vmName The name of the virtual machine.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the VirtualMachineInner object
     */
public Observable<ServiceResponse<VirtualMachineInner>> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String vmName) {
    if (resourceGroupName == null) {
        throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
    }
    if (vmName == null) {
        throw new IllegalArgumentException("Parameter vmName 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 InstanceViewTypes expand = null;
    return service.getByResourceGroup(resourceGroupName, vmName, this.client.subscriptionId(), expand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()).flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<VirtualMachineInner>>>() {

        @Override
        public Observable<ServiceResponse<VirtualMachineInner>> call(Response<ResponseBody> response) {
            try {
                ServiceResponse<VirtualMachineInner> clientResponse = getByResourceGroupDelegate(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) InstanceViewTypes(com.microsoft.azure.management.compute.InstanceViewTypes) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Aggregations

InstanceViewTypes (com.microsoft.azure.management.compute.InstanceViewTypes)1 ServiceResponse (com.microsoft.rest.ServiceResponse)1 ResponseBody (okhttp3.ResponseBody)1 Response (retrofit2.Response)1 Observable (rx.Observable)1