com.amazonaws.services.sqs.model.AddPermissionRequest Java Examples

The following examples show how to use com.amazonaws.services.sqs.model.AddPermissionRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SqsExecutor.java    From spring-integration-aws with MIT License 6 votes vote down vote up
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()));
					}
				});
	}
}
 
Example #2
Source File: QueueImpl.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@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);
}
 
Example #3
Source File: AbstractAmazonSQSClientWrapper.java    From amazon-sqs-java-temporary-queues-client with Apache License 2.0 4 votes vote down vote up
@Override
public AddPermissionResult addPermission(AddPermissionRequest request) {
    request.getRequestClientOptions().appendUserAgent(userAgent);
    return amazonSqsToBeExtended.addPermission(request);
}
 
Example #4
Source File: AbstractAmazonSQSClientWrapperTest.java    From amazon-sqs-java-temporary-queues-client with Apache License 2.0 4 votes vote down vote up
@Test
public void addPermission() {
    assertWrappedMethod(AmazonSQS::addPermission, new AddPermissionRequest());
}
 
Example #5
Source File: QueueImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public void addPermission(AddPermissionRequest request) {
    addPermission(request, null);
}
 
Example #6
Source File: QueueImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public void addPermission(AddPermissionRequest request, ResultCapture<Void>
        extractor) {

    resource.performAction("AddPermission", request, extractor);
}
 
Example #7
Source File: AmazonSQSExtendedClientBase.java    From amazon-sqs-java-extended-client-lib with Apache License 2.0 2 votes vote down vote up
/**
 * <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);
}
 
Example #8
Source File: Queue.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * 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);
 
Example #9
Source File: Queue.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * 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);