Example usage for com.amazonaws.services.ec2.model Image getPublic

List of usage examples for com.amazonaws.services.ec2.model Image getPublic

Introduction

In this page you can find the example usage for com.amazonaws.services.ec2.model Image getPublic.

Prototype


public Boolean getPublic() 

Source Link

Document

Indicates whether the image has public launch permissions.

Usage

From source file:com.axemblr.yab.cli.ListCommand.java

License:Apache License

@Override
public void run() {
    YaB yab = YaB.createWithEnvironmentCredentials(getRegion());

    try {/*from ww w. java  2s.c  o m*/
        System.out.println(";; using region " + getRegion());

        for (Image image : yab.describeBackedImages()) {
            System.out.printf("%s : %s : %s - %s (%s)%n", image.getImageId(),
                    (image.getPublic() ? "public" : "private"), image.getState(), image.getName(),
                    image.getDescription());
            System.out.printf(String.format("tags: %s%n", image.getTags()));
        }

    } finally {
        yab.close();
    }
}

From source file:com.zotoh.cloudapi.aws.AMImage.java

License:Open Source License

private MachineImage toMI(Image i) {
    MachineImage m = null;/*from w  w w .j a va2  s.  com*/
    if (i != null) {
        m = new MachineImage();
        m.setProviderRegionId(_svc.getCloud().getContext().getRegionId());
        m.setArchitecture(toArch(i.getArchitecture()));
        m.setCurrentState(toImageState(i.getState()));

        m.setProviderMachineImageId(i.getImageId());
        m.setName(i.getName());
        m.setProviderOwnerId(i.getOwnerId());
        m.setSoftware("");
        m.setType(toImageType(i.getRootDeviceType()));

        m.addTag("manifest-location", nsb(i.getImageLocation()));
        m.addTag("hypervisor", nsb(i.getHypervisor()));
        m.addTag("alias", nsb(i.getImageOwnerAlias()));
        m.addTag("kernel", nsb(i.getKernelId()));
        m.addTag("public", i.getPublic() ? "true" : "false");
        m.addTag("ramdisk", nsb(i.getRamdiskId()));
        m.addTag("root-dev-name", nsb(i.getRootDeviceName()));
        m.addTag("state-reason", nsb(i.getStateReason()));
        m.addTag("virtualization-type", nsb(i.getVirtualizationType()));

        m.setDescription(i.getDescription());
        m.setPlatform(nsb(i.getPlatform()).toLowerCase().indexOf("windows") >= 0 ? Platform.WINDOWS
                : Platform.UBUNTU);
    }

    return m;
}