Example usage for com.amazonaws.services.ec2.model ImageAttribute getLaunchPermissions

List of usage examples for com.amazonaws.services.ec2.model ImageAttribute getLaunchPermissions

Introduction

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

Prototype


public java.util.List<LaunchPermission> getLaunchPermissions() 

Source Link

Document

The launch permissions.

Usage

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

License:Open Source License

@Override
public Iterable<String> listShares(String ami) throws CloudException, InternalException {
    tstEStrArg("image-id", ami);
    DescribeImageAttributeResult res = _svc.getCloud().getEC2()
            .describeImageAttribute(new DescribeImageAttributeRequest().withImageId(ami));
    ImageAttribute attr = res == null ? null : res.getImageAttribute();
    List<LaunchPermission> lst = attr == null ? null : attr.getLaunchPermissions();
    List<String> rc = LT();
    if (lst != null)
        for (int i = 0; i < lst.size(); ++i) {
            rc.add(lst.get(i).getUserId());
        }/*w  w w  .  j  ava  2 s  .co  m*/
    return rc;
}