PageRenderTime 50ms CodeModel.GetById 16ms RepoModel.GetById 1ms 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

Large files files are truncated, but you can click here to view the full file

  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 st…

Large files files are truncated, but you can click here to view the full file