Class ResourcePolicy
The policy for a data stream or registered consumer.
Inherited Members
Namespace: Amazon.CDK.AWS.Kinesis
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ResourcePolicy : Resource, IResource, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class ResourcePolicy Inherits Resource Implements IResource, IConstruct, IDependable, IEnvironmentAware
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 stream = new Stream(this, "MyStream");
var streamConsumer = new StreamConsumer(this, "MyStreamConsumer", new StreamConsumerProps {
StreamConsumerName = "MyStreamConsumer",
Stream = stream
});
// create a custom policy document
var policyDocument = new PolicyDocument(new PolicyDocumentProps {
AssignSids = true,
Statements = new [] {
new PolicyStatement(new PolicyStatementProps {
Actions = new [] { "kinesis:GetRecords" },
Resources = new [] { stream.StreamArn },
Principals = new [] { new AnyPrincipal() }
}) }
});
// create a stream resource policy manually
// create a stream resource policy manually
new ResourcePolicy(this, "ResourcePolicy", new ResourcePolicyProps {
Stream = stream,
PolicyDocument = policyDocument
});
// create a stream consumer resource policy manually
// create a stream consumer resource policy manually
new ResourcePolicy(this, "ResourcePolicy", new ResourcePolicyProps {
StreamConsumer = streamConsumer,
PolicyDocument = policyDocument
});
Synopsis
Constructors
| ResourcePolicy(Construct, string, IResourcePolicyProps) | The policy for a data stream or registered consumer. |
Properties
| Document | The IAM policy document for this policy. |
| PROPERTY_INJECTION_ID | Uniquely identifies this class. |
Constructors
ResourcePolicy(Construct, string, IResourcePolicyProps)
The policy for a data stream or registered consumer.
public ResourcePolicy(Construct scope, string id, IResourcePolicyProps props)
Parameters
- scope Construct
- id string
- props IResourcePolicyProps
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 stream = new Stream(this, "MyStream");
var streamConsumer = new StreamConsumer(this, "MyStreamConsumer", new StreamConsumerProps {
StreamConsumerName = "MyStreamConsumer",
Stream = stream
});
// create a custom policy document
var policyDocument = new PolicyDocument(new PolicyDocumentProps {
AssignSids = true,
Statements = new [] {
new PolicyStatement(new PolicyStatementProps {
Actions = new [] { "kinesis:GetRecords" },
Resources = new [] { stream.StreamArn },
Principals = new [] { new AnyPrincipal() }
}) }
});
// create a stream resource policy manually
// create a stream resource policy manually
new ResourcePolicy(this, "ResourcePolicy", new ResourcePolicyProps {
Stream = stream,
PolicyDocument = policyDocument
});
// create a stream consumer resource policy manually
// create a stream consumer resource policy manually
new ResourcePolicy(this, "ResourcePolicy", new ResourcePolicyProps {
StreamConsumer = streamConsumer,
PolicyDocument = policyDocument
});
Properties
Document
The IAM policy document for this policy.
public virtual PolicyDocument Document { get; }
Property Value
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
PROPERTY_INJECTION_ID
Uniquely identifies this class.
public static string PROPERTY_INJECTION_ID { get; }
Property Value
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