diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnostics.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnostics.java index 54a98991df2a..9c8704fffeb5 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnostics.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnostics.java @@ -12,9 +12,8 @@ /** * Boot Diagnostics is a debugging feature which allows you to view Console - * Output and Screenshot to diagnose VM status. <br><br> For Linux - * Virtual Machines, you can easily view the output of your console log. - * <br><br> For both Windows and Linux virtual machines, Azure also + * Output and Screenshot to diagnose VM status. <br><br> You can + * easily view the output of your console log. <br><br> Azure also * enables you to see a screenshot of the VM from the hypervisor. */ public class BootDiagnostics { diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnosticsInstanceView.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnosticsInstanceView.java index e9b57e135648..f400de777263 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnosticsInstanceView.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/BootDiagnosticsInstanceView.java @@ -17,13 +17,13 @@ public class BootDiagnosticsInstanceView { /** * The console screenshot blob URI. */ - @JsonProperty(value = "consoleScreenshotBlobUri") + @JsonProperty(value = "consoleScreenshotBlobUri", access = JsonProperty.Access.WRITE_ONLY) private String consoleScreenshotBlobUri; /** * The Linux serial console log blob Uri. */ - @JsonProperty(value = "serialConsoleLogBlobUri") + @JsonProperty(value = "serialConsoleLogBlobUri", access = JsonProperty.Access.WRITE_ONLY) private String serialConsoleLogBlobUri; /** @@ -35,17 +35,6 @@ public String consoleScreenshotBlobUri() { return this.consoleScreenshotBlobUri; } - /** - * Set the console screenshot blob URI. - * - * @param consoleScreenshotBlobUri the consoleScreenshotBlobUri value to set - * @return the BootDiagnosticsInstanceView object itself. - */ - public BootDiagnosticsInstanceView withConsoleScreenshotBlobUri(String consoleScreenshotBlobUri) { - this.consoleScreenshotBlobUri = consoleScreenshotBlobUri; - return this; - } - /** * Get the Linux serial console log blob Uri. * @@ -55,15 +44,4 @@ public String serialConsoleLogBlobUri() { return this.serialConsoleLogBlobUri; } - /** - * Set the Linux serial console log blob Uri. - * - * @param serialConsoleLogBlobUri the serialConsoleLogBlobUri value to set - * @return the BootDiagnosticsInstanceView object itself. - */ - public BootDiagnosticsInstanceView withSerialConsoleLogBlobUri(String serialConsoleLogBlobUri) { - this.serialConsoleLogBlobUri = serialConsoleLogBlobUri; - return this; - } - } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiagnosticsProfile.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiagnosticsProfile.java index 3fc9ba6886e3..ad1efe83282e 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiagnosticsProfile.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/DiagnosticsProfile.java @@ -17,9 +17,8 @@ public class DiagnosticsProfile { /** * Boot Diagnostics is a debugging feature which allows you to view Console - * Output and Screenshot to diagnose VM status. <br><br> For - * Linux Virtual Machines, you can easily view the output of your console - * log. <br><br> For both Windows and Linux virtual machines, + * Output and Screenshot to diagnose VM status. <br><br> You + * can easily view the output of your console log. <br><br> * Azure also enables you to see a screenshot of the VM from the * hypervisor. */ @@ -27,7 +26,7 @@ public class DiagnosticsProfile { private BootDiagnostics bootDiagnostics; /** - * Get boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> For Linux Virtual Machines, you can easily view the output of your console log. <br><br> For both Windows and Linux virtual machines, Azure also enables you to see a screenshot of the VM from the hypervisor. + * Get boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. * * @return the bootDiagnostics value */ @@ -36,7 +35,7 @@ public BootDiagnostics bootDiagnostics() { } /** - * Set boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> For Linux Virtual Machines, you can easily view the output of your console log. <br><br> For both Windows and Linux virtual machines, Azure also enables you to see a screenshot of the VM from the hypervisor. + * Set boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. * * @param bootDiagnostics the bootDiagnostics value to set * @return the DiagnosticsProfile object itself. diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachine.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachine.java index d91d3c66f51c..81edce0f1367 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachine.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachine.java @@ -9,23 +9,21 @@ package com.microsoft.azure.management.compute.v2017_03_30; import com.microsoft.azure.arm.model.HasInner; -import com.microsoft.azure.arm.resources.models.Resource; -import com.microsoft.azure.arm.resources.models.GroupableResourceCore; -import com.microsoft.azure.arm.resources.models.HasResourceGroup; -import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.management.compute.v2017_03_30.implementation.VirtualMachineInner; +import com.microsoft.azure.arm.model.Indexable; import com.microsoft.azure.arm.model.Updatable; import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.compute.v2017_03_30.implementation.ComputeManager; +import java.util.Map; import com.microsoft.azure.SubResource; import java.util.List; -import com.microsoft.azure.management.compute.v2017_03_30.implementation.VirtualMachineInner; /** * Type representing VirtualMachine. */ -public interface VirtualMachine extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { +public interface VirtualMachine extends HasInner, Indexable, Updatable, HasManager { /** * @return the availabilitySet value. */ @@ -41,6 +39,11 @@ public interface VirtualMachine extends HasInner, Resource, */ HardwareProfile hardwareProfile(); + /** + * @return the id value. + */ + String id(); + /** * @return the identity value. */ @@ -56,6 +59,16 @@ public interface VirtualMachine extends HasInner, Resource, */ String licenseType(); + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + /** * @return the networkProfile value. */ @@ -86,6 +99,16 @@ public interface VirtualMachine extends HasInner, Resource, */ StorageProfile storageProfile(); + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + /** * @return the vmId value. */ @@ -99,7 +122,7 @@ public interface VirtualMachine extends HasInner, Resource, /** * The entirety of the VirtualMachine definition. */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithLocation, DefinitionStages.WithCreate { } /** @@ -109,17 +132,31 @@ interface DefinitionStages { /** * The first stage of a VirtualMachine definition. */ - interface Blank extends GroupableResourceCore.DefinitionWithRegion { + interface Blank extends WithLocation { } /** - * The stage of the VirtualMachine definition allowing to specify the resource group. + * The stage of the virtualmachine definition allowing to specify Location. */ - interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + interface WithLocation { + /** + * Specifies resourceGroupName. + */ + WithLocation withExistingLocation(String resourceGroupName); } /** - * The stage of the virtualmachine update allowing to specify AvailabilitySet. + * The stage of the virtualmachine definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the virtualmachine definition allowing to specify AvailabilitySet. */ interface WithAvailabilitySet { /** @@ -129,7 +166,7 @@ interface WithAvailabilitySet { } /** - * The stage of the virtualmachine update allowing to specify DiagnosticsProfile. + * The stage of the virtualmachine definition allowing to specify DiagnosticsProfile. */ interface WithDiagnosticsProfile { /** @@ -139,7 +176,7 @@ interface WithDiagnosticsProfile { } /** - * The stage of the virtualmachine update allowing to specify HardwareProfile. + * The stage of the virtualmachine definition allowing to specify HardwareProfile. */ interface WithHardwareProfile { /** @@ -149,7 +186,7 @@ interface WithHardwareProfile { } /** - * The stage of the virtualmachine update allowing to specify Identity. + * The stage of the virtualmachine definition allowing to specify Identity. */ interface WithIdentity { /** @@ -159,7 +196,7 @@ interface WithIdentity { } /** - * The stage of the virtualmachine update allowing to specify LicenseType. + * The stage of the virtualmachine definition allowing to specify LicenseType. */ interface WithLicenseType { /** @@ -169,7 +206,7 @@ interface WithLicenseType { } /** - * The stage of the virtualmachine update allowing to specify NetworkProfile. + * The stage of the virtualmachine definition allowing to specify NetworkProfile. */ interface WithNetworkProfile { /** @@ -179,7 +216,7 @@ interface WithNetworkProfile { } /** - * The stage of the virtualmachine update allowing to specify OsProfile. + * The stage of the virtualmachine definition allowing to specify OsProfile. */ interface WithOsProfile { /** @@ -189,7 +226,7 @@ interface WithOsProfile { } /** - * The stage of the virtualmachine update allowing to specify Plan. + * The stage of the virtualmachine definition allowing to specify Plan. */ interface WithPlan { /** @@ -199,7 +236,7 @@ interface WithPlan { } /** - * The stage of the virtualmachine update allowing to specify StorageProfile. + * The stage of the virtualmachine definition allowing to specify StorageProfile. */ interface WithStorageProfile { /** @@ -209,7 +246,17 @@ interface WithStorageProfile { } /** - * The stage of the virtualmachine update allowing to specify Zones. + * The stage of the virtualmachine definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the virtualmachine definition allowing to specify Zones. */ interface WithZones { /** @@ -223,13 +270,13 @@ interface WithZones { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAvailabilitySet, DefinitionStages.WithDiagnosticsProfile, DefinitionStages.WithHardwareProfile, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithNetworkProfile, DefinitionStages.WithOsProfile, DefinitionStages.WithPlan, DefinitionStages.WithStorageProfile, DefinitionStages.WithZones { + interface WithCreate extends Creatable, DefinitionStages.WithAvailabilitySet, DefinitionStages.WithDiagnosticsProfile, DefinitionStages.WithHardwareProfile, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithNetworkProfile, DefinitionStages.WithOsProfile, DefinitionStages.WithPlan, DefinitionStages.WithStorageProfile, DefinitionStages.WithTags, DefinitionStages.WithZones { } } /** * The template for a VirtualMachine update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAvailabilitySet, UpdateStages.WithDiagnosticsProfile, UpdateStages.WithHardwareProfile, UpdateStages.WithIdentity, UpdateStages.WithLicenseType, UpdateStages.WithNetworkProfile, UpdateStages.WithOsProfile, UpdateStages.WithPlan, UpdateStages.WithStorageProfile, UpdateStages.WithZones { + interface Update extends Appliable, UpdateStages.WithAvailabilitySet, UpdateStages.WithDiagnosticsProfile, UpdateStages.WithHardwareProfile, UpdateStages.WithIdentity, UpdateStages.WithLicenseType, UpdateStages.WithNetworkProfile, UpdateStages.WithOsProfile, UpdateStages.WithPlan, UpdateStages.WithStorageProfile, UpdateStages.WithTags, UpdateStages.WithZones { } /** @@ -237,7 +284,7 @@ interface Update extends Appliable, Resource.UpdateWithTags tags); + } + + /** + * The stage of the virtualmachine update allowing to specify Zones. */ interface WithZones { /** diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensions.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensions.java index b67f682b13af..a263720b6dd2 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensions.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachineExtensions.java @@ -8,16 +8,20 @@ package com.microsoft.azure.management.compute.v2017_03_30; -import com.microsoft.azure.arm.collection.SupportsCreating; -import rx.Completable; import rx.Observable; -import com.microsoft.azure.management.compute.v2017_03_30.implementation.VirtualMachineExtensionsInner; -import com.microsoft.azure.arm.model.HasInner; +import rx.Completable; /** * Type representing VirtualMachineExtensions. */ -public interface VirtualMachineExtensions extends SupportsCreating, HasInner { +public interface VirtualMachineExtensions { + /** + * Begins definition for a new Extension resource. + * @param name resource name. + * @return the first stage of the new Extension definition. + */ + VirtualMachineExtension.DefinitionStages.Blank defineExtension(String name); + /** * The operation to get the extension. * diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachines.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachines.java index a3881f15dddd..f23a11d0163f 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachines.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/VirtualMachines.java @@ -8,21 +8,31 @@ package com.microsoft.azure.management.compute.v2017_03_30; -import com.microsoft.azure.arm.collection.SupportsCreating; -import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; -import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; -import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; import rx.Observable; -import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; -import com.microsoft.azure.arm.collection.SupportsListing; -import com.microsoft.azure.management.compute.v2017_03_30.implementation.VirtualMachinesInner; -import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachine; +import rx.Completable; import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachineVirtualMachineSize; /** * Type representing VirtualMachines. */ -public interface VirtualMachines extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +public interface VirtualMachines { + /** + * Begins definition for a new VirtualMachine resource. + * @param name resource name. + * @return the first stage of the new VirtualMachine definition. + */ + VirtualMachine.DefinitionStages.Blank defineVirtualMachine(String name); + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(final String location); + /** * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. * @@ -34,6 +44,26 @@ public interface VirtualMachines extends SupportsCreating captureAsync(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters); + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAsync(String resourceGroupName, String vmName); + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByResourceGroupAsync(String resourceGroupName, String vmName); + /** * Retrieves information about the run-time state of a virtual machine. * @@ -135,6 +165,23 @@ public interface VirtualMachines extends SupportsCreating runCommandAsync(String resourceGroupName, String vmName, RunCommandInput parameters); + /** + * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupAsync(final String resourceGroupName); + + /** + * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + /** * The operation to get all extensions of a Virtual Machine. * diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionsImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionsImpl.java index bb4bab5f5d1d..9f72a176cabc 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionsImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineExtensionsImpl.java @@ -4,17 +4,17 @@ * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * + * abc */ package com.microsoft.azure.management.compute.v2017_03_30.implementation; import com.microsoft.azure.arm.model.implementation.WrapperImpl; import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachineExtensions; -import rx.Completable; import rx.Observable; import rx.functions.Func1; import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachineExtension; +import rx.Completable; class VirtualMachineExtensionsImpl extends WrapperImpl implements VirtualMachineExtensions { private final ComputeManager manager; @@ -29,16 +29,24 @@ public ComputeManager manager() { } @Override - public VirtualMachineExtensionImpl define(String name) { - return wrapModel(name); + public VirtualMachineExtensionImpl defineExtension(String name) { + return wrapExtensionModel(name); + } + + private VirtualMachineExtensionImpl wrapExtensionModel(String name) { + return new VirtualMachineExtensionImpl(name, this.manager()); } - private VirtualMachineExtensionImpl wrapModel(VirtualMachineExtensionInner inner) { + private VirtualMachineExtensionImpl wrapVirtualMachineExtensionModel(VirtualMachineExtensionInner inner) { return new VirtualMachineExtensionImpl(inner, manager()); } - private VirtualMachineExtensionImpl wrapModel(String name) { - return new VirtualMachineExtensionImpl(name, this.manager()); + private Observable getVirtualMachineExtensionInnerUsingVirtualMachineExtensionsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String vmName = IdParsingUtils.getValueFromIdByName(id, "virtualMachines"); + String vmExtensionName = IdParsingUtils.getValueFromIdByName(id, "extensions"); + VirtualMachineExtensionsInner client = this.inner(); + return client.getAsync(resourceGroupName, vmName, vmExtensionName); } @Override @@ -48,7 +56,7 @@ public Observable getAsync(String resourceGroupName, St .map(new Func1() { @Override public VirtualMachineExtension call(VirtualMachineExtensionInner inner) { - return wrapModel(inner); + return wrapVirtualMachineExtensionModel(inner); } }); } diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImpl.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImpl.java index 58612679f40d..60c7fe6f67ed 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImpl.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineImpl.java @@ -8,9 +8,10 @@ package com.microsoft.azure.management.compute.v2017_03_30.implementation; -import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachine; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; import rx.Observable; +import java.util.Map; import com.microsoft.azure.management.compute.v2017_03_30.Plan; import com.microsoft.azure.management.compute.v2017_03_30.HardwareProfile; import com.microsoft.azure.management.compute.v2017_03_30.StorageProfile; @@ -24,29 +25,53 @@ import java.util.ArrayList; import com.microsoft.azure.management.compute.v2017_03_30.VirtualMachineExtension; -class VirtualMachineImpl extends GroupableResourceCoreImpl implements VirtualMachine, VirtualMachine.Definition, VirtualMachine.Update { - VirtualMachineImpl(String name, VirtualMachineInner inner, ComputeManager manager) { - super(name, inner, manager); +class VirtualMachineImpl extends CreatableUpdatableImpl implements VirtualMachine, VirtualMachine.Definition, VirtualMachine.Update { + private final ComputeManager manager; + private String resourceGroupName; + private String vmName; + + VirtualMachineImpl(String name, ComputeManager manager) { + super(name, new VirtualMachineInner()); + this.manager = manager; + // Set resource name + this.vmName = name; + // + } + + VirtualMachineImpl(VirtualMachineInner inner, ComputeManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.vmName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.vmName = IdParsingUtils.getValueFromIdByName(inner.id(), "virtualMachines"); + // + } + + @Override + public ComputeManager manager() { + return this.manager; } @Override public Observable createResourceAsync() { VirtualMachinesInner client = this.manager().inner().virtualMachines(); - return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + return client.createOrUpdateAsync(this.resourceGroupName, this.vmName, this.inner()) .map(innerToFluentMap(this)); } @Override public Observable updateResourceAsync() { VirtualMachinesInner client = this.manager().inner().virtualMachines(); - return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + return client.createOrUpdateAsync(this.resourceGroupName, this.vmName, this.inner()) .map(innerToFluentMap(this)); } @Override protected Observable getInnerAsync() { VirtualMachinesInner client = this.manager().inner().virtualMachines(); - return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + return null; // NOP getInnerAsync implementation as get is not supported } @Override @@ -70,6 +95,11 @@ public HardwareProfile hardwareProfile() { return this.inner().hardwareProfile(); } + @Override + public String id() { + return this.inner().id(); + } + @Override public VirtualMachineIdentity identity() { return this.inner().identity(); @@ -90,6 +120,16 @@ public String licenseType() { return this.inner().licenseType(); } + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + @Override public NetworkProfile networkProfile() { return this.inner().networkProfile(); @@ -126,6 +166,16 @@ public StorageProfile storageProfile() { return this.inner().storageProfile(); } + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + @Override public String vmId() { return this.inner().vmId(); @@ -136,6 +186,18 @@ public List zones() { return this.inner().zones(); } + @Override + public VirtualMachineImpl withExistingLocation(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public VirtualMachineImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + @Override public VirtualMachineImpl withAvailabilitySet(SubResource availabilitySet) { this.inner().withAvailabilitySet(availabilitySet); @@ -190,6 +252,12 @@ public VirtualMachineImpl withStorageProfile(StorageProfile storageProfile) { return this; } + @Override + public VirtualMachineImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + @Override public VirtualMachineImpl withZones(List zones) { this.inner().withZones(zones); diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineInstanceViewInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineInstanceViewInner.java index 711214be6202..95abc2e135c3 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineInstanceViewInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineInstanceViewInner.java @@ -65,9 +65,8 @@ public class VirtualMachineInstanceViewInner { /** * Boot Diagnostics is a debugging feature which allows you to view Console - * Output and Screenshot to diagnose VM status. <br><br> For - * Linux Virtual Machines, you can easily view the output of your console - * log. <br><br> For both Windows and Linux virtual machines, + * Output and Screenshot to diagnose VM status. <br><br> You + * can easily view the output of your console log. <br><br> * Azure also enables you to see a screenshot of the VM from the * hypervisor. */ @@ -221,7 +220,7 @@ public VirtualMachineInstanceViewInner withExtensions(List implements VirtualMachines { - protected VirtualMachinesImpl(ComputeManager manager) { - super(manager.inner().virtualMachines(), manager); - } +class VirtualMachinesImpl extends WrapperImpl implements VirtualMachines { + private final ComputeManager manager; - @Override - protected Observable getInnerAsync(String resourceGroupName, String name) { - VirtualMachinesInner client = this.inner(); - return client.getByResourceGroupAsync(resourceGroupName, name); + VirtualMachinesImpl(ComputeManager manager) { + super(manager.inner().virtualMachines()); + this.manager = manager; } - @Override - protected Completable deleteInnerAsync(String resourceGroupName, String name) { - VirtualMachinesInner client = this.inner(); - return client.deleteAsync(resourceGroupName, name).toCompletable(); + public ComputeManager manager() { + return this.manager; } @Override - public Observable deleteByIdsAsync(Collection ids) { - if (ids == null || ids.isEmpty()) { - return Observable.empty(); - } - Collection> observables = new ArrayList<>(); - for (String id : ids) { - final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); - final String name = ResourceUtilsCore.nameFromResourceId(id); - Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); - observables.add(o); - } - return Observable.mergeDelayError(observables); + public VirtualMachineImpl defineVirtualMachine(String name) { + return wrapVirtualMachineModel(name); } - @Override - public Observable deleteByIdsAsync(String...ids) { - return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + private VirtualMachineImpl wrapVirtualMachineModel(String name) { + return new VirtualMachineImpl(name, this.manager()); } - @Override - public void deleteByIds(Collection ids) { - if (ids != null && !ids.isEmpty()) { - this.deleteByIdsAsync(ids).toBlocking().last(); - } + private VirtualMachineImpl wrapVirtualMachineModel(VirtualMachineInner inner) { + return new VirtualMachineImpl(inner, manager()); } - @Override - public void deleteByIds(String...ids) { - this.deleteByIds(new ArrayList(Arrays.asList(ids))); - } - - @Override - public PagedList listByResourceGroup(String resourceGroupName) { - VirtualMachinesInner client = this.inner(); - return this.wrapList(client.listByResourceGroup(resourceGroupName)); + private VirtualMachineVirtualMachineSizeImpl wrapVirtualMachineVirtualMachineSizeModel(VirtualMachineSizeInner inner) { + return new VirtualMachineVirtualMachineSizeImpl(inner, manager()); } @Override - public Observable listByResourceGroupAsync(String resourceGroupName) { + public Observable listByLocationAsync(final String location) { VirtualMachinesInner client = this.inner(); - return client.listByResourceGroupAsync(resourceGroupName) + return client.listByLocationAsync(location) .flatMapIterable(new Func1, Iterable>() { @Override public Iterable call(Page page) { @@ -100,48 +67,43 @@ public Iterable call(Page page) { .map(new Func1() { @Override public VirtualMachine call(VirtualMachineInner inner) { - return wrapModel(inner); + return wrapVirtualMachineModel(inner); } }); } @Override - public PagedList list() { + public Observable captureAsync(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { VirtualMachinesInner client = this.inner(); - return this.wrapList(client.list()); + return client.captureAsync(resourceGroupName, vmName, parameters) + .map(new Func1() { + @Override + public VirtualMachineCaptureResult call(VirtualMachineCaptureResultInner inner) { + return new VirtualMachineCaptureResultImpl(inner, manager()); + } + }); } @Override - public Observable listAsync() { + public Observable deleteAsync(String resourceGroupName, String vmName) { VirtualMachinesInner client = this.inner(); - return client.listAsync() - .flatMapIterable(new Func1, Iterable>() { - @Override - public Iterable call(Page page) { - return page.items(); - } - }) - .map(new Func1() { + return client.deleteAsync(resourceGroupName, vmName) + .map(new Func1() { @Override - public VirtualMachine call(VirtualMachineInner inner) { - return wrapModel(inner); + public OperationStatusResponse call(OperationStatusResponseInner inner) { + return new OperationStatusResponseImpl(inner, manager()); } }); } @Override - public VirtualMachineImpl define(String name) { - return wrapModel(name); - } - - @Override - public Observable captureAsync(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { + public Observable getByResourceGroupAsync(String resourceGroupName, String vmName) { VirtualMachinesInner client = this.inner(); - return client.captureAsync(resourceGroupName, vmName, parameters) - .map(new Func1() { + return client.getByResourceGroupAsync(resourceGroupName, vmName) + .map(new Func1() { @Override - public VirtualMachineCaptureResult call(VirtualMachineCaptureResultInner inner) { - return new VirtualMachineCaptureResultImpl(inner, manager()); + public VirtualMachine call(VirtualMachineInner inner) { + return new VirtualMachineImpl(inner, manager()); } }); } @@ -267,17 +229,39 @@ public RunCommandResult call(RunCommandResultInner inner) { } @Override - protected VirtualMachineImpl wrapModel(VirtualMachineInner inner) { - return new VirtualMachineImpl(inner.name(), inner, manager()); + public Observable listByResourceGroupAsync(final String resourceGroupName) { + VirtualMachinesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public VirtualMachine call(VirtualMachineInner inner) { + return new VirtualMachineImpl(inner, manager()); + } + }); } @Override - protected VirtualMachineImpl wrapModel(String name) { - return new VirtualMachineImpl(name, new VirtualMachineInner(), this.manager()); - } - - private VirtualMachineVirtualMachineSizeImpl wrapVirtualMachineVirtualMachineSizeModel(VirtualMachineSizeInner inner) { - return new VirtualMachineVirtualMachineSizeImpl(inner, manager()); + public Observable listAsync() { + VirtualMachinesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public VirtualMachine call(VirtualMachineInner inner) { + return new VirtualMachineImpl(inner, manager()); + } + }); } @Override diff --git a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java index 71036e8f6c72..ba49e614f76f 100644 --- a/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java +++ b/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java @@ -72,6 +72,10 @@ interface VirtualMachinesService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions") Observable> getExtensions(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Query("$expand") String expand, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2017_03_30.VirtualMachines listByLocation" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines") + Observable> listByLocation(@Path("location") String location, @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.v2017_03_30.VirtualMachines capture" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture") Observable> capture(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineCaptureParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -184,6 +188,10 @@ interface VirtualMachinesService { @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand") Observable> beginRunCommand(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Body RunCommandInput parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2017_03_30.VirtualMachines listByLocationNext" }) + @GET + Observable> listByLocationNext(@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.v2017_03_30.VirtualMachines listByResourceGroupNext" }) @GET Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -364,6 +372,121 @@ private ServiceResponse getExtensionsDe .build(response); } + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @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<VirtualMachineInner> object if successful. + */ + public PagedList listByLocation(final String location) { + ServiceResponse> response = listByLocationSinglePageAsync(location).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @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> listByLocationAsync(final String location, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationSinglePageAsync(location), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineInner> object + */ + public Observable> listByLocationAsync(final String location) { + return listByLocationWithServiceResponseAsync(location) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String location) { + return listByLocationSinglePageAsync(location) + .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(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + ServiceResponse> * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualMachineInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(final String location) { + if (location == null) { + throw new IllegalArgumentException("Parameter location 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByLocation(location, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationDelegate(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); + } + /** * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. * @@ -2784,6 +2907,117 @@ private ServiceResponse beginRunCommandDelegate(Response< .build(response); } + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @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<VirtualMachineInner> object if successful. + */ + public PagedList listByLocationNext(final String nextPageLink) { + ServiceResponse> response = listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @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> listByLocationNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @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<VirtualMachineInner> object + */ + public Observable> listByLocationNextAsync(final String nextPageLink) { + return listByLocationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @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<VirtualMachineInner> object + */ + public Observable>> listByLocationNextWithServiceResponseAsync(final String nextPageLink) { + return listByLocationNextSinglePageAsync(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(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualMachineInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationNextSinglePageAsync(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.listByLocationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationNextDelegate(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); + } + /** * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines. * diff --git a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/BootDiagnostics.java b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/BootDiagnostics.java index abde4fb15a84..5c512f30c003 100644 --- a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/BootDiagnostics.java +++ b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/BootDiagnostics.java @@ -12,9 +12,8 @@ /** * Boot Diagnostics is a debugging feature which allows you to view Console - * Output and Screenshot to diagnose VM status. <br><br> For Linux - * Virtual Machines, you can easily view the output of your console log. - * <br><br> For both Windows and Linux virtual machines, Azure also + * Output and Screenshot to diagnose VM status. <br><br> You can + * easily view the output of your console log. <br><br> Azure also * enables you to see a screenshot of the VM from the hypervisor. */ public class BootDiagnostics { diff --git a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/BootDiagnosticsInstanceView.java b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/BootDiagnosticsInstanceView.java index 038592758e98..c3c1c511e5e5 100644 --- a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/BootDiagnosticsInstanceView.java +++ b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/BootDiagnosticsInstanceView.java @@ -17,13 +17,13 @@ public class BootDiagnosticsInstanceView { /** * The console screenshot blob URI. */ - @JsonProperty(value = "consoleScreenshotBlobUri") + @JsonProperty(value = "consoleScreenshotBlobUri", access = JsonProperty.Access.WRITE_ONLY) private String consoleScreenshotBlobUri; /** * The Linux serial console log blob Uri. */ - @JsonProperty(value = "serialConsoleLogBlobUri") + @JsonProperty(value = "serialConsoleLogBlobUri", access = JsonProperty.Access.WRITE_ONLY) private String serialConsoleLogBlobUri; /** @@ -35,17 +35,6 @@ public String consoleScreenshotBlobUri() { return this.consoleScreenshotBlobUri; } - /** - * Set the console screenshot blob URI. - * - * @param consoleScreenshotBlobUri the consoleScreenshotBlobUri value to set - * @return the BootDiagnosticsInstanceView object itself. - */ - public BootDiagnosticsInstanceView withConsoleScreenshotBlobUri(String consoleScreenshotBlobUri) { - this.consoleScreenshotBlobUri = consoleScreenshotBlobUri; - return this; - } - /** * Get the Linux serial console log blob Uri. * @@ -55,15 +44,4 @@ public String serialConsoleLogBlobUri() { return this.serialConsoleLogBlobUri; } - /** - * Set the Linux serial console log blob Uri. - * - * @param serialConsoleLogBlobUri the serialConsoleLogBlobUri value to set - * @return the BootDiagnosticsInstanceView object itself. - */ - public BootDiagnosticsInstanceView withSerialConsoleLogBlobUri(String serialConsoleLogBlobUri) { - this.serialConsoleLogBlobUri = serialConsoleLogBlobUri; - return this; - } - } diff --git a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/DiagnosticsProfile.java b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/DiagnosticsProfile.java index 9bdc138e1abc..f306a7c86ba8 100644 --- a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/DiagnosticsProfile.java +++ b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/DiagnosticsProfile.java @@ -17,9 +17,8 @@ public class DiagnosticsProfile { /** * Boot Diagnostics is a debugging feature which allows you to view Console - * Output and Screenshot to diagnose VM status. <br><br> For - * Linux Virtual Machines, you can easily view the output of your console - * log. <br><br> For both Windows and Linux virtual machines, + * Output and Screenshot to diagnose VM status. <br><br> You + * can easily view the output of your console log. <br><br> * Azure also enables you to see a screenshot of the VM from the * hypervisor. */ @@ -27,7 +26,7 @@ public class DiagnosticsProfile { private BootDiagnostics bootDiagnostics; /** - * Get boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> For Linux Virtual Machines, you can easily view the output of your console log. <br><br> For both Windows and Linux virtual machines, Azure also enables you to see a screenshot of the VM from the hypervisor. + * Get boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. * * @return the bootDiagnostics value */ @@ -36,7 +35,7 @@ public BootDiagnostics bootDiagnostics() { } /** - * Set boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> For Linux Virtual Machines, you can easily view the output of your console log. <br><br> For both Windows and Linux virtual machines, Azure also enables you to see a screenshot of the VM from the hypervisor. + * Set boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot to diagnose VM status. <br><br> You can easily view the output of your console log. <br><br> Azure also enables you to see a screenshot of the VM from the hypervisor. * * @param bootDiagnostics the bootDiagnostics value to set * @return the DiagnosticsProfile object itself. diff --git a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/VirtualMachine.java b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/VirtualMachine.java index 259954b05cfa..634661bc5381 100644 --- a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/VirtualMachine.java +++ b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/VirtualMachine.java @@ -9,24 +9,22 @@ package com.microsoft.azure.management.compute.v2017_12_01; import com.microsoft.azure.arm.model.HasInner; -import com.microsoft.azure.arm.resources.models.Resource; -import com.microsoft.azure.arm.resources.models.GroupableResourceCore; -import com.microsoft.azure.arm.resources.models.HasResourceGroup; -import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.management.compute.v2017_12_01.implementation.VirtualMachineInner; +import com.microsoft.azure.arm.model.Indexable; import com.microsoft.azure.arm.model.Updatable; import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; import com.microsoft.azure.arm.resources.models.HasManager; import com.microsoft.azure.management.compute.v2017_12_01.implementation.ComputeManager; +import java.util.Map; import com.microsoft.azure.SubResource; import com.microsoft.azure.management.compute.v2017_12_01.implementation.VirtualMachineInstanceViewInner; import java.util.List; -import com.microsoft.azure.management.compute.v2017_12_01.implementation.VirtualMachineInner; /** * Type representing VirtualMachine. */ -public interface VirtualMachine extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { +public interface VirtualMachine extends HasInner, Indexable, Updatable, HasManager { /** * @return the availabilitySet value. */ @@ -42,6 +40,11 @@ public interface VirtualMachine extends HasInner, Resource, */ HardwareProfile hardwareProfile(); + /** + * @return the id value. + */ + String id(); + /** * @return the identity value. */ @@ -57,6 +60,16 @@ public interface VirtualMachine extends HasInner, Resource, */ String licenseType(); + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + /** * @return the networkProfile value. */ @@ -87,6 +100,16 @@ public interface VirtualMachine extends HasInner, Resource, */ StorageProfile storageProfile(); + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + /** * @return the vmId value. */ @@ -100,7 +123,7 @@ public interface VirtualMachine extends HasInner, Resource, /** * The entirety of the VirtualMachine definition. */ - interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithLocation, DefinitionStages.WithCreate { } /** @@ -110,17 +133,31 @@ interface DefinitionStages { /** * The first stage of a VirtualMachine definition. */ - interface Blank extends GroupableResourceCore.DefinitionWithRegion { + interface Blank extends WithLocation { } /** - * The stage of the VirtualMachine definition allowing to specify the resource group. + * The stage of the virtualmachine definition allowing to specify Location. */ - interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + interface WithLocation { + /** + * Specifies resourceGroupName. + */ + WithLocation withExistingLocation(String resourceGroupName); } /** - * The stage of the virtualmachine update allowing to specify AvailabilitySet. + * The stage of the virtualmachine definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + */ + WithCreate withLocation(String location); + } + + /** + * The stage of the virtualmachine definition allowing to specify AvailabilitySet. */ interface WithAvailabilitySet { /** @@ -130,7 +167,7 @@ interface WithAvailabilitySet { } /** - * The stage of the virtualmachine update allowing to specify DiagnosticsProfile. + * The stage of the virtualmachine definition allowing to specify DiagnosticsProfile. */ interface WithDiagnosticsProfile { /** @@ -140,7 +177,7 @@ interface WithDiagnosticsProfile { } /** - * The stage of the virtualmachine update allowing to specify HardwareProfile. + * The stage of the virtualmachine definition allowing to specify HardwareProfile. */ interface WithHardwareProfile { /** @@ -150,7 +187,7 @@ interface WithHardwareProfile { } /** - * The stage of the virtualmachine update allowing to specify Identity. + * The stage of the virtualmachine definition allowing to specify Identity. */ interface WithIdentity { /** @@ -160,7 +197,7 @@ interface WithIdentity { } /** - * The stage of the virtualmachine update allowing to specify LicenseType. + * The stage of the virtualmachine definition allowing to specify LicenseType. */ interface WithLicenseType { /** @@ -170,7 +207,7 @@ interface WithLicenseType { } /** - * The stage of the virtualmachine update allowing to specify NetworkProfile. + * The stage of the virtualmachine definition allowing to specify NetworkProfile. */ interface WithNetworkProfile { /** @@ -180,7 +217,7 @@ interface WithNetworkProfile { } /** - * The stage of the virtualmachine update allowing to specify OsProfile. + * The stage of the virtualmachine definition allowing to specify OsProfile. */ interface WithOsProfile { /** @@ -190,7 +227,7 @@ interface WithOsProfile { } /** - * The stage of the virtualmachine update allowing to specify Plan. + * The stage of the virtualmachine definition allowing to specify Plan. */ interface WithPlan { /** @@ -200,7 +237,7 @@ interface WithPlan { } /** - * The stage of the virtualmachine update allowing to specify StorageProfile. + * The stage of the virtualmachine definition allowing to specify StorageProfile. */ interface WithStorageProfile { /** @@ -210,7 +247,17 @@ interface WithStorageProfile { } /** - * The stage of the virtualmachine update allowing to specify Zones. + * The stage of the virtualmachine definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the virtualmachine definition allowing to specify Zones. */ interface WithZones { /** @@ -224,13 +271,13 @@ interface WithZones { * the resource to be created (via {@link WithCreate#create()}), but also allows * for any other optional settings to be specified. */ - interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithAvailabilitySet, DefinitionStages.WithDiagnosticsProfile, DefinitionStages.WithHardwareProfile, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithNetworkProfile, DefinitionStages.WithOsProfile, DefinitionStages.WithPlan, DefinitionStages.WithStorageProfile, DefinitionStages.WithZones { + interface WithCreate extends Creatable, DefinitionStages.WithAvailabilitySet, DefinitionStages.WithDiagnosticsProfile, DefinitionStages.WithHardwareProfile, DefinitionStages.WithIdentity, DefinitionStages.WithLicenseType, DefinitionStages.WithNetworkProfile, DefinitionStages.WithOsProfile, DefinitionStages.WithPlan, DefinitionStages.WithStorageProfile, DefinitionStages.WithTags, DefinitionStages.WithZones { } } /** * The template for a VirtualMachine update operation, containing all the settings that can be modified. */ - interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithAvailabilitySet, UpdateStages.WithDiagnosticsProfile, UpdateStages.WithHardwareProfile, UpdateStages.WithIdentity, UpdateStages.WithLicenseType, UpdateStages.WithNetworkProfile, UpdateStages.WithOsProfile, UpdateStages.WithPlan, UpdateStages.WithStorageProfile, UpdateStages.WithZones { + interface Update extends Appliable, UpdateStages.WithAvailabilitySet, UpdateStages.WithDiagnosticsProfile, UpdateStages.WithHardwareProfile, UpdateStages.WithIdentity, UpdateStages.WithLicenseType, UpdateStages.WithNetworkProfile, UpdateStages.WithOsProfile, UpdateStages.WithPlan, UpdateStages.WithStorageProfile, UpdateStages.WithTags, UpdateStages.WithZones { } /** @@ -238,7 +285,7 @@ interface Update extends Appliable, Resource.UpdateWithTags tags); + } + + /** + * The stage of the virtualmachine update allowing to specify Zones. */ interface WithZones { /** diff --git a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/VirtualMachineExtensions.java b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/VirtualMachineExtensions.java index 11df68b64868..18bb37df8f29 100644 --- a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/VirtualMachineExtensions.java +++ b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/VirtualMachineExtensions.java @@ -8,16 +8,20 @@ package com.microsoft.azure.management.compute.v2017_12_01; -import com.microsoft.azure.arm.collection.SupportsCreating; -import rx.Completable; import rx.Observable; -import com.microsoft.azure.management.compute.v2017_12_01.implementation.VirtualMachineExtensionsInner; -import com.microsoft.azure.arm.model.HasInner; +import rx.Completable; /** * Type representing VirtualMachineExtensions. */ -public interface VirtualMachineExtensions extends SupportsCreating, HasInner { +public interface VirtualMachineExtensions { + /** + * Begins definition for a new Extension resource. + * @param name resource name. + * @return the first stage of the new Extension definition. + */ + VirtualMachineExtension.DefinitionStages.Blank defineExtension(String name); + /** * The operation to get the extension. * diff --git a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/VirtualMachines.java b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/VirtualMachines.java index 19735474f5b3..700e08c6f254 100644 --- a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/VirtualMachines.java +++ b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/VirtualMachines.java @@ -8,21 +8,31 @@ package com.microsoft.azure.management.compute.v2017_12_01; -import com.microsoft.azure.arm.collection.SupportsCreating; -import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; -import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; -import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; import rx.Observable; -import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; -import com.microsoft.azure.arm.collection.SupportsListing; -import com.microsoft.azure.management.compute.v2017_12_01.implementation.VirtualMachinesInner; -import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.compute.v2017_12_01.VirtualMachine; +import rx.Completable; import com.microsoft.azure.management.compute.v2017_12_01.VirtualMachineVirtualMachineSize; /** * Type representing VirtualMachines. */ -public interface VirtualMachines extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +public interface VirtualMachines { + /** + * Begins definition for a new VirtualMachine resource. + * @param name resource name. + * @return the first stage of the new VirtualMachine definition. + */ + VirtualMachine.DefinitionStages.Blank defineVirtualMachine(String name); + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByLocationAsync(final String location); + /** * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. * @@ -34,6 +44,26 @@ public interface VirtualMachines extends SupportsCreating captureAsync(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters); + /** + * The operation to delete a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable deleteAsync(String resourceGroupName, String vmName); + + /** + * Retrieves information about the model view or the instance view of a virtual machine. + * + * @param resourceGroupName The name of the resource group. + * @param vmName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getByResourceGroupAsync(String resourceGroupName, String vmName); + /** * Retrieves information about the run-time state of a virtual machine. * @@ -135,6 +165,23 @@ public interface VirtualMachines extends SupportsCreating runCommandAsync(String resourceGroupName, String vmName, RunCommandInput parameters); + /** + * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceGroupAsync(final String resourceGroupName); + + /** + * Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + /** * The operation to get all extensions of a Virtual Machine. * diff --git a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionsImpl.java b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionsImpl.java index f0ff02f0132b..74a81c2fe4d0 100644 --- a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionsImpl.java +++ b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionsImpl.java @@ -4,17 +4,17 @@ * license information. * * Code generated by Microsoft (R) AutoRest Code Generator. - * + * abc */ package com.microsoft.azure.management.compute.v2017_12_01.implementation; import com.microsoft.azure.arm.model.implementation.WrapperImpl; import com.microsoft.azure.management.compute.v2017_12_01.VirtualMachineExtensions; -import rx.Completable; import rx.Observable; import rx.functions.Func1; import com.microsoft.azure.management.compute.v2017_12_01.VirtualMachineExtension; +import rx.Completable; class VirtualMachineExtensionsImpl extends WrapperImpl implements VirtualMachineExtensions { private final ComputeManager manager; @@ -29,16 +29,24 @@ public ComputeManager manager() { } @Override - public VirtualMachineExtensionImpl define(String name) { - return wrapModel(name); + public VirtualMachineExtensionImpl defineExtension(String name) { + return wrapExtensionModel(name); + } + + private VirtualMachineExtensionImpl wrapExtensionModel(String name) { + return new VirtualMachineExtensionImpl(name, this.manager()); } - private VirtualMachineExtensionImpl wrapModel(VirtualMachineExtensionInner inner) { + private VirtualMachineExtensionImpl wrapVirtualMachineExtensionModel(VirtualMachineExtensionInner inner) { return new VirtualMachineExtensionImpl(inner, manager()); } - private VirtualMachineExtensionImpl wrapModel(String name) { - return new VirtualMachineExtensionImpl(name, this.manager()); + private Observable getVirtualMachineExtensionInnerUsingVirtualMachineExtensionsInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String vmName = IdParsingUtils.getValueFromIdByName(id, "virtualMachines"); + String vmExtensionName = IdParsingUtils.getValueFromIdByName(id, "extensions"); + VirtualMachineExtensionsInner client = this.inner(); + return client.getAsync(resourceGroupName, vmName, vmExtensionName); } @Override @@ -48,7 +56,7 @@ public Observable getAsync(String resourceGroupName, St .map(new Func1() { @Override public VirtualMachineExtension call(VirtualMachineExtensionInner inner) { - return wrapModel(inner); + return wrapVirtualMachineExtensionModel(inner); } }); } diff --git a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineImpl.java b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineImpl.java index ed1c149f6270..5046549d571d 100644 --- a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineImpl.java +++ b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineImpl.java @@ -8,10 +8,11 @@ package com.microsoft.azure.management.compute.v2017_12_01.implementation; -import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; import com.microsoft.azure.management.compute.v2017_12_01.VirtualMachine; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; import rx.Observable; import com.microsoft.azure.management.compute.v2017_12_01.VirtualMachineUpdate; +import java.util.Map; import com.microsoft.azure.SubResource; import java.util.List; import com.microsoft.azure.management.compute.v2017_12_01.Plan; @@ -26,17 +27,42 @@ import com.microsoft.azure.management.compute.v2017_12_01.VirtualMachineExtension; import rx.functions.Func1; -class VirtualMachineImpl extends GroupableResourceCoreImpl implements VirtualMachine, VirtualMachine.Definition, VirtualMachine.Update { +class VirtualMachineImpl extends CreatableUpdatableImpl implements VirtualMachine, VirtualMachine.Definition, VirtualMachine.Update { + private final ComputeManager manager; + private String resourceGroupName; + private String vmName; private VirtualMachineUpdate updateParameter; - VirtualMachineImpl(String name, VirtualMachineInner inner, ComputeManager manager) { - super(name, inner, manager); + + VirtualMachineImpl(String name, ComputeManager manager) { + super(name, new VirtualMachineInner()); + this.manager = manager; + // Set resource name + this.vmName = name; + // this.updateParameter = new VirtualMachineUpdate(); } + VirtualMachineImpl(VirtualMachineInner inner, ComputeManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.vmName = inner.name(); + // resource ancestor names + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.vmName = IdParsingUtils.getValueFromIdByName(inner.id(), "virtualMachines"); + // + this.updateParameter = new VirtualMachineUpdate(); + } + + @Override + public ComputeManager manager() { + return this.manager; + } + @Override public Observable createResourceAsync() { VirtualMachinesInner client = this.manager().inner().virtualMachines(); - return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + return client.createOrUpdateAsync(this.resourceGroupName, this.vmName, this.inner()) .map(new Func1() { @Override public VirtualMachineInner call(VirtualMachineInner resource) { @@ -50,7 +76,7 @@ public VirtualMachineInner call(VirtualMachineInner resource) { @Override public Observable updateResourceAsync() { VirtualMachinesInner client = this.manager().inner().virtualMachines(); - return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + return client.updateAsync(this.resourceGroupName, this.vmName, this.updateParameter) .map(new Func1() { @Override public VirtualMachineInner call(VirtualMachineInner resource) { @@ -64,7 +90,7 @@ public VirtualMachineInner call(VirtualMachineInner resource) { @Override protected Observable getInnerAsync() { VirtualMachinesInner client = this.manager().inner().virtualMachines(); - return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + return null; // NOP getInnerAsync implementation as get is not supported } @Override @@ -91,6 +117,11 @@ public HardwareProfile hardwareProfile() { return this.inner().hardwareProfile(); } + @Override + public String id() { + return this.inner().id(); + } + @Override public VirtualMachineIdentity identity() { return this.inner().identity(); @@ -111,6 +142,16 @@ public String licenseType() { return this.inner().licenseType(); } + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + @Override public NetworkProfile networkProfile() { return this.inner().networkProfile(); @@ -147,6 +188,16 @@ public StorageProfile storageProfile() { return this.inner().storageProfile(); } + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + @Override public String vmId() { return this.inner().vmId(); @@ -157,6 +208,18 @@ public List zones() { return this.inner().zones(); } + @Override + public VirtualMachineImpl withExistingLocation(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + @Override + public VirtualMachineImpl withLocation(String location) { + this.inner().withLocation(location); + return this; + } + @Override public VirtualMachineImpl withAvailabilitySet(SubResource availabilitySet) { if (isInCreateMode()) { @@ -247,6 +310,16 @@ public VirtualMachineImpl withStorageProfile(StorageProfile storageProfile) { return this; } + @Override + public VirtualMachineImpl withTags(Map tags) { + if (isInCreateMode()) { + this.inner().withTags(tags); + } else { + this.updateParameter.withTags(tags); + } + return this; + } + @Override public VirtualMachineImpl withZones(List zones) { if (isInCreateMode()) { diff --git a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineInstanceViewInner.java b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineInstanceViewInner.java index 02b18940d335..384370c1f449 100644 --- a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineInstanceViewInner.java +++ b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineInstanceViewInner.java @@ -83,9 +83,8 @@ public class VirtualMachineInstanceViewInner { /** * Boot Diagnostics is a debugging feature which allows you to view Console - * Output and Screenshot to diagnose VM status. <br><br> For - * Linux Virtual Machines, you can easily view the output of your console - * log. <br><br> For both Windows and Linux virtual machines, + * Output and Screenshot to diagnose VM status. <br><br> You + * can easily view the output of your console log. <br><br> * Azure also enables you to see a screenshot of the VM from the * hypervisor. */ @@ -299,7 +298,7 @@ public VirtualMachineInstanceViewInner withExtensions(List implements VirtualMachines { - protected VirtualMachinesImpl(ComputeManager manager) { - super(manager.inner().virtualMachines(), manager); - } +class VirtualMachinesImpl extends WrapperImpl implements VirtualMachines { + private final ComputeManager manager; - @Override - protected Observable getInnerAsync(String resourceGroupName, String name) { - VirtualMachinesInner client = this.inner(); - return client.getByResourceGroupAsync(resourceGroupName, name); + VirtualMachinesImpl(ComputeManager manager) { + super(manager.inner().virtualMachines()); + this.manager = manager; } - @Override - protected Completable deleteInnerAsync(String resourceGroupName, String name) { - VirtualMachinesInner client = this.inner(); - return client.deleteAsync(resourceGroupName, name).toCompletable(); + public ComputeManager manager() { + return this.manager; } @Override - public Observable deleteByIdsAsync(Collection ids) { - if (ids == null || ids.isEmpty()) { - return Observable.empty(); - } - Collection> observables = new ArrayList<>(); - for (String id : ids) { - final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); - final String name = ResourceUtilsCore.nameFromResourceId(id); - Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); - observables.add(o); - } - return Observable.mergeDelayError(observables); + public VirtualMachineImpl defineVirtualMachine(String name) { + return wrapVirtualMachineModel(name); } - @Override - public Observable deleteByIdsAsync(String...ids) { - return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + private VirtualMachineImpl wrapVirtualMachineModel(String name) { + return new VirtualMachineImpl(name, this.manager()); } - @Override - public void deleteByIds(Collection ids) { - if (ids != null && !ids.isEmpty()) { - this.deleteByIdsAsync(ids).toBlocking().last(); - } + private VirtualMachineImpl wrapVirtualMachineModel(VirtualMachineInner inner) { + return new VirtualMachineImpl(inner, manager()); } - @Override - public void deleteByIds(String...ids) { - this.deleteByIds(new ArrayList(Arrays.asList(ids))); - } - - @Override - public PagedList listByResourceGroup(String resourceGroupName) { - VirtualMachinesInner client = this.inner(); - return this.wrapList(client.listByResourceGroup(resourceGroupName)); + private VirtualMachineVirtualMachineSizeImpl wrapVirtualMachineVirtualMachineSizeModel(VirtualMachineSizeInner inner) { + return new VirtualMachineVirtualMachineSizeImpl(inner, manager()); } @Override - public Observable listByResourceGroupAsync(String resourceGroupName) { + public Observable listByLocationAsync(final String location) { VirtualMachinesInner client = this.inner(); - return client.listByResourceGroupAsync(resourceGroupName) + return client.listByLocationAsync(location) .flatMapIterable(new Func1, Iterable>() { @Override public Iterable call(Page page) { @@ -100,48 +67,43 @@ public Iterable call(Page page) { .map(new Func1() { @Override public VirtualMachine call(VirtualMachineInner inner) { - return wrapModel(inner); + return wrapVirtualMachineModel(inner); } }); } @Override - public PagedList list() { + public Observable captureAsync(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { VirtualMachinesInner client = this.inner(); - return this.wrapList(client.list()); + return client.captureAsync(resourceGroupName, vmName, parameters) + .map(new Func1() { + @Override + public VirtualMachineCaptureResult call(VirtualMachineCaptureResultInner inner) { + return new VirtualMachineCaptureResultImpl(inner, manager()); + } + }); } @Override - public Observable listAsync() { + public Observable deleteAsync(String resourceGroupName, String vmName) { VirtualMachinesInner client = this.inner(); - return client.listAsync() - .flatMapIterable(new Func1, Iterable>() { - @Override - public Iterable call(Page page) { - return page.items(); - } - }) - .map(new Func1() { + return client.deleteAsync(resourceGroupName, vmName) + .map(new Func1() { @Override - public VirtualMachine call(VirtualMachineInner inner) { - return wrapModel(inner); + public OperationStatusResponse call(OperationStatusResponseInner inner) { + return new OperationStatusResponseImpl(inner, manager()); } }); } @Override - public VirtualMachineImpl define(String name) { - return wrapModel(name); - } - - @Override - public Observable captureAsync(String resourceGroupName, String vmName, VirtualMachineCaptureParameters parameters) { + public Observable getByResourceGroupAsync(String resourceGroupName, String vmName) { VirtualMachinesInner client = this.inner(); - return client.captureAsync(resourceGroupName, vmName, parameters) - .map(new Func1() { + return client.getByResourceGroupAsync(resourceGroupName, vmName) + .map(new Func1() { @Override - public VirtualMachineCaptureResult call(VirtualMachineCaptureResultInner inner) { - return new VirtualMachineCaptureResultImpl(inner, manager()); + public VirtualMachine call(VirtualMachineInner inner) { + return new VirtualMachineImpl(inner, manager()); } }); } @@ -267,17 +229,39 @@ public RunCommandResult call(RunCommandResultInner inner) { } @Override - protected VirtualMachineImpl wrapModel(VirtualMachineInner inner) { - return new VirtualMachineImpl(inner.name(), inner, manager()); + public Observable listByResourceGroupAsync(final String resourceGroupName) { + VirtualMachinesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public VirtualMachine call(VirtualMachineInner inner) { + return new VirtualMachineImpl(inner, manager()); + } + }); } @Override - protected VirtualMachineImpl wrapModel(String name) { - return new VirtualMachineImpl(name, new VirtualMachineInner(), this.manager()); - } - - private VirtualMachineVirtualMachineSizeImpl wrapVirtualMachineVirtualMachineSizeModel(VirtualMachineSizeInner inner) { - return new VirtualMachineVirtualMachineSizeImpl(inner, manager()); + public Observable listAsync() { + VirtualMachinesInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public VirtualMachine call(VirtualMachineInner inner) { + return new VirtualMachineImpl(inner, manager()); + } + }); } @Override diff --git a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachinesInner.java b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachinesInner.java index 68236ab662c2..e44e408479c8 100644 --- a/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachinesInner.java +++ b/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachinesInner.java @@ -74,6 +74,10 @@ interface VirtualMachinesService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/extensions") Observable> getExtensions(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Query("$expand") String expand, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2017_12_01.VirtualMachines listByLocation" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/virtualMachines") + Observable> listByLocation(@Path("location") String location, @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.v2017_12_01.VirtualMachines capture" }) @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/capture") Observable> capture(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Body VirtualMachineCaptureParameters parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -194,6 +198,10 @@ interface VirtualMachinesService { @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/runCommand") Observable> beginRunCommand(@Path("resourceGroupName") String resourceGroupName, @Path("vmName") String vmName, @Path("subscriptionId") String subscriptionId, @Body RunCommandInput parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.compute.v2017_12_01.VirtualMachines listByLocationNext" }) + @GET + Observable> listByLocationNext(@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.v2017_12_01.VirtualMachines listByResourceGroupNext" }) @GET Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -374,6 +382,121 @@ private ServiceResponse getExtensionsDe .build(response); } + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @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<VirtualMachineInner> object if successful. + */ + public PagedList listByLocation(final String location) { + ServiceResponse> response = listByLocationSinglePageAsync(location).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @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> listByLocationAsync(final String location, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationSinglePageAsync(location), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineInner> object + */ + public Observable> listByLocationAsync(final String location) { + return listByLocationWithServiceResponseAsync(location) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<VirtualMachineInner> object + */ + public Observable>> listByLocationWithServiceResponseAsync(final String location) { + return listByLocationSinglePageAsync(location) + .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(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + ServiceResponse> * @param location The location for which virtual machines under the subscription are queried. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualMachineInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationSinglePageAsync(final String location) { + if (location == null) { + throw new IllegalArgumentException("Parameter location 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 (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByLocation(location, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationDelegate(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); + } + /** * Captures the VM by copying virtual hard disks of the VM and outputs a template that can be used to create similar VMs. * @@ -2966,6 +3089,117 @@ private ServiceResponse beginRunCommandDelegate(Response< .build(response); } + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @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<VirtualMachineInner> object if successful. + */ + public PagedList listByLocationNext(final String nextPageLink) { + ServiceResponse> response = listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @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> listByLocationNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByLocationNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByLocationNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @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<VirtualMachineInner> object + */ + public Observable> listByLocationNextAsync(final String nextPageLink) { + return listByLocationNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + * @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<VirtualMachineInner> object + */ + public Observable>> listByLocationNextWithServiceResponseAsync(final String nextPageLink) { + return listByLocationNextSinglePageAsync(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(listByLocationNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets all the virtual machines under the specified subscription for the specified location. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<VirtualMachineInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByLocationNextSinglePageAsync(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.listByLocationNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByLocationNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByLocationNextDelegate(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); + } + /** * Lists all of the virtual machines in the specified resource group. Use the nextLink property in the response to get the next page of virtual machines. *