aws_ddk_core.pipelines.DataStage

class aws_ddk_core.pipelines.DataStage(*args: Any, **kwargs)

Class that represents a stage within a data pipeline.

To create a DataStage, inherit from this class, add infrastructure required by the stage, and implement get_event_pattern and get_targets methods. For example:

class MyStage(DataStage):
    def __init__(
        self,
        scope: Construct,
        id: str,
        environment_id: str,
    ) -> None:
        # Define stage infrastructure, for example a queue
        self._queue = SQSFactory.queue(
            self,
            id,
            environment_id,
        )

    @property
    def queue(self) -> Queue:
        '''
        Return: Queue
            The SQS queue
        '''
        return self._queue

    def get_event_pattern(self) -> Optional[EventPattern]:
        return EventPattern(
            detail_type=["my-detail-type"],
        )

    def get_targets(self) -> Optional[List[IRuleTarget]]:
        return [SqsQueue(self._queue)]
__init__(scope: constructs.Construct, id: str, name: Optional[str] = None, description: Optional[str] = None) None

Create a stage.

Parameters
  • scope (Construct) – Scope within which this construct is defined

  • id (str) – Identifier of the stage

  • name (Optional[str]) – Name of the stage

  • description (Optional[str]) – Description of the stage

Methods

__init__(scope, id[, name, description])

Create a stage.

get_event_pattern()

Get output event pattern of the stage.

get_targets()

Get input targets of the stage.

is_construct(x)

(deprecated) Checks if x is a construct.

to_string()

Returns a string representation of this construct.

Attributes

node

The tree node.

abstract get_event_pattern() Optional[aws_cdk.aws_events.EventPattern]

Get output event pattern of the stage.

Event pattern describes the structure of output event(s) produced by this stage. Event Rules use event patterns to select events and route them to targets.

Returns

event_pattern – Event pattern

Return type

Optional[EventPattern]

abstract get_targets() Optional[List[aws_cdk.aws_events.IRuleTarget]]

Get input targets of the stage.

Targets are used by Event Rules to describe what should be invoked when a rule matches an event.

Returns

targets – List of targets

Return type

Optional[List[IRuleTarget]]