Example usage for com.amazonaws.services.ec2.model DescribeSnapshotAttributeResult getCreateVolumePermissions

List of usage examples for com.amazonaws.services.ec2.model DescribeSnapshotAttributeResult getCreateVolumePermissions

Introduction

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

Prototype


public java.util.List<CreateVolumePermission> getCreateVolumePermissions() 

Source Link

Document

The users and groups that have the permissions for creating volumes from the snapshot.

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  .jav a  2  s  . c o  m
        }
    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());
        }/*  w  w  w .  j a va  2s.  co  m*/
    return rc;
}