runway.variables module¶
Runway variables.
-
runway.variables.
resolve_variables
(variables, context, provider)[source]¶ Given a list of variables, resolve all of them.
- Parameters
variables (List[
Variable
]) – List of variables.context (
runway.cfngin.context.Context
) – CFNgin context.provider (
runway.cfngin.providers.base.BaseProvider
) – Subclass of the base provider.
-
class
runway.variables.
Variable
(name, value, variable_type='cfngin')[source]¶ Bases:
object
Represents a variable provided to a Runway directive.
Initialize class.
- Parameters
name – Name of the variable (directive/key).
value – The variable itself.
variable_type – Type of variable (cfngin|runway).
-
property
dependencies
¶ Stack names that this variable depends on.
- Returns
Stack names that this variable depends on.
- Return type
Set[str]
-
property
resolved
¶ Boolean for whether the Variable has been resolved.
Variables only need to be resolved if they contain lookups.
-
property
value
¶ Return the current value of the Variable.
-
class
runway.variables.
VariableValue
[source]¶ Bases:
object
Syntax tree base class to parse variable values.
-
property
dependencies
¶ Stack names that this variable depends on.
-
property
resolved
¶ Use to check if the variable value has been resolved.
Should be implimented in subclasses.
-
property
simplified
¶ Return a simplified version of the value.
This can be used to concatenate two literals into one literal or flatten nested concatenations.
Should be implimented in subclasses where applicable.
-
property
value
¶ Value of the variable. Can be resolved or unresolved.
Should be implimented in subclasses.
-
property
-
class
runway.variables.
VariableValueLiteral
(value)[source]¶ Bases:
runway.variables.VariableValue
The literal value of a variable as provided.
Initialize class.
-
property
resolved
¶ Use to check if the variable value has been resolved.
The ValueLiteral will always appear as resolved because it does not “resolve” since it is the literal definition of the value.
-
property
value
¶ Value of the variable.
-
property
-
class
runway.variables.
VariableValueList
[source]¶ Bases:
runway.variables.VariableValue
,list
A list variable value.
-
property
dependencies
¶ Stack names that this variable depends on.
-
property
resolved
¶ Use to check if the variable value has been resolved.
-
property
simplified
¶ Return a simplified version of the value.
This can be used to concatenate two literals into one literal or flatten nested concatenations.
-
property
value
¶ Value of the variable. Can be resolved or unresolved.
-
property
-
class
runway.variables.
VariableValueDict
[source]¶ Bases:
runway.variables.VariableValue
,dict
A dict variable value.
-
property
dependencies
¶ Stack names that this variable depends on.
-
property
resolved
¶ Use to check if the variable value has been resolved.
-
property
simplified
¶ Return a simplified version of the value.
This can be used to concatenate two literals into one literal or flatten nested concatenations.
-
property
value
¶ Value of the variable. Can be resolved or unresolved.
-
property
-
class
runway.variables.
VariableValueConcatenation
[source]¶ Bases:
runway.variables.VariableValue
,list
A concatinated variable value.
-
property
dependencies
¶ Stack names that this variable depends on.
-
property
resolved
¶ Use to check if the variable value has been resolved.
-
property
simplified
¶ Return a simplified version of the value.
This can be used to concatenate two literals into one literal or flatten nested concatenations.
-
property
value
¶ Value of the variable. Can be resolved or unresolved.
-
property
-
class
runway.variables.
VariableValueLookup
(lookup_name, lookup_data, handler=None, variable_type='cfngin')[source]¶ Bases:
runway.variables.VariableValue
A lookup variable value.
Initialize class.
- Parameters
lookup_name – Name of the invoked lookup
lookup_data – Data portion of the lookup
handler – Lookup handler that will be use to resolve the value.
variable_type – Type of variable (cfngin|runway).
-
property
dependencies
¶ Stack names that this variable depends on.
-
property
resolved
¶ Use to check if the variable value has been resolved.
-
property
simplified
¶ Return a simplified version of the value.
This can be used to concatenate two literals into one literal or flatten nested concatenations.
-
property
value
¶ Value of the variable. Can be resolved or unresolved.
-
resolve
(context, provider=None, variables=None, **kwargs)[source]¶ Resolve the variable value.
- Parameters
context – The current context object.
provider – Subclass of the base provider.
variables – Object containing variables passed to Runway.
- Raises
FailedLookup – A lookup failed for any reason.