private void addPermissions() { if (permissions != null && permissions.isEmpty() == false) { GetQueueAttributesResult result = sqsClient .getQueueAttributes(new GetQueueAttributesRequest(queueUrl, Arrays.asList("Policy"))); AwsUtil.addPermissions(result.getAttributes(), permissions, new AwsUtil.AddPermissionHandler() { @Override public void execute(Permission p) { sqsClient.addPermission(new AddPermissionRequest() .withQueueUrl(queueUrl) .withLabel(p.getLabel()) .withAWSAccountIds(p.getAwsAccountIds()) .withActions(p.getActions())); } }); } }
@Test public void testNonInjectableMocks_shouldReturnNormal() { assertNotNull(sqs.changeMessageVisibilityBatch(new ChangeMessageVisibilityBatchRequest())); assertNotNull(sqs.addPermission(new AddPermissionRequest().withActions("one").withAWSAccountIds("two","three").withLabel("four").withQueueUrl("five"))); assertNotNull(sqs.listDeadLetterSourceQueues(new ListDeadLetterSourceQueuesRequest().withQueueUrl("ten"))); assertNotNull(sqs.getQueueAttributes(new GetQueueAttributesRequest().withAttributeNames(ImmutableList.of("eleven")).withQueueUrl("twelve"))); assertNotNull(sqs.setQueueAttributes(new SetQueueAttributesRequest().withAttributes(ImmutableMap.of("thirteen","fourteen")).withQueueUrl("fifteen"))); }
@Override public void addPermission(List<String> actions, String label, List<String> aWSAccountIds, ResultCapture<Void> extractor) { AddPermissionRequest request = new AddPermissionRequest() .withActions(actions) .withLabel(label) .withAWSAccountIds(aWSAccountIds); addPermission(request, extractor); }
public Observable<AddPermissionResult> addPermissionAsync(AddPermissionRequest addPermissionRequest) { return Observable.from(sqsClient.addPermissionAsync(addPermissionRequest)); }
@Override public void addPermission(AddPermissionRequest request) { addPermission(request, null); }
@Override public void addPermission(AddPermissionRequest request, ResultCapture<Void> extractor) { resource.performAction("AddPermission", request, extractor); }
/** * <p> * Adds a permission to a queue for a specific <a * href="http://docs.aws.amazon.com/general/latest/gr/glos-chap.html#P"> * principal </a> . This allows for sharing access to the queue. * </p> * <p> * When you create a queue, you have full control access rights for the * queue. Only you (as owner of the queue) can grant or deny permissions to * the queue. For more information about these permissions, see <a href= * "http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/acp-overview.html" * > Shared Queues </a> in the <i>Amazon SQS Developer Guide</i> . * </p> * <p> * <b>NOTE:</b> AddPermission writes an Amazon SQS-generated policy. If you * want to write your own policy, use SetQueueAttributes to upload your * policy. For more information about writing your own policy, see Using The * Access Policy Language in the Amazon SQS Developer Guide. * </p> * <p> * <b>NOTE:</b>Some API actions take lists of parameters. These lists are * specified using the param.n notation. Values of n are integers starting * from 1. For example, a parameter list with two elements looks like this: * </p> * <p> * <code>&Attribute.1=this</code> * </p> * <p> * <code>&Attribute.2=that</code> * </p> * * @param addPermissionRequest * Container for the necessary parameters to execute the * AddPermission service method on AmazonSQS. * * * @throws OverLimitException * * @throws AmazonClientException * If any internal errors are encountered inside the client * while attempting to make the request or handle the response. * For example if a network connection is not available. * @throws AmazonServiceException * If an error response is returned by AmazonSQS indicating * either a problem with the data in the request, or a server * side issue. */ public AddPermissionResult addPermission(AddPermissionRequest addPermissionRequest) throws AmazonServiceException, AmazonClientException { return amazonSqsToBeExtended.addPermission(addPermissionRequest); }
/** * Performs the <code>AddPermission</code> action. * * <p> * The following request parameters will be populated from the data of this * <code>Queue</code> resource, and any conflicting parameter value set in * the request will be overridden: * <ul> * <li> * <b><code>QueueUrl</code></b> * - mapped from the <code>Url</code> identifier. * </li> * </ul> * * <p> * * @see AddPermissionRequest */ void addPermission(AddPermissionRequest request);
/** * Performs the <code>AddPermission</code> action and use a ResultCapture to * retrieve the low-level client response. * * <p> * The following request parameters will be populated from the data of this * <code>Queue</code> resource, and any conflicting parameter value set in * the request will be overridden: * <ul> * <li> * <b><code>QueueUrl</code></b> * - mapped from the <code>Url</code> identifier. * </li> * </ul> * * <p> * * @see AddPermissionRequest */ void addPermission(AddPermissionRequest request, ResultCapture<Void> extractor);