The AddPermission action adds a permission to a queue for a specific principal. This allows for sharing access to the queue.
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 Shared Queues in the Amazon SQS Developer Guide.
AddPermission
writes an 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
Appendix: The Access Policy Language in the Amazon SQS Developer Guide.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The URL of the SQS queue to take action on. |
|
|
Required |
The unique identification of the permission you’re setting (e.g., |
|
|
Required |
The AWS account number of the principal who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS. Pass a string for a single value, or an indexed array for multiple values. |
|
|
Required |
The action the client wants to allow for the specified principal. Pass a string for a single value, or an indexed array for multiple values. |
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Give account ID 133904017518
certain permissions on the queue.
// Add permissions to a queue $sqs = new AmazonSQS(); $response = $sqs->add_permission('example-queue', 'SDKTesting', '133904017518', array( 'GetQueueAttributes', 'ChangeMessageVisibility' )); // Success? var_dump($response->isOK());Result:
bool(true)
Related Methods
Source
Method defined in services/sqs.class.php | Toggle source view (18 lines) | View on GitHub