@Override public VirtualMachineImpl withLicenseType(String licenseType) { inner().withLicenseType(licenseType); return this; }
@Override public Set<String> userAssignedManagedServiceIdentityIds() { if (this.inner().identity() != null && this.inner().identity().userAssignedIdentities() != null) { return Collections.unmodifiableSet(new HashSet<String>(this.inner().identity().userAssignedIdentities().keySet())); } return Collections.unmodifiableSet(new HashSet<String>()); }
void handleExternalIdentities() { if (!this.userAssignedIdentities.isEmpty()) { this.virtualMachine.inner().identity().withUserAssignedIdentities(this.userAssignedIdentities); } }
@Override public VirtualMachineImpl withAdminUsername(String adminUserName) { this.inner().osProfile().withAdminUsername(adminUserName); return this; }
@Override public VirtualMachineImpl withCustomData(String base64EncodedCustomData) { this.inner().osProfile().withCustomData(base64EncodedCustomData); return this; }
@Override public List<String> networkInterfaceIds() { List<String> nicIds = new ArrayList<>(); for (NetworkInterfaceReference nicRef : inner().networkProfile().networkInterfaces()) { nicIds.add(nicRef.id()); } return nicIds; }
@Override public VirtualMachineImpl withSpecificLinuxImageVersion(ImageReference imageReference) { this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().withImageReference(imageReference); this.inner().osProfile().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
@Override public VirtualMachineImpl withoutVMAgent() { this.inner().osProfile().windowsConfiguration().withProvisionVMAgent(false); return this; }
@Override public VirtualMachineImpl withoutAutoUpdate() { this.inner().osProfile().windowsConfiguration().withEnableAutomaticUpdates(false); return this; }
@Override public VirtualMachineImpl withTimeZone(String timeZone) { this.inner().osProfile().windowsConfiguration().withTimeZone(timeZone); return this; }
@Override public VirtualMachineImpl withSize(String sizeName) { this.inner().hardwareProfile().withVmSize(VirtualMachineSizeTypes.fromString(sizeName)); return this; }
@Override public VirtualMachineImpl withOSDiskEncryptionSettings(DiskEncryptionSettings settings) { this.inner().storageProfile().osDisk().withEncryptionSettings(settings); return this; }
@Override public VirtualMachineImpl withWindowsCustomImage(String customImageId) { ImageReference imageReferenceInner = new ImageReference(); imageReferenceInner.withId(customImageId); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner().storageProfile().withImageReference(imageReferenceInner); this.inner().osProfile().withWindowsConfiguration(new WindowsConfiguration()); // sets defaults for "Stored(User)Image", "VM(Platform | Custom | Gallery)Image" this.inner().osProfile().windowsConfiguration().withProvisionVMAgent(true); this.inner().osProfile().windowsConfiguration().withEnableAutomaticUpdates(true); return this; }
@Override public VirtualMachineImpl withSpecializedOSUnmanagedDisk(String osDiskUrl, OperatingSystemTypes osType) { VirtualHardDisk osVhd = new VirtualHardDisk(); osVhd.withUri(osDiskUrl); this.inner().storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.ATTACH); this.inner().storageProfile().osDisk().withVhd(osVhd); this.inner().storageProfile().osDisk().withOsType(osType); this.inner().storageProfile().osDisk().withManagedDisk(null); return this; }
@Override public String osUnmanagedDiskVhdUri() { if (isManagedDiskEnabled()) { return null; } return inner().storageProfile().osDisk().vhd().uri(); }