Example usage for com.amazonaws.auth.policy Statement getPrincipals

List of usage examples for com.amazonaws.auth.policy Statement getPrincipals

Introduction

In this page you can find the example usage for com.amazonaws.auth.policy Statement getPrincipals.

Prototype

public List<Principal> getPrincipals() 

Source Link

Document

Returns the principals associated with this policy statement, indicating which AWS accounts are affected by this policy statement.

Usage

From source file:com.netflix.conductor.contribs.queue.sqs.SQSObservableQueue.java

License:Apache License

private String getPolicy(List<String> accountIds) {
    Policy policy = new Policy("ReloadedWorkerAccessPolicy");
    Statement stmt = new Statement(Effect.Allow);
    Action action = SQSActions.SendMessage;
    stmt.getActions().add(action);// ww w .jav a  2  s .  c o m
    stmt.setResources(new LinkedList<>());
    for (String accountId : accountIds) {
        Principal principal = new Principal(accountId);
        stmt.getPrincipals().add(principal);
    }
    stmt.getResources().add(new Resource(getQueueARN()));
    policy.getStatements().add(stmt);
    return policy.toJson();
}