+ * You are not billed for the compute resources that the Virtual Machines uses. + * + * @throws CloudException thrown for an invalid response from the service + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when the operation is interrupted + */ + void deallocate() throws CloudException, IOException, InterruptedException; + + /** + * Power off (stop) the virtual machines in the scale set. + *
+ * You will be billed for the compute resources that the Virtual Machines uses + * + * @throws CloudException thrown for an invalid response from the service + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when the operation is interrupted + */ + void powerOff() throws CloudException, IOException, InterruptedException; + + /** + * Restart the virtual machines in the scale set. + * + * @throws CloudException thrown for an invalid response from the service + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when the operation is interrupted + */ + void restart() throws CloudException, IOException, InterruptedException; + + /** + * Start the virtual machines in the scale set. + * + * @throws CloudException thrown for an invalid response from the service + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when the operation is interrupted + */ + void start() throws CloudException, IOException, InterruptedException; + + /** + * Re-image (update the version of the installed operating system) the virtual machines in the scale set. + * + * @throws CloudException thrown for an invalid response from the service + * @throws IOException exception thrown from serialization/deserialization + * @throws InterruptedException exception thrown when the operation is interrupted + */ + void reimage() throws CloudException, IOException, InterruptedException; + + // Getters + // + + /** + * @return the name prefix of the virtual machines in the scale set + */ + String computerNamePrefix(); + + /** + * @return the operating system of the virtual machines in the scale set + */ + OperatingSystemTypes osType(); + + /** + * @return the operating system disk caching type, valid values are 'None', 'ReadOnly', 'ReadWrite' + */ + CachingTypes osDiskCachingType(); + + /** + * @return gets the name of the OS disk of virtual machines in the scale set + */ + String osDiskName(); + + /** + * @return the upgradeModel + */ + UpgradeMode upgradeModel(); + + /** + * @return true if over provision is enabled for the virtual machines, false otherwise + */ + boolean overProvisionEnabled(); + + /** + * @return the sku of the virtual machines in the scale set + */ + VirtualMachineScaleSetSkuTypes sku(); + + /** + * @return the number of virtual machine instances in the scale set + */ + int capacity(); + + /** + * @return the virtual network associated with the primary network interfaces of the virtual machines + * in the scale set. + *
+ * A primary internal load balancer associated with the primary network interfaces of the scale set + * virtual machine will be also belongs to this network + *
+ * @throws IOException the IO exception + */ + Network primaryNetwork() throws IOException; + + /** + * @return the internet facing load balancer associated with the primary network interface of + * the virtual machines in the scale set. + * + * @throws IOException the IO exception + */ + LoadBalancer primaryInternetFacingLoadBalancer() throws IOException; + + /** + * @return the internet facing load balancer's backends associated with the primary network interface + * of the virtual machines in the scale set + * + * @throws IOException the IO exception + */ + Map+ * By default all the backend and inbound NAT pool of the load balancer will be associated with the primary + * network interface of the scale set virtual machines unless subset of them is selected in the next stages + * {@link WithPrimaryInternetFacingLoadBalancerBackendOrNatPool}. + *
+ * @param loadBalancer an existing public load balancer + * @return the next stage of the definition + */ + WithPrimaryInternetFacingLoadBalancerBackendOrNatPool withPrimaryInternetFacingLoadBalancer(LoadBalancer loadBalancer); + + /** + * Specifies that no public load balancer needs to be associated with virtual machine scale set. + * + * @return the next stage of the virtual machine scale set definition + */ + WithPrimaryInternalLoadBalancer withoutPrimaryInternetFacingLoadBalancer(); + } + + /** + * The stage of the virtual machine scale set definition allowing to specify an internal load balancer for + * the primary network interface of the scale set virtual machines. + */ + interface WithPrimaryInternalLoadBalancer { + /** + * Specify the internal load balancer where it's backends and/or NAT pools can be assigned to the primary network + * interface of the scale set virtual machines. + *
+ * By default all the backend and inbound NAT pool of the load balancer will be associated with the primary + * network interface of the scale set virtual machines unless subset of them is selected in the next stages + * {@link WithInternalLoadBalancerBackendOrNatPool}. + *
+ * @param loadBalancer an existing internal load balancer + * @return the next stage of the definition + */ + WithInternalLoadBalancerBackendOrNatPool withPrimaryInternalLoadBalancer(LoadBalancer loadBalancer); + + /** + * Specifies that no internal load balancer needs to be associated with primary network interface of the + * virtual machines in the scale set. + * + * @return the next stage of the virtual machine scale set definition + */ + WithOS withoutPrimaryInternalLoadBalancer(); + } + + /** + * The stage of the virtual machine scale set definition allowing to associate backend pool and/or inbound NAT pool + * of the internet facing load balancer selected in the previous state {@link WithPrimaryInternetFacingLoadBalancer} + * with the primary network interface of the scale set virtual machines. + */ + interface WithPrimaryInternetFacingLoadBalancerBackendOrNatPool extends WithPrimaryInternetFacingLoadBalancerNatPool { + /** + * Associate internet facing load balancer backends with the primary network interface of the scale set virtual machines. + * + * @param backendNames the backend names + * @return the next stage of the virtual machine scale set definition + */ + WithPrimaryInternetFacingLoadBalancerNatPool withPrimaryInternetFacingLoadBalancerBackends(String ...backendNames); + } + + /** + * The stage of the virtual machine scale set definition allowing to associate inbound NAT pool of the internet + * facing load balancer selected in the previous state {@link WithPrimaryInternetFacingLoadBalancer} with the + * primary network interface of the scale set virtual machines. + */ + interface WithPrimaryInternetFacingLoadBalancerNatPool extends WithPrimaryInternalLoadBalancer { + /** + * Associate internet facing load balancer inbound NAT pools with the the primary network interface of the + * scale set virtual machines. + * + * @param natPoolNames the inbound NAT pool names + * @return the next stage of the virtual machine scale set definition + */ + WithPrimaryInternalLoadBalancer withPrimaryInternetFacingLoadBalancerInboundNatPools(String ...natPoolNames); + } + + /** + * The stage of the virtual machine scale set definition allowing to associate backend pool and/or inbound NAT pool + * of the internal load balancer selected in the previous state {@link WithPrimaryInternalLoadBalancer} with the + * primary network interface of the scale set virtual machines. + */ + interface WithInternalLoadBalancerBackendOrNatPool extends WithCreate { + /** + * Associate internal load balancer backends with the primary network interface of the scale set virtual machines. + * + * @param backendNames the backend names + * @return the next stage of the virtual machine scale set definition + */ + WithInternalInternalLoadBalancerNatPool withPrimaryInternalLoadBalancerBackends(String ...backendNames); + } + + /** + * The stage of the virtual machine scale set definition allowing to associate inbound NAT pool of the internal + * load balancer selected in the previous state {@link WithPrimaryInternalLoadBalancer} with the primary network + * interface of the scale set virtual machines. + */ + interface WithInternalInternalLoadBalancerNatPool extends WithOS { + /** + * Associate internal load balancer inbound NAT pools with the the primary network interface of the + * scale set virtual machine. + * + * + * @param natPoolNames inbound NAT pool names + * @return the next stage of the virtual machine scale set definition + */ + WithOS withPrimaryInternalLoadBalancerInboundNatPools(String ...natPoolNames); + } + + /** + * The stage of the virtual machine scale set definition allowing to specify the Operation System image. + */ + interface WithOS { + /** + * Specifies the known marketplace Windows image used as OS for virtual machines in the scale set. + * + * @param knownImage enum value indicating known market-place image + * @return the next stage of the virtual machine scale set definition + */ + WithAdminUserName withPopularWindowsImage(KnownWindowsVirtualMachineImage knownImage); + + /** + * Specifies that the latest version of a marketplace Windows image needs to be used. + * + * @param publisher specifies the publisher of the image + * @param offer specifies the offer of the image + * @param sku specifies the SKU of the image + * @return the next stage of the virtual machine scale set definition + */ + WithAdminUserName withLatestWindowsImage(String publisher, String offer, String sku); + + /** + * Specifies the version of a marketplace Windows image needs to be used. + * + * @param imageReference describes publisher, offer, sku and version of the market-place image + * @return the next stage of the virtual machine scale set definition + */ + WithAdminUserName withSpecificWindowsImageVersion(ImageReference imageReference); + + /** + * Specifies the user (custom) Windows image used for as the OS for virtual machines in the + * scale set. + *
+ * Custom images are currently limited to single storage account and the number of virtual machines + * in the scale set that can be created using custom image is limited to 40 when over provision + * is disabled {@link WithOverProvision} and up to 20 when enabled. + *
+ * @param imageUrl the url the the VHD + * @return the next stage of the virtual machine scale set definition + */ + WithAdminUserName withStoredWindowsImage(String imageUrl); + + /** + * Specifies the known marketplace Linux image used for the virtual machine's OS. + * + * @param knownImage enum value indicating known market-place image + * @return the next stage of the virtual machine scale set definition + */ + WithRootUserName withPopularLinuxImage(KnownLinuxVirtualMachineImage knownImage); + + /** + * Specifies that the latest version of a marketplace Linux image needs to be used. + * + * @param publisher specifies the publisher of the image + * @param offer specifies the offer of the image + * @param sku specifies the SKU of the image + * @return the next stage of the virtual machine scale set definition + */ + WithRootUserName withLatestLinuxImage(String publisher, String offer, String sku); + + /** + * Specifies the version of a market-place Linux image needs to be used. + * + * @param imageReference describes publisher, offer, sku and version of the market-place image + * @return the next stage of the virtual machine scale set definition + */ + WithRootUserName withSpecificLinuxImageVersion(ImageReference imageReference); + + /** + * Specifies the user (custom) Linux image used for the virtual machine's OS. + *+ * Custom images are currently limited to single storage account and the number of virtual machines + * in the scale set that can be created using custom image is limited to 40 when over provision + * is disabled {@link WithOverProvision} and up to 20 when enabled. + *
+ * @param imageUrl the url the the VHD + * @return the next stage of the virtual machine scale set definition + */ + WithRootUserName withStoredLinuxImage(String imageUrl); + } + + /** + * The stage of the Linux virtual machine scale set definition allowing to specify root user name. + */ + interface WithRootUserName { + /** + * Specifies the root user name for the Linux virtual machines in the scale set. + * + * @param rootUserName the Linux root user name. This must follow the required naming convention for Linux user name + * @return the next stage of the Linux virtual machine scale set definition + */ + WithLinuxCreate withRootUserName(String rootUserName); + } + + /** + * The stage of the Windows virtual machine scale set definition allowing to specify administrator user name. + */ + interface WithAdminUserName { + /** + * Specifies the administrator user name for the Windows virtual machines in the scale set. + * + * @param adminUserName the Windows administrator user name. This must follow the required naming convention for Windows user name + * @return the stage representing creatable Windows VM scale set definition + */ + WithWindowsCreate withAdminUserName(String adminUserName); + } + + /** + * The stage of the Linux virtual machine scale set definition which contains all the minimum required inputs + * for the resource to be created (via {@link WithCreate#create()}), but also allows for any other optional + * settings to be specified. + * + */ + interface WithLinuxCreate extends WithCreate { + /** + * Specifies the SSH public key. + *+ * Each call to this method adds the given public key to the list of VM's public keys. + * + * @param publicKey the SSH public key in PEM format. + * @return the stage representing creatable Linux VM scale set definition + */ + WithLinuxCreate withSsh(String publicKey); + } + + /** + * The stage of the Windows virtual machine scale set definition which contains all the minimum required + * inputs for the resource to be created (via {@link WithCreate#create()}, but also allows for any other + * optional settings to be specified. + * + */ + interface WithWindowsCreate extends WithCreate { + /** + * Specifies that VM Agent should be provisioned. + * + * @return the stage representing creatable Windows VM scale set definition + */ + WithWindowsCreate withVmAgent(); + + /** + * Specifies that VM Agent should not be provisioned. + * + * @return the stage representing creatable Windows VM scale set definition + */ + WithWindowsCreate withoutVmAgent(); + + /** + * Specifies that automatic updates should be enabled. + * + * @return the stage representing creatable Windows VM scale set definition + */ + WithWindowsCreate withAutoUpdate(); + + /** + * Specifies that automatic updates should be disabled. + * + * @return the stage representing creatable Windows VM scale set definition + */ + WithWindowsCreate withoutAutoUpdate(); + + /** + * Specifies the time-zone. + * + * @param timeZone the timezone + * @return the stage representing creatable Windows VM scale set definition + */ + WithWindowsCreate withTimeZone(String timeZone); + + /** + * Specifies the WINRM listener. + *
+ * Each call to this method adds the given listener to the list of VM's WinRM listeners.
+ *
+ * @param listener the WinRmListener
+ * @return the stage representing creatable Windows VM scale set definition
+ */
+ WithWindowsCreate withWinRm(WinRMListener listener);
+ }
+
+ /**
+ * The stage of the virtual machine scale set definition allowing to specify password.
+ */
+ interface WithPassword {
+ /**
+ * Specifies the password for the virtual machines in the scale set.
+ *
+ * @param password the password, this must follow the criteria for Azure VM password
+ * @return the stage representing creatable VM scale set definition
+ */
+ WithCreate withPassword(String password);
+ }
+
+ /**
+ * The stage of the virtual machine scale set definition allowing to specify the computer name prefix.
+ */
+ interface WithComputerNamePrefix {
+ /**
+ * Specifies the bane prefix for the virtual machines in the scale set.
+ *
+ * @param namePrefix the prefix for the name of virtual machines in the scale set
+ * @return the stage representing creatable VM scale set definition
+ */
+ WithCreate withComputerNamePrefix(String namePrefix);
+ }
+
+ /**
+ * The stage of the virtual machine scale set definition allowing to specify number of
+ * virtual machines in the scale set.
+ */
+ interface WithCapacity {
+ /**
+ * Specifies the number of virtual machines in the scale set.
+ *
+ * @param capacity the virtual machine capacity
+ * @return the stage representing creatable VM scale set definition
+ */
+ WithCreate withCapacity(int capacity);
+ }
+
+ /**
+ * The stage of the virtual machine scale set definition allowing to specify upgrade policy.
+ */
+ interface WithUpgradePolicy {
+ /**
+ * Specifies virtual machine scale set upgrade policy mode.
+ *
+ * @param upgradeMode upgrade policy mode
+ * @return the stage representing creatable VM scale set definition
+ */
+ WithCreate withUpgradeMode(UpgradeMode upgradeMode);
+ }
+
+ /**
+ * The stage of the virtual machine scale set definition allowing to specify whether
+ * or not over provision virtual machines in the scale set.
+ */
+ interface WithOverProvision {
+ /**
+ * Enable or disable over provisioning of virtual machines in the scale set.
+ *
+ * @param enabled true to enable over provisioning of virtual machines in the
+ * scale set
+ * @return Enable over provision of virtual machines
+ */
+ WithCreate withOverProvision(boolean enabled);
+
+ /**
+ * Enable over provision of virtual machines.
+ *
+ * @return the stage representing creatable VM scale set definition
+ */
+ WithCreate withOverProvisionEnabled();
+
+ /**
+ * Disable over provision of virtual machines.
+ *
+ * @return the stage representing creatable VM scale set definition
+ */
+ WithCreate withOverProvisionDisabled();
+ }
+
+ /**
+ * The stage of the virtual machine scale set definition allowing to specify OS disk configurations.
+ */
+ interface WithOsDiskSettings {
+ /**
+ * Specifies the caching type for the Operating System disk.
+ *
+ * @param cachingType the caching type
+ * @return the stage representing creatable VM scale set definition
+ */
+ WithCreate withOsDiskCaching(CachingTypes cachingType);
+
+ /**
+ * Specifies the name for the OS Disk.
+ *
+ * @param name the OS Disk name
+ * @return the stage representing creatable VM scale set definition
+ */
+ WithCreate withOsDiskName(String name);
+ }
+
+ /**
+ * The stage of the virtual machine scale set definition allowing to specify storage account.
+ */
+ interface WithStorageAccount {
+ /**
+ * Specifies the name of a new storage account to put the OS and data disk VHD of the virtual machines
+ * in the scale set.
+ *
+ * @param name the name of the storage account
+ * @return the stage representing creatable VM scale set definition
+ */
+ WithCreate withNewStorageAccount(String name);
+
+ /**
+ * Specifies definition of a not-yet-created storage account definition
+ * to put OS and data disk VHDs of virtual machines in the scale set.
+ *
+ * @param creatable the storage account in creatable stage
+ * @return the stage representing creatable VM scale set definition
+ */
+ WithCreate withNewStorageAccount(Creatable
+ * This will replace the current internet facing load balancer associated with the virtual machines in the
+ * scale set (if any).
+ * By default all the backend and inbound NAT pool of the load balancer will be associated with the primary
+ * network interface of the scale set virtual machines unless subset of them is selected in the next stages
+ * {@link WithPrimaryInternetFacingLoadBalancerBackendOrNatPool}.
+ *
+ * This will replace the current internal load balancer associated with the virtual machines in the
+ * scale set (if any).
+ * By default all the backend and inbound NAT pool of the load balancer will be associated with the primary
+ * network interface of the scale set virtual machines unless subset of them is selected in the next stages
+ * {@link WithPrimaryInternalLoadBalancerBackendOrNatPool}.
+ *
+ * This removes the association between primary network interface configuration and all backend and
+ * inbound NAT pools in the load balancer.
+ *
+ * This removes the association between primary network interface configuration and all backend and
+ * inbound NAT pools in the load balancer.
+ *
+ * At this stage, any remaining optional settings can be specified, or the virtual machine scale set extension definition
+ * can be attached to the parent virtual machine scale set definition using {@link VirtualMachineExtension.DefinitionStages.WithAttach#attach()}.
+ * @param
+ * At this stage, any remaining optional settings can be specified, or the virtual machine scale set extension definition
+ * can be attached to the parent virtual machine scale set definition using {@link VirtualMachineExtension.UpdateDefinitionStages.WithAttach#attach()}.
+ * @param
+ * You are not billed for the compute resources that the Virtual Machines uses
+ *
+ * @param groupName the name of the resource group the virtual machine scale set is in
+ * @param name the name of the virtual machine scale set
+ * @throws CloudException thrown for an invalid response from the service.
+ * @throws IOException exception thrown from serialization/deserialization
+ * @throws InterruptedException exception thrown when the operation is interrupted
+ */
+ void deallocate(String groupName, String name) throws CloudException, IOException, InterruptedException;
+
+ /**
+ * Power off (stop) the virtual machines in the scale set.
+ *
+ * You will be billed for the compute resources that the Virtual Machines uses.
+ *
+ * @param groupName the name of the resource group the virtual machine scale set is in
+ * @param name the name of the virtual machine scale set
+ * @throws CloudException thrown for an invalid response from the service.
+ * @throws IOException exception thrown from serialization/deserialization
+ * @throws InterruptedException exception thrown when the operation is interrupted
+ */
+ void powerOff(String groupName, String name) throws CloudException, IOException, InterruptedException;
+
+ /**
+ * Restart the virtual machines in the scale set.
+ *
+ * @param groupName the name of the resource group the virtual machine scale set is in
+ * @param name the name of the virtual machine scale set
+ * @throws CloudException thrown for an invalid response from the service.
+ * @throws IOException exception thrown from serialization/deserialization
+ * @throws InterruptedException exception thrown when the operation is interrupted
+ */
+ void restart(String groupName, String name) throws CloudException, IOException, InterruptedException;
+
+ /**
+ * Start the virtual machines in the scale set.
+ *
+ * @param groupName the name of the resource group the virtual machine scale set is in
+ * @param name the name of the virtual machine scale set
+ * @throws CloudException thrown for an invalid response from the service.
+ * @throws IOException exception thrown from serialization/deserialization
+ * @throws InterruptedException exception thrown when the operation is interrupted
+ */
+ void start(String groupName, String name) throws CloudException, IOException, InterruptedException;
+
+ /**
+ * Re-image (update the version of the installed operating system) the virtual machines in the scale set.
+ *
+ * @param groupName the name of the resource group the virtual machine scale set is in
+ * @param name the name of the virtual machine scale set
+ * @throws CloudException thrown for an invalid response from the service.
+ * @throws IOException exception thrown from serialization/deserialization
+ * @throws InterruptedException exception thrown when the operation is interrupted
+ */
+ void reimage(String groupName, String name) throws CloudException, IOException, InterruptedException;
+}
diff --git a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ComputeManager.java b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ComputeManager.java
index 50744531ae9a6..e48c6854dc8b5 100644
--- a/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ComputeManager.java
+++ b/azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/ComputeManager.java
@@ -4,6 +4,7 @@
import com.microsoft.azure.management.compute.AvailabilitySets;
import com.microsoft.azure.management.compute.VirtualMachineExtensionImages;
import com.microsoft.azure.management.compute.VirtualMachineImages;
+import com.microsoft.azure.management.compute.VirtualMachineScaleSets;
import com.microsoft.azure.management.compute.VirtualMachines;
import com.microsoft.azure.management.network.implementation.NetworkManager;
import com.microsoft.azure.management.resources.fluentcore.arm.AzureConfigurable;
@@ -25,6 +26,7 @@ public final class ComputeManager extends Manager