Class QueuePolicy
Allows you to set a policy of an SQS Queue while referencing ARN of the queue within the policy.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var queue = new Aws.Sqs.Queue("queue", new Aws.Sqs.QueueArgs
{
});
var test = new Aws.Sqs.QueuePolicy("test", new Aws.Sqs.QueuePolicyArgs
{
Policy = queue.Arn.Apply(arn => @$"{{
""Version"": ""2012-10-17"",
""Id"": ""sqspolicy"",
""Statement"": [
{{
""Sid"": ""First"",
""Effect"": ""Allow"",
""Principal"": ""*"",
""Action"": ""sqs:SendMessage"",
""Resource"": ""{arn}"",
""Condition"": {{
""ArnEquals"": {{
""aws:SourceArn"": ""{aws_sns_topic.Example.Arn}""
}}
}}
}}
]
}}
"),
QueueUrl = queue.Id,
});
}
}
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.Sqs
Assembly: Pulumi.Aws.dll
Syntax
public class QueuePolicy : CustomResource
Constructors
View SourceQueuePolicy(String, QueuePolicyArgs, CustomResourceOptions)
Create a QueuePolicy resource with the given unique name, arguments, and options.
Declaration
public QueuePolicy(string name, QueuePolicyArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| QueuePolicyArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourcePolicy
The JSON policy for the SQS queue.
Declaration
public Output<string> Policy { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
QueueUrl
The URL of the SQS Queue to which to attach the policy
Declaration
public Output<string> QueueUrl { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, QueuePolicyState, CustomResourceOptions)
Get an existing QueuePolicy resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static QueuePolicy Get(string name, Input<string> id, QueuePolicyState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| QueuePolicyState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| QueuePolicy |