Show / Hide Table of Contents

Class StreamConsumer

A Kinesis Stream Consumer.

Inheritance
object
Resource
StreamConsumer
Implements
IStreamConsumer
IResource
IConstruct
IDependable
IEnvironmentAware
Inherited Members
Resource.IsOwnedResource(IConstruct)
Resource.IsResource(IConstruct)
Resource.ApplyRemovalPolicy(RemovalPolicy)
Resource.GeneratePhysicalName()
Resource.GetResourceArnAttribute(string, IArnComponents)
Resource.GetResourceNameAttribute(string)
Resource.Env
Resource.PhysicalName
Resource.Stack
Namespace: Amazon.CDK.AWS.Kinesis
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class StreamConsumer : Resource, IStreamConsumer, IResource, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class StreamConsumer Inherits Resource Implements IStreamConsumer, IResource, IConstruct, IDependable, IEnvironmentAware
Remarks

ExampleMetadata: infused

Examples
var lambdaRole = new Role(this, "Role", new RoleProps {
                AssumedBy = new ServicePrincipal("lambda.amazonaws.com"),
                Description = "Example role..."
            });

            var stream = new Stream(this, "MyEncryptedStream", new StreamProps {
                Encryption = StreamEncryption.KMS
            });
            var streamConsumer = new StreamConsumer(this, "MyStreamConsumer", new StreamConsumerProps {
                StreamConsumerName = "MyStreamConsumer",
                Stream = stream
            });

            // give lambda permissions to read stream via the stream consumer
            streamConsumer.GrantRead(lambdaRole);

Synopsis

Constructors

StreamConsumer(Construct, string, IStreamConsumerProps)

A Kinesis Stream Consumer.

Properties

AutoCreatePolicy

Indicates if a resource policy should automatically be created upon the first call to addToResourcePolicy.

PROPERTY_INJECTION_ID

Uniquely identifies this class.

Stream

The Kinesis data stream this consumer is associated with.

StreamConsumerArn

The Amazon Resource Name (ARN) of the stream consumer.

StreamConsumerName

The name of the stream consumer.

Methods

AddToResourcePolicy(PolicyStatement)

Adds a statement to the IAM resource policy associated with this stream consumer.

FromStreamConsumerArn(Construct, string, string)

Imports an existing Kinesis Stream Consumer by its arn.

FromStreamConsumerAttributes(Construct, string, IStreamConsumerAttributes)

Imports an existing Kinesis Stream Consumer by its attributes.

Grant(IGrantable, params string[])

Grant the indicated permissions on this stream consumer to the given IAM principal (Role/Group/User).

GrantRead(IGrantable)

Grant read permissions for this stream consumer and its associated stream to an IAM principal (Role/Group/User).

Constructors

StreamConsumer(Construct, string, IStreamConsumerProps)

A Kinesis Stream Consumer.

public StreamConsumer(Construct scope, string id, IStreamConsumerProps props)
Parameters
scope Construct
id string
props IStreamConsumerProps
Remarks

ExampleMetadata: infused

Examples
var lambdaRole = new Role(this, "Role", new RoleProps {
                AssumedBy = new ServicePrincipal("lambda.amazonaws.com"),
                Description = "Example role..."
            });

            var stream = new Stream(this, "MyEncryptedStream", new StreamProps {
                Encryption = StreamEncryption.KMS
            });
            var streamConsumer = new StreamConsumer(this, "MyStreamConsumer", new StreamConsumerProps {
                StreamConsumerName = "MyStreamConsumer",
                Stream = stream
            });

            // give lambda permissions to read stream via the stream consumer
            streamConsumer.GrantRead(lambdaRole);

Properties

AutoCreatePolicy

Indicates if a resource policy should automatically be created upon the first call to addToResourcePolicy.

protected virtual bool AutoCreatePolicy { get; }
Property Value

bool

Remarks

Set by subclasses.

PROPERTY_INJECTION_ID

Uniquely identifies this class.

public static string PROPERTY_INJECTION_ID { get; }
Property Value

string

Remarks

ExampleMetadata: infused

Stream

The Kinesis data stream this consumer is associated with.

public virtual IStream Stream { get; }
Property Value

IStream

Remarks

ExampleMetadata: infused

StreamConsumerArn

The Amazon Resource Name (ARN) of the stream consumer.

public virtual string StreamConsumerArn { get; }
Property Value

string

Remarks

ExampleMetadata: infused

StreamConsumerName

The name of the stream consumer.

public virtual string StreamConsumerName { get; }
Property Value

string

Remarks

ExampleMetadata: infused

Methods

AddToResourcePolicy(PolicyStatement)

Adds a statement to the IAM resource policy associated with this stream consumer.

public virtual IAddToResourcePolicyResult AddToResourcePolicy(PolicyStatement statement)
Parameters
statement PolicyStatement
Returns

IAddToResourcePolicyResult

Remarks

If this stream consumer was created in this stack (new StreamConsumer), a resource policy will be automatically created upon the first call to addToResourcePolicy. If the stream is imported (StreamConsumer.from), then this is a no-op.

FromStreamConsumerArn(Construct, string, string)

Imports an existing Kinesis Stream Consumer by its arn.

public static IStreamConsumer FromStreamConsumerArn(Construct scope, string id, string streamConsumerArn)
Parameters
scope Construct

the Construct scope.

id string

the ID of the construct.

streamConsumerArn string

the arn of the existing stream consumer.

Returns

IStreamConsumer

Remarks

ExampleMetadata: infused

FromStreamConsumerAttributes(Construct, string, IStreamConsumerAttributes)

Imports an existing Kinesis Stream Consumer by its attributes.

public static IStreamConsumer FromStreamConsumerAttributes(Construct scope, string id, IStreamConsumerAttributes attrs)
Parameters
scope Construct

the Construct scope.

id string

the ID of the construct.

attrs IStreamConsumerAttributes

the attributes of the existing stream consumer.

Returns

IStreamConsumer

Remarks

ExampleMetadata: infused

Grant(IGrantable, params string[])

Grant the indicated permissions on this stream consumer to the given IAM principal (Role/Group/User).

public virtual Grant Grant(IGrantable grantee, params string[] actions)
Parameters
grantee IGrantable
actions string[]
Returns

Grant

Remarks

ExampleMetadata: infused

GrantRead(IGrantable)

Grant read permissions for this stream consumer and its associated stream to an IAM principal (Role/Group/User).

public virtual Grant GrantRead(IGrantable grantee)
Parameters
grantee IGrantable
Returns

Grant

Remarks

ExampleMetadata: infused

Implements

IStreamConsumer
IResource
Constructs.IConstruct
Constructs.IDependable
IEnvironmentAware
Back to top Generated by DocFX