Class TopicPolicy
The policy for an SNS Topic.
Inherited Members
Namespace: Amazon.CDK.AWS.SNS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class TopicPolicy : Resource, IResource
Syntax (vb)
Public Class TopicPolicy
Inherits Resource
Implements IResource
Remarks
Policies define the operations that are allowed on this resource.
You almost never need to define this construct directly.
All AWS resources that support resource policies have a method called
addToResourcePolicy()
, which will automatically create a new resource
policy if one doesn't exist yet, otherwise it will add to the existing
policy.
Prefer to use addToResourcePolicy()
instead.
ExampleMetadata: infused
Examples
var topic = new Topic(this, "Topic");
var policyDocument = new PolicyDocument(new PolicyDocumentProps {
AssignSids = true,
Statements = new [] {
new PolicyStatement(new PolicyStatementProps {
Actions = new [] { "sns:Subscribe" },
Principals = new [] { new AnyPrincipal() },
Resources = new [] { topic.TopicArn }
}) }
});
var topicPolicy = new TopicPolicy(this, "Policy", new TopicPolicyProps {
Topics = new [] { topic },
PolicyDocument = policyDocument
});
Synopsis
Constructors
TopicPolicy(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
TopicPolicy(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
TopicPolicy(Construct, String, ITopicPolicyProps) |
Properties
Document | The IAM policy document for this policy. |
Methods
CreateSSLPolicyDocument(String) | Adds a statement to enforce encryption of data in transit when publishing to the topic. |
Constructors
TopicPolicy(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected TopicPolicy(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
TopicPolicy(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected TopicPolicy(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
TopicPolicy(Construct, String, ITopicPolicyProps)
public TopicPolicy(Construct scope, string id, ITopicPolicyProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props ITopicPolicyProps
Properties
Document
The IAM policy document for this policy.
public virtual PolicyDocument Document { get; }
Property Value
Methods
CreateSSLPolicyDocument(String)
Adds a statement to enforce encryption of data in transit when publishing to the topic.
protected virtual PolicyStatement CreateSSLPolicyDocument(string topicArn)
Parameters
- topicArn System.String
Returns