Example usage for com.amazonaws.services.ec2.model DescribeImageAttributeResult getImageAttribute

List of usage examples for com.amazonaws.services.ec2.model DescribeImageAttributeResult getImageAttribute

Introduction

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

Prototype


public ImageAttribute getImageAttribute() 

Source Link

Document

Describes an image attribute.

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());
        }/*from  www.j  a v a  2  s.  c om*/
    return rc;
}