PageRenderTime 53ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/sdk/compute/mgmt/src/main/java/com/azure/management/compute/VirtualMachine.java

http://github.com/WindowsAzure/azure-sdk-for-java
Java | 2169 lines | 482 code | 240 blank | 1447 comment | 0 complexity | 7464b19b2c5398f0cfda2c92798436ce MD5 | raw file
Possible License(s): MIT
  1. // Copyright (c) Microsoft Corporation. All rights reserved.
  2. // Licensed under the MIT License.
  3. package com.azure.management.compute;
  4. import com.azure.core.annotation.Fluent;
  5. import com.azure.core.http.rest.PagedIterable;
  6. import com.azure.management.compute.implementation.ComputeManager;
  7. import com.azure.management.compute.models.VirtualMachineInner;
  8. import com.azure.management.graphrbac.BuiltInRole;
  9. import com.azure.management.msi.Identity;
  10. import com.azure.management.network.Network;
  11. import com.azure.management.network.NetworkInterface;
  12. import com.azure.management.network.PublicIPAddress;
  13. import com.azure.management.network.models.HasNetworkInterfaces;
  14. import com.azure.management.resources.fluentcore.arm.AvailabilityZoneId;
  15. import com.azure.management.resources.fluentcore.arm.models.GroupableResource;
  16. import com.azure.management.resources.fluentcore.arm.models.Resource;
  17. import com.azure.management.resources.fluentcore.model.Appliable;
  18. import com.azure.management.resources.fluentcore.model.Creatable;
  19. import com.azure.management.resources.fluentcore.model.Refreshable;
  20. import com.azure.management.resources.fluentcore.model.Updatable;
  21. import com.azure.management.storage.StorageAccount;
  22. import java.util.List;
  23. import java.util.Map;
  24. import java.util.Set;
  25. import reactor.core.publisher.Mono;
  26. /** An immutable client-side representation of an Azure virtual machine. */
  27. @Fluent
  28. public interface VirtualMachine
  29. extends GroupableResource<ComputeManager, VirtualMachineInner>,
  30. Refreshable<VirtualMachine>,
  31. Updatable<VirtualMachine.Update>,
  32. HasNetworkInterfaces {
  33. // Actions
  34. /** Shuts down the virtual machine and releases the compute resources. */
  35. void deallocate();
  36. /**
  37. * Shuts down the virtual machine and releases the compute resources asynchronously.
  38. *
  39. * @return a representation of the deferred computation of this call
  40. */
  41. Mono<Void> deallocateAsync();
  42. /** Generalizes the virtual machine. */
  43. void generalize();
  44. /**
  45. * Generalizes the virtual machine asynchronously.
  46. *
  47. * @return a representation of the deferred computation of this call
  48. */
  49. Mono<Void> generalizeAsync();
  50. /** Powers off (stops) the virtual machine. */
  51. void powerOff();
  52. /**
  53. * Powers off (stops) the virtual machine asynchronously.
  54. *
  55. * @return a representation of the deferred computation of this call
  56. */
  57. Mono<Void> powerOffAsync();
  58. /** Restarts the virtual machine. */
  59. void restart();
  60. /**
  61. * Restarts the virtual machine asynchronously.
  62. *
  63. * @return a representation of the deferred computation of this call
  64. */
  65. Mono<Void> restartAsync();
  66. /** Starts the virtual machine. */
  67. void start();
  68. /**
  69. * Starts the virtual machine asynchronously.
  70. *
  71. * @return a representation of the deferred computation of this call
  72. */
  73. Mono<Void> startAsync();
  74. /** Redeploys the virtual machine. */
  75. void redeploy();
  76. /**
  77. * Redeploys the virtual machine asynchronously.
  78. *
  79. * @return a representation of the deferred computation of this call
  80. */
  81. Mono<Void> redeployAsync();
  82. /** @return entry point to enabling, disabling and querying disk encryption */
  83. VirtualMachineEncryption diskEncryption();
  84. /** Converts (migrates) the virtual machine with un-managed disks to use managed disk. */
  85. void convertToManaged();
  86. /**
  87. * Converts (migrates) the virtual machine with un-managed disks to use managed disk asynchronously.
  88. *
  89. * @return a representation of the deferred computation of this call
  90. */
  91. Mono<Void> convertToManagedAsync();
  92. /**
  93. * Lists all available virtual machine sizes this virtual machine can resized to.
  94. *
  95. * @return the virtual machine sizes
  96. */
  97. PagedIterable<VirtualMachineSize> availableSizes();
  98. /**
  99. * Captures the virtual machine by copying virtual hard disks of the VM.
  100. *
  101. * @param containerName destination container name to store the captured VHD
  102. * @param vhdPrefix the prefix for the VHD holding captured image
  103. * @param overwriteVhd whether to overwrites destination VHD if it exists
  104. * @return the JSON template for creating more such virtual machines
  105. */
  106. String capture(String containerName, String vhdPrefix, boolean overwriteVhd);
  107. /**
  108. * Captures the virtual machine by copying virtual hard disks of the VM asynchronously.
  109. *
  110. * @param containerName destination container name to store the captured VHD
  111. * @param vhdPrefix the prefix for the VHD holding captured image
  112. * @param overwriteVhd whether to overwrites destination VHD if it exists
  113. * @return a representation of the deferred computation of this call
  114. */
  115. Mono<String> captureAsync(String containerName, String vhdPrefix, boolean overwriteVhd);
  116. /**
  117. * Refreshes the virtual machine instance view to sync with Azure.
  118. *
  119. * <p>The instance view will be cached for later retrieval using <code>instanceView</code>.
  120. *
  121. * @return the refreshed instance view
  122. */
  123. VirtualMachineInstanceView refreshInstanceView();
  124. /**
  125. * Refreshes the virtual machine instance view to sync with Azure.
  126. *
  127. * @return an observable that emits the instance view of the virtual machine.
  128. */
  129. Mono<VirtualMachineInstanceView> refreshInstanceViewAsync();
  130. /**
  131. * Run shell script in a virtual machine.
  132. *
  133. * @param groupName the resource group name
  134. * @param name the virtual machine name
  135. * @param scriptLines PowerShell script lines
  136. * @param scriptParameters script parameters
  137. * @return result of PowerShell script execution
  138. */
  139. RunCommandResult runPowerShellScript(
  140. String groupName, String name, List<String> scriptLines, List<RunCommandInputParameter> scriptParameters);
  141. /**
  142. * Run shell script in the virtual machine asynchronously.
  143. *
  144. * @param scriptLines PowerShell script lines
  145. * @param scriptParameters script parameters
  146. * @return handle to the asynchronous execution
  147. */
  148. Mono<RunCommandResult> runPowerShellScriptAsync(
  149. List<String> scriptLines, List<RunCommandInputParameter> scriptParameters);
  150. /**
  151. * Run shell script in the virtual machine.
  152. *
  153. * @param scriptLines shell script lines
  154. * @param scriptParameters script parameters
  155. * @return result of shell script execution
  156. */
  157. RunCommandResult runShellScript(List<String> scriptLines, List<RunCommandInputParameter> scriptParameters);
  158. /**
  159. * Run shell script in the virtual machine asynchronously.
  160. *
  161. * @param scriptLines shell script lines
  162. * @param scriptParameters script parameters
  163. * @return handle to the asynchronous execution
  164. */
  165. Mono<RunCommandResult> runShellScriptAsync(
  166. List<String> scriptLines, List<RunCommandInputParameter> scriptParameters);
  167. /**
  168. * Run commands in the virtual machine.
  169. *
  170. * @param inputCommand command input
  171. * @return result of execution
  172. */
  173. RunCommandResult runCommand(RunCommandInput inputCommand);
  174. /**
  175. * Run commands in the virtual machine asynchronously.
  176. *
  177. * @param inputCommand command input
  178. * @return handle to the asynchronous execution
  179. */
  180. Mono<RunCommandResult> runCommandAsync(RunCommandInput inputCommand);
  181. // Getters
  182. //
  183. /** @return true if managed disks are used for the virtual machine's disks (OS, data) */
  184. boolean isManagedDiskEnabled();
  185. /** @return name of this virtual machine */
  186. String computerName();
  187. /** @return the virtual machine size */
  188. VirtualMachineSizeTypes size();
  189. /** @return the operating system of this virtual machine */
  190. OperatingSystemTypes osType();
  191. /** @return the URI to the VHD file backing this virtual machine's operating system disk */
  192. String osUnmanagedDiskVhdUri();
  193. /** @return the operating system disk caching type */
  194. CachingTypes osDiskCachingType();
  195. /** @return the size of the operating system disk in GB */
  196. int osDiskSize();
  197. /** @return the storage account type of the managed disk backing OS disk */
  198. StorageAccountTypes osDiskStorageAccountType();
  199. /** @return resource ID of the managed disk backing the OS disk */
  200. String osDiskId();
  201. /** @return the unmanaged data disks associated with this virtual machine, indexed by LUN number */
  202. Map<Integer, VirtualMachineUnmanagedDataDisk> unmanagedDataDisks();
  203. /** @return the managed data disks associated with this virtual machine, indexed by LUN */
  204. Map<Integer, VirtualMachineDataDisk> dataDisks();
  205. /**
  206. * Gets the public IP address associated with this virtual machine's primary network interface.
  207. *
  208. * <p>Note that this method makes a rest API call to fetch the resource.
  209. *
  210. * @return the public IP of the primary network interface
  211. */
  212. PublicIPAddress getPrimaryPublicIPAddress();
  213. /**
  214. * @return the resource ID of the public IP address associated with this virtual machine's primary network interface
  215. */
  216. String getPrimaryPublicIPAddressId();
  217. /** @return the resource ID of the availability set associated with this virtual machine */
  218. String availabilitySetId();
  219. /** @return the provisioningState value */
  220. String provisioningState();
  221. /** @return the licenseType value */
  222. String licenseType();
  223. /**
  224. * Get specifies information about the proximity placement group that the virtual machine scale set should be
  225. * assigned to.
  226. *
  227. * @return the proximityPlacementGroup.
  228. */
  229. ProximityPlacementGroup proximityPlacementGroup();
  230. /**
  231. * @return a representation of the deferred computation of this call, returning extensions attached to the virtual
  232. * machine
  233. */
  234. Mono<List<VirtualMachineExtension>> listExtensionsAsync();
  235. /** @return extensions attached to the virtual machine */
  236. Map<String, VirtualMachineExtension> listExtensions();
  237. /** @return the plan value */
  238. Plan plan();
  239. /**
  240. * Returns the storage profile of an Azure virtual machine.
  241. *
  242. * @return the storageProfile value
  243. */
  244. StorageProfile storageProfile();
  245. /** @return the operating system profile */
  246. OSProfile osProfile();
  247. /** @return the diagnostics profile */
  248. DiagnosticsProfile diagnosticsProfile();
  249. /** @return the virtual machine unique ID. */
  250. String vmId();
  251. /** @return the power state of the virtual machine */
  252. PowerState powerState();
  253. /**
  254. * Get the virtual machine instance view.
  255. *
  256. * <p>The instance view will be cached for later retrieval using <code>instanceView</code>.
  257. *
  258. * @return the virtual machine's instance view
  259. */
  260. VirtualMachineInstanceView instanceView();
  261. /** @return the availability zones assigned to the virtual machine */
  262. Set<AvailabilityZoneId> availabilityZones();
  263. /** @return true if boot diagnostics is enabled for the virtual machine */
  264. boolean isBootDiagnosticsEnabled();
  265. /** @return the storage blob endpoint uri if boot diagnostics is enabled for the virtual machine */
  266. String bootDiagnosticsStorageUri();
  267. /** @return true if Managed Service Identity is enabled for the virtual machine */
  268. boolean isManagedServiceIdentityEnabled();
  269. /**
  270. * @return the System Assigned (Local) Managed Service Identity specific Active Directory tenant ID assigned to the
  271. * virtual machine.
  272. */
  273. String systemAssignedManagedServiceIdentityTenantId();
  274. /**
  275. * @return the System Assigned (Local) Managed Service Identity specific Active Directory service principal ID
  276. * assigned to the virtual machine.
  277. */
  278. String systemAssignedManagedServiceIdentityPrincipalId();
  279. /** @return the type of Managed Service Identity used for the virtual machine. */
  280. ResourceIdentityType managedServiceIdentityType();
  281. /** @return the resource ids of User Assigned Managed Service Identities associated with the virtual machine. */
  282. Set<String> userAssignedManagedServiceIdentityIds();
  283. /** @return the priority for the virtual machine. */
  284. VirtualMachinePriorityTypes priority();
  285. /** @return the eviction policy for the virtual machine. */
  286. VirtualMachineEvictionPolicyTypes evictionPolicy();
  287. /** @return the billing related details of a low priority virtual machine */
  288. BillingProfile billingProfile();
  289. // Setters
  290. //
  291. /** The virtual machine scale set stages shared between managed and unmanaged based virtual machine definitions. */
  292. interface DefinitionShared
  293. extends DefinitionStages.Blank,
  294. DefinitionStages.WithGroup,
  295. DefinitionStages.WithNetwork,
  296. DefinitionStages.WithSubnet,
  297. DefinitionStages.WithPrivateIP,
  298. DefinitionStages.WithPublicIPAddress,
  299. DefinitionStages.WithPrimaryNetworkInterface,
  300. DefinitionStages.WithOS,
  301. DefinitionStages.WithProximityPlacementGroup,
  302. DefinitionStages.WithCreate {
  303. }
  304. /** The entirety of the virtual machine definition. */
  305. interface DefinitionManagedOrUnmanaged
  306. extends DefinitionShared,
  307. DefinitionStages.WithLinuxRootUsernameManagedOrUnmanaged,
  308. DefinitionStages.WithLinuxRootPasswordOrPublicKeyManagedOrUnmanaged,
  309. DefinitionStages.WithWindowsAdminUsernameManagedOrUnmanaged,
  310. DefinitionStages.WithWindowsAdminPasswordManagedOrUnmanaged,
  311. DefinitionStages.WithFromImageCreateOptionsManagedOrUnmanaged,
  312. DefinitionStages.WithLinuxCreateManagedOrUnmanaged,
  313. DefinitionStages.WithWindowsCreateManagedOrUnmanaged,
  314. DefinitionStages.WithManagedCreate,
  315. DefinitionStages.WithUnmanagedCreate {
  316. }
  317. /** The entirety of the managed disk based virtual machine definition. */
  318. interface DefinitionManaged
  319. extends DefinitionShared,
  320. DefinitionStages.WithLinuxRootUsernameManaged,
  321. DefinitionStages.WithLinuxRootPasswordOrPublicKeyManaged,
  322. DefinitionStages.WithWindowsAdminUsernameManaged,
  323. DefinitionStages.WithWindowsAdminPasswordManaged,
  324. DefinitionStages.WithFromImageCreateOptionsManaged,
  325. DefinitionStages.WithLinuxCreateManaged,
  326. DefinitionStages.WithWindowsCreateManaged,
  327. DefinitionStages.WithManagedCreate {
  328. }
  329. /** The entirety of the unmanaged disk based virtual machine definition. */
  330. interface DefinitionUnmanaged
  331. extends DefinitionStages.Blank,
  332. DefinitionStages.WithGroup,
  333. DefinitionStages.WithNetwork,
  334. DefinitionStages.WithSubnet,
  335. DefinitionStages.WithPrivateIP,
  336. DefinitionStages.WithPublicIPAddress,
  337. DefinitionStages.WithPrimaryNetworkInterface,
  338. DefinitionStages.WithOS,
  339. DefinitionStages.WithLinuxRootUsernameUnmanaged,
  340. DefinitionStages.WithLinuxRootPasswordOrPublicKeyUnmanaged,
  341. DefinitionStages.WithWindowsAdminUsernameUnmanaged,
  342. DefinitionStages.WithWindowsAdminPasswordUnmanaged,
  343. DefinitionStages.WithFromImageCreateOptionsUnmanaged,
  344. DefinitionStages.WithLinuxCreateUnmanaged,
  345. DefinitionStages.WithWindowsCreateUnmanaged,
  346. DefinitionStages.WithUnmanagedCreate {
  347. }
  348. /** Grouping of virtual machine definition stages. */
  349. interface DefinitionStages {
  350. /** The first stage of a virtual machine definition. */
  351. interface Blank extends GroupableResource.DefinitionWithRegion<WithGroup> {
  352. }
  353. /** The stage of a virtual machine definition allowing to specify the resource group. */
  354. interface WithGroup extends GroupableResource.DefinitionStages.WithGroup<WithNetwork> {
  355. }
  356. /**
  357. * The stage of a virtual machine definition allowing to specify a virtual network with the new primary network
  358. * interface.
  359. */
  360. interface WithNetwork extends WithPrimaryNetworkInterface {
  361. /**
  362. * Creates a new virtual network to associate with the virtual machine's primary network interface, based on
  363. * the provided definition.
  364. *
  365. * @param creatable a creatable definition for a new virtual network
  366. * @return the next stage of the definition
  367. */
  368. WithPrivateIP withNewPrimaryNetwork(Creatable<Network> creatable);
  369. /**
  370. * Creates a new virtual network to associate with the virtual machine's primary network interface.
  371. *
  372. * <p>The virtual network will be created in the same resource group and region as of virtual machine, it
  373. * will be created with the specified address space and a default subnet covering the entirety of the
  374. * network IP address space.
  375. *
  376. * @param addressSpace the address space for the virtual network
  377. * @return the next stage of the definition
  378. */
  379. WithPrivateIP withNewPrimaryNetwork(String addressSpace);
  380. /**
  381. * Associates an existing virtual network with the virtual machine's primary network interface.
  382. *
  383. * @param network an existing virtual network
  384. * @return the next stage of the definition
  385. */
  386. WithSubnet withExistingPrimaryNetwork(Network network);
  387. }
  388. /**
  389. * The stage of a virtual machine definition allowing to specify the virtual network subnet for a new primary
  390. * network interface.
  391. */
  392. interface WithSubnet {
  393. /**
  394. * Associates a subnet with the virtual machine's primary network interface.
  395. *
  396. * @param name the subnet name
  397. * @return the next stage of the definition
  398. */
  399. WithPrivateIP withSubnet(String name);
  400. }
  401. /**
  402. * The stage of a virtual machine definition allowing to specify a private IP address within a virtual network
  403. * subnet.
  404. */
  405. interface WithPrivateIP {
  406. /**
  407. * Enables dynamic private IP address allocation within the specified existing virtual network subnet for
  408. * the VM's primary network interface.
  409. *
  410. * @return the next stage of the definition
  411. */
  412. WithPublicIPAddress withPrimaryPrivateIPAddressDynamic();
  413. /**
  414. * Assigns the specified static private IP address within the specified existing virtual network subnet to
  415. * the VM's primary network interface.
  416. *
  417. * @param staticPrivateIPAddress a static IP address within the specified subnet
  418. * @return the next stage of the definition
  419. */
  420. WithPublicIPAddress withPrimaryPrivateIPAddressStatic(String staticPrivateIPAddress);
  421. }
  422. /**
  423. * The stage of a virtual machine definition allowing to associate a public IP address with its primary network
  424. * interface.
  425. */
  426. interface WithPublicIPAddress {
  427. /**
  428. * Creates a new public IP address to associate with the VM's primary network interface.
  429. *
  430. * @param creatable a creatable definition for a new public IP
  431. * @return the next stage of the definition
  432. */
  433. WithProximityPlacementGroup withNewPrimaryPublicIPAddress(Creatable<PublicIPAddress> creatable);
  434. /**
  435. * Creates a new public IP address in the same region and resource group as the resource, with the specified
  436. * DNS label and associates it with the VM's primary network interface.
  437. *
  438. * <p>The internal name for the public IP address will be derived from the DNS label.
  439. *
  440. * @param leafDnsLabel a leaf domain label
  441. * @return the next stage of the definition
  442. */
  443. WithProximityPlacementGroup withNewPrimaryPublicIPAddress(String leafDnsLabel);
  444. /**
  445. * Associates an existing public IP address with the VM's primary network interface.
  446. *
  447. * @param publicIPAddress an existing public IP address
  448. * @return the next stage of the definition
  449. */
  450. WithProximityPlacementGroup withExistingPrimaryPublicIPAddress(PublicIPAddress publicIPAddress);
  451. /**
  452. * Specifies that the VM should not have a public IP address.
  453. *
  454. * @return the next stage of the definition
  455. */
  456. WithProximityPlacementGroup withoutPrimaryPublicIPAddress();
  457. }
  458. /** The stage of a virtual machine definition allowing to specify the primary network interface. */
  459. interface WithPrimaryNetworkInterface {
  460. /**
  461. * Creates a new network interface to associate with the virtual machine as its primary network interface,
  462. * based on the provided definition.
  463. *
  464. * @param creatable a creatable definition for a new network interface
  465. * @return the next stage of the definition
  466. */
  467. WithProximityPlacementGroup withNewPrimaryNetworkInterface(Creatable<NetworkInterface> creatable);
  468. /**
  469. * Associates an existing network interface with the virtual machine as its primary network interface.
  470. *
  471. * @param networkInterface an existing network interface
  472. * @return the next stage of the definition
  473. */
  474. WithProximityPlacementGroup withExistingPrimaryNetworkInterface(NetworkInterface networkInterface);
  475. }
  476. /**
  477. * The stage of a virtual machine definition allowing to set information about the proximity placement group
  478. * that the virtual machine scale set should be assigned to.
  479. */
  480. interface WithProximityPlacementGroup extends WithOS {
  481. /**
  482. * Set information about the proximity placement group that the virtual machine scale set should be assigned
  483. * to.
  484. *
  485. * @param promixityPlacementGroupId The Id of the proximity placement group subResource.
  486. * @return the next stage of the definition.
  487. */
  488. WithOS withProximityPlacementGroup(String promixityPlacementGroupId);
  489. /**
  490. * Creates a new proximity placement gruup witht he specified name and then adds it to the VM.
  491. *
  492. * @param proximityPlacementGroupName The name of the group to be created.
  493. * @param type the type of the group
  494. * @return the next stage of the definition.
  495. */
  496. WithOS withNewProximityPlacementGroup(String proximityPlacementGroupName, ProximityPlacementGroupType type);
  497. }
  498. /** The stage of a virtual machine definition allowing to specify the operating system image. */
  499. interface WithOS {
  500. /**
  501. * Specifies a known marketplace Windows image to be used for the virtual machine's OS.
  502. *
  503. * @param knownImage a known market-place image
  504. * @return the next stage of the definition
  505. */
  506. WithWindowsAdminUsernameManagedOrUnmanaged withPopularWindowsImage(
  507. KnownWindowsVirtualMachineImage knownImage);
  508. /**
  509. * Specifies that the latest version of a marketplace Windows image should to be used as the virtual
  510. * machine's OS.
  511. *
  512. * @param publisher specifies the publisher of the image
  513. * @param offer specifies the offer of the image
  514. * @param sku specifies the SKU of the image
  515. * @return the next stage of the definition
  516. */
  517. WithWindowsAdminUsernameManagedOrUnmanaged withLatestWindowsImage(
  518. String publisher, String offer, String sku);
  519. /**
  520. * Specifies a version of a marketplace Windows image to be used as the virtual machine's OS.
  521. *
  522. * @param imageReference describes publisher, offer, SKU and version of the market-place image
  523. * @return the next stage of the definition
  524. */
  525. WithWindowsAdminUsernameManagedOrUnmanaged withSpecificWindowsImageVersion(ImageReference imageReference);
  526. /**
  527. * Specifies the resource ID of a Windows custom image to be used as the virtual machine's OS.
  528. *
  529. * @param customImageId the resource ID of the custom image
  530. * @return the next stage of the definition
  531. */
  532. WithWindowsAdminUsernameManaged withWindowsCustomImage(String customImageId);
  533. /**
  534. * Specifies the resource ID of a Windows gallery image version to be used as the virtual machine's OS.
  535. *
  536. * @param galleryImageVersionId the resource ID of the gallery image version
  537. * @return the next stage of the definition
  538. */
  539. WithWindowsAdminUsernameManaged withWindowsGalleryImageVersion(String galleryImageVersionId);
  540. /**
  541. * Specifies the user (generalized) Windows image to be used for the virtual machine's OS.
  542. *
  543. * @param imageUrl the URL of a VHD
  544. * @return the next stage of the definition
  545. */
  546. WithWindowsAdminUsernameUnmanaged withStoredWindowsImage(String imageUrl);
  547. /**
  548. * Specifies a known marketplace Linux image to be used for the virtual machine's OS.
  549. *
  550. * @param knownImage a known market-place image
  551. * @return the next stage of the definition
  552. */
  553. WithLinuxRootUsernameManagedOrUnmanaged withPopularLinuxImage(KnownLinuxVirtualMachineImage knownImage);
  554. /**
  555. * Specifies that the latest version of a marketplace Linux image is to be used as the virtual machine's OS.
  556. *
  557. * @param publisher specifies the publisher of an image
  558. * @param offer specifies an offer of the image
  559. * @param sku specifies a SKU of the image
  560. * @return the next stage of the definition
  561. */
  562. WithLinuxRootUsernameManagedOrUnmanaged withLatestLinuxImage(String publisher, String offer, String sku);
  563. /**
  564. * Specifies a version of a market-place Linux image to be used as the virtual machine's OS.
  565. *
  566. * @param imageReference describes the publisher, offer, SKU and version of the market-place image
  567. * @return the next stage of the definition
  568. */
  569. WithLinuxRootUsernameManagedOrUnmanaged withSpecificLinuxImageVersion(ImageReference imageReference);
  570. /**
  571. * Specifies the resource ID of a Linux custom image to be used as the virtual machines' OS.
  572. *
  573. * @param customImageId the resource ID of a custom image
  574. * @return the next stage of the definition
  575. */
  576. WithLinuxRootUsernameManaged withLinuxCustomImage(String customImageId);
  577. /**
  578. * Specifies the resource ID of a Linux gallery image version to be used as the virtual machines' OS.
  579. *
  580. * @param galleryImageVersionId the resource ID of a gallery image version
  581. * @return the next stage of the definition
  582. */
  583. WithLinuxRootUsernameManaged withLinuxGalleryImageVersion(String galleryImageVersionId);
  584. /**
  585. * Specifies a user (generalized) Linux image to be used for the virtual machine's OS.
  586. *
  587. * @param imageUrl the URL of a VHD
  588. * @return the next stage of the definition
  589. */
  590. WithLinuxRootUsernameUnmanaged withStoredLinuxImage(String imageUrl);
  591. /**
  592. * Specifies a specialized operating system unmanaged disk to be attached to the virtual machine.
  593. *
  594. * @param osDiskUrl osDiskUrl the URL to the OS disk in the Azure Storage account
  595. * @param osType the OS type
  596. * @return the next stage of the definition
  597. */
  598. WithUnmanagedCreate withSpecializedOSUnmanagedDisk(String osDiskUrl, OperatingSystemTypes osType);
  599. /**
  600. * Specifies a specialized operating system managed disk to be attached to the virtual machine.
  601. *
  602. * @param disk the managed disk to attach
  603. * @param osType the OS type
  604. * @return the next stage of the definition
  605. */
  606. WithManagedCreate withSpecializedOSDisk(Disk disk, OperatingSystemTypes osType);
  607. }
  608. /** The stage of a Linux virtual machine definition allowing to specify an SSH root user name. */
  609. interface WithLinuxRootUsernameManagedOrUnmanaged {
  610. /**
  611. * Specifies an SSH root user name for the Linux virtual machine.
  612. *
  613. * @param rootUserName a user name following the required naming convention for Linux user names
  614. * @return the next stage of the definition
  615. */
  616. WithLinuxRootPasswordOrPublicKeyManagedOrUnmanaged withRootUsername(String rootUserName);
  617. }
  618. /** The stage of a Linux virtual machine definition allowing to specify an SSH root user name. */
  619. interface WithLinuxRootUsernameManaged {
  620. /**
  621. * Specifies an SSH root user name for the Linux virtual machine.
  622. *
  623. * @param rootUserName a user name following the required naming convention for Linux user names
  624. * @return the next stage of the definition
  625. */
  626. WithLinuxRootPasswordOrPublicKeyManaged withRootUsername(String rootUserName);
  627. }
  628. /** The stage of a Linux virtual machine definition allowing to specify an SSH root user name. */
  629. interface WithLinuxRootUsernameUnmanaged {
  630. /**
  631. * Specifies an SSH root user name for the Linux virtual machine.
  632. *
  633. * @param rootUserName a user name following the required naming convention for Linux user names
  634. * @return the next stage of the definition
  635. */
  636. WithLinuxRootPasswordOrPublicKeyUnmanaged withRootUsername(String rootUserName);
  637. }
  638. /** The stage of a Linux virtual machine definition allowing to specify an SSH root password or public key. */
  639. interface WithLinuxRootPasswordOrPublicKeyManagedOrUnmanaged {
  640. /**
  641. * Specifies the SSH root password for the Linux virtual machine.
  642. *
  643. * @param rootPassword a password following the complexity criteria for Azure Linux VM passwords.
  644. * @return the next stage of the definition
  645. */
  646. WithLinuxCreateManagedOrUnmanaged withRootPassword(String rootPassword);
  647. /**
  648. * Specifies the SSH public key.
  649. *
  650. * @param publicKey an SSH public key in the PEM format.
  651. * @return the next stage of the definition
  652. */
  653. WithLinuxCreateManagedOrUnmanaged withSsh(String publicKey);
  654. }
  655. /** The stage of a Linux virtual machine definition allowing to specify an SSH root password or public key. */
  656. interface WithLinuxRootPasswordOrPublicKeyManaged {
  657. /**
  658. * Specifies the SSH root password for the Linux virtual machine.
  659. *
  660. * @param rootPassword a password, following the complexity criteria for Azure Linux VM passwords.
  661. * @return the next stage of the definition
  662. */
  663. WithLinuxCreateManaged withRootPassword(String rootPassword);
  664. /**
  665. * Specifies an SSH public key.
  666. *
  667. * @param publicKey an SSH public key in the PEM format.
  668. * @return the next stage of the definition
  669. */
  670. WithLinuxCreateManaged withSsh(String publicKey);
  671. }
  672. /** The stage of a Linux virtual machine definition allowing to specify an SSH root password or public key. */
  673. interface WithLinuxRootPasswordOrPublicKeyUnmanaged {
  674. /**
  675. * Specifies an SSH root password for the Linux virtual machine.
  676. *
  677. * @param rootPassword a password following the complexity criteria for Azure Linux VM passwords.
  678. * @return the next stage of the definition
  679. */
  680. WithLinuxCreateUnmanaged withRootPassword(String rootPassword);
  681. /**
  682. * Specifies an SSH public key.
  683. *
  684. * @param publicKey an SSH public key in the PEM format.
  685. * @return the next stage of the definition
  686. */
  687. WithLinuxCreateUnmanaged withSsh(String publicKey);
  688. }
  689. /** The stage of a Windows virtual machine definition allowing to specify an administrator user name. */
  690. interface WithWindowsAdminUsernameManagedOrUnmanaged {
  691. /**
  692. * Specifies the administrator user name for the Windows virtual machine.
  693. *
  694. * @param adminUserName a user name following the required naming convention for Windows user names.
  695. * @return the next stage of the definition
  696. */
  697. WithWindowsAdminPasswordManagedOrUnmanaged withAdminUsername(String adminUserName);
  698. }
  699. /** The stage of a Windows virtual machine definition allowing to specify an administrator user name. */
  700. interface WithWindowsAdminUsernameManaged {
  701. /**
  702. * Specifies the administrator user name for the Windows virtual machine.
  703. *
  704. * @param adminUserName a user name followinmg the required naming convention for Windows user names
  705. * @return the next stage of the definition
  706. */
  707. WithWindowsAdminPasswordManaged withAdminUsername(String adminUserName);
  708. }
  709. /** The stage of the Windows virtual machine definition allowing to specify an administrator user name. */
  710. interface WithWindowsAdminUsernameUnmanaged {
  711. /**
  712. * Specifies the administrator user name for the Windows virtual machine.
  713. *
  714. * @param adminUserName a user name following the required naming convention for Windows user names
  715. * @return the next stage of the definition
  716. */
  717. WithWindowsAdminPasswordUnmanaged withAdminUsername(String adminUserName);
  718. }
  719. /** The stage of a Windows virtual machine definition allowing to specify an administrator password. */
  720. interface WithWindowsAdminPasswordManagedOrUnmanaged {
  721. /**
  722. * Specifies the administrator password for the Windows virtual machine.
  723. *
  724. * @param adminPassword a password following the complexity criteria for Azure Windows VM passwords
  725. * @return the next stage of the definition
  726. */
  727. WithWindowsCreateManagedOrUnmanaged withAdminPassword(String adminPassword);
  728. }
  729. /** The stage of a Windows virtual machine definition allowing to specify an administrator user name. */
  730. interface WithWindowsAdminPasswordManaged {
  731. /**
  732. * Specifies the administrator password for the Windows virtual machine.
  733. *
  734. * @param adminPassword a password following the complexity criteria for Azure Windows VM passwords.
  735. * @return the next stage of the definition
  736. */
  737. WithWindowsCreateManaged withAdminPassword(String adminPassword);
  738. }
  739. /** The stage of a Windows virtual machine definition allowing to specify an administrator password. */
  740. interface WithWindowsAdminPasswordUnmanaged {
  741. /**
  742. * Specifies the administrator password for the Windows virtual machine.
  743. *
  744. * @param adminPassword a password following the criteria for Azure Windows VM passwords.
  745. * @return the next stage of the definition
  746. */
  747. WithWindowsCreateUnmanaged withAdminPassword(String adminPassword);
  748. }
  749. /**
  750. * The stage of a virtual machine definition containing various settings when virtual machine is created from
  751. * image.
  752. */
  753. interface WithFromImageCreateOptionsManagedOrUnmanaged extends WithFromImageCreateOptionsManaged {
  754. /**
  755. * Specifies that unmanaged disks will be used.
  756. *
  757. * @return the next stage of the definition
  758. */
  759. WithFromImageCreateOptionsUnmanaged withUnmanagedDisks();
  760. }
  761. /**
  762. * The stage of a virtual machine definition containing various settings when virtual machine is created from
  763. * image.
  764. */
  765. interface WithFromImageCreateOptionsManaged extends WithManagedCreate {
  766. /**
  767. * Specifies the custom data for the virtual machine.
  768. *
  769. * @param base64EncodedCustomData the base64 encoded custom data
  770. * @return the next stage of the definition
  771. */
  772. WithFromImageCreateOptionsManaged withCustomData(String base64EncodedCustomData);
  773. /**
  774. * Specifies the computer name for the virtual machine.
  775. *
  776. * @param computerName a name for the computer
  777. * @return the next stage stage of the definition
  778. */
  779. WithFromImageCreateOptionsManaged withComputerName(String computerName);
  780. }
  781. /**
  782. * The stage of a virtual machine definition containing various settings when virtual machine is created from
  783. * image.
  784. */
  785. interface WithFromImageCreateOptionsUnmanaged extends WithUnmanagedCreate {
  786. /**
  787. * Specifies the custom data for the virtual machine.
  788. *
  789. * @param base64EncodedCustomData base64 encoded custom data
  790. * @return the next stage of the definition
  791. */
  792. WithFromImageCreateOptionsUnmanaged withCustomData(String base64EncodedCustomData);
  793. /**
  794. * Specifies the computer name for the virtual machine.
  795. *
  796. * @param computerName a computer name
  797. * @return the next stage of the definition
  798. */
  799. WithFromImageCreateOptionsUnmanaged withComputerName(String computerName);
  800. }
  801. /**
  802. * The stage of the Linux virtual machine definition which contains all the minimum required inputs for the
  803. * resource to be created, but also allows for any other optional settings to be specified.
  804. */
  805. interface WithLinuxCreateManagedOrUnmanaged extends WithFromImageCreateOptionsManagedOrUnmanaged {
  806. /**
  807. * Specifies an SSH public key.
  808. *
  809. * @param publicKey an SSH public key in the PEM format.
  810. * @return the next stage of the definition
  811. */
  812. WithLinuxCreateManagedOrUnmanaged withSsh(String publicKey);
  813. }
  814. /**
  815. * The stage of a Linux virtual machine definition which contains all the minimum required inputs for the
  816. * resource to be created, but also allows for any other optional settings to be specified.
  817. */
  818. interface WithLinuxCreateManaged extends WithFromImageCreateOptionsManaged {
  819. /**
  820. * Specifies the SSH public key.
  821. *
  822. * <p>Each call to this method adds the given public key to the list of VM's public keys.
  823. *
  824. * @param publicKey the SSH public key in PEM format.
  825. * @return the stage representing creatable Linux VM definition
  826. */
  827. WithLinuxCreateManaged withSsh(String publicKey);
  828. }
  829. /**
  830. * The stage of a Linux virtual machine definition which contains all the minimum required inputs for the
  831. * resource to be created, but also allows for any other optional settings to be specified.
  832. */
  833. interface WithLinuxCreateUnmanaged extends WithFromImageCreateOptionsUnmanaged {
  834. /**
  835. * Specifies an SSH public key.
  836. *
  837. * @param publicKey an SSH public key in the PEM format.
  838. * @return the next stage of the definition
  839. */
  840. WithLinuxCreateUnmanaged withSsh(String publicKey);
  841. }
  842. /**
  843. * The stage of the Windows virtual machine definition allowing to enable unmanaged disks or continue the
  844. * definition of the VM with managed disks only.
  845. */
  846. interface WithWindowsCreateManagedOrUnmanaged extends WithWindowsCreateManaged {
  847. /**
  848. * Enables unmanaged disk support on this virtual machine.
  849. *
  850. * @return the next stage of the definition
  851. */
  852. WithWindowsCreateUnmanaged withUnmanagedDisks();
  853. }
  854. /**
  855. * The stage of a Windows virtual machine definition which contains all the minimum required inputs for the
  856. * resource to be created, but also allows for any other optional settings to be specified.
  857. */
  858. interface WithWindowsCreateManaged extends WithFromImageCreateOptionsManaged {
  859. /**
  860. * Prevents the provisioning of a VM agent.
  861. *
  862. * @return the next stage of the definition
  863. */
  864. WithWindowsCreateManaged withoutVMAgent();
  865. /**
  866. * Disables automatic updates.
  867. *
  868. * @return the next stage of the definition
  869. */
  870. WithWindowsCreateManaged withoutAutoUpdate();
  871. /**
  872. * Specifies the time-zone.
  873. *
  874. * @param timeZone a time zone
  875. * @return the next stage of the definition
  876. */
  877. WithWindowsCreateManaged withTimeZone(String timeZone);
  878. /**
  879. * Specifies WinRM listener.
  880. *
  881. * <p>Each call to this method adds the given listener to the list of the VM's WinRM listeners.
  882. *
  883. * @param listener a WinRM listener
  884. * @return the next stage of the definition
  885. */
  886. WithWindowsCreateManaged withWinRM(WinRMListener listener);
  887. }
  888. /**
  889. * The stage of the Windows virtual machine definition which contains all the minimum required inputs for the
  890. * resource to be created, but also allows for any other optional settings to be specified.
  891. */
  892. interface WithWindowsCreateUnmanaged extends WithFromImageCreateOptionsUnmanaged {
  893. /**
  894. * Specifies that VM Agent should not be provisioned.
  895. *
  896. * @return the stage representing creatable Windows VM definition
  897. */
  898. WithWindowsCreateUnmanaged withoutVMAgent();
  899. /**
  900. * Specifies that automatic updates should be disabled.
  901. *
  902. * @return the stage representing creatable Windows VM definition
  903. */
  904. WithWindowsCreateUnmanaged withoutAutoUpdate();
  905. /**
  906. * Specifies the time-zone.
  907. *
  908. * @param timeZone the timezone
  909. * @return the stage representing creatable Windows VM definition
  910. */
  911. WithWindowsCreateUnmanaged withTimeZone(String timeZone);
  912. /**
  913. * Specifies the WINRM listener.
  914. *
  915. * <p>Each call to this method adds the given listener to the list of VM's WinRM listeners.
  916. *
  917. * @param listener the WinRMListener
  918. * @return the stage representing creatable Windows VM definition
  919. */
  920. WithWindowsCreateUnmanaged withWinRM(WinRMListener listener);
  921. }
  922. /** The stage of a virtual machine definition allowing to specify OS disk configurations. */
  923. interface WithOSDiskSettings {
  924. /**
  925. * Specifies the caching type for the OS disk.
  926. *
  927. * @param cachingType a caching type
  928. * @return the next stage of the definition
  929. */
  930. WithCreate withOSDiskCaching(CachingTypes cachingType);
  931. /**
  932. * Specifies the encryption settings for the OS Disk.
  933. *
  934. * @param settings the encryption settings
  935. * @return the next stage of the definition
  936. */
  937. WithCreate withOSDiskEncryptionSettings(DiskEncryptionSettings settings);
  938. /**
  939. * Specifies the size of the OSDisk in GB.
  940. *
  941. * @param size the VHD size
  942. * @return the next stage of the definition
  943. * @deprecated use {@link #withOSDiskSizeInGB(int)} instead
  944. */
  945. @Deprecated
  946. WithCreate withOSDiskSizeInGB(Integer size);
  947. /**
  948. * Specifies the size of the OSDisk in GB.
  949. *
  950. * @param size the VHD size
  951. * @return the next stage of the definition
  952. */
  953. WithCreate withOSDiskSizeInGB(int size);
  954. /**
  955. * Specifies the name for the OS Disk.
  956. *
  957. * @param name an OS disk name
  958. * @return the next stage of the definition
  959. */
  960. WithCreate withOSDiskName(String name);
  961. }
  962. /** The stage of a virtual machine definition allowing to select a VM size. */
  963. interface WithVMSize {
  964. /**
  965. * Selects the size of the virtual machine.
  966. *
  967. * @param sizeName the name of a size for the virtual machine as text
  968. * @return the next stage of the definition
  969. */
  970. WithCreate withSize(String sizeName);
  971. /**
  972. * Specifies the size of the virtual machine.
  973. *
  974. * @param size a size from the list of available sizes for the virtual machine
  975. * @return the next stage of the definition
  976. */
  977. WithCreate withSize(VirtualMachineSizeTypes size);
  978. }
  979. /** The stage of a virtual machine definition allowing to add an unmanaged data disk. */
  980. interface WithUnmanagedDataDisk {
  981. /**
  982. * Attaches a new blank unmanaged data disk to the virtual machine.
  983. *
  984. * @param sizeInGB the disk size in GB
  985. * @return the next stage of the definition
  986. */
  987. WithUnmanagedCreate withNewUnmanagedDataDisk(Integer sizeInGB);
  988. /**
  989. * Attaches an existing unmanaged VHD as a data disk to the virtual machine.
  990. *
  991. * @param storageAccountName a storage account name
  992. * @param containerName the name of the container holding the VHD file
  993. * @param vhdName the name for the VHD file
  994. * @return the next stage of the definition
  995. */
  996. WithUnmanagedCreate withExistingUnmanagedDataDisk(
  997. String storageAccountName, String containerName, String vhdName);
  998. /**
  999. * Begins definition of an unmanaged data disk to be attached to the virtual machine.
  1000. *
  1001. * @param name the name for the data disk
  1002. * @return the first stage of an unmanaged data disk definition
  1003. */
  1004. VirtualMachineUnmanagedDataDisk.DefinitionStages.Blank<WithUnmanagedCreate> defineUnmanagedDataDisk(
  1005. String name);
  1006. }
  1007. /** The stage of a virtual machine definition allowing to specify a managed data disk. */
  1008. interface WithManagedDataDisk {
  1009. /**
  1010. * Specifies that a managed disk should be created explicitly with the given definition and attached to the
  1011. * virtual machine as a data disk.
  1012. *
  1013. * @param creatable a creatable disk definition
  1014. * @return the next stage of the definition
  1015. */
  1016. WithManagedCreate withNewDataDisk(Creatable<Disk> creatable);
  1017. /**
  1018. * Specifies that a managed disk needs to be created explicitly with the given definition and attach to the
  1019. * virtual machine as data disk.
  1020. *
  1021. * @param creatable a creatable disk
  1022. * @param lun the data disk LUN
  1023. * @param cachingType a data disk caching type
  1024. * @return the next stage of the definition
  1025. */
  1026. WithManagedCreate withNewDataDisk(Creatable<Disk> creatable, int lun, CachingTypes cachingType);
  1027. /**
  1028. * Specifies that a managed disk needs to be created implicitly with the given size.
  1029. *
  1030. * @param sizeInGB the size of the managed disk in GB
  1031. * @return the next stage of the definition
  1032. */
  1033. WithManagedCreate withNewDataDisk(int sizeInGB);
  1034. /**
  1035. * Specifies that a managed disk needs to be created implicitly with the given settings.
  1036. *
  1037. * @param sizeInGB the size of the managed disk in GB
  1038. * @param lun the disk LUN
  1039. * @param cachingType the caching type
  1040. * @return the next stage of the definition
  1041. */
  1042. WithManagedCreate withNewDataDisk(int sizeInGB, int lun, CachingTypes cachingType);
  1043. /**
  1044. * Specifies that a managed disk needs to be created implicitly with the given settings.
  1045. *
  1046. * @param sizeInGB the size of the managed disk in GB
  1047. * @param lun the disk LUN
  1048. * @param cachingType the caching type
  1049. * @param storageAccountType the storage account type
  1050. * @return the next stage of the definition
  1051. */
  1052. WithManagedCreate withNewDataDisk(
  1053. int sizeInGB, int lun, CachingTypes cachingType, StorageAccountTypes storageAccountType);
  1054. /**
  1055. * Associates an existing source managed disk with the virtual machine.
  1056. *
  1057. * @param disk an existing managed disk
  1058. * @return the next stage of the definition
  1059. */
  1060. WithManagedCreate withExistingDataDisk(Disk disk);
  1061. /**
  1062. * Associates an existing source managed disk with the virtual machine and specifies additional settings.
  1063. *
  1064. * @param disk a managed disk
  1065. * @param lun the disk LUN
  1066. * @param cachingType a caching type
  1067. * @return the next stage of the definition
  1068. */
  1069. WithManagedCreate withExistingDataDisk(Disk disk, int lun, CachingTypes cachingType);
  1070. /**
  1071. * Associates an existing source managed disk with the virtual machine and specifies additional settings.
  1072. *
  1073. * @param disk a managed disk
  1074. * @param newSizeInGB the disk resize size in GB
  1075. * @param lun the disk LUN
  1076. * @param cachingType a caching type
  1077. * @return the next stage of the definition
  1078. */
  1079. WithManagedCreate withExistingDataDisk(Disk disk, int newSizeInGB, int lun, CachingTypes cachingType);
  1080. /**
  1081. * Specifies the data disk to be created from the data disk image in the virtual machine image.
  1082. *
  1083. * @param imageLun the LUN of the source data disk image
  1084. * @return the next stage of the definition
  1085. */
  1086. WithManagedCreate withNewDataDiskFromImage(int imageLun);
  1087. /**
  1088. * Specifies the data disk to be created from the data disk image in the virtual machine image.
  1089. *
  1090. * @param imageLun the LUN of the source data disk image
  1091. * @param newSizeInGB the new size that overrides the default size specified in the data disk image
  1092. * @param cachingType a caching type
  1093. * @return the next stage of the definition
  1094. */
  1095. WithManagedCreate withNewDataDiskFromImage(int imageLun, int newSizeInGB, CachingTypes cachingType);
  1096. /**
  1097. * Specifies the data disk to be created from the data disk image in the virtual machine image.
  1098. *
  1099. * @param imageLun the LUN of the source data disk image
  1100. * @param newSizeInGB the new size that overrides the default size specified in the data disk image
  1101. * @param cachingType a caching type
  1102. * @param storageAccountType a storage account type
  1103. * @return the next stage of the definition
  1104. */
  1105. WithManagedCreate withNewDataDiskFromImage(
  1106. int imageLun, int newSizeInGB, CachingTypes cachingType, StorageAccountTypes storageAccountType);
  1107. }
  1108. /** The stage of the virtual machine definition allowing to specify availability set. */
  1109. interface WithAvailabilitySet {
  1110. /**
  1111. * Specifies the name of a new availability set to associate with the virtual machine.
  1112. *
  1113. * @param name the name of an availability set
  1114. * @return the next stage of the definition
  1115. */
  1116. WithCreate withNewAvailabilitySet(String name);
  1117. /**
  1118. * Specifies definition of a not-yet-created availability set definition to associate the virtual machine
  1119. * with.
  1120. *
  1121. * @param creatable a creatable availability set definition
  1122. * @return the next stage of the definition
  1123. */
  1124. WithCreate withNewAvailabilitySet(Creatable<AvailabilitySet> creatable);
  1125. /**
  1126. * Specifies an existing availability set to associate with the virtual machine.
  1127. *
  1128. * @param availabilitySet an existing availability set
  1129. * @return the next stage of the definition
  1130. */
  1131. WithCreate withExistingAvailabilitySet(AvailabilitySet availabilitySet);
  1132. }
  1133. /** The stage of a virtual machine definition allowing to specify a storage account. */
  1134. interface WithStorageAccount {
  1135. /**
  1136. * Specifies the name of a new storage account to put the VM's OS and data disk VHD into.
  1137. *
  1138. * <p>Only an OS disk based on a marketplace image will be stored in the new storage account. An OS disk
  1139. * based on a user image will be stored in the same storage account as the user image.
  1140. *
  1141. * @param name the name for a new storage account
  1142. * @return the next stage of the definition
  1143. */
  1144. WithCreate withNewStorageAccount(String name);
  1145. /**
  1146. * Specifies the definition of a not-yet-created storage account to put the VM's OS and data disk VHDs into.
  1147. *
  1148. * <p>Only the OS disk based on a marketplace image will be stored in the new storage account. An OS disk
  1149. * based on a user image will be stored in the same storage account as the user image.
  1150. *
  1151. * @param creatable a creatable storage account definition
  1152. * @return the next stage of the definition
  1153. */
  1154. WithCreate withNewStorageAccount(Creatable<StorageAccount> creatable);
  1155. /**
  1156. * Specifies an existing storage account to put the VM's OS and data disk VHD in.
  1157. *
  1158. * <p>An OS disk based on a marketplace or a user image (generalized image) will be stored in this storage
  1159. * account.
  1160. *
  1161. * @param storageAccount an existing storage account
  1162. * @return the next stage of the definition
  1163. */
  1164. WithCreate withExistingStorageAccount(StorageAccount storageAccount);
  1165. }
  1166. /** The stage of a virtual machine definition allowing to specify additional network interfaces. */
  1167. interface WithSecondaryNetworkInterface {
  1168. /**
  1169. * Creates a new network interface to associate with the virtual machine, based on the provided definition.
  1170. *
  1171. * <p>Note this method's effect is additive, i.e. each time it is used, a new secondary network interface
  1172. * added to the virtual machine.
  1173. *
  1174. * @param creatable a creatable definition for a new network interface
  1175. * @return the next stage of the definition
  1176. */
  1177. WithCreate withNewSecondaryNetworkInterface(Creatable<NetworkInterface> creatable);
  1178. /**
  1179. * Associates an existing network interface with the virtual machine.
  1180. *
  1181. * <p>Note this method's effect is additive, i.e. each time it is used, the new secondary network interface
  1182. * added to the virtual machine.
  1183. *
  1184. * @param networkInterface an existing network interface
  1185. * @return the next stage of the definition
  1186. */
  1187. WithCreate withExistingSecondaryNetworkInterface(NetworkInterface networkInterface);
  1188. }
  1189. /** The stage of the virtual machine definition allowing to specify extensions. */
  1190. interface WithExtension {
  1191. /**
  1192. * Starts the definition of an extension to be attached to the virtual machine.
  1193. *
  1194. * @param name the reference name for the extension
  1195. * @return the first stage stage of an extension definition
  1196. */
  1197. VirtualMachineExtension.DefinitionStages.Blank<WithCreate> defineNewExtension(String name);
  1198. }
  1199. /** The stage of a virtual machine definition allowing to specify a purchase plan. */
  1200. interface WithPlan {
  1201. /**
  1202. * Specifies the purchase plan for the virtual machine.
  1203. *
  1204. * @param plan a purchase plan
  1205. * @return the next stage of the definition
  1206. */
  1207. WithCreate withPlan(PurchasePlan plan);
  1208. /**
  1209. * Specifies the purchase plan for the virtual machine.
  1210. *
  1211. * @param plan a purchase plan
  1212. * @param promotionCode a promotion code
  1213. * @return the next stage of the definition
  1214. */
  1215. WithCreate withPromotionalPlan(PurchasePlan plan, String promotionCode);
  1216. }
  1217. /** The stage of the virtual machine definition allowing to enable boot diagnostics. */
  1218. interface WithBootDiagnostics {
  1219. /**
  1220. * Specifies that boot diagnostics needs to be enabled in the virtual machine.
  1221. *
  1222. * @return the next stage of the definition
  1223. */
  1224. WithCreate withBootDiagnostics();
  1225. /**
  1226. * Specifies that boot diagnostics needs to be enabled in the virtual machine.
  1227. *
  1228. * @param creatable the storage account to be created and used for store the boot diagnostics
  1229. * @return the next stage of the definition
  1230. */
  1231. WithCreate withBootDiagnostics(Creatable<StorageAccount> creatable);
  1232. /**
  1233. * Specifies that boot diagnostics needs to be enabled in the virtual machine.
  1234. *
  1235. * @param storageAccount an existing storage account to be uses to store the boot diagnostics
  1236. * @return the next stage of the definition
  1237. */
  1238. WithCreate withBootDiagnostics(StorageAccount storageAccount);
  1239. /**
  1240. * Specifies that boot diagnostics needs to be enabled in the virtual machine.
  1241. *
  1242. * @param storageAccountBlobEndpointUri a storage account blob endpoint to store the boot diagnostics
  1243. * @return the next stage of the definition
  1244. */
  1245. WithCreate withBootDiagnostics(String storageAccountBlobEndpointUri);
  1246. }
  1247. /** The stage of the virtual machine definition allowing to specify priority. */
  1248. interface WithPriority {
  1249. /**
  1250. * Specifies the priority of the virtual machine.
  1251. *
  1252. * @param priority the priority to set
  1253. * @return the next stage of the definition
  1254. */
  1255. WithCreate withPriority(VirtualMachinePriorityTypes priority);
  1256. /**
  1257. * Specify that virtual machine should be low priority.
  1258. *
  1259. * @return the next stage of the definition
  1260. */
  1261. WithCreate withLowPriority();
  1262. /**
  1263. * Specify that virtual machines should be low priority VMs with the provided eviction policy.
  1264. *
  1265. * @param policy eviction policy for the virtual machine
  1266. * @return the next stage of the definition
  1267. */
  1268. WithCreate withLowPriority(VirtualMachineEvictionPolicyTypes policy);
  1269. }
  1270. /**
  1271. * The stage of a virtual machine definition allowing to set the billing related details of a low priority
  1272. * virtual machine.
  1273. */
  1274. interface WithBillingProfile {
  1275. /**
  1276. * Set the billing related details of a low priority virtual machine. This price is in US Dollars.
  1277. *
  1278. * @param maxPrice the maxPrice value to set
  1279. * @return the next stage of the definition
  1280. */
  1281. WithCreate withMaxPrice(Double maxPrice);
  1282. }
  1283. /**
  1284. * The stage of the virtual machine definition allowing to enable System Assigned (Local) Managed Service
  1285. * Identity.
  1286. */
  1287. interface WithSystemAssignedManagedServiceIdentity {
  1288. /**
  1289. * Specifies that System Assigned (Local) Managed Service Identity needs to be enabled in the virtual
  1290. * machine.
  1291. *
  1292. * @return the next stage of the definition
  1293. */
  1294. WithSystemAssignedIdentityBasedAccessOrCreate withSystemAssignedManagedServiceIdentity();
  1295. }
  1296. /**
  1297. * The stage of the System Assigned (Local) Managed Service Identity enabled virtual machine allowing to set
  1298. * access role for the identity.
  1299. */
  1300. interface WithSystemAssignedIdentityBasedAccessOrCreate extends WithCreate {
  1301. /**
  1302. * Specifies that virtual machine's system assigned (local) identity should have the given access (described
  1303. * by the role) on an ARM resource identified by the resource ID. Applications running on the virtual
  1304. * machine will have the same permission (role) on the ARM resource.
  1305. *
  1306. * @param resourceId the ARM identifier of the resource
  1307. * @param role access role to assigned to the virtual machine's local identity
  1308. * @return the next stage of the definition
  1309. */
  1310. WithSystemAssignedIdentityBasedAccessOrCreate withSystemAssignedIdentityBasedAccessTo(
  1311. String resourceId, BuiltInRole role);
  1312. /**
  1313. * Specifies that virtual machine's system assigned (local) identity should have the given access (described
  1314. * by the role) on the resource group that virtual machine resides. Applications running on the virtual
  1315. * machine will have the same permission (role) on the resource group.
  1316. *
  1317. * @param role access role to assigned to the virtual machine's local identity
  1318. * @return the next stage of the definition
  1319. */
  1320. WithSystemAssignedIdentityBasedAccessOrCreate withSystemAssignedIdentityBasedAccessToCurrentResourceGroup(
  1321. BuiltInRole role);
  1322. /**
  1323. * Specifies that virtual machine's system assigned (local) identity should have the access (described by
  1324. * the role definition) on an ARM resource identified by the resource ID. Applications running on the
  1325. * virtual machine will have the same permission (role) on the ARM resource.
  1326. *
  1327. * @param resourceId scope of the access represented in ARM resource ID format
  1328. * @param roleDefinitionId access role definition to assigned to the virtual machine's local identity
  1329. * @return the next stage of the definition
  1330. */
  1331. WithSystemAssignedIdentityBasedAccessOrCreate withSystemAssignedIdentityBasedAccessTo(
  1332. String resourceId, String roleDefinitionId);
  1333. /**
  1334. * Specifies that virtual machine's system assigned (local) identity should have the access (described by
  1335. * the role definition) on the resource group that virtual machine resides. Applications running on the
  1336. * virtual machine will have the same permission (role) on the resource group.
  1337. *
  1338. * @param roleDefinitionId access role definition to assigned to the virtual machine's local identity
  1339. * @return the next stage of the definition
  1340. */
  1341. WithSystemAssignedIdentityBasedAccessOrCreate withSystemAssignedIdentityBasedAccessToCurrentResourceGroup(
  1342. String roleDefinitionId);
  1343. }
  1344. /**
  1345. * The stage of the virtual machine definition allowing to specify User Assigned (External) Managed Service
  1346. * Identities.
  1347. */
  1348. interface WithUserAssignedManagedServiceIdentity {
  1349. /**
  1350. * Specifies the definition of a not-yet-created user assigned identity to be associated with the virtual
  1351. * machine.
  1352. *
  1353. * @param creatableIdentity a creatable identity definition
  1354. * @return the next stage of the virtual machine definition
  1355. */
  1356. WithCreate withNewUserAssignedManagedServiceIdentity(Creatable<Identity> creatableIdentity);
  1357. /**
  1358. * Specifies an existing user assigned identity to be associated with the virtual machine.
  1359. *
  1360. * @param identity the identity
  1361. * @return the next stage of the virtual machine definition
  1362. */
  1363. WithCreate withExistingUserAssignedManagedServiceIdentity(Identity identity);
  1364. }
  1365. /**
  1366. * The stage of the virtual machine definition allowing to specify that the image or disk that is being used was
  1367. * licensed on-premises. This element is only used for images that contain the Windows Server operating system.
  1368. */
  1369. interface WithLicenseType {
  1370. /**
  1371. * Specifies that the image or disk that is being used was licensed on-premises.
  1372. *
  1373. * @param licenseType license type
  1374. * @return the next stage of the virtual machine definition
  1375. */
  1376. WithCreate withLicenseType(String licenseType);
  1377. }
  1378. /** The stage of the VM definition allowing to specify availability zone. */
  1379. interface WithAvailabilityZone {
  1380. /**
  1381. * Specifies the availability zone for the virtual machine.
  1382. *
  1383. * @param zoneId the zone identifier.
  1384. * @return the next stage of the definition
  1385. */
  1386. WithManagedCreate withAvailabilityZone(AvailabilityZoneId zoneId);
  1387. }
  1388. /**
  1389. * The stage of the definition which contains all the minimum required inputs for the VM using managed OS disk
  1390. * to be created and optionally allow managed data disks specific settings to be specified.
  1391. */
  1392. interface WithManagedCreate extends WithManagedDataDisk, WithAvailabilityZone, WithCreate {
  1393. /**
  1394. * Specifies the storage account type for the managed OS disk.
  1395. *
  1396. * @param accountType storage account type
  1397. * @return the next stage of the definition
  1398. */
  1399. WithManagedCreate withOSDiskStorageAccountType(StorageAccountTypes accountType);
  1400. /**
  1401. * Specifies the default caching type for the managed data disks.
  1402. *
  1403. * @param cachingType a caching type
  1404. * @return the next stage of teh definition
  1405. */
  1406. WithManagedCreate withDataDiskDefaultCachingType(CachingTypes cachingType);
  1407. /**
  1408. * Specifies the default caching type for managed data disks.
  1409. *
  1410. * @param storageAccountType a storage account type
  1411. * @return the next stage of the definition
  1412. */
  1413. WithManagedCreate withDataDiskDefaultStorageAccountType(StorageAccountTypes storageAccountType);
  1414. }
  1415. /**
  1416. * The stage of a virtual machine definition which contains all the minimum required inputs for the VM using
  1417. * storage account (unmanaged based OS disk to be created and optionally allow unmanaged data disk and settings
  1418. * specific to unmanaged OS disk to be specified.
  1419. */
  1420. interface WithUnmanagedCreate extends WithUnmanagedDataDisk, WithCreate {
  1421. /**
  1422. * Specifies the name of an OS disk VHD file and its parent container.
  1423. *
  1424. * @param containerName the name of the container in the selected storage account
  1425. * @param vhdName the name for the OS disk VHD.
  1426. * @return the next stage of the definition
  1427. */
  1428. WithUnmanagedCreate withOSDiskVhdLocation(String containerName, String vhdName);
  1429. }
  1430. /**
  1431. * The stage of the definition which contains all the minimum required inputs for the resource to be created,
  1432. * but also allows for any other optional settings to be specified.
  1433. */
  1434. interface WithCreate
  1435. extends Creatable<VirtualMachine>,
  1436. Resource.DefinitionWithTags<WithCreate>,
  1437. DefinitionStages.WithOSDiskSettings,
  1438. DefinitionStages.WithVMSize,
  1439. DefinitionStages.WithStorageAccount,
  1440. DefinitionStages.WithAvailabilitySet,
  1441. DefinitionStages.WithSecondaryNetworkInterface,
  1442. DefinitionStages.WithExtension,
  1443. DefinitionStages.WithPlan,
  1444. DefinitionStages.WithBootDiagnostics,
  1445. DefinitionStages.WithPriority,
  1446. DefinitionStages.WithBillingProfile,
  1447. DefinitionStages.WithSystemAssignedManagedServiceIdentity,
  1448. DefinitionStages.WithUserAssignedManagedServiceIdentity,
  1449. DefinitionStages.WithLicenseType {
  1450. }
  1451. }
  1452. /** Grouping of virtual machine update stages. */
  1453. interface UpdateStages {
  1454. /**
  1455. * The stage of a virtual machine update allowing to set/remove information about the proximity placement group
  1456. * that the virtual machine scale set should be assigned to.
  1457. */
  1458. interface WithProximityPlacementGroup {
  1459. /**
  1460. * Set information about the proximity placement group that the virtual machineshould be assigned to.
  1461. *
  1462. * @param proximityPlacementGroupId The Id of the proximity placement group subResource.
  1463. * @return the next stage of the definition.
  1464. */
  1465. Update withProximityPlacementGroup(String proximityPlacementGroupId);
  1466. /**
  1467. * Removes the Proximity placement group from the VM.
  1468. *
  1469. * @return the next stage of the definition.
  1470. */
  1471. Update withoutProximityPlacementGroup();
  1472. }
  1473. /** /** The stage of the virtual machine update allowing to specify billing profile. */
  1474. interface WithBillingProfile {
  1475. /**
  1476. * Set the billing related details of a low priority virtual machine.
  1477. *
  1478. * @param maxPrice the maxPrice value to set
  1479. * @return the next stage of the update
  1480. */
  1481. Update withMaxPrice(Double maxPrice);
  1482. }
  1483. /** The stage of a virtual machine definition allowing to specify unmanaged data disk configuration. */
  1484. interface WithUnmanagedDataDisk {
  1485. /**
  1486. * Specifies that a new blank unmanaged data disk needs to be attached to virtual machine.
  1487. *
  1488. * @param sizeInGB the disk size in GB
  1489. * @return the stage representing creatable VM definition
  1490. */
  1491. Update withNewUnmanagedDataDisk(Integer sizeInGB);
  1492. /**
  1493. * Specifies an existing VHD that needs to be attached to the virtual machine as data disk.
  1494. *
  1495. * @param storageAccountName the storage account name
  1496. * @param containerName the name of the container holding the VHD file
  1497. * @param vhdName the name for the VHD file
  1498. * @return the stage representing creatable VM definition
  1499. */
  1500. Update withExistingUnmanagedDataDisk(String storageAccountName, String containerName, String vhdName);
  1501. /**
  1502. * Begins the definition of a blank unmanaged data disk to be attached to the virtual machine along with its
  1503. * configuration.
  1504. *
  1505. * @param name the name for the data disk
  1506. * @return the first stage of the data disk definition
  1507. */
  1508. VirtualMachineUnmanagedDataDisk.UpdateDefinitionStages.Blank<Update> defineUnmanagedDataDisk(String name);
  1509. /**
  1510. * Begins the description of an update of an existing unmanaged data disk of this virtual machine.
  1511. *
  1512. * @param name the name of an existing disk
  1513. * @return the first stage of the data disk update
  1514. */
  1515. VirtualMachineUnmanagedDataDisk.Update updateUnmanagedDataDisk(String name);
  1516. /**
  1517. * Detaches an unmanaged data disk from the virtual machine.
  1518. *
  1519. * @param name the name of an existing data disk to remove
  1520. * @return the next stage of the update
  1521. */
  1522. Update withoutUnmanagedDataDisk(String name);
  1523. /**
  1524. * Detaches a unmanaged data disk from the virtual machine.
  1525. *
  1526. * @param lun the logical unit number of the data disk to remove
  1527. * @return the next stage of the update
  1528. */
  1529. Update withoutUnmanagedDataDisk(int lun);
  1530. }
  1531. /** The stage of a virtual machine update allowing to specify a managed data disk. */
  1532. interface WithManagedDataDisk {
  1533. /**
  1534. * Specifies that a managed disk needs to be created explicitly with the given definition and attached to
  1535. * the virtual machine as a data disk.
  1536. *
  1537. * @param creatable a creatable disk definition
  1538. * @return the next stage of the update
  1539. */
  1540. Update withNewDataDisk(Creatable<Disk> creatable);
  1541. /**
  1542. * Specifies that a managed disk needs to be created explicitly with the given definition and attached to
  1543. * the virtual machine as a data disk.
  1544. *
  1545. * @param creatable a creatable disk definition
  1546. * @param lun the data disk LUN
  1547. * @param cachingType a data disk caching type
  1548. * @return the next stage of the update
  1549. */
  1550. Update withNewDataDisk(Creatable<Disk> creatable, int lun, CachingTypes cachingType);
  1551. /**
  1552. * Specifies that a managed disk needs to be created implicitly with the given size.
  1553. *
  1554. * @param sizeInGB the size of the managed disk
  1555. * @return the next stage of the update
  1556. */
  1557. Update withNewDataDisk(int sizeInGB);
  1558. /**
  1559. * Specifies that a managed disk needs to be created implicitly with the given settings.
  1560. *
  1561. * @param sizeInGB the size of the managed disk
  1562. * @param lun the disk LUN
  1563. * @param cachingType a caching type
  1564. * @return the next stage of the update
  1565. */
  1566. Update withNewDataDisk(int sizeInGB, int lun, CachingTypes cachingType);
  1567. /**
  1568. * Specifies that a managed disk needs to be created implicitly with the given settings.
  1569. *
  1570. * @param sizeInGB the size of the managed disk
  1571. * @param lun the disk LUN
  1572. * @param cachingType a caching type
  1573. * @param storageAccountType a storage account type
  1574. * @return the next stage of the update
  1575. */
  1576. Update withNewDataDisk(
  1577. int sizeInGB, int lun, CachingTypes cachingType, StorageAccountTypes storageAccountType);
  1578. /**
  1579. * Associates an existing source managed disk with the VM.
  1580. *
  1581. * @param disk a managed disk
  1582. * @return the next stage of the update
  1583. */
  1584. Update withExistingDataDisk(Disk disk);
  1585. /**
  1586. * Specifies an existing source managed disk and settings.
  1587. *
  1588. * @param disk the managed disk
  1589. * @param lun the disk LUN
  1590. * @param cachingType a caching type
  1591. * @return the next stage of the update
  1592. */
  1593. Update withExistingDataDisk(Disk disk, int lun, CachingTypes cachingType);
  1594. /**
  1595. * Specifies an existing source managed disk and settings.
  1596. *
  1597. * @param disk a managed disk
  1598. * @param newSizeInGB the disk resize size in GB
  1599. * @param lun the disk LUN
  1600. * @param cachingType a caching type
  1601. * @return the next stage of the update
  1602. */
  1603. Update withExistingDataDisk(Disk disk, int newSizeInGB, int lun, CachingTypes cachingType);
  1604. /**
  1605. * Detaches a managed data disk with the given LUN from the virtual machine.
  1606. *
  1607. * @param lun the disk LUN
  1608. * @return the next stage of the update
  1609. */
  1610. Update withoutDataDisk(int lun);
  1611. /**
  1612. * Updates the size of a managed data disk with the given LUN.
  1613. *
  1614. * @param lun the disk LUN
  1615. * @param newSizeInGB the new size of the disk
  1616. * @return the next stage of the update
  1617. */
  1618. // TODO: This has been disabled by the Azure REST API
  1619. // Update withDataDiskUpdated(int lun, int newSizeInGB);
  1620. /**
  1621. * Updates the size and caching type of a managed data disk with the given LUN.
  1622. *
  1623. * @param lun the disk LUN
  1624. * @param newSizeInGB the new size of the disk
  1625. * @param cachingType a caching type
  1626. * @return the next stage of the update
  1627. */
  1628. // TODO: This has been disabled by the Azure REST API
  1629. // Update withDataDiskUpdated(int lun, int newSizeInGB, CachingTypes cachingType);
  1630. /**
  1631. * Updates the size, caching type and storage account type of a managed data disk with the given LUN.
  1632. *
  1633. * @param lun the disk LUN
  1634. * @param newSizeInGB the new size of the disk
  1635. * @param cachingType a caching type
  1636. * @param storageAccountType a storage account type
  1637. * @return the next stage of the update
  1638. */
  1639. // TODO: This has been disabled by the Azure REST API
  1640. // Update withDataDiskUpdated(int lun,
  1641. // int newSizeInGB,
  1642. // CachingTypes cachingType,
  1643. // StorageAccountTypes storageAccountType);
  1644. }
  1645. /** The stage of a virtual machine update allowing to specify additional network interfaces. */
  1646. interface WithSecondaryNetworkInterface {
  1647. /**
  1648. * Creates a new network interface to associate with the virtual machine.
  1649. *
  1650. * <p>Note this method's effect is additive, i.e. each time it is used, the new secondary network interface
  1651. * added to the virtual machine.
  1652. *
  1653. * @param creatable a creatable definition for a new network interface
  1654. * @return the next stage of the update
  1655. */
  1656. Update withNewSecondaryNetworkInterface(Creatable<NetworkInterface> creatable);
  1657. /**
  1658. * Associates an existing network interface with the virtual machine.
  1659. *
  1660. * <p>Note this method's effect is additive, i.e. each time it is used, the new secondary network interface
  1661. * added to the virtual machine.
  1662. *
  1663. * @param networkInterface an existing network interface
  1664. * @return the next stage of the update
  1665. */
  1666. Update withExistingSecondaryNetworkInterface(NetworkInterface networkInterface);
  1667. /**
  1668. * Removes a secondary network interface from the virtual machine.
  1669. *
  1670. * @param name the name of a secondary network interface to remove
  1671. * @return the next stage of the update
  1672. */
  1673. Update withoutSecondaryNetworkInterface(String name);
  1674. }
  1675. /** The stage of a virtual machine update allowing to specify extensions. */
  1676. interface WithExtension {
  1677. /**
  1678. * Begins the definition of an extension to be attached to the virtual machine.
  1679. *
  1680. * @param name a reference name for the extension
  1681. * @return the first stage of an extension definition
  1682. */
  1683. VirtualMachineExtension.UpdateDefinitionStages.Blank<Update> defineNewExtension(String name);
  1684. /**
  1685. * Begins the description of an update of an existing extension of this virtual machine.
  1686. *
  1687. * @param name the reference name of an existing extension
  1688. * @return the first stage of an extension update
  1689. */
  1690. VirtualMachineExtension.Update updateExtension(String name);
  1691. /**
  1692. * Detaches an extension from the virtual machine.
  1693. *
  1694. * @param name the reference name of the extension to be removed/uninstalled
  1695. * @return the next stage of the update
  1696. */
  1697. Update withoutExtension(String name);
  1698. }
  1699. /** The stage of the virtual machine definition allowing to enable boot diagnostics. */
  1700. interface WithBootDiagnostics {
  1701. /**
  1702. * Specifies that boot diagnostics needs to be enabled in the virtual machine.
  1703. *
  1704. * @return the next stage of the update
  1705. */
  1706. Update withBootDiagnostics();
  1707. /**
  1708. * Specifies that boot diagnostics needs to be enabled in the virtual machine.
  1709. *
  1710. * @param creatable the storage account to be created and used for store the boot diagnostics
  1711. * @return the next stage of the update
  1712. */
  1713. Update withBootDiagnostics(Creatable<StorageAccount> creatable);
  1714. /**
  1715. * Specifies that boot diagnostics needs to be enabled in the virtual machine.
  1716. *
  1717. * @param storageAccount an existing storage account to be uses to store the boot diagnostics
  1718. * @return the next stage of the update
  1719. */
  1720. Update withBootDiagnostics(StorageAccount storageAccount);
  1721. /**
  1722. * Specifies that boot diagnostics needs to be enabled in the virtual machine.
  1723. *
  1724. * @param storageAccountBlobEndpointUri a storage account blob endpoint to store the boot diagnostics
  1725. * @return the next stage of the update
  1726. */
  1727. Update withBootDiagnostics(String storageAccountBlobEndpointUri);
  1728. /**
  1729. * Specifies that boot diagnostics needs to be disabled in the virtual machine.
  1730. *
  1731. * @return the next stage of the update
  1732. */
  1733. Update withoutBootDiagnostics();
  1734. }
  1735. /**
  1736. * The stage of the virtual machine update allowing to enable System Assigned (Local) Managed Service Identity.
  1737. */
  1738. interface WithSystemAssignedManagedServiceIdentity {
  1739. /**
  1740. * Specifies that System Assigned (Local) Managed Service Identity needs to be enabled in the virtual
  1741. * machine.
  1742. *
  1743. * @return the next stage of the update
  1744. */
  1745. WithSystemAssignedIdentityBasedAccessOrUpdate withSystemAssignedManagedServiceIdentity();
  1746. /**
  1747. * Specifies that System Assigned (Local) Managed Service Identity needs to be disabled.
  1748. *
  1749. * @return the next stage of the update
  1750. */
  1751. Update withoutSystemAssignedManagedServiceIdentity();
  1752. }
  1753. /**
  1754. * The stage of the System Assigned (Local) Managed Service Identity enabled virtual machine allowing to set
  1755. * access role for the identity.
  1756. */
  1757. interface WithSystemAssignedIdentityBasedAccessOrUpdate extends Update {
  1758. /**
  1759. * Specifies that virtual machine's system assigned (local) identity should have the given access (described
  1760. * by the role) on an ARM resource identified by the resource ID. Applications running on the virtual
  1761. * machine will have the same permission (role) on the ARM resource.
  1762. *
  1763. * @param resourceId the ARM identifier of the resource
  1764. * @param role access role to assigned to the virtual machine's local identity
  1765. * @return the next stage of the update
  1766. */
  1767. WithSystemAssignedIdentityBasedAccessOrUpdate withSystemAssignedIdentityBasedAccessTo(
  1768. String resourceId, BuiltInRole role);
  1769. /**
  1770. * Specifies that virtual machine's system assigned (local) identity should have the given access (described
  1771. * by the role) on the resource group that virtual machine resides. Applications running on the virtual
  1772. * machine will have the same permission (role) on the resource group.
  1773. *
  1774. * @param role access role to assigned to the virtual machine's local identity
  1775. * @return the next stage of the update
  1776. */
  1777. WithSystemAssignedIdentityBasedAccessOrUpdate withSystemAssignedIdentityBasedAccessToCurrentResourceGroup(
  1778. BuiltInRole role);
  1779. /**
  1780. * Specifies that virtual machine's system assigned (local) identity should have the access (described by
  1781. * the role definition) on an ARM resource identified by the resource ID. Applications running on the
  1782. * virtual machine will have the same permission (role) on the ARM resource.
  1783. *
  1784. * @param resourceId scope of the access represented in ARM resource ID format
  1785. * @param roleDefinitionId access role definition to assigned to the virtual machine's local identity
  1786. * @return the next stage of the update
  1787. */
  1788. WithSystemAssignedIdentityBasedAccessOrUpdate withSystemAssignedIdentityBasedAccessTo(
  1789. String resourceId, String roleDefinitionId);
  1790. /**
  1791. * Specifies that virtual machine's system assigned (local) identity should have the access (described by
  1792. * the role definition) on the resource group that virtual machine resides. Applications running on the
  1793. * virtual machine will have the same permission (role) on the resource group.
  1794. *
  1795. * @param roleDefinitionId access role definition to assigned to the virtual machine's local identity
  1796. * @return the next stage of the update
  1797. */
  1798. WithSystemAssignedIdentityBasedAccessOrUpdate withSystemAssignedIdentityBasedAccessToCurrentResourceGroup(
  1799. String roleDefinitionId);
  1800. }
  1801. /**
  1802. * The stage of the virtual machine update allowing to add or remove User Assigned (External) Managed Service
  1803. * Identities.
  1804. */
  1805. interface WithUserAssignedManagedServiceIdentity {
  1806. /**
  1807. * Specifies the definition of a not-yet-created user assigned identity to be associated with the virtual
  1808. * machine.
  1809. *
  1810. * @param creatableIdentity a creatable identity definition
  1811. * @return the next stage of the virtual machine update
  1812. */
  1813. Update withNewUserAssignedManagedServiceIdentity(Creatable<Identity> creatableIdentity);
  1814. /**
  1815. * Specifies an existing user assigned identity to be associated with the virtual machine.
  1816. *
  1817. * @param identity the identity
  1818. * @return the next stage of the virtual machine update
  1819. */
  1820. Update withExistingUserAssignedManagedServiceIdentity(Identity identity);
  1821. /**
  1822. * Specifies that an user assigned identity associated with the virtual machine should be removed.
  1823. *
  1824. * @param identityId ARM resource id of the identity
  1825. * @return the next stage of the virtual machine update
  1826. */
  1827. Update withoutUserAssignedManagedServiceIdentity(String identityId);
  1828. }
  1829. /**
  1830. * The stage of the virtual machine update allowing to specify that the image or disk that is being used was
  1831. * licensed on-premises. This element is only used for images that contain the Windows Server operating system.
  1832. */
  1833. interface WithLicenseType {
  1834. /**
  1835. * Specifies that the image or disk that is being used was licensed on-premises.
  1836. *
  1837. * @param licenseType license type
  1838. * @return the next stage of the virtual machine update
  1839. */
  1840. Update withLicenseType(String licenseType);
  1841. }
  1842. }
  1843. /** The template for an update operation, containing all the settings that can be modified. */
  1844. interface Update
  1845. extends Appliable<VirtualMachine>,
  1846. Resource.UpdateWithTags<Update>,
  1847. UpdateStages.WithProximityPlacementGroup,
  1848. UpdateStages.WithUnmanagedDataDisk,
  1849. UpdateStages.WithManagedDataDisk,
  1850. UpdateStages.WithSecondaryNetworkInterface,
  1851. UpdateStages.WithExtension,
  1852. UpdateStages.WithBootDiagnostics,
  1853. UpdateStages.WithBillingProfile,
  1854. UpdateStages.WithSystemAssignedManagedServiceIdentity,
  1855. UpdateStages.WithUserAssignedManagedServiceIdentity,
  1856. UpdateStages.WithLicenseType {
  1857. /**
  1858. * Specifies the encryption settings for the OS Disk.
  1859. *
  1860. * @param settings the encryption settings.
  1861. * @return the stage representing creatable VM update
  1862. */
  1863. Update withOSDiskEncryptionSettings(DiskEncryptionSettings settings);
  1864. /**
  1865. * Specifies the default caching type for the managed data disks.
  1866. *
  1867. * @param cachingType a caching type
  1868. * @return the next stage of the update
  1869. */
  1870. Update withDataDiskDefaultCachingType(CachingTypes cachingType);
  1871. /**
  1872. * Specifies a storage account type.
  1873. *
  1874. * @param storageAccountType a storage account type
  1875. * @return the next stage of the update
  1876. */
  1877. Update withDataDiskDefaultStorageAccountType(StorageAccountTypes storageAccountType);
  1878. /**
  1879. * Specifies the caching type for the OS disk.
  1880. *
  1881. * @param cachingType a caching type.
  1882. * @return the next stage of the update
  1883. */
  1884. Update withOSDiskCaching(CachingTypes cachingType);
  1885. /**
  1886. * Specifies the size of the OS disk in GB.
  1887. *
  1888. * <p>Only unmanaged disks may be resized as part of a VM update. Managed disks must be resized separately,
  1889. * using managed disk API.
  1890. *
  1891. * @param size a disk size.
  1892. * @return the next stage of the update
  1893. * @deprecated use {@link #withOSDiskSizeInGB(int)} instead.
  1894. */
  1895. @Deprecated
  1896. Update withOSDiskSizeInGB(Integer size);
  1897. /**
  1898. * Specifies the size of the OS disk in GB.
  1899. *
  1900. * <p>Only unmanaged disks may be resized as part of a VM update. Managed disks must be resized separately,
  1901. * using managed disk API.
  1902. *
  1903. * @param size a disk size.
  1904. * @return the next stage of the update
  1905. */
  1906. Update withOSDiskSizeInGB(int size);
  1907. /**
  1908. * Specifies a new size for the virtual machine.
  1909. *
  1910. * @param sizeName the name of a size for the virtual machine as text
  1911. * @return the next stage of the update
  1912. */
  1913. Update withSize(String sizeName);
  1914. /**
  1915. * Specifies a new size for the virtual machine.
  1916. *
  1917. * @param size a size from the list of available sizes for the virtual machine
  1918. * @return the next stage of the definition
  1919. */
  1920. Update withSize(VirtualMachineSizeTypes size);
  1921. /**
  1922. * Specifies a new priority for the virtual machine.
  1923. *
  1924. * @param priority a priority from the list of available priority types
  1925. * @return the next stage of the update
  1926. */
  1927. Update withPriority(VirtualMachinePriorityTypes priority);
  1928. }
  1929. }