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 c2dbf143ca9..47876604914 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,46 +8,34 @@ package com.microsoft.azure.management.compute; +import java.util.Collection; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import com.microsoft.rest.ExpandableStringEnum; /** * Defines values for AccessLevel. */ -public enum AccessLevel { - /** Enum value None. */ - NONE("None"), +public final class AccessLevel extends ExpandableStringEnum { + /** Static value None for AccessLevel. */ + public static final AccessLevel NONE = fromString("None"); - /** Enum value Read. */ - READ("Read"); - - /** The actual serialized value for a AccessLevel instance. */ - private String value; - - AccessLevel(String value) { - this.value = value; - } + /** Static value Read for AccessLevel. */ + public static final AccessLevel READ = fromString("Read"); /** - * 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. + * Creates or finds a AccessLevel from its string representation. + * @param name a name to look for + * @return the corresponding AccessLevel */ @JsonCreator - public static AccessLevel fromString(String value) { - AccessLevel[] items = AccessLevel.values(); - for (AccessLevel item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static AccessLevel fromString(String name) { + return fromString(name, AccessLevel.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** + * @return known AccessLevel values + */ + public static Collection values() { + return values(AccessLevel.class); } } 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 58edcd359d7..3a4a97be686 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,7 +16,8 @@ public class CreationData { /** * This enumerates the possible sources of a disk's creation. Possible - * values include: 'Empty', 'Attach', 'FromImage', 'Import', 'Copy'. + * values include: 'Empty', 'Attach', 'FromImage', 'Import', 'Copy', + * 'Restore'. */ @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 903fd7cbca9..98c18c3d144 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,55 +8,46 @@ package com.microsoft.azure.management.compute; +import java.util.Collection; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import com.microsoft.rest.ExpandableStringEnum; /** * Defines values for DiskCreateOption. */ -public enum DiskCreateOption { - /** Enum value Empty. */ - EMPTY("Empty"), +public final class DiskCreateOption extends ExpandableStringEnum { + /** Static value Empty for DiskCreateOption. */ + public static final DiskCreateOption EMPTY = fromString("Empty"); - /** Enum value Attach. */ - ATTACH("Attach"), + /** Static value Attach for DiskCreateOption. */ + public static final DiskCreateOption ATTACH = fromString("Attach"); - /** Enum value FromImage. */ - FROM_IMAGE("FromImage"), + /** Static value FromImage for DiskCreateOption. */ + public static final DiskCreateOption FROM_IMAGE = fromString("FromImage"); - /** Enum value Import. */ - IMPORT("Import"), + /** Static value Import for DiskCreateOption. */ + public static final DiskCreateOption IMPORT = fromString("Import"); - /** Enum value Copy. */ - COPY("Copy"); + /** Static value Copy for DiskCreateOption. */ + public static final DiskCreateOption COPY = fromString("Copy"); - /** The actual serialized value for a DiskCreateOption instance. */ - private String value; - - DiskCreateOption(String value) { - this.value = value; - } + /** Static value Restore for DiskCreateOption. */ + public static final DiskCreateOption RESTORE = fromString("Restore"); /** - * 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. + * Creates or finds a DiskCreateOption from its string representation. + * @param name a name to look for + * @return the corresponding DiskCreateOption */ @JsonCreator - public static DiskCreateOption fromString(String value) { - DiskCreateOption[] items = DiskCreateOption.values(); - for (DiskCreateOption item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static DiskCreateOption fromString(String name) { + return fromString(name, DiskCreateOption.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** + * @return known DiskCreateOption values + */ + public static Collection values() { + return values(DiskCreateOption.class); } } 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 b8c17affbbe..66781dc00fe 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,49 +8,37 @@ package com.microsoft.azure.management.compute; +import java.util.Collection; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import com.microsoft.rest.ExpandableStringEnum; /** * Defines values for DiskCreateOptionTypes. */ -public enum DiskCreateOptionTypes { - /** Enum value FromImage. */ - FROM_IMAGE("FromImage"), +public final class DiskCreateOptionTypes extends ExpandableStringEnum { + /** Static value FromImage for DiskCreateOptionTypes. */ + public static final DiskCreateOptionTypes FROM_IMAGE = fromString("FromImage"); - /** Enum value Empty. */ - EMPTY("Empty"), + /** Static value Empty for DiskCreateOptionTypes. */ + public static final DiskCreateOptionTypes EMPTY = fromString("Empty"); - /** Enum value Attach. */ - ATTACH("Attach"); - - /** The actual serialized value for a DiskCreateOptionTypes instance. */ - private String value; - - DiskCreateOptionTypes(String value) { - this.value = value; - } + /** Static value Attach for DiskCreateOptionTypes. */ + public static final DiskCreateOptionTypes ATTACH = fromString("Attach"); /** - * 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. + * Creates or finds a DiskCreateOptionTypes from its string representation. + * @param name a name to look for + * @return the corresponding DiskCreateOptionTypes */ @JsonCreator - public static DiskCreateOptionTypes fromString(String value) { - DiskCreateOptionTypes[] items = DiskCreateOptionTypes.values(); - for (DiskCreateOptionTypes item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static DiskCreateOptionTypes fromString(String name) { + return fromString(name, DiskCreateOptionTypes.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** + * @return known DiskCreateOptionTypes values + */ + public static Collection values() { + return values(DiskCreateOptionTypes.class); } } 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 39b94bcaf85..b42552ed482 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 and snapshots sku name. Can be Standard_LRS or Premium_LRS. + * The disks 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/ImageStorageProfile.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/ImageStorageProfile.java index 616a6d8e130..d3e87946e78 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", required = true) + @JsonProperty(value = "osDisk") private ImageOSDisk osDisk; /** @@ -33,6 +33,14 @@ 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. * @@ -73,4 +81,24 @@ 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/PlatformImageReference.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/PlatformImageReference.java new file mode 100644 index 00000000000..c80196d6156 --- /dev/null +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/PlatformImageReference.java @@ -0,0 +1,92 @@ +/** + * 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; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A reference that identifies a CRP-PIR image or a UserVMImage. + */ +public class PlatformImageReference { + /** + * Publisher. + */ + @JsonProperty(value = "publisher", access = JsonProperty.Access.WRITE_ONLY) + private String publisher; + + /** + * Offer. + */ + @JsonProperty(value = "offer", access = JsonProperty.Access.WRITE_ONLY) + private String offer; + + /** + * Sku. + */ + @JsonProperty(value = "sku", access = JsonProperty.Access.WRITE_ONLY) + private String sku; + + /** + * Version. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * Specifies the virtual hard disk's uri. + */ + @JsonProperty(value = "uri", access = JsonProperty.Access.WRITE_ONLY) + private String uri; + + /** + * Get the publisher value. + * + * @return the publisher value + */ + public String publisher() { + return this.publisher; + } + + /** + * Get the offer value. + * + * @return the offer value + */ + public String offer() { + return this.offer; + } + + /** + * Get the sku value. + * + * @return the sku value + */ + public String sku() { + return this.sku; + } + + /** + * Get the version value. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Get the uri value. + * + * @return the uri value + */ + public String uri() { + return this.uri; + } + +} 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 ce427401d24..0f30ca9c570 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,46 +8,34 @@ package com.microsoft.azure.management.compute; +import java.util.Collection; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; +import com.microsoft.rest.ExpandableStringEnum; /** * Defines values for StorageAccountTypes. */ -public enum StorageAccountTypes { - /** Enum value Standard_LRS. */ - STANDARD_LRS("Standard_LRS"), +public final class StorageAccountTypes extends ExpandableStringEnum { + /** Static value Standard_LRS for StorageAccountTypes. */ + public static final StorageAccountTypes STANDARD_LRS = fromString("Standard_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; - } + /** Static value Premium_LRS for StorageAccountTypes. */ + public static final StorageAccountTypes PREMIUM_LRS = fromString("Premium_LRS"); /** - * 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. + * Creates or finds a StorageAccountTypes from its string representation. + * @param name a name to look for + * @return the corresponding StorageAccountTypes */ @JsonCreator - public static StorageAccountTypes fromString(String value) { - StorageAccountTypes[] items = StorageAccountTypes.values(); - for (StorageAccountTypes item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; + public static StorageAccountTypes fromString(String name) { + return fromString(name, StorageAccountTypes.class); } - @JsonValue - @Override - public String toString() { - return this.value; + /** + * @return known StorageAccountTypes values + */ + public static Collection values() { + return values(StorageAccountTypes.class); } } 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 f6a7ae05f86..8b8b7ecb7cf 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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/SnapshotInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/SnapshotInner.java index ddc0ed006e4..851559f1d20 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.DiskSku; +import com.microsoft.azure.management.compute.SnapshotSku; 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 DiskSku sku; + private SnapshotSku sku; /** * The time when the disk was created. @@ -89,7 +89,7 @@ public String managedBy() { * * @return the sku value */ - public DiskSku sku() { + public SnapshotSku sku() { return this.sku; } @@ -99,7 +99,7 @@ public DiskSku sku() { * @param sku the sku value to set * @return the SnapshotInner object itself. */ - public SnapshotInner withSku(DiskSku sku) { + public SnapshotInner withSku(SnapshotSku 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 bd95385db8f..3e8637ef477 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 = "2017-03-30"; + final String apiVersion = "2018-04-01"; 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 74282f47593..2bc0e32a743 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,6 +79,19 @@ 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. */ @@ -229,6 +242,46 @@ 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/VirtualMachineScaleSetOSUpgradeHistoryInner.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetOSUpgradeHistoryInner.java new file mode 100644 index 00000000000..23a3e27fa8b --- /dev/null +++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetOSUpgradeHistoryInner.java @@ -0,0 +1,97 @@ +/** + * 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.RollingUpgradeRunningStatus; +import com.microsoft.azure.management.compute.RollingUpgradeProgressInfo; +import com.microsoft.azure.management.compute.ApiError; +import com.microsoft.azure.management.compute.PlatformImageReference; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes each OS upgrade on the Virtual Machine Scale Set. + */ +public class VirtualMachineScaleSetOSUpgradeHistoryInner { + /** + * Information about the overall status of the upgrade operation. + */ + @JsonProperty(value = "runningStatus", access = JsonProperty.Access.WRITE_ONLY) + private RollingUpgradeRunningStatus runningStatus; + + /** + * Counts of the VM's in each state. + */ + @JsonProperty(value = "progressInfo", access = JsonProperty.Access.WRITE_ONLY) + private RollingUpgradeProgressInfo progressInfo; + + /** + * Error Details for this upgrade if there are any. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private ApiError error; + + /** + * Error Details for this upgrade if there are any. Possible values + * include: 'Unknown', 'User', 'Platform'. + */ + @JsonProperty(value = "startedBy", access = JsonProperty.Access.WRITE_ONLY) + private String startedBy; + + /** + * Error Details for this upgrade if there are any. + */ + @JsonProperty(value = "targetImageReference", access = JsonProperty.Access.WRITE_ONLY) + private PlatformImageReference targetImageReference; + + /** + * Get the runningStatus value. + * + * @return the runningStatus value + */ + public RollingUpgradeRunningStatus runningStatus() { + return this.runningStatus; + } + + /** + * Get the progressInfo value. + * + * @return the progressInfo value + */ + public RollingUpgradeProgressInfo progressInfo() { + return this.progressInfo; + } + + /** + * Get the error value. + * + * @return the error value + */ + public ApiError error() { + return this.error; + } + + /** + * Get the startedBy value. + * + * @return the startedBy value + */ + public String startedBy() { + return this.startedBy; + } + + /** + * Get the targetImageReference value. + * + * @return the targetImageReference value + */ + public PlatformImageReference targetImageReference() { + return this.targetImageReference; + } + +} 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 95d03b488b9..d7e523a6abb 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,6 +9,7 @@ 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; @@ -45,6 +46,12 @@ 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. */ @@ -167,6 +174,26 @@ 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 df3a5c9885d..b7c3251ed48 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,6 +138,22 @@ 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); @@ -1924,6 +1940,338 @@ 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 e738a5ffc2c..e197d678438 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 @@ -128,6 +128,10 @@ interface VirtualMachineScaleSetsService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus") Observable> listSkus(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @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.VirtualMachineScaleSets getOSUpgradeHistory" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/osUpgradeHistory") + Observable> getOSUpgradeHistory(@Path("resourceGroupName") String resourceGroupName, @Path("vmScaleSetName") String vmScaleSetName, @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.VirtualMachineScaleSets powerOff" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff") Observable> powerOff(@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); @@ -152,6 +156,22 @@ 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); @@ -192,6 +212,10 @@ interface VirtualMachineScaleSetsService { @GET Observable> listSkusNext(@Url String nextUrl, @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.VirtualMachineScaleSets getOSUpgradeHistoryNext" }) + @GET + Observable> getOSUpgradeHistoryNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + } /** @@ -1682,6 +1706,127 @@ private ServiceResponse> listSkusDeleg .build(response); } + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @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 PagedList<VirtualMachineScaleSetOSUpgradeHistoryInner> object if successful. + */ + public PagedList getOSUpgradeHistory(final String resourceGroupName, final String vmScaleSetName) { + ServiceResponse> response = getOSUpgradeHistorySinglePageAsync(resourceGroupName, vmScaleSetName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return getOSUpgradeHistoryNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @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> getOSUpgradeHistoryAsync(final String resourceGroupName, final String vmScaleSetName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + getOSUpgradeHistorySinglePageAsync(resourceGroupName, vmScaleSetName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return getOSUpgradeHistoryNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @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 PagedList<VirtualMachineScaleSetOSUpgradeHistoryInner> object + */ + public Observable> getOSUpgradeHistoryAsync(final String resourceGroupName, final String vmScaleSetName) { + return getOSUpgradeHistoryWithServiceResponseAsync(resourceGroupName, vmScaleSetName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @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 PagedList<VirtualMachineScaleSetOSUpgradeHistoryInner> object + */ + public Observable>> getOSUpgradeHistoryWithServiceResponseAsync(final String resourceGroupName, final String vmScaleSetName) { + return getOSUpgradeHistorySinglePageAsync(resourceGroupName, vmScaleSetName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(getOSUpgradeHistoryNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. + ServiceResponse> * @param vmScaleSetName The name of the VM scale set. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualMachineScaleSetOSUpgradeHistoryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> getOSUpgradeHistorySinglePageAsync(final String resourceGroupName, final 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"; + return service.getOSUpgradeHistory(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getOSUpgradeHistoryDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getOSUpgradeHistoryDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + /** * Power off (stop) one or more virtual machines in a VM scale set. Note that resources are still attached and you are getting charged for the resources. Instead, use deallocate to release resources and avoid charges. * @@ -2646,45 +2791,42 @@ private ServiceResponse beginStartDelegate(Respons } /** - * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * 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. * @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 updateInstances(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return updateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().last().body(); + public OperationStatusResponseInner redeploy(String resourceGroupName, String vmScaleSetName) { + return redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().last().body(); } /** - * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * 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. * @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 updateInstancesAsync(String resourceGroupName, String vmScaleSetName, List instanceIds, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(updateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds), serviceCallback); + public ServiceFuture redeployAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName), serviceCallback); } /** - * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * 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. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */ - public Observable updateInstancesAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return updateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1, OperationStatusResponseInner>() { + public Observable redeployAsync(String resourceGroupName, String vmScaleSetName) { + return redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse response) { return response.body(); @@ -2693,15 +2835,14 @@ public OperationStatusResponseInner call(ServiceResponse> updateInstancesWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { + public Observable> redeployWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -2711,57 +2852,53 @@ public Observable> updateInstances if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (instanceIds == null) { - throw new IllegalArgumentException("Parameter instanceIds is required and cannot be null."); - } - Validator.validate(instanceIds); final String apiVersion = "2017-12-01"; - VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); - vmInstanceIDs.withInstanceIds(instanceIds); - Observable> observable = service.updateInstances(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); + 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()); } - /** - * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * 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. + * @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 beginUpdateInstances(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return beginUpdateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().single().body(); + public OperationStatusResponseInner redeploy(String resourceGroupName, String vmScaleSetName, List instanceIds) { + return redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().last().body(); } /** - * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * 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. + * @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 beginUpdateInstancesAsync(String resourceGroupName, String vmScaleSetName, List instanceIds, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginUpdateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds), serviceCallback); + public ServiceFuture redeployAsync(String resourceGroupName, String vmScaleSetName, List instanceIds, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(redeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds), serviceCallback); } /** - * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * 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. + * @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 + * @return the observable for the request */ - public Observable beginUpdateInstancesAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return beginUpdateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1, OperationStatusResponseInner>() { + 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(); @@ -2770,15 +2907,15 @@ public OperationStatusResponseInner call(ServiceResponse> beginUpdateInstancesWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { + public Observable> redeployWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -2788,37 +2925,19 @@ public Observable> beginUpdateInst if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } - if (instanceIds == null) { - throw new IllegalArgumentException("Parameter instanceIds is required and cannot be null."); - } Validator.validate(instanceIds); final String apiVersion = "2017-12-01"; - VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); - vmInstanceIDs.withInstanceIds(instanceIds); - return service.beginUpdateInstances(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()) - .flatMap(new Func1, Observable>>() { - @Override - public Observable> call(Response response) { - try { - ServiceResponse clientResponse = beginUpdateInstancesDelegate(response); - return Observable.just(clientResponse); - } catch (Throwable t) { - return Observable.error(t); - } - } - }); - } - - private ServiceResponse beginUpdateInstancesDelegate(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); + 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()); } /** - * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. + * 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. @@ -2827,12 +2946,12 @@ private ServiceResponse beginUpdateInstancesDelega * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the OperationStatusResponseInner object if successful. */ - public OperationStatusResponseInner reimage(String resourceGroupName, String vmScaleSetName) { - return reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().last().body(); + public OperationStatusResponseInner beginRedeploy(String resourceGroupName, String vmScaleSetName) { + return beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().single().body(); } /** - * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. + * 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. @@ -2840,20 +2959,20 @@ public OperationStatusResponseInner reimage(String resourceGroupName, String vmS * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture reimageAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName), serviceCallback); + public ServiceFuture beginRedeployAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName), serviceCallback); } /** - * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. + * 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 + * @return the observable to the OperationStatusResponseInner object */ - public Observable reimageAsync(String resourceGroupName, String vmScaleSetName) { - return reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1, OperationStatusResponseInner>() { + public Observable beginRedeployAsync(String resourceGroupName, String vmScaleSetName) { + return beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse response) { return response.body(); @@ -2862,14 +2981,14 @@ public OperationStatusResponseInner call(ServiceResponse> reimageWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName) { + public Observable> beginRedeployWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -2880,14 +2999,25 @@ public Observable> reimageWithServ throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2017-12-01"; - final String instanceIdsConverted = null; + final List instanceIds = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); - Observable> observable = service.reimage(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + 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); + } + } + }); } + /** - * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. + * 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. @@ -2897,12 +3027,12 @@ public Observable> reimageWithServ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the OperationStatusResponseInner object if successful. */ - public OperationStatusResponseInner reimage(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().last().body(); + public OperationStatusResponseInner beginRedeploy(String resourceGroupName, String vmScaleSetName, List instanceIds) { + return beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().single().body(); } /** - * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. + * 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. @@ -2911,21 +3041,21 @@ public OperationStatusResponseInner reimage(String resourceGroupName, String vmS * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture reimageAsync(String resourceGroupName, String vmScaleSetName, List instanceIds, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds), serviceCallback); + public ServiceFuture beginRedeployAsync(String resourceGroupName, String vmScaleSetName, List instanceIds, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRedeployWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds), serviceCallback); } /** - * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. + * 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 + * @return the observable to the OperationStatusResponseInner object */ - public Observable reimageAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { - return reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1, OperationStatusResponseInner>() { + 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(); @@ -2934,15 +3064,15 @@ public OperationStatusResponseInner call(ServiceResponse> reimageWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { + public Observable> beginRedeployWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -2959,12 +3089,30 @@ public Observable> reimageWithServ vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(instanceIds); } - Observable> observable = service.reimage(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); - return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + 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); } /** - * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. + * 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. @@ -2973,12 +3121,12 @@ public Observable> reimageWithServ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the OperationStatusResponseInner object if successful. */ - public OperationStatusResponseInner beginReimage(String resourceGroupName, String vmScaleSetName) { - return beginReimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().single().body(); + public OperationStatusResponseInner performMaintenance(String resourceGroupName, String vmScaleSetName) { + return performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().last().body(); } /** - * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. + * 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. @@ -2986,20 +3134,20 @@ public OperationStatusResponseInner beginReimage(String resourceGroupName, Strin * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */ - public ServiceFuture beginReimageAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { - return ServiceFuture.fromResponse(beginReimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName), serviceCallback); + public ServiceFuture performMaintenanceAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName), serviceCallback); } /** - * Reimages (upgrade the operating system) one or more virtual machines in a VM scale set. + * 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 + * @return the observable for the request */ - public Observable beginReimageAsync(String resourceGroupName, String vmScaleSetName) { - return beginReimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1, OperationStatusResponseInner>() { + public Observable performMaintenanceAsync(String resourceGroupName, String vmScaleSetName) { + return performMaintenanceWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse response) { return response.body(); @@ -3008,14 +3156,14 @@ public OperationStatusResponseInner call(ServiceResponse> beginReimageWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName) { + public Observable> performMaintenanceWithServiceResponseAsync(String resourceGroupName, String vmScaleSetName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } @@ -3026,15 +3174,654 @@ public Observable> beginReimageWit throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } final String apiVersion = "2017-12-01"; - final List instanceIds = null; + final String instanceIdsConverted = null; VirtualMachineScaleSetVMInstanceIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceIDs(); vmInstanceIDs.withInstanceIds(null); - return service.beginReimage(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 = beginReimageDelegate(response); + 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. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceIds The virtual machine scale set instance ids. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 updateInstances(String resourceGroupName, String vmScaleSetName, List instanceIds) { + return updateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().last().body(); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceIds The virtual machine scale set instance ids. + * @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 updateInstancesAsync(String resourceGroupName, String vmScaleSetName, List instanceIds, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds), serviceCallback); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceIds The virtual machine scale set instance ids. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateInstancesAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { + return updateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1, OperationStatusResponseInner>() { + @Override + public OperationStatusResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceIds The virtual machine scale set instance ids. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateInstancesWithServiceResponseAsync(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."); + } + if (instanceIds == null) { + throw new IllegalArgumentException("Parameter instanceIds is required and cannot be null."); + } + Validator.validate(instanceIds); + final String apiVersion = "2017-12-01"; + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); + vmInstanceIDs.withInstanceIds(instanceIds); + Observable> observable = service.updateInstances(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceIds The virtual machine scale set instance ids. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @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 beginUpdateInstances(String resourceGroupName, String vmScaleSetName, List instanceIds) { + return beginUpdateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().single().body(); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceIds The virtual machine scale set instance ids. + * @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 beginUpdateInstancesAsync(String resourceGroupName, String vmScaleSetName, List instanceIds, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds), serviceCallback); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceIds The virtual machine scale set instance ids. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationStatusResponseInner object + */ + public Observable beginUpdateInstancesAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { + return beginUpdateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1, OperationStatusResponseInner>() { + @Override + public OperationStatusResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. + * + * @param resourceGroupName The name of the resource group. + * @param vmScaleSetName The name of the VM scale set. + * @param instanceIds The virtual machine scale set instance ids. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationStatusResponseInner object + */ + public Observable> beginUpdateInstancesWithServiceResponseAsync(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."); + } + if (instanceIds == null) { + throw new IllegalArgumentException("Parameter instanceIds is required and cannot be null."); + } + Validator.validate(instanceIds); + final String apiVersion = "2017-12-01"; + VirtualMachineScaleSetVMInstanceRequiredIDs vmInstanceIDs = new VirtualMachineScaleSetVMInstanceRequiredIDs(); + vmInstanceIDs.withInstanceIds(instanceIds); + return service.beginUpdateInstances(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateInstancesDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateInstancesDelegate(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); + } + + /** + * Reimages (upgrade the operating system) 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 reimage(String resourceGroupName, String vmScaleSetName) { + return reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().last().body(); + } + + /** + * Reimages (upgrade the operating system) 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 reimageAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName), serviceCallback); + } + + /** + * Reimages (upgrade the operating system) 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 reimageAsync(String resourceGroupName, String vmScaleSetName) { + return reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1, OperationStatusResponseInner>() { + @Override + public OperationStatusResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Reimages (upgrade the operating system) 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> reimageWithServiceResponseAsync(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.reimage(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Reimages (upgrade the operating system) 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 reimage(String resourceGroupName, String vmScaleSetName, List instanceIds) { + return reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).toBlocking().last().body(); + } + + /** + * Reimages (upgrade the operating system) 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 reimageAsync(String resourceGroupName, String vmScaleSetName, List instanceIds, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds), serviceCallback); + } + + /** + * Reimages (upgrade the operating system) 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 reimageAsync(String resourceGroupName, String vmScaleSetName, List instanceIds) { + return reimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1, OperationStatusResponseInner>() { + @Override + public OperationStatusResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Reimages (upgrade the operating system) 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> reimageWithServiceResponseAsync(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.reimage(resourceGroupName, vmScaleSetName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), vmInstanceIDs, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Reimages (upgrade the operating system) 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 beginReimage(String resourceGroupName, String vmScaleSetName) { + return beginReimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName).toBlocking().single().body(); + } + + /** + * Reimages (upgrade the operating system) 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 beginReimageAsync(String resourceGroupName, String vmScaleSetName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginReimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName), serviceCallback); + } + + /** + * Reimages (upgrade the operating system) 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 beginReimageAsync(String resourceGroupName, String vmScaleSetName) { + return beginReimageWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1, OperationStatusResponseInner>() { + @Override + public OperationStatusResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Reimages (upgrade the operating system) 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> beginReimageWithServiceResponseAsync(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.beginReimage(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 = beginReimageDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -3880,4 +4667,115 @@ private ServiceResponse> listSkusNextD .build(response); } + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @param nextPageLink The NextLink from the previous successful call to List 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 PagedList<VirtualMachineScaleSetOSUpgradeHistoryInner> object if successful. + */ + public PagedList getOSUpgradeHistoryNext(final String nextPageLink) { + ServiceResponse> response = getOSUpgradeHistoryNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return getOSUpgradeHistoryNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @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> getOSUpgradeHistoryNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + getOSUpgradeHistoryNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return getOSUpgradeHistoryNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineScaleSetOSUpgradeHistoryInner> object + */ + public Observable> getOSUpgradeHistoryNextAsync(final String nextPageLink) { + return getOSUpgradeHistoryNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineScaleSetOSUpgradeHistoryInner> object + */ + public Observable>> getOSUpgradeHistoryNextWithServiceResponseAsync(final String nextPageLink) { + return getOSUpgradeHistoryNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(getOSUpgradeHistoryNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets list of OS upgrades on a VM scale set instance. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualMachineScaleSetOSUpgradeHistoryInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> getOSUpgradeHistoryNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.getOSUpgradeHistoryNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = getOSUpgradeHistoryNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> getOSUpgradeHistoryNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + }