ContextProvider

class aws_cdk.core.ContextProvider(*args: Any, **kwargs)

Bases: object

Base class for the model side of context providers.

Instances of this class communicate with context provider plugins in the ‘cdk toolkit’ via context variables (input), outputting specialized queries for more context variables (output).

ContextProvider needs access to a Construct to hook into the context mechanism.

Static Methods

classmethod get_key(scope, *, provider, include_environment=None, props=None)
Parameters:
  • scope (Construct) –

  • provider (str) – The context provider to query.

  • include_environment (Optional[bool]) – Whether to include the stack’s account and region automatically. Default: true

  • props (Optional[Mapping[str, Any]]) – Provider-specific properties.

Return type:

GetContextKeyResult

Returns:

the context key or undefined if a key cannot be rendered (due to tokens used in any of the props)

classmethod get_value(scope, *, dummy_value, provider, include_environment=None, props=None)
Parameters:
  • scope (Construct) –

  • dummy_value (Any) – The value to return if the context value was not found and a missing context is reported. This should be a dummy value that should preferably fail during deployment since it represents an invalid state.

  • provider (str) – The context provider to query.

  • include_environment (Optional[bool]) – Whether to include the stack’s account and region automatically. Default: true

  • props (Optional[Mapping[str, Any]]) – Provider-specific properties.

Return type:

GetContextValueResult