private static void addMarketplacePlanToMetadataIfPresent(ImageBuilder builder, VMImage image) { if (image.versionProperties() != null && image.versionProperties().plan() != null) { // Store the plan information in the metadata so the adapter can // properly configure it when deploying images from the marketplace Plan plan = image.versionProperties().plan(); builder.userMetadata(ImmutableMap.of("publisher", plan.publisher(), "name", plan.name(), "product", plan.product())); } }
private static void addMarketplacePlanToMetadataIfPresent(ImageBuilder builder, VMImage image) { if (image.versionProperties() != null && image.versionProperties().plan() != null) { // Store the plan information in the metadata so the adapter can // properly configure it when deploying images from the marketplace Plan plan = image.versionProperties().plan(); builder.userMetadata(ImmutableMap.of("publisher", plan.publisher(), "name", plan.name(), "product", plan.product())); } }
@Override public OperatingSystem.Builder apply(final VMImage image) { final String label = checkNotNull(image.offer(), "offer").toLowerCase(); OsFamily family = findInStandardFamilies(label).or(findInOtherOSMap(label)).or(OsFamily.UNRECOGNIZED); // Fallback to generic operating system type if (OsFamily.UNRECOGNIZED == family && image.versionProperties() != null && image.versionProperties().osDiskImage() != null && image.versionProperties().osDiskImage().operatingSystem() != null) { family = OsFamily.fromValue(image.versionProperties().osDiskImage().operatingSystem().toUpperCase()); } // only 64bit OS images are supported by Azure ARM return OperatingSystem.builder().family(family).is64Bit(true) .description(image.custom() ? AzureComputeImageExtension.CUSTOM_IMAGE_OFFER : image.sku()) .version(image.custom() ? "latest" : image.sku()); } };
@Override public OperatingSystem.Builder apply(final VMImage image) { final String label = checkNotNull(image.offer(), "offer").toLowerCase(); OsFamily family = findInStandardFamilies(label).or(findInOtherOSMap(label)).or(OsFamily.UNRECOGNIZED); // Fallback to generic operating system type if (OsFamily.UNRECOGNIZED == family && image.versionProperties() != null && image.versionProperties().osDiskImage() != null && image.versionProperties().osDiskImage().operatingSystem() != null) { family = OsFamily.fromValue(image.versionProperties().osDiskImage().operatingSystem().toUpperCase()); } // only 64bit OS images are supported by Azure ARM return OperatingSystem.builder().family(family).is64Bit(true) .description(image.custom() ? AzureComputeImageExtension.CUSTOM_IMAGE_OFFER : image.sku()) .version(image.custom() ? "latest" : image.sku()); } };