runway.module.cdk module

CDK module.

class runway.module.cdk.CloudDevelopmentKit[source]

Bases: runway.module.base.RunwayModuleNpm

CDK Runway Module.

__init__(context: RunwayContext, *, explicitly_enabled: Optional[bool] = False, logger: RunwayLogger = <RunwayLogger runway.module.cdk (WARNING)>, module_root: Path, name: Optional[str] = None, options: Optional[Union[Dict[str, Any], ModuleOptions]] = None, parameters: Optional[Dict[str, Any]] = None, **_: Any) None[source]

Instantiate class.

Parameters
  • context – Runway context object for the current session.

  • explicitly_enabled – Whether or not the module is explicitly enabled. This is can be set in the event that the current environment being deployed to matches the defined environments of the module/deployment.

  • logger – Used to write logs.

  • module_root – Root path of the module.

  • name – Name of the module.

  • options – Options passed to the module class from the config as options or module_options if coming from the deployment level.

  • parameters – Values to pass to the underlying infrastructure as code tool that will alter the resulting infrastructure being deployed. Used to templatize IaC.

property cli_args: List[str]

Generate CLI args from self used in all CDK commands.

property cli_args_context: List[str]

Generate CLI args from self passed to CDK commands as --context.

property skip: bool

Determine if the module should be skipped.

cdk_bootstrap() None[source]

Execute cdk bootstrap command.

cdk_deploy() None[source]

Execute cdk deploy command.

cdk_destroy() None[source]

Execute cdk destroy command.

cdk_diff(stack_name: Optional[str] = None) None[source]

Execute cdk diff command.

cdk_list() List[str][source]

Execute cdk list command.

deploy() None[source]

Run cdk deploy.

destroy() None[source]

Run cdk destroy.

gen_cmd(command: Literal['bootstrap', 'context', 'deploy', 'destroy', 'diff', 'docs', 'doctor', 'init', 'list', 'metadata', 'synthesize'], args_list: Optional[List[str]] = None, *, include_context: bool = False) List[str][source]

Generate and log a CDK command.

This does not execute the command, only prepares it for use.

Parameters
  • command – The CDK command to be executed.

  • args_list – Additional arguments to include in the generated command.

  • include_context – Optionally, pass context to the CLI. Context is not valid for all commands.

Returns

The full command to be passed into a subprocess.

init() None[source]

Run cdk bootstrap.

plan() None[source]

Run cdk diff.

run_build_steps() None[source]

Run build steps.

__getitem__(key: str) Any

Make the object subscriptable.

Parameters

key – Attribute to get.

__new__(**kwargs)
static check_for_npm(*, logger: Union[logging.Logger, PrefixAdaptor, RunwayLogger] = <RunwayLogger runway.module.base (WARNING)>) None

Ensure npm is installed and in the current path.

Parameters

logger – Optionally provide a custom logger to use.

log_npm_command(command: List[str]) None

Log an npm command that is going to be run.

Parameters

command – List that will be passed into a subprocess.

npm_install() None

Run npm install.

package_json_missing() bool

Check for the existence for a package.json file in the module.

Returns

True if the file was not found.

Return type

bool

static warn_on_boto_env_vars(env_vars: Dict[str, str], *, logger: Union[logging.Logger, PrefixAdaptor, RunwayLogger] = <RunwayLogger runway.module.base (WARNING)>) None

Inform user if boto-specific environment variables are in use.

Parameters
  • env_vars – Environment variables to check.

  • logger – Optionally provide a custom logger to use.

class runway.module.cdk.CloudDevelopmentKitOptions[source]

Bases: runway.module.base.ModuleOptions

Module options for AWS Cloud Development Kit.

build_steps

A list of commands to be executed before each action (e.g. diff, deploy, destroy).

data

Options parsed into a data model.

skip_npm_ci

Skip running npm ci in the module directory prior to processing the module.

__init__(data: runway.config.models.runway.options.cdk.RunwayCdkModuleOptionsDataModel) None[source]

Instantiate class.

Parameters

data – Options parsed into a data model.

classmethod parse_obj(obj: object) runway.module.cdk.CloudDevelopmentKitOptions[source]

Parse options definition and return an options object.

Parameters

obj – Object to parse.

__eq__(other: Any) bool

Assess equality.

__new__(**kwargs)
get(name: str, default: Any = None) Any

Get a value or return the default.