Example usage for com.amazonaws.services.ec2.model DescribeSnapshotAttributeRequest DescribeSnapshotAttributeRequest

List of usage examples for com.amazonaws.services.ec2.model DescribeSnapshotAttributeRequest DescribeSnapshotAttributeRequest

Introduction

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

Prototype

public DescribeSnapshotAttributeRequest() 

Source Link

Document

Default constructor for DescribeSnapshotAttributeRequest object.

Usage

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

License:Open Source License

@Override
public boolean isPublic(String snap) throws InternalException, CloudException {
    DescribeSnapshotAttributeResult res = _svc.getCloud().getEC2()
            .describeSnapshotAttribute(new DescribeSnapshotAttributeRequest()
                    .withAttribute("createVolumePermission").withSnapshotId(snap));
    List<CreateVolumePermission> lst = res == null ? null : res.getCreateVolumePermissions();
    if (lst != null)
        for (int i = 0; i < lst.size(); ++i) {
            if ("all".equals(lst.get(i).getGroup())) {
                return true;
            }//  ww w . j  a v a  2s .com
        }
    return false;
}

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

License:Open Source License

@Override
public Iterable<String> listShares(String snap) throws InternalException, CloudException {
    DescribeSnapshotAttributeResult res = _svc.getCloud().getEC2()
            .describeSnapshotAttribute(new DescribeSnapshotAttributeRequest()
                    .withAttribute("createVolumePermission").withSnapshotId(snap));
    List<CreateVolumePermission> lst = res == null ? null : res.getCreateVolumePermissions();
    List<String> rc = LT();
    if (lst != null)
        for (int i = 0; i < lst.size(); ++i) {
            rc.add(lst.get(i).getUserId());
        }/* ww  w . ja  va  2 s . c  o  m*/
    return rc;
}