diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ComputeManagementClientImpl.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ComputeManagementClientImpl.java index bff9f747b1a..4f0e7eb94b5 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ComputeManagementClientImpl.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ComputeManagementClientImpl.java @@ -172,6 +172,19 @@ public VirtualMachineExtensionsInner virtualMachineExtensions() { return this.virtualMachineExtensions; } + /** + * The VirtualMachinesInner object to access its operations. + */ + private VirtualMachinesInner virtualMachines; + + /** + * Gets the VirtualMachinesInner object to access its operations. + * @return the VirtualMachinesInner object. + */ + public VirtualMachinesInner virtualMachines() { + return this.virtualMachines; + } + /** * The VirtualMachineImagesInner object to access its operations. */ @@ -224,19 +237,6 @@ public ImagesInner images() { return this.images; } - /** - * The VirtualMachinesInner object to access its operations. - */ - private VirtualMachinesInner virtualMachines; - - /** - * Gets the VirtualMachinesInner object to access its operations. - * @return the VirtualMachinesInner object. - */ - public VirtualMachinesInner virtualMachines() { - return this.virtualMachines; - } - /** * The VirtualMachineScaleSetsInner object to access its operations. */ @@ -405,11 +405,11 @@ protected void initialize() { this.availabilitySets = new AvailabilitySetsInner(restClient().retrofit(), this); this.virtualMachineExtensionImages = new VirtualMachineExtensionImagesInner(restClient().retrofit(), this); this.virtualMachineExtensions = new VirtualMachineExtensionsInner(restClient().retrofit(), this); + this.virtualMachines = new VirtualMachinesInner(restClient().retrofit(), this); this.virtualMachineImages = new VirtualMachineImagesInner(restClient().retrofit(), this); this.usages = new UsagesInner(restClient().retrofit(), this); this.virtualMachineSizes = new VirtualMachineSizesInner(restClient().retrofit(), this); this.images = new ImagesInner(restClient().retrofit(), this); - this.virtualMachines = new VirtualMachinesInner(restClient().retrofit(), this); this.virtualMachineScaleSets = new VirtualMachineScaleSetsInner(restClient().retrofit(), this); this.virtualMachineScaleSetExtensions = new VirtualMachineScaleSetExtensionsInner(restClient().retrofit(), this); this.virtualMachineScaleSetRollingUpgrades = new VirtualMachineScaleSetRollingUpgradesInner(restClient().retrofit(), this); diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineExtensionsInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineExtensionsInner.java index d305cd8be81..eaf7bcb2d6d 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineExtensionsInner.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineExtensionsInner.java @@ -22,6 +22,7 @@ import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.HTTP; +import retrofit2.http.PATCH; import retrofit2.http.Path; import retrofit2.http.PUT; import retrofit2.http.Query; @@ -63,6 +64,14 @@ interface VirtualMachineExtensionsService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}") Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("vmExtensionName") String vmExtensionName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineExtensionInner extensionParameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachineExtensions update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("vmExtensionName") String vmExtensionName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineExtensionUpdateInner extensionParameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachineExtensions beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("vmExtensionName") String vmExtensionName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineExtensionUpdateInner extensionParameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachineExtensions delete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions/{vmExtensionName}", method = "DELETE", hasBody = true) Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("vmExtensionName") String vmExtensionName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -81,7 +90,7 @@ interface VirtualMachineExtensionsService { * The operation to create or update the extension. * * @param resourceGroupName The name of the resource group. - * @param vmName The name of the virtual machine where the extension should be create or updated. + * @param vmName The name of the virtual machine where the extension should be created or updated. * @param vmExtensionName The name of the virtual machine extension. * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -97,7 +106,7 @@ public VirtualMachineExtensionInner createOrUpdate(String resourceGroupName, Str * The operation to create or update the extension. * * @param resourceGroupName The name of the resource group. - * @param vmName The name of the virtual machine where the extension should be create or updated. + * @param vmName The name of the virtual machine where the extension should be created or updated. * @param vmExtensionName The name of the virtual machine extension. * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -112,7 +121,7 @@ public ServiceFuture createOrUpdateAsync(String re * The operation to create or update the extension. * * @param resourceGroupName The name of the resource group. - * @param vmName The name of the virtual machine where the extension should be create or updated. + * @param vmName The name of the virtual machine where the extension should be created or updated. * @param vmExtensionName The name of the virtual machine extension. * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -131,7 +140,7 @@ public VirtualMachineExtensionInner call(ServiceResponse> createOrUpdateW * The operation to create or update the extension. * * @param resourceGroupName The name of the resource group. - * @param vmName The name of the virtual machine where the extension should be create or updated. + * @param vmName The name of the virtual machine where the extension should be created or updated. * @param vmExtensionName The name of the virtual machine extension. * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -179,7 +188,7 @@ public VirtualMachineExtensionInner beginCreateOrUpdate(String resourceGroupName * The operation to create or update the extension. * * @param resourceGroupName The name of the resource group. - * @param vmName The name of the virtual machine where the extension should be create or updated. + * @param vmName The name of the virtual machine where the extension should be created or updated. * @param vmExtensionName The name of the virtual machine extension. * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. @@ -194,7 +203,7 @@ public ServiceFuture beginCreateOrUpdateAsync(Stri * The operation to create or update the extension. * * @param resourceGroupName The name of the resource group. - * @param vmName The name of the virtual machine where the extension should be create or updated. + * @param vmName The name of the virtual machine where the extension should be created or updated. * @param vmExtensionName The name of the virtual machine extension. * @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation. * @throws IllegalArgumentException thrown if parameters fail the validation @@ -213,7 +222,7 @@ public VirtualMachineExtensionInner call(ServiceResponse beginCreateOrUpdateDelegat .build(response); } + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VirtualMachineExtensionInner object if successful. + */ + public VirtualMachineExtensionInner update(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionUpdateInner extensionParameters) { + return updateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).toBlocking().last().body(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionUpdateInner extensionParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters), serviceCallback); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionUpdateInner extensionParameters) { + return updateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).map(new Func1, VirtualMachineExtensionInner>() { + @Override + public VirtualMachineExtensionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionUpdateInner extensionParameters) { + 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 (vmExtensionName == null) { + throw new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) { + throw new IllegalArgumentException("Parameter extensionParameters is required and cannot be null."); + } + Validator.validate(extensionParameters); + final String apiVersion = "2017-12-01"; + Observable> observable = service.update(resourceGroupName, vmName, vmExtensionName, this.client.subscriptionId(), extensionParameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VirtualMachineExtensionInner object if successful. + */ + public VirtualMachineExtensionInner beginUpdate(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionUpdateInner extensionParameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).toBlocking().single().body(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionUpdateInner extensionParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters), serviceCallback); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineExtensionInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionUpdateInner extensionParameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).map(new Func1, VirtualMachineExtensionInner>() { + @Override + public VirtualMachineExtensionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine where the extension should be updated. + * @param vmExtensionName The name of the virtual machine extension. + * @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineExtensionInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionUpdateInner extensionParameters) { + 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 (vmExtensionName == null) { + throw new IllegalArgumentException("Parameter vmExtensionName 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 (extensionParameters == null) { + throw new IllegalArgumentException("Parameter extensionParameters is required and cannot be null."); + } + Validator.validate(extensionParameters); + final String apiVersion = "2017-12-01"; + return service.beginUpdate(resourceGroupName, vmName, vmExtensionName, this.client.subscriptionId(), extensionParameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * The operation to delete the extension. * diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachinesInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachinesInner.java index 78a4b7ddfcb..83d7664d18c 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachinesInner.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachinesInner.java @@ -67,6 +67,10 @@ public VirtualMachinesInner(Retrofit retrofit, ComputeManagementClientImpl clien * used by Retrofit to perform actually REST calls. */ interface VirtualMachinesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachines getExtensions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions") + Observable> getExtensions(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Query("$expand") String expand, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachines capture" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture") Observable> capture(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineCaptureParametersInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -197,6 +201,172 @@ interface VirtualMachinesService { } + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VirtualMachineExtensionsListResultInner object if successful. + */ + public VirtualMachineExtensionsListResultInner getExtensions(String resourceGroupName, String vmName) { + return getExtensionsWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().single().body(); + } + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getExtensionsAsync(String resourceGroupName, String vmName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getExtensionsWithServiceResponseAsync(resourceGroupName, vmName), serviceCallback); + } + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineExtensionsListResultInner object + */ + public Observable getExtensionsAsync(String resourceGroupName, String vmName) { + return getExtensionsWithServiceResponseAsync(resourceGroupName, vmName).map(new Func1, VirtualMachineExtensionsListResultInner>() { + @Override + public VirtualMachineExtensionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineExtensionsListResultInner object + */ + public Observable> getExtensionsWithServiceResponseAsync(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 = "2017-12-01"; + final String expand = null; + return service.getExtensions(resourceGroupName, vmName, this.client.subscriptionId(), expand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getExtensionsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VirtualMachineExtensionsListResultInner object if successful. + */ + public VirtualMachineExtensionsListResultInner getExtensions(String resourceGroupName, String vmName, String expand) { + return getExtensionsWithServiceResponseAsync(resourceGroupName, vmName, expand).toBlocking().single().body(); + } + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getExtensionsAsync(String resourceGroupName, String vmName, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getExtensionsWithServiceResponseAsync(resourceGroupName, vmName, expand), serviceCallback); + } + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineExtensionsListResultInner object + */ + public Observable getExtensionsAsync(String resourceGroupName, String vmName, String expand) { + return getExtensionsWithServiceResponseAsync(resourceGroupName, vmName, expand).map(new Func1, VirtualMachineExtensionsListResultInner>() { + @Override + public VirtualMachineExtensionsListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to get all extensions of a Virtual Machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineExtensionsListResultInner object + */ + public Observable> getExtensionsWithServiceResponseAsync(String resourceGroupName, String vmName, String expand) { + 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 = "2017-12-01"; + return service.getExtensions(resourceGroupName, vmName, this.client.subscriptionId(), expand, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getExtensionsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getExtensionsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. *