runway.cfngin.actions.base module

CFNgin base action.

class runway.cfngin.actions.base.BaseAction[source]

Bases: object

Actions perform the actual work of each Command.

Each action is responsible for building the runway.cfngin.plan.Plan that will be executed.

DESCRIPTION

Description used when creating a plan for an action.

Type:

ClassVar[str]

NAME

Name of the action.

Type:

ClassVar[str | None]

bucket_name

S3 bucket used by the action.

Type:

str | None

bucket_region

AWS region where S3 bucket is located.

Type:

str | None

cancel

Cancel handler.

Type:

threading.Event

context

The context for the current run.

Type:

CfnginContext

provider_builder

An object that will build a provider that will be interacted with in order to perform the necessary actions.

Type:

ProviderBuilder | None

s3_conn

Boto3 S3 client.

Type:

S3Client

__init__(context: CfnginContext, provider_builder: ProviderBuilder | None = None, cancel: threading.Event | None = None) None[source]

Instantiate class.

Parameters:
  • context – The context for the current run.

  • provider_builder – An object that will build a provider that will be interacted with in order to perform the necessary actions.

  • cancel – Cancel handler.

build_provider() Provider[source]

Build a CFNgin provider.

ensure_cfn_bucket() None[source]

CloudFormation bucket where templates will be stored.

execute(**kwargs: Any) None[source]

Run the action with pre and post steps.

post_run(*, dump: bool | str = False, outline: bool = False, **_BaseAction__kwargs: Any) None[source]

Perform steps after running the action.

pre_run(*, dump: bool | str = False, outline: bool = False, **_BaseAction__kwargs: Any) None[source]

Perform steps before running the action.

property provider: Provider

Return a generic provider using the default region.

Used for running things like hooks.

run(*, concurrency: int = 0, dump: bool | str = False, force: bool = False, outline: bool = False, tail: bool = False, upload_disabled: bool = False, **_kwargs: Any) None[source]

Abstract method for running the action.

s3_stack_push(blueprint: Blueprint, force: bool = False) str[source]

Push the rendered blueprint’s template to S3.

Verifies that the template doesn’t already exist in S3 before pushing.

Returns:

URL to the template in S3.

stack_template_url(blueprint: Blueprint) str[source]

S3 URL for CloudFormation template object.

runway.cfngin.actions.base.build_walker(concurrency: int) Callable[[...], Any][source]

Return a function for waling a graph.

Passed to runway.cfngin.plan.Plan for walking the graph.

If concurrency is 1 (no parallelism) this will return a simple topological walker that doesn’t use any multithreading.

If concurrency is 0, this will return a walker that will walk the graph as fast as the graph topology allows.

If concurrency is greater than 1, it will return a walker that will only execute a maximum of concurrency steps at any given time.

Parameters:

concurrency – Number of threads to use while walking.

Returns:

Function to walk a runway.cfngin.dag.DAG.

runway.cfngin.actions.base.stack_template_url(bucket_name: str, blueprint: Blueprint, endpoint: str) str[source]

Produce an s3 url for a given blueprint.

Parameters:
  • bucket_name – The name of the S3 bucket where the resulting templates are stored.

  • blueprint – The blueprint object to create the URL to.

  • endpoint – The s3 endpoint used for the bucket.