Search in sources :

Example 1 with VirtualMachineExtensionImageType

use of com.microsoft.azure.management.compute.VirtualMachineExtensionImageType in project azure-sdk-for-java by Azure.

the class ListVirtualMachineExtensionImages method runSample.

/**
     * Main function which runs the actual sample.
     * @param azure instance of the azure client
     * @return true if sample runs successfully
     */
public static boolean runSample(Azure azure) {
    final Region region = Region.US_WEST_CENTRAL;
    //=================================================================
    // List all virtual machine extension image publishers and
    // list all virtual machine extension images
    // published by Microsoft.OSTCExtensions and Microsoft.Azure.Extensions
    // by browsing through extension image publishers, types, and versions
    List<VirtualMachinePublisher> publishers = azure.virtualMachineImages().publishers().listByRegion(region);
    VirtualMachinePublisher chosenPublisher;
    System.out.println("US East data center: printing list of \n" + "a) Publishers and\n" + "b) virtual machine extension images published by Microsoft.OSTCExtensions and Microsoft.Azure.Extensions");
    System.out.println("=======================================================");
    System.out.println("\n");
    for (VirtualMachinePublisher publisher : publishers) {
        System.out.println("Publisher - " + publisher.name());
        if (publisher.name().equalsIgnoreCase("Microsoft.OSTCExtensions") | publisher.name().equalsIgnoreCase("Microsoft.Azure.Extensions")) {
            chosenPublisher = publisher;
            System.out.print("\n\n");
            System.out.println("=======================================================");
            System.out.println("Located " + chosenPublisher.name());
            System.out.println("=======================================================");
            System.out.println("Printing entries as publisher/type/version");
            for (VirtualMachineExtensionImageType imageType : chosenPublisher.extensionTypes().list()) {
                for (VirtualMachineExtensionImageVersion version : imageType.versions().list()) {
                    VirtualMachineExtensionImage image = version.getImage();
                    System.out.println("Image - " + chosenPublisher.name() + "/" + image.typeName() + "/" + image.versionName());
                }
            }
            System.out.print("\n\n");
        }
    }
    return true;
}
Also used : VirtualMachineExtensionImage(com.microsoft.azure.management.compute.VirtualMachineExtensionImage) Region(com.microsoft.azure.management.resources.fluentcore.arm.Region) VirtualMachinePublisher(com.microsoft.azure.management.compute.VirtualMachinePublisher) VirtualMachineExtensionImageType(com.microsoft.azure.management.compute.VirtualMachineExtensionImageType) VirtualMachineExtensionImageVersion(com.microsoft.azure.management.compute.VirtualMachineExtensionImageVersion)

Aggregations

VirtualMachineExtensionImage (com.microsoft.azure.management.compute.VirtualMachineExtensionImage)1 VirtualMachineExtensionImageType (com.microsoft.azure.management.compute.VirtualMachineExtensionImageType)1 VirtualMachineExtensionImageVersion (com.microsoft.azure.management.compute.VirtualMachineExtensionImageVersion)1 VirtualMachinePublisher (com.microsoft.azure.management.compute.VirtualMachinePublisher)1 Region (com.microsoft.azure.management.resources.fluentcore.arm.Region)1