Search in sources :

Example 1 with VirtualMachineScaleSetVMInstanceRequiredIDs

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

the class VirtualMachineScaleSetsInner method beginUpdateInstancesWithServiceResponseAsync.

/**
     * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model.
     *
     * @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>> beginUpdateInstancesWithServiceResponseAsync(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.beginUpdateInstances(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 = beginUpdateInstancesDelegate(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 2 with VirtualMachineScaleSetVMInstanceRequiredIDs

use of com.microsoft.azure.management.compute.VirtualMachineScaleSetVMInstanceRequiredIDs 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 3 with VirtualMachineScaleSetVMInstanceRequiredIDs

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

the class VirtualMachineScaleSetsInner method updateInstancesWithServiceResponseAsync.

/**
     * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model.
     *
     * @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 for the request
     */
public Observable<ServiceResponse<OperationStatusResponseInner>> updateInstancesWithServiceResponseAsync(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);
    Observable<Response<ResponseBody>> observable = service.updateInstances(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) VirtualMachineScaleSetVMInstanceRequiredIDs(com.microsoft.azure.management.compute.VirtualMachineScaleSetVMInstanceRequiredIDs) TypeToken(com.google.common.reflect.TypeToken)

Example 4 with VirtualMachineScaleSetVMInstanceRequiredIDs

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

the class VirtualMachineScaleSetsInner method deleteInstancesWithServiceResponseAsync.

/**
     * 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 for the request
     */
public Observable<ServiceResponse<OperationStatusResponseInner>> deleteInstancesWithServiceResponseAsync(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);
    Observable<Response<ResponseBody>> observable = service.deleteInstances(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) VirtualMachineScaleSetVMInstanceRequiredIDs(com.microsoft.azure.management.compute.VirtualMachineScaleSetVMInstanceRequiredIDs) TypeToken(com.google.common.reflect.TypeToken)

Aggregations

VirtualMachineScaleSetVMInstanceRequiredIDs (com.microsoft.azure.management.compute.VirtualMachineScaleSetVMInstanceRequiredIDs)4 ServiceResponse (com.microsoft.rest.ServiceResponse)4 Response (retrofit2.Response)4 TypeToken (com.google.common.reflect.TypeToken)2 ResponseBody (okhttp3.ResponseBody)2 Observable (rx.Observable)2