Search in sources :

Example 76 with TypeToken

use of com.google.common.reflect.TypeToken in project azure-sdk-for-java by Azure.

the class VirtualMachineScaleSetsInner method startWithServiceResponseAsync.

/**
     * 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 for the request
     */
public Observable<ServiceResponse<OperationStatusResponseInner>> startWithServiceResponseAsync(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.start(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 77 with TypeToken

use of com.google.common.reflect.TypeToken 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 78 with TypeToken

use of com.google.common.reflect.TypeToken in project azure-sdk-for-java by Azure.

the class VirtualMachineScaleSetsInner method restartWithServiceResponseAsync.

/**
     * 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 for the request
     */
public Observable<ServiceResponse<OperationStatusResponseInner>> restartWithServiceResponseAsync(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);
    }
    Observable<Response<ResponseBody>> observable = service.restart(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 79 with TypeToken

use of com.google.common.reflect.TypeToken in project azure-sdk-for-java by Azure.

the class VirtualMachineScaleSetsInner method startWithServiceResponseAsync.

/**
     * 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.
     * @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>> startWithServiceResponseAsync(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);
    }
    Observable<Response<ResponseBody>> observable = service.start(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 80 with TypeToken

use of com.google.common.reflect.TypeToken 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

TypeToken (com.google.common.reflect.TypeToken)135 Test (org.junit.Test)60 HttpResponse (co.cask.common.http.HttpResponse)26 URL (java.net.URL)24 ServiceResponse (com.microsoft.rest.ServiceResponse)22 Response (retrofit2.Response)22 BinaryEncoder (co.cask.cdap.common.io.BinaryEncoder)18 BinaryDecoder (co.cask.cdap.common.io.BinaryDecoder)17 PipedInputStream (java.io.PipedInputStream)17 PipedOutputStream (java.io.PipedOutputStream)17 ReflectionDatumReader (co.cask.cdap.internal.io.ReflectionDatumReader)16 List (java.util.List)16 Map (java.util.Map)11 ImmutableList (com.google.common.collect.ImmutableList)9 Type (java.lang.reflect.Type)9 AbstractViewTest (org.corfudb.runtime.view.AbstractViewTest)9 NotFoundException (co.cask.cdap.common.NotFoundException)8 VirtualMachineScaleSetVMInstanceIDs (com.microsoft.azure.management.compute.VirtualMachineScaleSetVMInstanceIDs)8 Gson (com.google.gson.Gson)7 JsonObject (com.google.gson.JsonObject)7