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

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

Introduction

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

Prototype

public ModifySnapshotAttributeRequest() 

Source Link

Document

Default constructor for ModifySnapshotAttributeRequest object.

Usage

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

License:Open Source License

@Override
public void shareSnapshot(String snapId, String acct, boolean share) throws InternalException, CloudException {
    tstEStrArg("snapshot-id", snapId);
    List<CreateVolumePermission> lst = new ArrayList<CreateVolumePermission>();
    CreateVolumePermission cp = new CreateVolumePermission();
    CreateVolumePermissionModifications perms = new CreateVolumePermissionModifications();
    lst.add(isEmpty(acct) ? cp.withGroup("all") : cp.withUserId(acct));
    if (share) {//from   w w  w. j av a2 s.c  om
        perms.setAdd(lst);
    } else {
        perms.setRemove(lst);
    }

    _svc.getCloud().getEC2().modifySnapshotAttribute(
            new ModifySnapshotAttributeRequest().withCreateVolumePermission(perms).withSnapshotId(snapId));
}