runway.cfngin.config package¶
CFNgin config.
-
class
runway.cfngin.config.
AnyType
(required=False, default=Undefined, serialized_name=None, choices=None, validators=None, deserialize_from=None, export_level=None, serialize_when_none=None, messages=None, metadata=None)[source]¶ Bases:
schematics.types.base.BaseType
Any type.
-
MESSAGES
= {'choices': 'Value must be one of {0}.', 'required': 'This field is required.'}¶
-
-
class
runway.cfngin.config.
Config
(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]¶ Bases:
schematics.deprecated.Model
Python representation of a CFNgin config file.
This is used internally by CFNgin to parse and validate a yaml formatted CFNgin configuration file, but can also be used in scripts to generate a CFNgin config file before handing it off to CFNgin to build/destroy.
Example:
from runway.cfngin.config import dump, Config, Stack vpc = Stack({ "name": "vpc", "class_path": "blueprints.VPC"}) config = Config() config.namespace = "prod" config.stacks = [vpc] print dump(config)
-
cfngin_bucket
¶ Bucket to use for CFNgin resources (e.g. CloudFormation templates). May be an empty string.
- Type
StringType
-
cfngin_bucket_region
¶ Explicit region to use for
cfngin_bucket
.- Type
StringType
-
cfngin_cache_dir
¶ Local directory to use for caching.
- Type
StringType
-
log_formats
¶ Custom formatting for log messages.
- Type
DictType
-
lookups
¶ Register custom lookups.
- Type
DictType
-
mappings
¶ Mappings that will be added to all stacks.
- Type
DictType
-
namespace
¶ Namespace to prepend to everything.
- Type
StringType
-
namespace_delimiter
¶ Character used to separate
namespace
and anything it prepends.- Type
StringType
-
package_sources
¶ Remote source locations.
- Type
ModelType
-
post_build
¶ Hooks to run after a build action.
- Type
ListType
-
post_destroy
¶ Hooks to run after a destroy action.
- Type
ListType
-
pre_build
¶ Hooks to run before a build action.
- Type
ListType
-
pre_destroy
¶ Hooks to run before a destroy action.
- Type
ListType
-
service_role
¶ IAM role for CloudFormation to use.
- Type
StringType
-
stacker_bucket
¶ [DEPRECATED] Replaced by
cfngin_bucket
, support will be retained until the release of version 2.0.0 at the earliest.- Type
StringType
-
stacker_bucket_region
¶ [DEPRECATED] Replaced by
cfngin_bucket_region
, support will be retained until the release of version 2.0.0 at the earliest.- Type
StringType
-
stacker_cache_dir
¶ [DEPRECATED] Replaced by
cfngin_cache_dir
, support will be retained until the release of version 2.0.0 at the earliest.- Type
StringType
-
stacks
¶ Stacks to be processed.
- Type
ListType
-
sys_path
¶ Relative or absolute path to use as the work directory.
- Type
StringType
Tags to apply to all resources.
- Type
DictType
-
targets
¶ Stag grouping.
- Type
ListType
-
template_indent
¶ Spaces to use per-indent level when outputing a template to json.
- Type
StringType
Extend functionality of the parent class.
Manipulation here allows us to _clone_ the values of legacy stacker field into their new names. Doing so we can retain support for Stacker configs and CFNgin configs.
-
cfngin_bucket
= <StringType() instance on Config as 'cfngin_bucket'>
-
cfngin_bucket_region
= <StringType() instance on Config as 'cfngin_bucket_region'>
-
cfngin_cache_dir
= <StringType() instance on Config as 'cfngin_cache_dir'>
-
log_formats
= <DictType(StringType) instance on Config as 'log_formats'>
-
lookups
= <DictType(StringType) instance on Config as 'lookups'>
-
mappings
= <DictType(DictType) instance on Config as 'mappings'>
-
namespace
= <StringType() instance on Config as 'namespace'>
-
namespace_delimiter
= <StringType() instance on Config as 'namespace_delimiter'>
-
package_sources
= <ModelType(PackageSources) instance on Config as 'package_sources'>
-
persistent_graph_key
= <StringType() instance on Config as 'persistent_graph_key'>
-
post_build
= <ListType(ModelType) instance on Config as 'post_build'>
-
post_destroy
= <ListType(ModelType) instance on Config as 'post_destroy'>
-
pre_build
= <ListType(ModelType) instance on Config as 'pre_build'>
-
pre_destroy
= <ListType(ModelType) instance on Config as 'pre_destroy'>
-
service_role
= <StringType() instance on Config as 'service_role'>
-
stacker_bucket
= <StringType() instance on Config as 'stacker_bucket'>
-
stacker_bucket_region
= <StringType() instance on Config as 'stacker_bucket_region'>
-
stacker_cache_dir
= <StringType() instance on Config as 'stacker_cache_dir'>
-
stacks
= <ListType(ModelType) instance on Config as 'stacks'>
-
sys_path
= <StringType() instance on Config as 'sys_path'>
-
tags
= <DictType(StringType) instance on Config as 'tags'>
-
targets
= <ListType(ModelType) instance on Config as 'targets'>
-
template_indent
= <StringType() instance on Config as 'template_indent'>
-
validate
(partial=False, convert=True, app_data=None, **kwargs)[source]¶ Validate the state of the model.
If the data is invalid, raises a
DataError
with error messages.- Parameters
partial (bool) – Allow partial data to validate. Essentially drops the
required=True
settings from field definitions.convert (bool) – Controls whether to perform import conversion before validating. Can be turned off to skip an unnecessary conversion step if all values are known to have the right datatypes (e.g., when validating immediately after the initial import).
- Raises
UndefinedValueError –
SchematicsError –
-
validate_stacker_bucket
(_data, value)[source]¶ Validate stack_bucket is not used.
If in use, show deprecation warning.
-
validate_stacker_bucket_region
(_data, value)[source]¶ Validate stacker_bucket_regio is not used.
If in use, show deprecation warning.
-
-
class
runway.cfngin.config.
GitPackageSource
(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]¶ Bases:
schematics.deprecated.Model
Git package source model.
Package source located in a git repo.
-
branch
¶ Branch name.
- Type
StringType
-
commit
¶ Commit hash.
- Type
StringType
-
configs
¶ List of CFNgin config paths to execute.
- Type
ListType
-
paths
¶ List of paths to append to
sys.path
.- Type
ListType
-
tag
¶ Git tag.
- Type
StringType
-
uri
¶ Remote git repo URI.
- Type
StringType
-
branch
= <StringType() instance on GitPackageSource as 'branch'>
-
commit
= <StringType() instance on GitPackageSource as 'commit'>
-
configs
= <ListType(StringType) instance on GitPackageSource as 'configs'>
-
paths
= <ListType(StringType) instance on GitPackageSource as 'paths'>
-
tag
= <StringType() instance on GitPackageSource as 'tag'>
-
uri
= <StringType() instance on GitPackageSource as 'uri'>
-
-
class
runway.cfngin.config.
Hook
(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]¶ Bases:
schematics.deprecated.Model
Hook module.
-
args
¶ - Type
DictType
-
data_key
¶ - Type
StringType
-
enabled
¶ - Type
BooleanType
-
path
¶ - Type
StringType
-
required
¶ - Type
BooleanType
-
args
= <DictType(AnyType) instance on Hook as 'args'>
-
data_key
= <StringType() instance on Hook as 'data_key'>
-
enabled
= <BooleanType() instance on Hook as 'enabled'>
-
path
= <StringType() instance on Hook as 'path'>
-
required
= <BooleanType() instance on Hook as 'required'>
-
-
class
runway.cfngin.config.
LocalPackageSource
(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]¶ Bases:
schematics.deprecated.Model
Local package source model.
Package source located on a local disk.
-
configs
¶ List of CFNgin config paths to execute.
- Type
ListType
-
paths
¶ List of paths to append to
sys.path
.- Type
ListType
-
source
¶ Source.
- Type
StringType
-
configs
= <ListType(StringType) instance on LocalPackageSource as 'configs'>
-
paths
= <ListType(StringType) instance on LocalPackageSource as 'paths'>
-
source
= <StringType() instance on LocalPackageSource as 'source'>
-
-
class
runway.cfngin.config.
PackageSources
(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]¶ Bases:
schematics.deprecated.Model
Package sources model.
-
git
¶ Package source located in a git repo.
- Type
-
local
¶ Package source located on a local disk.
- Type
-
s3
¶ Package source located in AWS S3.
- Type
-
git
= <ListType(ModelType) instance on PackageSources as 'git'>
-
local
= <ListType(ModelType) instance on PackageSources as 'local'>
-
s3
= <ListType(ModelType) instance on PackageSources as 's3'>
-
-
class
runway.cfngin.config.
S3PackageSource
(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]¶ Bases:
schematics.deprecated.Model
S3 package source model.
Package source located in AWS S3.
-
bucket
¶ AWS S3 bucket name.
- Type
StringType
-
configs
¶ List of CFNgin config paths to execute.
- Type
ListType
-
key
¶ Object key. The object should be a zip file.
- Type
StringType
-
paths
¶ List of paths to append to
sys.path
.- Type
ListType
-
requester_pays
¶ AWS S3 requester pays option.
- Type
BooleanType
-
use_latest
¶ Use the latest version of the object.
- Type
BooleanType
-
bucket
= <StringType() instance on S3PackageSource as 'bucket'>
-
configs
= <ListType(StringType) instance on S3PackageSource as 'configs'>
-
key
= <StringType() instance on S3PackageSource as 'key'>
-
paths
= <ListType(StringType) instance on S3PackageSource as 'paths'>
-
requester_pays
= <BooleanType() instance on S3PackageSource as 'requester_pays'>
-
use_latest
= <BooleanType() instance on S3PackageSource as 'use_latest'>
-
-
class
runway.cfngin.config.
Stack
(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]¶ Bases:
schematics.deprecated.Model
Stack model.
-
class_path
¶ - Type
StringType
-
description
¶ - Type
StringType
-
enabled
¶ - Type
BooleanType
-
in_progress_behavior
¶ - Type
StringType
-
locked
¶ - Type
BooleanType
-
name
¶ - Type
StringType
-
parameters
¶ - Type
DictType
-
profile
¶ - Type
StringType
-
protected
¶ - Type
BooleanType
-
region
¶ - Type
StringType
-
required_by
¶ - Type
ListType
-
requires
¶ - Type
ListType
-
stack_name
¶ - Type
StringType
-
stack_policy_path
¶ - Type
StringType
- Type
DictType
-
template_path
¶ - Type
StringType
-
termination_protection
¶ - Type
BooleanType
-
variables
¶ - Type
DictType
-
class_path
= <StringType() instance on Stack as 'class_path'>
-
description
= <StringType() instance on Stack as 'description'>
-
enabled
= <BooleanType() instance on Stack as 'enabled'>
-
in_progress_behavior
= <StringType() instance on Stack as 'in_progress_behavior'>
-
locked
= <BooleanType() instance on Stack as 'locked'>
-
name
= <StringType() instance on Stack as 'name'>
-
parameters
= <DictType(AnyType) instance on Stack as 'parameters'>
-
profile
= <StringType() instance on Stack as 'profile'>
-
protected
= <BooleanType() instance on Stack as 'protected'>
-
region
= <StringType() instance on Stack as 'region'>
-
required_by
= <ListType(StringType) instance on Stack as 'required_by'>
-
requires
= <ListType(StringType) instance on Stack as 'requires'>
-
stack_name
= <StringType() instance on Stack as 'stack_name'>
-
stack_policy_path
= <StringType() instance on Stack as 'stack_policy_path'>
-
tags
= <DictType(StringType) instance on Stack as 'tags'>
-
template_path
= <StringType() instance on Stack as 'template_path'>
-
termination_protection
= <BooleanType() instance on Stack as 'termination_protection'>
-
variables
= <DictType(AnyType) instance on Stack as 'variables'>
-
-
class
runway.cfngin.config.
Target
(raw_data=None, trusted_data=None, deserialize_mapping=None, init=True, partial=True, strict=True, validate=False, app_data=None, lazy=False, **kwargs)[source]¶ Bases:
schematics.deprecated.Model
Target model.
-
name
¶ - Type
StringType
-
required_by
¶ - Type
ListType
-
requires
¶ - Type
ListType
-
name
= <StringType() instance on Target as 'name'>
-
required_by
= <ListType(StringType) instance on Target as 'required_by'>
-
requires
= <ListType(StringType) instance on Target as 'requires'>
-
-
runway.cfngin.config.
load
(config)[source]¶ Load a CFNgin configuration by modifying syspath, loading lookups, etc.
-
runway.cfngin.config.
process_remote_sources
(raw_config, environment=None)[source]¶ Stage remote package sources and merge in remote configs.
-
runway.cfngin.config.
render
(raw_config, environment=None)[source]¶ Render a config, using it as a template with the environment.