runway.context package¶
Context objects.
- class runway.context.CfnginContext[source]¶
Bases:
BaseContext
CFNgin context object.
- __init__(*, config: CfnginConfig | None = None, config_path: Path | None = None, deploy_environment: DeployEnvironment | None = None, force_stacks: list[str] | None = None, logger: PrefixAdaptor | RunwayLogger = <RunwayLogger runway.context._cfngin (WARNING)>, parameters: MutableMapping[str, Any] | None = None, stack_names: list[str] | None = None, work_dir: Path | None = None, **_: Any) None [source]¶
Instantiate class.
- Parameters:
config – The CFNgin configuration being operated on.
config_path – Path to the config file that was provided.
deploy_environment – The current deploy environment.
force_stacks – A list of stacks to force work on. Used to work on locked stacks.
logger – Custom logger.
parameters – Parameters passed from Runway or read from a file.
stack_names – A list of stack_names to operate on. If not passed, all stacks defined in the config will be operated on.
work_dir – Working directory used by Runway.
- bucket_region: str¶
Region where the S3 Bucket is located.
The S3 Bucket being the Bucket configured for staging CloudFormation Templates.
- config: CfnginConfig¶
CFNgin configuration file that has been resolved & parsed into a python object.
- config_path: Path¶
Path to the configuration file that has been resolved, parsed and made accessible via this object.
- copy() runway.context.CfnginContext [source]¶
Copy the contents of this object into a new instance.
- env: DeployEnvironment¶
Deploy environment object containing information about the current deploy environment.
- get_fqn(name: str | None = None) str [source]¶
Return the fully qualified name of an object within this context.
If the name passed already appears to be a fully qualified name, it will be returned with no further processing.
- get_stack(name: str) Stack | None [source]¶
Get a stack by name.
- Parameters:
name – Name of a Stack as defined in the config.
- hook_data: dict[str, Any]¶
Values returned by hooks that are stored based on the
data_key
defined for the hook.Returned values are only stored if a
data_key
was provided AND the return value is a dict orpydantic.BaseModel
.
- lock_persistent_graph(lock_code: str) None [source]¶
Locks the persistent graph in s3.
- Parameters:
lock_code – The code that will be used to lock the S3 object.
- Raises:
- logger: PrefixAdaptor | RunwayLogger¶
Custom logger to use when logging messages.
- property persistent_graph: Graph | None¶
Graph if a persistent graph is being used.
Will create an “empty” object in S3 if one is not found.
- property persistent_graph_location: PersistentGraphLocation¶
Location of the persistent graph in s3.
- put_persistent_graph(lock_code: str) None [source]¶
Upload persistent graph to s3.
- Parameters:
lock_code (str) – The code that will be used to lock the S3 object.
- Raises:
- property s3_bucket_verified: bool¶
Check CFNgin bucket exists and you have access.
If the CFNgin bucket does not exist, will try to create one.
- property s3_client: S3Client¶
AWS S3 client.
- set_hook_data(key: str, data: Any) None [source]¶
Set hook data for the given key.
- Parameters:
key – The key to store the hook data in.
data – A dictionary of data to store, as returned from a hook.
- stack_names: list[str]¶
List of Stack names to operate on.
If value is falsy, all Stacks defined in the config will be operated on.
- property stacks_dict: dict[str, Stack]¶
Construct a dict of
{stack.fqn: Stack}
for easy access to stacks.
- class runway.context.RunwayContext[source]¶
Bases:
BaseContext
Runway context object.
- __init__(*, command: RunwayActionTypeDef | None = None, deploy_environment: DeployEnvironment | None = None, logger: PrefixAdaptor | RunwayLogger = <RunwayLogger runway.context._runway (WARNING)>, work_dir: Path | None = None, **_: Any) None [source]¶
Instantiate class.
- Parameters:
command – Runway command/action being run.
deploy_environment – The current deploy environment.
logger – Custom logger.
work_dir – Working directory used by Runway.
- copy() runway.context.RunwayContext [source]¶
Copy the contents of this object into a new instance.
- echo_detected_environment() None [source]¶
Print a helper note about how the environment was determined.