sceptre.resolvers package¶
- class sceptre.resolvers.ResolvableContainerProperty(name, placeholder_type=PlaceholderType.explicit)[source]¶
Bases:
ResolvableProperty
This is a descriptor class used to store an attribute that may CONTAIN Resolver objects. Resolvers will be resolved upon access of this property. When resolvers are resolved, they will be replaced in the container with their resolved value, in order to avoid redundant resolutions.
Supports nested dictionary and lists.
- Parameters
name (str) – Attribute suffix used to store the property in the instance.
- class ResolveLater(instance, name, key, resolution_function)[source]¶
Bases:
object
Represents a value that could not yet be resolved but can be resolved in the future.
- assign_value_to_stack(stack, value)[source]¶
Assigns a COPY of the specified value to the stack instance. This method copies the value rather than directly assigns it to avoid bugs related to shared objects in memory.
- get_resolved_value(stack, stack_class)[source]¶
Obtains the resolved value for this property. Any resolvers that resolve to None will have their key/index removed from their dict/list where they are. Other resolvers will have their key/index’s value replace with the resolved value to avoid redundant resolutions.
- class sceptre.resolvers.ResolvableProperty(name, placeholder_type=PlaceholderType.explicit)[source]¶
Bases:
ABC
This is an abstract base class for a descriptor used to store an attribute that have values associated with Resolver objects.
- Parameters
name (
str
) – Attribute suffix used to store the property in the instance.placeholder_type – The type of placeholder that should be returned, when placeholders are allowed, when a resolver can’t be resolved.
- abstract assign_value_to_stack(stack, value)[source]¶
Implement this method to assign the value to the resolvable property.
- abstract get_resolved_value(stack, stack_class)[source]¶
Implement this method to return the value of the resolvable_property.
- Return type
- get_setup_resolver_for_stack(stack, resolver)[source]¶
Obtains a clone of the resolver with the stack set on it and the setup method having been called on it.
- class sceptre.resolvers.ResolvableValueProperty(name, placeholder_type=PlaceholderType.explicit)[source]¶
Bases:
ResolvableProperty
This is a descriptor class used to store an attribute that may BE a single Resolver object. If it is a resolver, it will be resolved upon access of this property. When resolved, the resolved value will replace the resolver on the stack in order to avoid redundant resolutions.
- Parameters
name (str) – Attribute suffix used to store the property in the instance.
- assign_value_to_stack(stack, value)[source]¶
Assigns the value to the Stack instance passed, setting up and cloning the value if it is a Resolver.
- class sceptre.resolvers.Resolver(argument=None, stack=None)[source]¶
Bases:
ABC
Resolver is an abstract base class that should be inherited by all Resolvers.
- Parameters
Submodules¶
sceptre.resolvers.environment_variable module¶
sceptre.resolvers.file_contents module¶
sceptre.resolvers.no_value module¶
- class sceptre.resolvers.no_value.NoValue(argument=None, stack=None)[source]¶
Bases:
Resolver
This resolver resolves to nothing, functioning just like the AWS::NoValue special value. When assigned to a resolvable Stack property, it will remove the config key/value from the stack or the container on the stack where it has been assigned, as if this value wasn’t assigned at all.
This is mostly useful for simplifying conditional logic on Stack and StackGroup config files where, if a certain condition is met, a value is passed, otherwise it’s not passed at all.
sceptre.resolvers.placeholders module¶
- class sceptre.resolvers.placeholders.PlaceholderType(value)[source]¶
Bases:
Enum
An enumeration.
- alphanum = 2¶
- explicit = 1¶
- none = 3¶
- sceptre.resolvers.placeholders.are_placeholders_enabled()[source]¶
Indicates whether placeholders have been globally enabled or not.
- Return type
- sceptre.resolvers.placeholders.create_placeholder_value(resolver, placeholder_type)[source]¶
- Return type
- sceptre.resolvers.placeholders.use_resolver_placeholders_on_error()[source]¶
A context manager that toggles on placeholders for resolvers that error out. This should NOT be used while creating/launching stacks, but it is often required when validating or diffing stacks whose dependencies haven’t yet been deployed and that reference those dependencies with resolvers, especially in the sceptre_user_data.
sceptre.resolvers.stack_attr module¶
- class sceptre.resolvers.stack_attr.StackAttr(argument=None, stack=None)[source]¶
Bases:
Resolver
Resolves to the value of another field on the Stack Config, including other resolvers.
The argument for this resolver should be the “key path” from the stack object, which can access nested keys/indexes using a “.” to separate segments.
For example, given this Stack Config structure…
- sceptre_user_data:
- nested_list:
first
second
Using “!stack_attr sceptre_user_data.nested_list.1” on your stack would resolve to “second”.
- STACK_ATTR_MAP = {'protect': 'protected', 'stack_name': 'external_name', 'stack_tags': 'tags', 'template': 'template_handler_config'}¶
sceptre.resolvers.stack_output module¶
- class sceptre.resolvers.stack_output.StackOutput(*args, **kwargs)[source]¶
Bases:
StackOutputBase
Resolver for retrieving the value of a Stack output within the current Sceptre StackGroup. Adds the target Stack to the dependencies of the Stack using the Resolver.
- Parameters
argument (str in the format
"<stack name>::<output key>"
) – The Stack name and output name to get.
- class sceptre.resolvers.stack_output.StackOutputBase(*args, **kwargs)[source]¶
Bases:
Resolver
A abstract base class which provides methods for getting Stack outputs.
- class sceptre.resolvers.stack_output.StackOutputExternal(*args, **kwargs)[source]¶
Bases:
StackOutputBase
Resolver for retrieving the value of an output of any Stack within the current Sceptre stack_group’s account and region.
- Parameters
argument (str in the format
"<full stack name>::<output key>"
) – The Stack name and output name to get.