VirtualMachineImageImpl(Region location, String publisher, String offer, String sku, String version) { super(null); this.location = location; this.imageReference = new ImageReference(); this.imageReference.withPublisher(publisher); this.imageReference.withOffer(offer); this.imageReference.withSku(sku); this.imageReference.withVersion(version); }
@Override public VirtualMachineImpl withLinuxCustomImage(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().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
@Override public boolean isOSBasedOnCustomImage() { ImageReference imageReference = this.inner().storageProfile().imageReference(); if (imageReference != null && imageReference.id() != null) { return true; } return false; }
@Override public String publisherName() { return imageReference.publisher(); }
@Override public String offer() { return imageReference.offer(); }
@Override public String sku() { return imageReference.sku(); }
@Override public String version() { return imageReference.version(); }
@Override public VirtualMachineImpl withLinuxCustomImage(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().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
@Override public boolean isOSBasedOnCustomImage() { ImageReference imageReference = this.inner().storageProfile().imageReference(); if (imageReference != null && imageReference.id() != null) { return true; } return false; }
@Override public String publisherName() { return imageReference.publisher(); }
@Override public String offer() { return imageReference.offer(); }
@Override public String sku() { return imageReference.sku(); }
@Override public String version() { return imageReference.version(); }
VirtualMachineImageImpl(Region location, String publisher, String offer, String sku, String version, VirtualMachineImageInner innerModel) { super(innerModel); this.location = location; this.imageReference = new ImageReference(); this.imageReference.withPublisher(publisher); this.imageReference.withOffer(offer); this.imageReference.withSku(sku); this.imageReference.withVersion(version); }
@Override public boolean isOSBasedOnPlatformImage() { ImageReference imageReference = this.inner().storageProfile().imageReference(); if (imageReference != null && imageReference.publisher() != null && imageReference.sku() != null && imageReference.offer() != null && imageReference.version() != null) { return true; } return false; }
@Override public VirtualMachineScaleSetImpl withLinuxCustomImage(String customImageId) { ImageReference imageReferenceInner = new ImageReference(); imageReferenceInner.withId(customImageId); this.inner() .virtualMachineProfile() .storageProfile().osDisk().withCreateOption(DiskCreateOptionTypes.FROM_IMAGE); this.inner() .virtualMachineProfile() .storageProfile().withImageReference(imageReferenceInner); this.inner() .virtualMachineProfile() .osProfile().withLinuxConfiguration(new LinuxConfiguration()); this.isMarketplaceLinuxImage = true; return this; }
/** * Checks whether the OS disk is based on a CustomImage. * <p> * A custom image is represented by {@link com.microsoft.azure.management.compute.VirtualMachineCustomImage}. * * @param storageProfile the storage profile * @return true if the OS disk is configured to be based on custom image. */ private boolean isOsDiskFromCustomImage(StorageProfile storageProfile) { ImageReference imageReference = storageProfile.imageReference(); return isOSDiskFromImage(storageProfile.osDisk()) && imageReference != null && imageReference.id() != null; }
public ImageReference imageReference() { return new ImageReference() .withPublisher(publisher) .withOffer(offer) .withSku(sku) .withVersion(version); } }
@Override public boolean isOSBasedOnPlatformImage() { ImageReference imageReference = this.inner().storageProfile().imageReference(); if (imageReference != null && imageReference.publisher() != null && imageReference.sku() != null && imageReference.offer() != null && imageReference.version() != null) { return true; } return false; }