diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AccessLevel.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AccessLevel.java index 47876604914..c2dbf143ca9 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AccessLevel.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/AccessLevel.java @@ -8,34 +8,46 @@ package com.microsoft.azure.management.compute; -import java.util.Collection; import com.fasterxml.jackson.annotation.JsonCreator; -import com.microsoft.rest.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonValue; /** * Defines values for AccessLevel. */ -public final class AccessLevel extends ExpandableStringEnum { - /** Static value None for AccessLevel. */ - public static final AccessLevel NONE = fromString("None"); +public enum AccessLevel { + /** Enum value None. */ + NONE("None"), - /** Static value Read for AccessLevel. */ - public static final AccessLevel READ = fromString("Read"); + /** Enum value Read. */ + READ("Read"); + + /** The actual serialized value for a AccessLevel instance. */ + private String value; + + AccessLevel(String value) { + this.value = value; + } /** - * Creates or finds a AccessLevel from its string representation. - * @param name a name to look for - * @return the corresponding AccessLevel + * Parses a serialized value to a AccessLevel instance. + * + * @param value the serialized value to parse. + * @return the parsed AccessLevel object, or null if unable to parse. */ @JsonCreator - public static AccessLevel fromString(String name) { - return fromString(name, AccessLevel.class); + public static AccessLevel fromString(String value) { + AccessLevel[] items = AccessLevel.values(); + for (AccessLevel item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; } - /** - * @return known AccessLevel values - */ - public static Collection values() { - return values(AccessLevel.class); + @JsonValue + @Override + public String toString() { + return this.value; } } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/CreationData.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/CreationData.java index 3a4a97be686..58edcd359d7 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/CreationData.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/CreationData.java @@ -16,8 +16,7 @@ public class CreationData { /** * This enumerates the possible sources of a disk's creation. Possible - * values include: 'Empty', 'Attach', 'FromImage', 'Import', 'Copy', - * 'Restore'. + * values include: 'Empty', 'Attach', 'FromImage', 'Import', 'Copy'. */ @JsonProperty(value = "createOption", required = true) private DiskCreateOption createOption; diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/DiskCreateOption.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/DiskCreateOption.java index 98c18c3d144..903fd7cbca9 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/DiskCreateOption.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/DiskCreateOption.java @@ -8,46 +8,55 @@ package com.microsoft.azure.management.compute; -import java.util.Collection; import com.fasterxml.jackson.annotation.JsonCreator; -import com.microsoft.rest.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonValue; /** * Defines values for DiskCreateOption. */ -public final class DiskCreateOption extends ExpandableStringEnum { - /** Static value Empty for DiskCreateOption. */ - public static final DiskCreateOption EMPTY = fromString("Empty"); +public enum DiskCreateOption { + /** Enum value Empty. */ + EMPTY("Empty"), - /** Static value Attach for DiskCreateOption. */ - public static final DiskCreateOption ATTACH = fromString("Attach"); + /** Enum value Attach. */ + ATTACH("Attach"), - /** Static value FromImage for DiskCreateOption. */ - public static final DiskCreateOption FROM_IMAGE = fromString("FromImage"); + /** Enum value FromImage. */ + FROM_IMAGE("FromImage"), - /** Static value Import for DiskCreateOption. */ - public static final DiskCreateOption IMPORT = fromString("Import"); + /** Enum value Import. */ + IMPORT("Import"), - /** Static value Copy for DiskCreateOption. */ - public static final DiskCreateOption COPY = fromString("Copy"); + /** Enum value Copy. */ + COPY("Copy"); - /** Static value Restore for DiskCreateOption. */ - public static final DiskCreateOption RESTORE = fromString("Restore"); + /** The actual serialized value for a DiskCreateOption instance. */ + private String value; + + DiskCreateOption(String value) { + this.value = value; + } /** - * Creates or finds a DiskCreateOption from its string representation. - * @param name a name to look for - * @return the corresponding DiskCreateOption + * Parses a serialized value to a DiskCreateOption instance. + * + * @param value the serialized value to parse. + * @return the parsed DiskCreateOption object, or null if unable to parse. */ @JsonCreator - public static DiskCreateOption fromString(String name) { - return fromString(name, DiskCreateOption.class); + public static DiskCreateOption fromString(String value) { + DiskCreateOption[] items = DiskCreateOption.values(); + for (DiskCreateOption item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; } - /** - * @return known DiskCreateOption values - */ - public static Collection values() { - return values(DiskCreateOption.class); + @JsonValue + @Override + public String toString() { + return this.value; } } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/DiskCreateOptionTypes.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/DiskCreateOptionTypes.java index 66781dc00fe..b8c17affbbe 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/DiskCreateOptionTypes.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/DiskCreateOptionTypes.java @@ -8,37 +8,49 @@ package com.microsoft.azure.management.compute; -import java.util.Collection; import com.fasterxml.jackson.annotation.JsonCreator; -import com.microsoft.rest.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonValue; /** * Defines values for DiskCreateOptionTypes. */ -public final class DiskCreateOptionTypes extends ExpandableStringEnum { - /** Static value FromImage for DiskCreateOptionTypes. */ - public static final DiskCreateOptionTypes FROM_IMAGE = fromString("FromImage"); +public enum DiskCreateOptionTypes { + /** Enum value FromImage. */ + FROM_IMAGE("FromImage"), - /** Static value Empty for DiskCreateOptionTypes. */ - public static final DiskCreateOptionTypes EMPTY = fromString("Empty"); + /** Enum value Empty. */ + EMPTY("Empty"), - /** Static value Attach for DiskCreateOptionTypes. */ - public static final DiskCreateOptionTypes ATTACH = fromString("Attach"); + /** Enum value Attach. */ + ATTACH("Attach"); + + /** The actual serialized value for a DiskCreateOptionTypes instance. */ + private String value; + + DiskCreateOptionTypes(String value) { + this.value = value; + } /** - * Creates or finds a DiskCreateOptionTypes from its string representation. - * @param name a name to look for - * @return the corresponding DiskCreateOptionTypes + * Parses a serialized value to a DiskCreateOptionTypes instance. + * + * @param value the serialized value to parse. + * @return the parsed DiskCreateOptionTypes object, or null if unable to parse. */ @JsonCreator - public static DiskCreateOptionTypes fromString(String name) { - return fromString(name, DiskCreateOptionTypes.class); + public static DiskCreateOptionTypes fromString(String value) { + DiskCreateOptionTypes[] items = DiskCreateOptionTypes.values(); + for (DiskCreateOptionTypes item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; } - /** - * @return known DiskCreateOptionTypes values - */ - public static Collection values() { - return values(DiskCreateOptionTypes.class); + @JsonValue + @Override + public String toString() { + return this.value; } } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/DiskSku.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/DiskSku.java index b42552ed482..39b94bcaf85 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/DiskSku.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/DiskSku.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** - * The disks sku name. Can be Standard_LRS or Premium_LRS. + * The disks and snapshots sku name. Can be Standard_LRS or Premium_LRS. */ public class DiskSku { /** diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/HardwareProfile.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/HardwareProfile.java index 70ea72443eb..b0a9219106e 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/HardwareProfile.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/HardwareProfile.java @@ -21,13 +21,14 @@ public class HardwareProfile { * <br><br> The available VM sizes depend on region and * availability set. For a list of available sizes use these APIs: * <br><br> [List all available virtual machine sizes in an - * availability set](virtualmachines-list-sizes-availability-set.md) + * availability + * set](https://docs.microsoft.com/rest/api/compute/availabilitysets/listavailablesizes) * <br><br> [List all available virtual machine sizes in a - * region](virtualmachines-list-sizes-region.md) <br><br> [List - * all available virtual machine sizes for - * resizing](virtualmachines-list-sizes-for-resizing.md). Possible values - * include: 'Basic_A0', 'Basic_A1', 'Basic_A2', 'Basic_A3', 'Basic_A4', - * 'Standard_A0', 'Standard_A1', 'Standard_A2', 'Standard_A3', + * region](https://docs.microsoft.com/rest/api/compute/virtualmachinesizes/list) + * <br><br> [List all available virtual machine sizes for + * resizing](https://docs.microsoft.com/rest/api/compute/virtualmachines/listavailablesizes). + * Possible values include: 'Basic_A0', 'Basic_A1', 'Basic_A2', 'Basic_A3', + * 'Basic_A4', 'Standard_A0', 'Standard_A1', 'Standard_A2', 'Standard_A3', * 'Standard_A4', 'Standard_A5', 'Standard_A6', 'Standard_A7', * 'Standard_A8', 'Standard_A9', 'Standard_A10', 'Standard_A11', * 'Standard_A1_v2', 'Standard_A2_v2', 'Standard_A4_v2', 'Standard_A8_v2', diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/ImageStorageProfile.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/ImageStorageProfile.java index d3e87946e78..616a6d8e130 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/ImageStorageProfile.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/ImageStorageProfile.java @@ -21,7 +21,7 @@ public class ImageStorageProfile { * see [About disks and VHDs for Azure virtual * machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). */ - @JsonProperty(value = "osDisk") + @JsonProperty(value = "osDisk", required = true) private ImageOSDisk osDisk; /** @@ -33,14 +33,6 @@ public class ImageStorageProfile { @JsonProperty(value = "dataDisks") private List dataDisks; - /** - * Specifies whether an image is zone resilient or not. Default is false. - * Zone resilient images can be created only in regions that provide Zone - * Redundant Storage (ZRS). - */ - @JsonProperty(value = "zoneResilient") - private Boolean zoneResilient; - /** * Get the osDisk value. * @@ -81,24 +73,4 @@ public ImageStorageProfile withDataDisks(List dataDisks) { return this; } - /** - * Get the zoneResilient value. - * - * @return the zoneResilient value - */ - public Boolean zoneResilient() { - return this.zoneResilient; - } - - /** - * Set the zoneResilient value. - * - * @param zoneResilient the zoneResilient value to set - * @return the ImageStorageProfile object itself. - */ - public ImageStorageProfile withZoneResilient(Boolean zoneResilient) { - this.zoneResilient = zoneResilient; - return this; - } - } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/StorageAccountTypes.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/StorageAccountTypes.java index 0f30ca9c570..ce427401d24 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/StorageAccountTypes.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/StorageAccountTypes.java @@ -8,34 +8,46 @@ package com.microsoft.azure.management.compute; -import java.util.Collection; import com.fasterxml.jackson.annotation.JsonCreator; -import com.microsoft.rest.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonValue; /** * Defines values for StorageAccountTypes. */ -public final class StorageAccountTypes extends ExpandableStringEnum { - /** Static value Standard_LRS for StorageAccountTypes. */ - public static final StorageAccountTypes STANDARD_LRS = fromString("Standard_LRS"); +public enum StorageAccountTypes { + /** Enum value Standard_LRS. */ + STANDARD_LRS("Standard_LRS"), - /** Static value Premium_LRS for StorageAccountTypes. */ - public static final StorageAccountTypes PREMIUM_LRS = fromString("Premium_LRS"); + /** Enum value Premium_LRS. */ + PREMIUM_LRS("Premium_LRS"); + + /** The actual serialized value for a StorageAccountTypes instance. */ + private String value; + + StorageAccountTypes(String value) { + this.value = value; + } /** - * Creates or finds a StorageAccountTypes from its string representation. - * @param name a name to look for - * @return the corresponding StorageAccountTypes + * Parses a serialized value to a StorageAccountTypes instance. + * + * @param value the serialized value to parse. + * @return the parsed StorageAccountTypes object, or null if unable to parse. */ @JsonCreator - public static StorageAccountTypes fromString(String name) { - return fromString(name, StorageAccountTypes.class); + public static StorageAccountTypes fromString(String value) { + StorageAccountTypes[] items = StorageAccountTypes.values(); + for (StorageAccountTypes item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; } - /** - * @return known StorageAccountTypes values - */ - public static Collection values() { - return values(StorageAccountTypes.class); + @JsonValue + @Override + public String toString() { + return this.value; } } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetUpdateInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetUpdateInner.java new file mode 100644 index 00000000000..6d26aa6a3fe --- /dev/null +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetUpdateInner.java @@ -0,0 +1,152 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.compute.implementation; + +import java.util.List; +import com.microsoft.azure.SubResource; +import com.microsoft.azure.management.compute.InstanceViewStatus; +import com.microsoft.azure.management.compute.Sku; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.compute.UpdateResource; + +/** + * Specifies information about the availability set that the virtual machine + * should be assigned to. Virtual machines specified in the same availability + * set are allocated to different nodes to maximize availability. For more + * information about availability sets, see [Manage the availability of virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + * <br><br> For more information on Azure planned maintainance, see + * [Planned maintenance for virtual machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + * <br><br> Currently, a VM can only be added to availability set + * at creation time. An existing VM cannot be added to an availability set. + */ +@JsonFlatten +public class AvailabilitySetUpdateInner extends UpdateResource { + /** + * Update Domain count. + */ + @JsonProperty(value = "properties.platformUpdateDomainCount") + private Integer platformUpdateDomainCount; + + /** + * Fault Domain count. + */ + @JsonProperty(value = "properties.platformFaultDomainCount") + private Integer platformFaultDomainCount; + + /** + * A list of references to all virtual machines in the availability set. + */ + @JsonProperty(value = "properties.virtualMachines") + private List virtualMachines; + + /** + * The resource status information. + */ + @JsonProperty(value = "properties.statuses", access = JsonProperty.Access.WRITE_ONLY) + private List statuses; + + /** + * Sku of the availability set. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /** + * Get the platformUpdateDomainCount value. + * + * @return the platformUpdateDomainCount value + */ + public Integer platformUpdateDomainCount() { + return this.platformUpdateDomainCount; + } + + /** + * Set the platformUpdateDomainCount value. + * + * @param platformUpdateDomainCount the platformUpdateDomainCount value to set + * @return the AvailabilitySetUpdateInner object itself. + */ + public AvailabilitySetUpdateInner withPlatformUpdateDomainCount(Integer platformUpdateDomainCount) { + this.platformUpdateDomainCount = platformUpdateDomainCount; + return this; + } + + /** + * Get the platformFaultDomainCount value. + * + * @return the platformFaultDomainCount value + */ + public Integer platformFaultDomainCount() { + return this.platformFaultDomainCount; + } + + /** + * Set the platformFaultDomainCount value. + * + * @param platformFaultDomainCount the platformFaultDomainCount value to set + * @return the AvailabilitySetUpdateInner object itself. + */ + public AvailabilitySetUpdateInner withPlatformFaultDomainCount(Integer platformFaultDomainCount) { + this.platformFaultDomainCount = platformFaultDomainCount; + return this; + } + + /** + * Get the virtualMachines value. + * + * @return the virtualMachines value + */ + public List virtualMachines() { + return this.virtualMachines; + } + + /** + * Set the virtualMachines value. + * + * @param virtualMachines the virtualMachines value to set + * @return the AvailabilitySetUpdateInner object itself. + */ + public AvailabilitySetUpdateInner withVirtualMachines(List virtualMachines) { + this.virtualMachines = virtualMachines; + return this; + } + + /** + * Get the statuses value. + * + * @return the statuses value + */ + public List statuses() { + return this.statuses; + } + + /** + * Get the sku value. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku value. + * + * @param sku the sku value to set + * @return the AvailabilitySetUpdateInner object itself. + */ + public AvailabilitySetUpdateInner withSku(Sku sku) { + this.sku = sku; + return this; + } + +} diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetsInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetsInner.java index df52c45b336..9fc6e2ade1c 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetsInner.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetsInner.java @@ -27,6 +27,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; @@ -64,6 +65,10 @@ interface AvailabilitySetsService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}") Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("availabilitySetName") String availabilitySetName, @Path("subscriptionId") String subscriptionId, @Body AvailabilitySetInner parameters, @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.AvailabilitySets update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("availabilitySetName") String availabilitySetName, @Path("subscriptionId") String subscriptionId, @Body AvailabilitySetUpdateInner parameters, @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.AvailabilitySets delete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/availabilitySets/{availabilitySetName}", method = "DELETE", hasBody = true) Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("availabilitySetName") String availabilitySetName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -174,6 +179,98 @@ private ServiceResponse createOrUpdateDelegate(Response updateAsync(String resourceGroupName, String availabilitySetName, AvailabilitySetUpdateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, availabilitySetName, parameters), serviceCallback); + } + + /** + * Update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Update Availability Set operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AvailabilitySetInner object + */ + public Observable updateAsync(String resourceGroupName, String availabilitySetName, AvailabilitySetUpdateInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, availabilitySetName, parameters).map(new Func1, AvailabilitySetInner>() { + @Override + public AvailabilitySetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an availability set. + * + * @param resourceGroupName The name of the resource group. + * @param availabilitySetName The name of the availability set. + * @param parameters Parameters supplied to the Update Availability Set operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the AvailabilitySetInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String availabilitySetName, AvailabilitySetUpdateInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (availabilitySetName == null) { + throw new IllegalArgumentException("Parameter availabilitySetName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-12-01"; + return service.update(resourceGroupName, availabilitySetName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(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); + } + /** * Delete an availability set. * 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 33176c4098f..bff9f747b1a 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 @@ -120,6 +120,19 @@ public ComputeManagementClientImpl withGenerateClientRequestId(boolean generateC return this; } + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + /** * The AvailabilitySetsInner object to access its operations. */ @@ -388,6 +401,7 @@ protected void initialize() { this.acceptLanguage = "en-US"; this.longRunningOperationRetryTimeout = 30; this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); this.availabilitySets = new AvailabilitySetsInner(restClient().retrofit(), this); this.virtualMachineExtensionImages = new VirtualMachineExtensionImagesInner(restClient().retrofit(), this); this.virtualMachineExtensions = new VirtualMachineExtensionsInner(restClient().retrofit(), this); diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ComputeOperationValueInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ComputeOperationValueInner.java new file mode 100644 index 00000000000..3640f113e0d --- /dev/null +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ComputeOperationValueInner.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.compute.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Describes the properties of a Compute Operation value. + */ +@JsonFlatten +public class ComputeOperationValueInner { + /** + * The origin of the compute operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private String origin; + + /** + * The name of the compute operation. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The display name of the compute operation. + */ + @JsonProperty(value = "display.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The display name of the resource the operation applies to. + */ + @JsonProperty(value = "display.resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * The description of the operation. + */ + @JsonProperty(value = "display.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * The resource provider for the operation. + */ + @JsonProperty(value = "display.provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Get the origin value. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Get the name value. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the operation value. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the resource value. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Get the description value. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get the provider value. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + +} diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/DisksInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/DisksInner.java index 8b8b7ecb7cf..f6a7ae05f86 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/DisksInner.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/DisksInner.java @@ -198,7 +198,7 @@ public Observable> createOrUpdateWithServiceResponseA throw new IllegalArgumentException("Parameter disk is required and cannot be null."); } Validator.validate(disk); - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, diskName, apiVersion, disk, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } @@ -273,7 +273,7 @@ public Observable> beginCreateOrUpdateWithServiceResp throw new IllegalArgumentException("Parameter disk is required and cannot be null."); } Validator.validate(disk); - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, diskName, apiVersion, disk, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -366,7 +366,7 @@ public Observable> updateWithServiceResponseAsync(Str throw new IllegalArgumentException("Parameter disk is required and cannot be null."); } Validator.validate(disk); - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, diskName, apiVersion, disk, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } @@ -441,7 +441,7 @@ public Observable> beginUpdateWithServiceResponseAsyn throw new IllegalArgumentException("Parameter disk is required and cannot be null."); } Validator.validate(disk); - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, diskName, apiVersion, disk, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -526,7 +526,7 @@ public Observable> getByResourceGroupWithServiceRespo if (diskName == null) { throw new IllegalArgumentException("Parameter diskName is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, diskName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -610,7 +610,7 @@ public Observable> deleteWithServi if (diskName == null) { throw new IllegalArgumentException("Parameter diskName is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, diskName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } @@ -677,7 +677,7 @@ public Observable> beginDeleteWith if (diskName == null) { throw new IllegalArgumentException("Parameter diskName is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.beginDelete(this.client.subscriptionId(), resourceGroupName, diskName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -792,7 +792,7 @@ public Observable>> listByResourceGroupSinglePag if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override @@ -897,7 +897,7 @@ public Observable>> listSinglePageAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override @@ -989,7 +989,7 @@ public Observable> grantAccessWithServiceRespons throw new IllegalArgumentException("Parameter grantAccessData is required and cannot be null."); } Validator.validate(grantAccessData); - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; Observable> observable = service.grantAccess(this.client.subscriptionId(), resourceGroupName, diskName, apiVersion, grantAccessData, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } @@ -1064,7 +1064,7 @@ public Observable> beginGrantAccessWithServiceRe throw new IllegalArgumentException("Parameter grantAccessData is required and cannot be null."); } Validator.validate(grantAccessData); - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.beginGrantAccess(this.client.subscriptionId(), resourceGroupName, diskName, apiVersion, grantAccessData, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -1149,7 +1149,7 @@ public Observable> revokeAccessWit if (diskName == null) { throw new IllegalArgumentException("Parameter diskName is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; Observable> observable = service.revokeAccess(this.client.subscriptionId(), resourceGroupName, diskName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } @@ -1216,7 +1216,7 @@ public Observable> beginRevokeAcce if (diskName == null) { throw new IllegalArgumentException("Parameter diskName is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.beginRevokeAccess(this.client.subscriptionId(), resourceGroupName, diskName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ImageUpdateInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ImageUpdateInner.java new file mode 100644 index 00000000000..505fa198d32 --- /dev/null +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ImageUpdateInner.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.compute.implementation; + +import com.microsoft.azure.SubResource; +import com.microsoft.azure.management.compute.ImageStorageProfile; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.compute.UpdateResource; + +/** + * The source user image virtual hard disk. The virtual hard disk will be + * copied before being attached to the virtual machine. If SourceImage is + * provided, the destination virtual hard drive must not exist. + */ +@JsonFlatten +public class ImageUpdateInner extends UpdateResource { + /** + * The source virtual machine from which Image is created. + */ + @JsonProperty(value = "properties.sourceVirtualMachine") + private SubResource sourceVirtualMachine; + + /** + * Specifies the storage settings for the virtual machine disks. + */ + @JsonProperty(value = "properties.storageProfile") + private ImageStorageProfile storageProfile; + + /** + * The provisioning state. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the sourceVirtualMachine value. + * + * @return the sourceVirtualMachine value + */ + public SubResource sourceVirtualMachine() { + return this.sourceVirtualMachine; + } + + /** + * Set the sourceVirtualMachine value. + * + * @param sourceVirtualMachine the sourceVirtualMachine value to set + * @return the ImageUpdateInner object itself. + */ + public ImageUpdateInner withSourceVirtualMachine(SubResource sourceVirtualMachine) { + this.sourceVirtualMachine = sourceVirtualMachine; + return this; + } + + /** + * Get the storageProfile value. + * + * @return the storageProfile value + */ + public ImageStorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile value. + * + * @param storageProfile the storageProfile value to set + * @return the ImageUpdateInner object itself. + */ + public ImageUpdateInner withStorageProfile(ImageStorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + +} diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ImagesInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ImagesInner.java index 9c65769dfac..8ce7c3e316c 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ImagesInner.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ImagesInner.java @@ -30,6 +30,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; @@ -72,6 +73,14 @@ interface ImagesService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}") Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("imageName") String imageName, @Path("subscriptionId") String subscriptionId, @Body ImageInner parameters, @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.Images update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("imageName") String imageName, @Path("subscriptionId") String subscriptionId, @Body ImageUpdateInner parameters, @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.Images beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("imageName") String imageName, @Path("subscriptionId") String subscriptionId, @Body ImageUpdateInner parameters, @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.Images delete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}", method = "DELETE", hasBody = true) Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("imageName") String imageName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -270,6 +279,174 @@ private ServiceResponse beginCreateOrUpdateDelegate(Response updateAsync(String resourceGroupName, String imageName, ImageUpdateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, imageName, parameters), serviceCallback); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String imageName, ImageUpdateInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, imageName, parameters).map(new Func1, ImageInner>() { + @Override + public ImageInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String imageName, ImageUpdateInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (imageName == null) { + throw new IllegalArgumentException("Parameter imageName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-12-01"; + Observable> observable = service.update(resourceGroupName, imageName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image 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 ImageInner object if successful. + */ + public ImageInner beginUpdate(String resourceGroupName, String imageName, ImageUpdateInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).toBlocking().single().body(); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image 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 imageName, ImageUpdateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters), serviceCallback); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String imageName, ImageUpdateInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, imageName, parameters).map(new Func1, ImageInner>() { + @Override + public ImageInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update an image. + * + * @param resourceGroupName The name of the resource group. + * @param imageName The name of the image. + * @param parameters Parameters supplied to the Update Image operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ImageInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String imageName, ImageUpdateInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (imageName == null) { + throw new IllegalArgumentException("Parameter imageName 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 (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-12-01"; + return service.beginUpdate(resourceGroupName, imageName, this.client.subscriptionId(), parameters, 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()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Deletes an Image. * diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/OperationsInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/OperationsInner.java new file mode 100644 index 00000000000..896e51a2e50 --- /dev/null +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/OperationsInner.java @@ -0,0 +1,128 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.compute.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private ComputeManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, ComputeManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.Operations list" }) + @GET("providers/Microsoft.Compute/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of compute operations. + * + * @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 List<ComputeOperationValueInner> object if successful. + */ + public List list() { + return listWithServiceResponseAsync().toBlocking().single().body(); + } + + /** + * Gets a list of compute operations. + * + * @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> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets a list of compute operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ComputeOperationValueInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of compute operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ComputeOperationValueInner> object + */ + public Observable>> listWithServiceResponseAsync() { + final String apiVersion = "2017-12-01"; + return service.list(apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + ServiceResponse> clientResponse = new ServiceResponse>(result.body().items(), result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/SnapshotInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/SnapshotInner.java index 851559f1d20..ddc0ed006e4 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/SnapshotInner.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/SnapshotInner.java @@ -8,7 +8,7 @@ package com.microsoft.azure.management.compute.implementation; -import com.microsoft.azure.management.compute.SnapshotSku; +import com.microsoft.azure.management.compute.DiskSku; import org.joda.time.DateTime; import com.microsoft.azure.management.compute.OperatingSystemTypes; import com.microsoft.azure.management.compute.CreationData; @@ -32,7 +32,7 @@ public class SnapshotInner extends Resource { * The sku property. */ @JsonProperty(value = "sku") - private SnapshotSku sku; + private DiskSku sku; /** * The time when the disk was created. @@ -89,7 +89,7 @@ public String managedBy() { * * @return the sku value */ - public SnapshotSku sku() { + public DiskSku sku() { return this.sku; } @@ -99,7 +99,7 @@ public SnapshotSku sku() { * @param sku the sku value to set * @return the SnapshotInner object itself. */ - public SnapshotInner withSku(SnapshotSku sku) { + public SnapshotInner withSku(DiskSku sku) { this.sku = sku; return this; } diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/SnapshotsInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/SnapshotsInner.java index 3e8637ef477..bd95385db8f 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/SnapshotsInner.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/SnapshotsInner.java @@ -198,7 +198,7 @@ public Observable> createOrUpdateWithServiceRespo throw new IllegalArgumentException("Parameter snapshot is required and cannot be null."); } Validator.validate(snapshot); - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, snapshotName, apiVersion, snapshot, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } @@ -273,7 +273,7 @@ public Observable> beginCreateOrUpdateWithService throw new IllegalArgumentException("Parameter snapshot is required and cannot be null."); } Validator.validate(snapshot); - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, snapshotName, apiVersion, snapshot, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -366,7 +366,7 @@ public Observable> updateWithServiceResponseAsync throw new IllegalArgumentException("Parameter snapshot is required and cannot be null."); } Validator.validate(snapshot); - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, snapshotName, apiVersion, snapshot, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); } @@ -441,7 +441,7 @@ public Observable> beginUpdateWithServiceResponse throw new IllegalArgumentException("Parameter snapshot is required and cannot be null."); } Validator.validate(snapshot); - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, snapshotName, apiVersion, snapshot, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -526,7 +526,7 @@ public Observable> getByResourceGroupWithServiceR if (snapshotName == null) { throw new IllegalArgumentException("Parameter snapshotName is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, snapshotName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -610,7 +610,7 @@ public Observable> deleteWithServi if (snapshotName == null) { throw new IllegalArgumentException("Parameter snapshotName is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, snapshotName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } @@ -677,7 +677,7 @@ public Observable> beginDeleteWith if (snapshotName == null) { throw new IllegalArgumentException("Parameter snapshotName is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.beginDelete(this.client.subscriptionId(), resourceGroupName, snapshotName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -792,7 +792,7 @@ public Observable>> listByResourceGroupSingl if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.listByResourceGroup(this.client.subscriptionId(), resourceGroupName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override @@ -897,7 +897,7 @@ public Observable>> listSinglePageAsync() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.list(this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>>() { @Override @@ -989,7 +989,7 @@ public Observable> grantAccessWithServiceRespons throw new IllegalArgumentException("Parameter grantAccessData is required and cannot be null."); } Validator.validate(grantAccessData); - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; Observable> observable = service.grantAccess(this.client.subscriptionId(), resourceGroupName, snapshotName, apiVersion, grantAccessData, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } @@ -1064,7 +1064,7 @@ public Observable> beginGrantAccessWithServiceRe throw new IllegalArgumentException("Parameter grantAccessData is required and cannot be null."); } Validator.validate(grantAccessData); - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.beginGrantAccess(this.client.subscriptionId(), resourceGroupName, snapshotName, apiVersion, grantAccessData, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override @@ -1149,7 +1149,7 @@ public Observable> revokeAccessWit if (snapshotName == null) { throw new IllegalArgumentException("Parameter snapshotName is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; Observable> observable = service.revokeAccess(this.client.subscriptionId(), resourceGroupName, snapshotName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); } @@ -1216,7 +1216,7 @@ public Observable> beginRevokeAcce if (snapshotName == null) { throw new IllegalArgumentException("Parameter snapshotName is required and cannot be null."); } - final String apiVersion = "2018-04-01"; + final String apiVersion = "2017-03-30"; return service.beginRevokeAccess(this.client.subscriptionId(), resourceGroupName, snapshotName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetInner.java index 2bc0e32a743..74282f47593 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetInner.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetInner.java @@ -79,19 +79,6 @@ public class VirtualMachineScaleSetInner extends Resource { @JsonProperty(value = "properties.singlePlacementGroup") private Boolean singlePlacementGroup; - /** - * Whether to force stictly even Virtual Machine distribution cross x-zones - * in case there is zone outage. - */ - @JsonProperty(value = "properties.zoneBalance") - private Boolean zoneBalance; - - /** - * Fault Domain count for each placement group. - */ - @JsonProperty(value = "properties.platformFaultDomainCount") - private Integer platformFaultDomainCount; - /** * The identity of the virtual machine scale set, if configured. */ @@ -242,46 +229,6 @@ public VirtualMachineScaleSetInner withSinglePlacementGroup(Boolean singlePlacem return this; } - /** - * Get the zoneBalance value. - * - * @return the zoneBalance value - */ - public Boolean zoneBalance() { - return this.zoneBalance; - } - - /** - * Set the zoneBalance value. - * - * @param zoneBalance the zoneBalance value to set - * @return the VirtualMachineScaleSetInner object itself. - */ - public VirtualMachineScaleSetInner withZoneBalance(Boolean zoneBalance) { - this.zoneBalance = zoneBalance; - return this; - } - - /** - * Get the platformFaultDomainCount value. - * - * @return the platformFaultDomainCount value - */ - public Integer platformFaultDomainCount() { - return this.platformFaultDomainCount; - } - - /** - * Set the platformFaultDomainCount value. - * - * @param platformFaultDomainCount the platformFaultDomainCount value to set - * @return the VirtualMachineScaleSetInner object itself. - */ - public VirtualMachineScaleSetInner withPlatformFaultDomainCount(Integer platformFaultDomainCount) { - this.platformFaultDomainCount = platformFaultDomainCount; - return this; - } - /** * Get the identity value. * diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetVMInstanceViewInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetVMInstanceViewInner.java index d7e523a6abb..95d03b488b9 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetVMInstanceViewInner.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetVMInstanceViewInner.java @@ -9,7 +9,6 @@ package com.microsoft.azure.management.compute.implementation; import com.microsoft.azure.management.compute.VirtualMachineAgentInstanceView; -import com.microsoft.azure.management.compute.MaintenanceRedeployStatus; import java.util.List; import com.microsoft.azure.management.compute.DiskInstanceView; import com.microsoft.azure.management.compute.VirtualMachineExtensionInstanceView; @@ -46,12 +45,6 @@ public class VirtualMachineScaleSetVMInstanceViewInner { @JsonProperty(value = "vmAgent") private VirtualMachineAgentInstanceView vmAgent; - /** - * The Maintenance Operation status on the virtual machine. - */ - @JsonProperty(value = "maintenanceRedeployStatus") - private MaintenanceRedeployStatus maintenanceRedeployStatus; - /** * The disks information. */ @@ -174,26 +167,6 @@ public VirtualMachineScaleSetVMInstanceViewInner withVmAgent(VirtualMachineAgent return this; } - /** - * Get the maintenanceRedeployStatus value. - * - * @return the maintenanceRedeployStatus value - */ - public MaintenanceRedeployStatus maintenanceRedeployStatus() { - return this.maintenanceRedeployStatus; - } - - /** - * Set the maintenanceRedeployStatus value. - * - * @param maintenanceRedeployStatus the maintenanceRedeployStatus value to set - * @return the VirtualMachineScaleSetVMInstanceViewInner object itself. - */ - public VirtualMachineScaleSetVMInstanceViewInner withMaintenanceRedeployStatus(MaintenanceRedeployStatus maintenanceRedeployStatus) { - this.maintenanceRedeployStatus = maintenanceRedeployStatus; - return this; - } - /** * Get the disks value. * diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetVMsInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetVMsInner.java index b7c3251ed48..df3a5c9885d 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetVMsInner.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetVMsInner.java @@ -138,22 +138,6 @@ interface VirtualMachineScaleSetVMsService { @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start") Observable> beginStart(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("instanceId") String instanceId, @Path("subscriptionId") String subscriptionId, @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.VirtualMachineScaleSetVMs redeploy" }) - @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy") - Observable> redeploy(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("instanceId") String instanceId, @Path("subscriptionId") String subscriptionId, @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.VirtualMachineScaleSetVMs beginRedeploy" }) - @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/redeploy") - Observable> beginRedeploy(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("instanceId") String instanceId, @Path("subscriptionId") String subscriptionId, @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.VirtualMachineScaleSetVMs performMaintenance" }) - @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance") - Observable> performMaintenance(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("instanceId") String instanceId, @Path("subscriptionId") String subscriptionId, @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.VirtualMachineScaleSetVMs beginPerformMaintenance" }) - @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/performMaintenance") - Observable> beginPerformMaintenance(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("instanceId") String instanceId, @Path("subscriptionId") String subscriptionId, @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.VirtualMachineScaleSetVMs listNext" }) @GET Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -1940,338 +1924,6 @@ private ServiceResponse beginStartDelegate(Respons .build(response); } - /** - * Redeploys a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @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 OperationStatusResponseInner object if successful. - */ - public OperationStatusResponseInner redeploy(String resourceGroupName, String vmScaleSetName, String instanceId) { - return redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).toBlocking().last().body(); - } - - /** - * Redeploys a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @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 redeployAsync(String resourceGroupName, String vmScaleSetName, String instanceId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId), serviceCallback); - } - - /** - * Redeploys a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable redeployAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { - return redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).map(new Func1, OperationStatusResponseInner>() { - @Override - public OperationStatusResponseInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Redeploys a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable> redeployWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { - 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 (instanceId == null) { - throw new IllegalArgumentException("Parameter instanceId 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"; - Observable> observable = service.redeploy(resourceGroupName, vmScaleSetName, instanceId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); - } - - /** - * Redeploys a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @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 OperationStatusResponseInner object if successful. - */ - public OperationStatusResponseInner beginRedeploy(String resourceGroupName, String vmScaleSetName, String instanceId) { - return beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).toBlocking().single().body(); - } - - /** - * Redeploys a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @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 beginRedeployAsync(String resourceGroupName, String vmScaleSetName, String instanceId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId), serviceCallback); - } - - /** - * Redeploys a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OperationStatusResponseInner object - */ - public Observable beginRedeployAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { - return beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).map(new Func1, OperationStatusResponseInner>() { - @Override - public OperationStatusResponseInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Redeploys a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OperationStatusResponseInner object - */ - public Observable> beginRedeployWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { - 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 (instanceId == null) { - throw new IllegalArgumentException("Parameter instanceId 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.beginRedeploy(resourceGroupName, vmScaleSetName, instanceId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginRedeployDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse beginRedeployDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .register(202, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - - /** - * Performs maintenance on a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @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 OperationStatusResponseInner object if successful. - */ - public OperationStatusResponseInner performMaintenance(String resourceGroupName, String vmScaleSetName, String instanceId) { - return performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).toBlocking().last().body(); - } - - /** - * Performs maintenance on a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @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 performMaintenanceAsync(String resourceGroupName, String vmScaleSetName, String instanceId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId), serviceCallback); - } - - /** - * Performs maintenance on a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable performMaintenanceAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { - return performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).map(new Func1, OperationStatusResponseInner>() { - @Override - public OperationStatusResponseInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Performs maintenance on a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable> performMaintenanceWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { - 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 (instanceId == null) { - throw new IllegalArgumentException("Parameter instanceId 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"; - Observable> observable = service.performMaintenance(resourceGroupName, vmScaleSetName, instanceId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); - } - - /** - * Performs maintenance on a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @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 OperationStatusResponseInner object if successful. - */ - public OperationStatusResponseInner beginPerformMaintenance(String resourceGroupName, String vmScaleSetName, String instanceId) { - return beginPerformMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).toBlocking().single().body(); - } - - /** - * Performs maintenance on a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @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 beginPerformMaintenanceAsync(String resourceGroupName, String vmScaleSetName, String instanceId, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginPerformMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId), serviceCallback); - } - - /** - * Performs maintenance on a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OperationStatusResponseInner object - */ - public Observable beginPerformMaintenanceAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { - return beginPerformMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).map(new Func1, OperationStatusResponseInner>() { - @Override - public OperationStatusResponseInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Performs maintenance on a virtual machine in a VM scale set. - * - * @param resourceGroupName The name of the resource group. - * @param vmScaleSetName The name of the VM scale set. - * @param instanceId The instance ID of the virtual machine. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OperationStatusResponseInner object - */ - public Observable> beginPerformMaintenanceWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, String instanceId) { - 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 (instanceId == null) { - throw new IllegalArgumentException("Parameter instanceId 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.beginPerformMaintenance(resourceGroupName, vmScaleSetName, instanceId, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginPerformMaintenanceDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse beginPerformMaintenanceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .register(202, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - /** * Gets a list of all virtual machines in a VM scale sets. * diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetsInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetsInner.java index 9ca36448448..e738a5ffc2c 100644 --- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetsInner.java +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetsInner.java @@ -152,22 +152,6 @@ interface VirtualMachineScaleSetsService { @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start") Observable> beginStart(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachineScaleSets redeploy" }) - @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy") - Observable> redeploy(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachineScaleSets beginRedeploy" }) - @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/redeploy") - Observable> beginRedeploy(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachineScaleSets performMaintenance" }) - @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance") - Observable> performMaintenance(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, @Header("User-Agent") String userAgent); - - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachineScaleSets beginPerformMaintenance" }) - @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/performMaintenance") - Observable> beginPerformMaintenance(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs, @Header("User-Agent") String userAgent); - @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.VirtualMachineScaleSets updateInstances" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade") Observable> updateInstances(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs, @Header("User-Agent") String userAgent); @@ -2661,648 +2645,6 @@ private ServiceResponse beginStartDelegate(Respons .build(response); } - /** - * Redeploy 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 - * @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 OperationStatusResponseInner object if successful. - */ - public OperationStatusResponseInner redeploy(String resourceGroupName, String vmScaleSetName) { - return redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().last().body(); - } - - /** - * Redeploy 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 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 redeployAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName), serviceCallback); - } - - /** - * Redeploy 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 redeployAsync(String resourceGroupName, String vmScaleSetName) { - return redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1, OperationStatusResponseInner>() { - @Override - public OperationStatusResponseInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Redeploy 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> redeployWithServiceResponseAsync(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 = "2017-12-01"; - final String instanceIdsConverted = null; - VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); - vmInstanceIDs.withInstanceIds(null); - Observable> observable = service.redeploy(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); - } - /** - * Redeploy 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @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 OperationStatusResponseInner object if successful. - */ - public OperationStatusResponseInner redeploy(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().last().body(); - } - - /** - * Redeploy 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @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 redeployAsync(String resourceGroupName, String vmScaleSetName, List instanceIds, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds), serviceCallback); - } - - /** - * Redeploy 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable redeployAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1, OperationStatusResponseInner>() { - @Override - public OperationStatusResponseInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Redeploy 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable> redeployWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, List 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 = "2017-12-01"; - VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; - if (instanceIds != null) { - vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); - vmInstanceIDs.withInstanceIds(instanceIds); - } - Observable> observable = service.redeploy(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); - } - - /** - * Redeploy 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 - * @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 OperationStatusResponseInner object if successful. - */ - public OperationStatusResponseInner beginRedeploy(String resourceGroupName, String vmScaleSetName) { - return beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().single().body(); - } - - /** - * Redeploy 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 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 beginRedeployAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName), serviceCallback); - } - - /** - * Redeploy 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 beginRedeployAsync(String resourceGroupName, String vmScaleSetName) { - return beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1, OperationStatusResponseInner>() { - @Override - public OperationStatusResponseInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Redeploy 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> beginRedeployWithServiceResponseAsync(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 = "2017-12-01"; - final List instanceIds = null; - VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); - vmInstanceIDs.withInstanceIds(null); - return service.beginRedeploy(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginRedeployDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - /** - * Redeploy 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @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 OperationStatusResponseInner object if successful. - */ - public OperationStatusResponseInner beginRedeploy(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().single().body(); - } - - /** - * Redeploy 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @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 beginRedeployAsync(String resourceGroupName, String vmScaleSetName, List instanceIds, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds), serviceCallback); - } - - /** - * Redeploy 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OperationStatusResponseInner object - */ - public Observable beginRedeployAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1, OperationStatusResponseInner>() { - @Override - public OperationStatusResponseInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Redeploy 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OperationStatusResponseInner object - */ - public Observable> beginRedeployWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, List 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 = "2017-12-01"; - VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; - if (instanceIds != null) { - vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); - vmInstanceIDs.withInstanceIds(instanceIds); - } - return service.beginRedeploy(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginRedeployDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse beginRedeployDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .register(202, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - - /** - * Perform maintenance on 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 - * @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 OperationStatusResponseInner object if successful. - */ - public OperationStatusResponseInner performMaintenance(String resourceGroupName, String vmScaleSetName) { - return performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().last().body(); - } - - /** - * Perform maintenance on 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 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 performMaintenanceAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName), serviceCallback); - } - - /** - * Perform maintenance on 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 performMaintenanceAsync(String resourceGroupName, String vmScaleSetName) { - return performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1, OperationStatusResponseInner>() { - @Override - public OperationStatusResponseInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Perform maintenance on 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> performMaintenanceWithServiceResponseAsync(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 = "2017-12-01"; - final String instanceIdsConverted = null; - VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); - vmInstanceIDs.withInstanceIds(null); - Observable> observable = service.performMaintenance(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); - } - /** - * Perform maintenance on 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @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 OperationStatusResponseInner object if successful. - */ - public OperationStatusResponseInner performMaintenance(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().last().body(); - } - - /** - * Perform maintenance on 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @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 performMaintenanceAsync(String resourceGroupName, String vmScaleSetName, List instanceIds, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds), serviceCallback); - } - - /** - * Perform maintenance on 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable performMaintenanceAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1, OperationStatusResponseInner>() { - @Override - public OperationStatusResponseInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Perform maintenance on 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable for the request - */ - public Observable> performMaintenanceWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, List 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 = "2017-12-01"; - VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; - if (instanceIds != null) { - vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); - vmInstanceIDs.withInstanceIds(instanceIds); - } - Observable> observable = service.performMaintenance(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); - } - - /** - * Perform maintenance on 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 - * @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 OperationStatusResponseInner object if successful. - */ - public OperationStatusResponseInner beginPerformMaintenance(String resourceGroupName, String vmScaleSetName) { - return beginPerformMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().single().body(); - } - - /** - * Perform maintenance on 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 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 beginPerformMaintenanceAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginPerformMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName), serviceCallback); - } - - /** - * Perform maintenance on 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 beginPerformMaintenanceAsync(String resourceGroupName, String vmScaleSetName) { - return beginPerformMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1, OperationStatusResponseInner>() { - @Override - public OperationStatusResponseInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Perform maintenance on 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> beginPerformMaintenanceWithServiceResponseAsync(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 = "2017-12-01"; - final List instanceIds = null; - VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); - vmInstanceIDs.withInstanceIds(null); - return service.beginPerformMaintenance(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginPerformMaintenanceDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - /** - * Perform maintenance on 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @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 OperationStatusResponseInner object if successful. - */ - public OperationStatusResponseInner beginPerformMaintenance(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return beginPerformMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().single().body(); - } - - /** - * Perform maintenance on 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @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 beginPerformMaintenanceAsync(String resourceGroupName, String vmScaleSetName, List instanceIds, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginPerformMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds), serviceCallback); - } - - /** - * Perform maintenance on 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OperationStatusResponseInner object - */ - public Observable beginPerformMaintenanceAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return beginPerformMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1, OperationStatusResponseInner>() { - @Override - public OperationStatusResponseInner call(ServiceResponse response) { - return response.body(); - } - }); - } - - /** - * Perform maintenance on 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. Omitting the virtual machine scale set instance ids will result in the operation being performed on all virtual machines in the virtual machine scale set. - * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the OperationStatusResponseInner object - */ - public Observable> beginPerformMaintenanceWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, List 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 = "2017-12-01"; - VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = null; - if (instanceIds != null) { - vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); - vmInstanceIDs.withInstanceIds(instanceIds); - } - return service.beginPerformMaintenance(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginPerformMaintenanceDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse beginPerformMaintenanceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { - return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) - .register(200, new TypeToken() { }.getType()) - .register(202, new TypeToken() { }.getType()) - .registerError(CloudException.class) - .build(response); - } - /** * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. * diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineUpdateInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineUpdateInner.java new file mode 100644 index 00000000000..beebee6fe43 --- /dev/null +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineUpdateInner.java @@ -0,0 +1,363 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.compute.implementation; + +import com.microsoft.azure.management.compute.Plan; +import com.microsoft.azure.management.compute.HardwareProfile; +import com.microsoft.azure.management.compute.StorageProfile; +import com.microsoft.azure.management.compute.OSProfile; +import com.microsoft.azure.management.compute.NetworkProfile; +import com.microsoft.azure.management.compute.DiagnosticsProfile; +import com.microsoft.azure.SubResource; +import com.microsoft.azure.management.compute.VirtualMachineIdentity; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.compute.UpdateResource; + +/** + * Describes a Virtual Machine. + */ +@JsonFlatten +public class VirtualMachineUpdateInner extends UpdateResource { + /** + * Specifies information about the marketplace image used to create the + * virtual machine. This element is only used for marketplace images. + * Before you can use a marketplace image from an API, you must enable the + * image for programmatic use. In the Azure portal, find the marketplace + * image that you want to use and then click **Want to deploy + * programmatically, Get Started ->**. Enter any required information + * and then click **Save**. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /** + * Specifies the hardware settings for the virtual machine. + */ + @JsonProperty(value = "properties.hardwareProfile") + private HardwareProfile hardwareProfile; + + /** + * Specifies the storage settings for the virtual machine disks. + */ + @JsonProperty(value = "properties.storageProfile") + private StorageProfile storageProfile; + + /** + * Specifies the operating system settings for the virtual machine. + */ + @JsonProperty(value = "properties.osProfile") + private OSProfile osProfile; + + /** + * Specifies the network interfaces of the virtual machine. + */ + @JsonProperty(value = "properties.networkProfile") + private NetworkProfile networkProfile; + + /** + * Specifies the boot diagnostic settings state. + * <br><br>Minimum api-version: 2015-06-15. + */ + @JsonProperty(value = "properties.diagnosticsProfile") + private DiagnosticsProfile diagnosticsProfile; + + /** + * Specifies information about the availability set that the virtual + * machine should be assigned to. Virtual machines specified in the same + * availability set are allocated to different nodes to maximize + * availability. For more information about availability sets, see [Manage + * the availability of virtual + * machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-manage-availability?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json). + * <br><br> For more information on Azure planned maintainance, + * see [Planned maintenance for virtual machines in + * Azure](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-planned-maintenance?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + * <br><br> Currently, a VM can only be added to availability + * set at creation time. An existing VM cannot be added to an availability + * set. + */ + @JsonProperty(value = "properties.availabilitySet") + private SubResource availabilitySet; + + /** + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * The virtual machine instance view. + */ + @JsonProperty(value = "properties.instanceView", access = JsonProperty.Access.WRITE_ONLY) + private VirtualMachineInstanceViewInner instanceView; + + /** + * Specifies that the image or disk that is being used was licensed + * on-premises. This element is only used for images that contain the + * Windows Server operating system. <br><br> Possible values + * are: <br><br> Windows_Client <br><br> + * Windows_Server <br><br> If this element is included in a + * request for an update, the value must match the initial value. This + * value cannot be updated. <br><br> For more information, see + * [Azure Hybrid Use Benefit for Windows + * Server](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-hybrid-use-benefit-licensing?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json) + * <br><br> Minimum api-version: 2015-06-15. + */ + @JsonProperty(value = "properties.licenseType") + private String licenseType; + + /** + * Specifies the VM unique ID which is a 128-bits identifier that is + * encoded and stored in all Azure IaaS VMs SMBIOS and can be read using + * platform BIOS commands. + */ + @JsonProperty(value = "properties.vmId", access = JsonProperty.Access.WRITE_ONLY) + private String vmId; + + /** + * The identity of the virtual machine, if configured. + */ + @JsonProperty(value = "identity") + private VirtualMachineIdentity identity; + + /** + * The virtual machine zones. + */ + @JsonProperty(value = "zones") + private List zones; + + /** + * Get the plan value. + * + * @return the plan value + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan value. + * + * @param plan the plan value to set + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Get the hardwareProfile value. + * + * @return the hardwareProfile value + */ + public HardwareProfile hardwareProfile() { + return this.hardwareProfile; + } + + /** + * Set the hardwareProfile value. + * + * @param hardwareProfile the hardwareProfile value to set + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withHardwareProfile(HardwareProfile hardwareProfile) { + this.hardwareProfile = hardwareProfile; + return this; + } + + /** + * Get the storageProfile value. + * + * @return the storageProfile value + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile value. + * + * @param storageProfile the storageProfile value to set + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the osProfile value. + * + * @return the osProfile value + */ + public OSProfile osProfile() { + return this.osProfile; + } + + /** + * Set the osProfile value. + * + * @param osProfile the osProfile value to set + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withOsProfile(OSProfile osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get the networkProfile value. + * + * @return the networkProfile value + */ + public NetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile value. + * + * @param networkProfile the networkProfile value to set + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withNetworkProfile(NetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the diagnosticsProfile value. + * + * @return the diagnosticsProfile value + */ + public DiagnosticsProfile diagnosticsProfile() { + return this.diagnosticsProfile; + } + + /** + * Set the diagnosticsProfile value. + * + * @param diagnosticsProfile the diagnosticsProfile value to set + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withDiagnosticsProfile(DiagnosticsProfile diagnosticsProfile) { + this.diagnosticsProfile = diagnosticsProfile; + return this; + } + + /** + * Get the availabilitySet value. + * + * @return the availabilitySet value + */ + public SubResource availabilitySet() { + return this.availabilitySet; + } + + /** + * Set the availabilitySet value. + * + * @param availabilitySet the availabilitySet value to set + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withAvailabilitySet(SubResource availabilitySet) { + this.availabilitySet = availabilitySet; + return this; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the instanceView value. + * + * @return the instanceView value + */ + public VirtualMachineInstanceViewInner instanceView() { + return this.instanceView; + } + + /** + * Get the licenseType value. + * + * @return the licenseType value + */ + public String licenseType() { + return this.licenseType; + } + + /** + * Set the licenseType value. + * + * @param licenseType the licenseType value to set + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withLicenseType(String licenseType) { + this.licenseType = licenseType; + return this; + } + + /** + * Get the vmId value. + * + * @return the vmId value + */ + public String vmId() { + return this.vmId; + } + + /** + * Get the identity value. + * + * @return the identity value + */ + public VirtualMachineIdentity identity() { + return this.identity; + } + + /** + * Set the identity value. + * + * @param identity the identity value to set + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withIdentity(VirtualMachineIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the zones value. + * + * @return the zones value + */ + public List zones() { + return this.zones; + } + + /** + * Set the zones value. + * + * @param zones the zones value to set + * @return the VirtualMachineUpdateInner object itself. + */ + public VirtualMachineUpdateInner withZones(List zones) { + this.zones = zones; + return this; + } + +} 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 01719d2b67c..78a4b7ddfcb 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 @@ -31,6 +31,7 @@ import retrofit2.http.Header; import retrofit2.http.Headers; import retrofit2.http.HTTP; +import retrofit2.http.PATCH; import retrofit2.http.Path; import retrofit2.http.POST; import retrofit2.http.PUT; @@ -82,6 +83,14 @@ interface VirtualMachinesService { @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineInner parameters, @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 update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineUpdateInner parameters, @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 beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}") + Observable> beginUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineUpdateInner parameters, @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 delete" }) @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}", method = "DELETE", hasBody = true) Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -524,6 +533,174 @@ private ServiceResponse beginCreateOrUpdateDelegate(Respons .build(response); } + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine 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 VirtualMachineInner object if successful. + */ + public VirtualMachineInner update(String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, vmName, parameters).toBlocking().last().body(); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine 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, VirtualMachineUpdateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, vmName, parameters), serviceCallback); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1, VirtualMachineInner>() { + @Override + public VirtualMachineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) { + 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."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-12-01"; + Observable> observable = service.update(resourceGroupName, vmName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine 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 VirtualMachineInner object if successful. + */ + public VirtualMachineInner beginUpdate(String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, parameters).toBlocking().single().body(); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine 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, VirtualMachineUpdateInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, parameters), serviceCallback); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1, VirtualMachineInner>() { + @Override + public VirtualMachineInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * The operation to update a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @param parameters Parameters supplied to the Update Virtual Machine operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VirtualMachineInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) { + 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."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2017-12-01"; + return service.beginUpdate(resourceGroupName, vmName, this.client.subscriptionId(), parameters, 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()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * The operation to delete a virtual machine. *