ContextProvider

class aws_cdk.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, ignore_error_on_missing_context=None, 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.

  • ignore_error_on_missing_context (Optional[bool]) – When True, the context provider will not throw an error if missing context is reported. Default: false

  • 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