Search in sources :

Example 91 with ServiceResponse

use of com.microsoft.rest.ServiceResponse 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)

Example 92 with ServiceResponse

use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.

the class VirtualMachineScaleSetsInner method powerOffWithServiceResponseAsync.

/**
     * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges.
     *
     * @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 for the request
     */
public Observable<ServiceResponse<OperationStatusResponseInner>> powerOffWithServiceResponseAsync(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 String instanceIdsConverted = null;
    VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs();
    vmInstanceIDs.withInstanceIds(null);
    Observable<Response<ResponseBody>> observable = service.powerOff(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent());
    return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<OperationStatusResponseInner>() {
    }.getType());
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) VirtualMachineScaleSetVMInstanceIDs(com.microsoft.azure.management.compute.VirtualMachineScaleSetVMInstanceIDs) TypeToken(com.google.common.reflect.TypeToken)

Example 93 with ServiceResponse

use of com.microsoft.rest.ServiceResponse 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.
     * @throws IllegalArgumentException thrown if parameters fail the validation
     * @return the observable to the OperationStatusResponseInner object
     */
public Observable<ServiceResponse<OperationStatusResponseInner>> beginRestartWithServiceResponseAsync(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.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 : 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 94 with ServiceResponse

use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.

the class VirtualMachineScaleSetsInner method beginDeleteInstancesWithServiceResponseAsync.

/**
     * Deletes 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>> beginDeleteInstancesWithServiceResponseAsync(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.");
    }
    if (instanceIds == null) {
        throw new IllegalArgumentException("Parameter instanceIds is required and cannot be null.");
    }
    Validator.validate(instanceIds);
    final String apiVersion = "2016-04-30-preview";
    VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs();
    vmInstanceIDs.withInstanceIds(instanceIds);
    return service.beginDeleteInstances(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 = beginDeleteInstancesDelegate(response);
                return Observable.just(clientResponse);
            } catch (Throwable t) {
                return Observable.error(t);
            }
        }
    });
}
Also used : Response(retrofit2.Response) ServiceResponse(com.microsoft.rest.ServiceResponse) VirtualMachineScaleSetVMInstanceRequiredIDs(com.microsoft.azure.management.compute.VirtualMachineScaleSetVMInstanceRequiredIDs) ServiceResponse(com.microsoft.rest.ServiceResponse) Observable(rx.Observable) ResponseBody(okhttp3.ResponseBody)

Example 95 with ServiceResponse

use of com.microsoft.rest.ServiceResponse in project azure-sdk-for-java by Azure.

the class VirtualMachineScaleSetsInner method beginPowerOffWithServiceResponseAsync.

/**
     * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges.
     *
     * @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>> beginPowerOffWithServiceResponseAsync(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.beginPowerOff(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 = beginPowerOffDelegate(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

ServiceResponse (com.microsoft.rest.ServiceResponse)114 Response (retrofit2.Response)114 ResponseBody (okhttp3.ResponseBody)92 Observable (rx.Observable)92 TypeToken (com.google.common.reflect.TypeToken)22 VirtualMachineScaleSetVMInstanceIDs (com.microsoft.azure.management.compute.VirtualMachineScaleSetVMInstanceIDs)16 KeyBundle (com.microsoft.azure.keyvault.models.KeyBundle)7 CertificateBundle (com.microsoft.azure.keyvault.models.CertificateBundle)6 RegenerateKeysParameters (com.microsoft.azure.management.servicebus.RegenerateKeysParameters)6 CertificateAttributes (com.microsoft.azure.keyvault.models.CertificateAttributes)4 IssuerBundle (com.microsoft.azure.keyvault.models.IssuerBundle)4 KeyOperationResult (com.microsoft.azure.keyvault.models.KeyOperationResult)4 SecretBundle (com.microsoft.azure.keyvault.models.SecretBundle)4 CsmPublishingProfileOptions (com.microsoft.azure.management.appservice.CsmPublishingProfileOptions)4 FailoverPolicies (com.microsoft.azure.management.documentdb.FailoverPolicies)4 RoleAssignmentCreateParameters (com.microsoft.azure.management.graphrbac.RoleAssignmentCreateParameters)4 InputStream (java.io.InputStream)4 Page (com.microsoft.azure.Page)3 CertificateOperation (com.microsoft.azure.keyvault.models.CertificateOperation)3 CertificatePolicy (com.microsoft.azure.keyvault.models.CertificatePolicy)3