runway.cfngin.lookups.handlers.awslambda module

Dedicated lookup for use with AwsLambdaHook based hooks.

To use this hook, there must be a AwsLambdaHook based hook defined in the pre_deploy section of the CFNgin configuration file. This hook must also define a data_key that is unique within the CFNgin configuration file (it can be reused in other CFNgin configuration files). The data_key is then passed to the lookup as it’s input/query. This allows the lookup to function during a runway plan.

class runway.cfngin.lookups.handlers.awslambda.AwsLambdaLookup[source]

Bases: runway.lookups.handlers.base.LookupHandler

Lookup for AwsLambdaHook responses.

classmethod get_deployment_package_data(context: CfnginContext, data_key: str) AwsLambdaHookDeployResponse[source]

Get the response of an AwsLambdaHook run.

Parameters
  • context – CFNgin context object.

  • data_key – The value of the data_key field as assigned in a Hook definition.

Returns

The AwsLambdaHook response parsed into a data model. This will come from hook data if it exists or it will be calculated and added to hook data for future use.

Raises

TypeError – The data stored in hook data does not align with the expected data model.

static get_required_hook_definition(config: CfnginConfig, data_key: str) CfnginHookDefinitionModel[source]

Get the required Hook definition from the CFNgin config.

Currently, this only supports finding the data_key pre_deploy.

Parameters
  • config – CFNgin config being processed.

  • data_key – The value of the data_key field as assigned in a Hook definition.

Returns

The Hook definition set to use the provided data_key.

Raises

ValueError – Either a Hook definition was not found for the provided data_key or, more than one was found.

classmethod handle(value: str, context: Union[CfnginContext, RunwayContext], *_args: Any, **_kwargs: Any) AwsLambdaHookDeployResponse[source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters
  • value – Value to resolve.

  • context – The current context object.

Returns

The full AwsLambdaHookDeployResponse data model.

static init_hook_class(context: CfnginContext, hook_def: CfnginHookDefinitionModel) AwsLambdaHook[Any][source]

Initialize AwsLambdaHook subclass instance.

Parameters
  • context – CFNgin context object.

  • hook_def – The AwsLambdaHook definition.

Returns

The loaded AwsLambdaHook object.

class Code[source]

Bases: runway.lookups.handlers.base.LookupHandler

Lookup for AwsLambdaHook responses.

classmethod handle(value: str, context: Union[CfnginContext, RunwayContext], *args: Any, **kwargs: Any) Code[source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters
  • value – Value to resolve.

  • context – The current context object.

Returns

Value that can be passed into CloudFormation property AWS::Lambda::Function.Code.

__init__()
__new__(**kwargs)
classmethod dependencies(_LookupHandler__lookup_query: VariableValue) Set[str]

Calculate any dependencies required to perform this lookup.

Note that lookup_query may not be (completely) resolved at this time.

classmethod format_results(value: Any, get: Optional[str] = None, load: Optional[str] = None, transform: Optional[typing_extensions.Literal[bool, str]] = None, **kwargs: Any) Any

Format results to be returned by a lookup.

Parameters
  • value – Data collected by the Lookup.

  • get – Nested value to get from a dictionary like object.

  • load – Parser to use to parse a formatted string before the get and transform method.

  • transform – Convert the final value to a different data type before returning it.

Raises

TypeError – If get is provided but the value value is not a dictionary like object.

Runs the following actions in order:

  1. load() if load is provided.

  2. runway.util.MutableMap.find() or dict.get() depending on the data type if get is provided.

  3. Convert null value string to NoneType object. This includes string values of “None” and “null”. This conversion is case insensitive.

  4. transform() if transform is provided.

classmethod load(value: Any, parser: Optional[str] = None, **kwargs: Any) Any

Load a formatted string or object into a python data type.

First action taken in format_results(). If a lookup needs to handling loading data to process it before it enters format_results(), is should use args.pop('load') to prevent the data from being loaded twice.

Parameters
  • value – What is being loaded.

  • parser – Name of the parser to use.

Returns

The loaded value.

classmethod parse(value: str) Tuple[str, Dict[str, str]]

Parse the value passed to a lookup in a standardized way.

Parameters

value – The raw value passed to a lookup.

Returns

The lookup query and a dict of arguments

classmethod transform(value: Any, *, to_type: Optional[typing_extensions.Literal[bool, str]] = 'str', **kwargs: Any) Any

Transform the result of a lookup into another datatype.

Last action taken in format_results(). If a lookup needs to handling transforming the data in a way that the base class can’t support it should overwrite this method of the base class to register different transform methods.

Parameters
  • value – What is to be transformed.

  • to_type – The type the value will be transformed into.

Returns

The transformed value.

class CodeSha256[source]

Bases: runway.lookups.handlers.base.LookupHandler

Lookup for AwsLambdaHook responses.

classmethod handle(value: str, context: Union[CfnginContext, RunwayContext], *args: Any, **kwargs: Any) str[source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters
  • value – Value to resolve.

  • context – The current context object.

Returns

Value that can be passed into CloudFormation property AWS::Lambda::Version.CodeSha256.

__init__()
__new__(**kwargs)
classmethod dependencies(_LookupHandler__lookup_query: VariableValue) Set[str]

Calculate any dependencies required to perform this lookup.

Note that lookup_query may not be (completely) resolved at this time.

classmethod format_results(value: Any, get: Optional[str] = None, load: Optional[str] = None, transform: Optional[typing_extensions.Literal[bool, str]] = None, **kwargs: Any) Any

Format results to be returned by a lookup.

Parameters
  • value – Data collected by the Lookup.

  • get – Nested value to get from a dictionary like object.

  • load – Parser to use to parse a formatted string before the get and transform method.

  • transform – Convert the final value to a different data type before returning it.

Raises

TypeError – If get is provided but the value value is not a dictionary like object.

Runs the following actions in order:

  1. load() if load is provided.

  2. runway.util.MutableMap.find() or dict.get() depending on the data type if get is provided.

  3. Convert null value string to NoneType object. This includes string values of “None” and “null”. This conversion is case insensitive.

  4. transform() if transform is provided.

classmethod load(value: Any, parser: Optional[str] = None, **kwargs: Any) Any

Load a formatted string or object into a python data type.

First action taken in format_results(). If a lookup needs to handling loading data to process it before it enters format_results(), is should use args.pop('load') to prevent the data from being loaded twice.

Parameters
  • value – What is being loaded.

  • parser – Name of the parser to use.

Returns

The loaded value.

classmethod parse(value: str) Tuple[str, Dict[str, str]]

Parse the value passed to a lookup in a standardized way.

Parameters

value – The raw value passed to a lookup.

Returns

The lookup query and a dict of arguments

classmethod transform(value: Any, *, to_type: Optional[typing_extensions.Literal[bool, str]] = 'str', **kwargs: Any) Any

Transform the result of a lookup into another datatype.

Last action taken in format_results(). If a lookup needs to handling transforming the data in a way that the base class can’t support it should overwrite this method of the base class to register different transform methods.

Parameters
  • value – What is to be transformed.

  • to_type – The type the value will be transformed into.

Returns

The transformed value.

class CompatibleArchitectures[source]

Bases: runway.lookups.handlers.base.LookupHandler

Lookup for AwsLambdaHook responses.

classmethod handle(value: str, context: Union[CfnginContext, RunwayContext], *args: Any, **kwargs: Any) Optional[List[str]][source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters
  • value – Value to resolve.

  • context – The current context object.

Returns

Value that can be passed into CloudFormation property AWS::Lambda::LayerVersion.CompatibleArchitectures.

__init__()
__new__(**kwargs)
classmethod dependencies(_LookupHandler__lookup_query: VariableValue) Set[str]

Calculate any dependencies required to perform this lookup.

Note that lookup_query may not be (completely) resolved at this time.

classmethod format_results(value: Any, get: Optional[str] = None, load: Optional[str] = None, transform: Optional[typing_extensions.Literal[bool, str]] = None, **kwargs: Any) Any

Format results to be returned by a lookup.

Parameters
  • value – Data collected by the Lookup.

  • get – Nested value to get from a dictionary like object.

  • load – Parser to use to parse a formatted string before the get and transform method.

  • transform – Convert the final value to a different data type before returning it.

Raises

TypeError – If get is provided but the value value is not a dictionary like object.

Runs the following actions in order:

  1. load() if load is provided.

  2. runway.util.MutableMap.find() or dict.get() depending on the data type if get is provided.

  3. Convert null value string to NoneType object. This includes string values of “None” and “null”. This conversion is case insensitive.

  4. transform() if transform is provided.

classmethod load(value: Any, parser: Optional[str] = None, **kwargs: Any) Any

Load a formatted string or object into a python data type.

First action taken in format_results(). If a lookup needs to handling loading data to process it before it enters format_results(), is should use args.pop('load') to prevent the data from being loaded twice.

Parameters
  • value – What is being loaded.

  • parser – Name of the parser to use.

Returns

The loaded value.

classmethod parse(value: str) Tuple[str, Dict[str, str]]

Parse the value passed to a lookup in a standardized way.

Parameters

value – The raw value passed to a lookup.

Returns

The lookup query and a dict of arguments

classmethod transform(value: Any, *, to_type: Optional[typing_extensions.Literal[bool, str]] = 'str', **kwargs: Any) Any

Transform the result of a lookup into another datatype.

Last action taken in format_results(). If a lookup needs to handling transforming the data in a way that the base class can’t support it should overwrite this method of the base class to register different transform methods.

Parameters
  • value – What is to be transformed.

  • to_type – The type the value will be transformed into.

Returns

The transformed value.

class CompatibleRuntimes[source]

Bases: runway.lookups.handlers.base.LookupHandler

Lookup for AwsLambdaHook responses.

classmethod handle(value: str, context: Union[CfnginContext, RunwayContext], *args: Any, **kwargs: Any) Any[source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters
  • value – Value to resolve.

  • context – The current context object.

Returns

Value that can be passed into CloudFormation property AWS::Lambda::LayerVersion.CompatibleRuntimes.

__init__()
__new__(**kwargs)
classmethod dependencies(_LookupHandler__lookup_query: VariableValue) Set[str]

Calculate any dependencies required to perform this lookup.

Note that lookup_query may not be (completely) resolved at this time.

classmethod format_results(value: Any, get: Optional[str] = None, load: Optional[str] = None, transform: Optional[typing_extensions.Literal[bool, str]] = None, **kwargs: Any) Any

Format results to be returned by a lookup.

Parameters
  • value – Data collected by the Lookup.

  • get – Nested value to get from a dictionary like object.

  • load – Parser to use to parse a formatted string before the get and transform method.

  • transform – Convert the final value to a different data type before returning it.

Raises

TypeError – If get is provided but the value value is not a dictionary like object.

Runs the following actions in order:

  1. load() if load is provided.

  2. runway.util.MutableMap.find() or dict.get() depending on the data type if get is provided.

  3. Convert null value string to NoneType object. This includes string values of “None” and “null”. This conversion is case insensitive.

  4. transform() if transform is provided.

classmethod load(value: Any, parser: Optional[str] = None, **kwargs: Any) Any

Load a formatted string or object into a python data type.

First action taken in format_results(). If a lookup needs to handling loading data to process it before it enters format_results(), is should use args.pop('load') to prevent the data from being loaded twice.

Parameters
  • value – What is being loaded.

  • parser – Name of the parser to use.

Returns

The loaded value.

classmethod parse(value: str) Tuple[str, Dict[str, str]]

Parse the value passed to a lookup in a standardized way.

Parameters

value – The raw value passed to a lookup.

Returns

The lookup query and a dict of arguments

classmethod transform(value: Any, *, to_type: Optional[typing_extensions.Literal[bool, str]] = 'str', **kwargs: Any) Any

Transform the result of a lookup into another datatype.

Last action taken in format_results(). If a lookup needs to handling transforming the data in a way that the base class can’t support it should overwrite this method of the base class to register different transform methods.

Parameters
  • value – What is to be transformed.

  • to_type – The type the value will be transformed into.

Returns

The transformed value.

class Content[source]

Bases: runway.lookups.handlers.base.LookupHandler

Lookup for AwsLambdaHook responses.

classmethod handle(value: str, context: Union[CfnginContext, RunwayContext], *args: Any, **kwargs: Any) Content[source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters
  • value – Value to resolve.

  • context – The current context object.

Returns

Value that can be passed into CloudFormation property AWS::Lambda::LayerVersion.Content.

__init__()
__new__(**kwargs)
classmethod dependencies(_LookupHandler__lookup_query: VariableValue) Set[str]

Calculate any dependencies required to perform this lookup.

Note that lookup_query may not be (completely) resolved at this time.

classmethod format_results(value: Any, get: Optional[str] = None, load: Optional[str] = None, transform: Optional[typing_extensions.Literal[bool, str]] = None, **kwargs: Any) Any

Format results to be returned by a lookup.

Parameters
  • value – Data collected by the Lookup.

  • get – Nested value to get from a dictionary like object.

  • load – Parser to use to parse a formatted string before the get and transform method.

  • transform – Convert the final value to a different data type before returning it.

Raises

TypeError – If get is provided but the value value is not a dictionary like object.

Runs the following actions in order:

  1. load() if load is provided.

  2. runway.util.MutableMap.find() or dict.get() depending on the data type if get is provided.

  3. Convert null value string to NoneType object. This includes string values of “None” and “null”. This conversion is case insensitive.

  4. transform() if transform is provided.

classmethod load(value: Any, parser: Optional[str] = None, **kwargs: Any) Any

Load a formatted string or object into a python data type.

First action taken in format_results(). If a lookup needs to handling loading data to process it before it enters format_results(), is should use args.pop('load') to prevent the data from being loaded twice.

Parameters
  • value – What is being loaded.

  • parser – Name of the parser to use.

Returns

The loaded value.

classmethod parse(value: str) Tuple[str, Dict[str, str]]

Parse the value passed to a lookup in a standardized way.

Parameters

value – The raw value passed to a lookup.

Returns

The lookup query and a dict of arguments

classmethod transform(value: Any, *, to_type: Optional[typing_extensions.Literal[bool, str]] = 'str', **kwargs: Any) Any

Transform the result of a lookup into another datatype.

Last action taken in format_results(). If a lookup needs to handling transforming the data in a way that the base class can’t support it should overwrite this method of the base class to register different transform methods.

Parameters
  • value – What is to be transformed.

  • to_type – The type the value will be transformed into.

Returns

The transformed value.

class LicenseInfo[source]

Bases: runway.lookups.handlers.base.LookupHandler

Lookup for AwsLambdaHook responses.

classmethod handle(value: str, context: Union[CfnginContext, RunwayContext], *args: Any, **kwargs: Any) Optional[str][source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters
  • value – Value to resolve.

  • context – The current context object.

Returns

Value that can be passed into CloudFormation property AWS::Lambda::LayerVersion.LicenseInfo.

__init__()
__new__(**kwargs)
classmethod dependencies(_LookupHandler__lookup_query: VariableValue) Set[str]

Calculate any dependencies required to perform this lookup.

Note that lookup_query may not be (completely) resolved at this time.

classmethod format_results(value: Any, get: Optional[str] = None, load: Optional[str] = None, transform: Optional[typing_extensions.Literal[bool, str]] = None, **kwargs: Any) Any

Format results to be returned by a lookup.

Parameters
  • value – Data collected by the Lookup.

  • get – Nested value to get from a dictionary like object.

  • load – Parser to use to parse a formatted string before the get and transform method.

  • transform – Convert the final value to a different data type before returning it.

Raises

TypeError – If get is provided but the value value is not a dictionary like object.

Runs the following actions in order:

  1. load() if load is provided.

  2. runway.util.MutableMap.find() or dict.get() depending on the data type if get is provided.

  3. Convert null value string to NoneType object. This includes string values of “None” and “null”. This conversion is case insensitive.

  4. transform() if transform is provided.

classmethod load(value: Any, parser: Optional[str] = None, **kwargs: Any) Any

Load a formatted string or object into a python data type.

First action taken in format_results(). If a lookup needs to handling loading data to process it before it enters format_results(), is should use args.pop('load') to prevent the data from being loaded twice.

Parameters
  • value – What is being loaded.

  • parser – Name of the parser to use.

Returns

The loaded value.

classmethod parse(value: str) Tuple[str, Dict[str, str]]

Parse the value passed to a lookup in a standardized way.

Parameters

value – The raw value passed to a lookup.

Returns

The lookup query and a dict of arguments

classmethod transform(value: Any, *, to_type: Optional[typing_extensions.Literal[bool, str]] = 'str', **kwargs: Any) Any

Transform the result of a lookup into another datatype.

Last action taken in format_results(). If a lookup needs to handling transforming the data in a way that the base class can’t support it should overwrite this method of the base class to register different transform methods.

Parameters
  • value – What is to be transformed.

  • to_type – The type the value will be transformed into.

Returns

The transformed value.

class Runtime[source]

Bases: runway.lookups.handlers.base.LookupHandler

Lookup for AwsLambdaHook responses.

classmethod handle(value: str, context: Union[CfnginContext, RunwayContext], *args: Any, **kwargs: Any) str[source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters
  • value – Value to resolve.

  • context – The current context object.

Returns

Value that can be passed into CloudFormation property AWS::Lambda::Function.Runtime.

__init__()
__new__(**kwargs)
classmethod dependencies(_LookupHandler__lookup_query: VariableValue) Set[str]

Calculate any dependencies required to perform this lookup.

Note that lookup_query may not be (completely) resolved at this time.

classmethod format_results(value: Any, get: Optional[str] = None, load: Optional[str] = None, transform: Optional[typing_extensions.Literal[bool, str]] = None, **kwargs: Any) Any

Format results to be returned by a lookup.

Parameters
  • value – Data collected by the Lookup.

  • get – Nested value to get from a dictionary like object.

  • load – Parser to use to parse a formatted string before the get and transform method.

  • transform – Convert the final value to a different data type before returning it.

Raises

TypeError – If get is provided but the value value is not a dictionary like object.

Runs the following actions in order:

  1. load() if load is provided.

  2. runway.util.MutableMap.find() or dict.get() depending on the data type if get is provided.

  3. Convert null value string to NoneType object. This includes string values of “None” and “null”. This conversion is case insensitive.

  4. transform() if transform is provided.

classmethod load(value: Any, parser: Optional[str] = None, **kwargs: Any) Any

Load a formatted string or object into a python data type.

First action taken in format_results(). If a lookup needs to handling loading data to process it before it enters format_results(), is should use args.pop('load') to prevent the data from being loaded twice.

Parameters
  • value – What is being loaded.

  • parser – Name of the parser to use.

Returns

The loaded value.

classmethod parse(value: str) Tuple[str, Dict[str, str]]

Parse the value passed to a lookup in a standardized way.

Parameters

value – The raw value passed to a lookup.

Returns

The lookup query and a dict of arguments

classmethod transform(value: Any, *, to_type: Optional[typing_extensions.Literal[bool, str]] = 'str', **kwargs: Any) Any

Transform the result of a lookup into another datatype.

Last action taken in format_results(). If a lookup needs to handling transforming the data in a way that the base class can’t support it should overwrite this method of the base class to register different transform methods.

Parameters
  • value – What is to be transformed.

  • to_type – The type the value will be transformed into.

Returns

The transformed value.

class S3Bucket[source]

Bases: runway.lookups.handlers.base.LookupHandler

Lookup for AwsLambdaHook responses.

classmethod handle(value: str, context: Union[CfnginContext, RunwayContext], *args: Any, **kwargs: Any) str[source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters
  • value – Value to resolve.

  • context – The current context object.

Returns

Value that can be passed into CloudFormation property AWS::Lambda::Function.Code.S3Bucket or AWS::Lambda::LayerVersion.Content.S3Bucket.

__init__()
__new__(**kwargs)
classmethod dependencies(_LookupHandler__lookup_query: VariableValue) Set[str]

Calculate any dependencies required to perform this lookup.

Note that lookup_query may not be (completely) resolved at this time.

classmethod format_results(value: Any, get: Optional[str] = None, load: Optional[str] = None, transform: Optional[typing_extensions.Literal[bool, str]] = None, **kwargs: Any) Any

Format results to be returned by a lookup.

Parameters
  • value – Data collected by the Lookup.

  • get – Nested value to get from a dictionary like object.

  • load – Parser to use to parse a formatted string before the get and transform method.

  • transform – Convert the final value to a different data type before returning it.

Raises

TypeError – If get is provided but the value value is not a dictionary like object.

Runs the following actions in order:

  1. load() if load is provided.

  2. runway.util.MutableMap.find() or dict.get() depending on the data type if get is provided.

  3. Convert null value string to NoneType object. This includes string values of “None” and “null”. This conversion is case insensitive.

  4. transform() if transform is provided.

classmethod load(value: Any, parser: Optional[str] = None, **kwargs: Any) Any

Load a formatted string or object into a python data type.

First action taken in format_results(). If a lookup needs to handling loading data to process it before it enters format_results(), is should use args.pop('load') to prevent the data from being loaded twice.

Parameters
  • value – What is being loaded.

  • parser – Name of the parser to use.

Returns

The loaded value.

classmethod parse(value: str) Tuple[str, Dict[str, str]]

Parse the value passed to a lookup in a standardized way.

Parameters

value – The raw value passed to a lookup.

Returns

The lookup query and a dict of arguments

classmethod transform(value: Any, *, to_type: Optional[typing_extensions.Literal[bool, str]] = 'str', **kwargs: Any) Any

Transform the result of a lookup into another datatype.

Last action taken in format_results(). If a lookup needs to handling transforming the data in a way that the base class can’t support it should overwrite this method of the base class to register different transform methods.

Parameters
  • value – What is to be transformed.

  • to_type – The type the value will be transformed into.

Returns

The transformed value.

class S3Key[source]

Bases: runway.lookups.handlers.base.LookupHandler

Lookup for AwsLambdaHook responses.

classmethod handle(value: str, context: Union[CfnginContext, RunwayContext], *args: Any, **kwargs: Any) str[source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters
  • value – Value to resolve.

  • context – The current context object.

Returns

Value that can be passed into CloudFormation property AWS::Lambda::Function.Code.S3Key or AWS::Lambda::LayerVersion.Content.S3Key.

__init__()
__new__(**kwargs)
classmethod dependencies(_LookupHandler__lookup_query: VariableValue) Set[str]

Calculate any dependencies required to perform this lookup.

Note that lookup_query may not be (completely) resolved at this time.

classmethod format_results(value: Any, get: Optional[str] = None, load: Optional[str] = None, transform: Optional[typing_extensions.Literal[bool, str]] = None, **kwargs: Any) Any

Format results to be returned by a lookup.

Parameters
  • value – Data collected by the Lookup.

  • get – Nested value to get from a dictionary like object.

  • load – Parser to use to parse a formatted string before the get and transform method.

  • transform – Convert the final value to a different data type before returning it.

Raises

TypeError – If get is provided but the value value is not a dictionary like object.

Runs the following actions in order:

  1. load() if load is provided.

  2. runway.util.MutableMap.find() or dict.get() depending on the data type if get is provided.

  3. Convert null value string to NoneType object. This includes string values of “None” and “null”. This conversion is case insensitive.

  4. transform() if transform is provided.

classmethod load(value: Any, parser: Optional[str] = None, **kwargs: Any) Any

Load a formatted string or object into a python data type.

First action taken in format_results(). If a lookup needs to handling loading data to process it before it enters format_results(), is should use args.pop('load') to prevent the data from being loaded twice.

Parameters
  • value – What is being loaded.

  • parser – Name of the parser to use.

Returns

The loaded value.

classmethod parse(value: str) Tuple[str, Dict[str, str]]

Parse the value passed to a lookup in a standardized way.

Parameters

value – The raw value passed to a lookup.

Returns

The lookup query and a dict of arguments

classmethod transform(value: Any, *, to_type: Optional[typing_extensions.Literal[bool, str]] = 'str', **kwargs: Any) Any

Transform the result of a lookup into another datatype.

Last action taken in format_results(). If a lookup needs to handling transforming the data in a way that the base class can’t support it should overwrite this method of the base class to register different transform methods.

Parameters
  • value – What is to be transformed.

  • to_type – The type the value will be transformed into.

Returns

The transformed value.

class S3ObjectVersion[source]

Bases: runway.lookups.handlers.base.LookupHandler

Lookup for AwsLambdaHook responses.

classmethod handle(value: str, context: Union[CfnginContext, RunwayContext], *args: Any, **kwargs: Any) Optional[str][source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters
  • value – Value to resolve.

  • context – The current context object.

Returns

Value that can be passed into CloudFormation property AWS::Lambda::Function.Code.S3ObjectVersion or AWS::Lambda::LayerVersion.Content.S3ObjectVersion.

__init__()
__new__(**kwargs)
classmethod dependencies(_LookupHandler__lookup_query: VariableValue) Set[str]

Calculate any dependencies required to perform this lookup.

Note that lookup_query may not be (completely) resolved at this time.

classmethod format_results(value: Any, get: Optional[str] = None, load: Optional[str] = None, transform: Optional[typing_extensions.Literal[bool, str]] = None, **kwargs: Any) Any

Format results to be returned by a lookup.

Parameters
  • value – Data collected by the Lookup.

  • get – Nested value to get from a dictionary like object.

  • load – Parser to use to parse a formatted string before the get and transform method.

  • transform – Convert the final value to a different data type before returning it.

Raises

TypeError – If get is provided but the value value is not a dictionary like object.

Runs the following actions in order:

  1. load() if load is provided.

  2. runway.util.MutableMap.find() or dict.get() depending on the data type if get is provided.

  3. Convert null value string to NoneType object. This includes string values of “None” and “null”. This conversion is case insensitive.

  4. transform() if transform is provided.

classmethod load(value: Any, parser: Optional[str] = None, **kwargs: Any) Any

Load a formatted string or object into a python data type.

First action taken in format_results(). If a lookup needs to handling loading data to process it before it enters format_results(), is should use args.pop('load') to prevent the data from being loaded twice.

Parameters
  • value – What is being loaded.

  • parser – Name of the parser to use.

Returns

The loaded value.

classmethod parse(value: str) Tuple[str, Dict[str, str]]

Parse the value passed to a lookup in a standardized way.

Parameters

value – The raw value passed to a lookup.

Returns

The lookup query and a dict of arguments

classmethod transform(value: Any, *, to_type: Optional[typing_extensions.Literal[bool, str]] = 'str', **kwargs: Any) Any

Transform the result of a lookup into another datatype.

Last action taken in format_results(). If a lookup needs to handling transforming the data in a way that the base class can’t support it should overwrite this method of the base class to register different transform methods.

Parameters
  • value – What is to be transformed.

  • to_type – The type the value will be transformed into.

Returns

The transformed value.

__init__()
__new__(**kwargs)
classmethod dependencies(_LookupHandler__lookup_query: VariableValue) Set[str]

Calculate any dependencies required to perform this lookup.

Note that lookup_query may not be (completely) resolved at this time.

classmethod format_results(value: Any, get: Optional[str] = None, load: Optional[str] = None, transform: Optional[typing_extensions.Literal[bool, str]] = None, **kwargs: Any) Any

Format results to be returned by a lookup.

Parameters
  • value – Data collected by the Lookup.

  • get – Nested value to get from a dictionary like object.

  • load – Parser to use to parse a formatted string before the get and transform method.

  • transform – Convert the final value to a different data type before returning it.

Raises

TypeError – If get is provided but the value value is not a dictionary like object.

Runs the following actions in order:

  1. load() if load is provided.

  2. runway.util.MutableMap.find() or dict.get() depending on the data type if get is provided.

  3. Convert null value string to NoneType object. This includes string values of “None” and “null”. This conversion is case insensitive.

  4. transform() if transform is provided.

classmethod load(value: Any, parser: Optional[str] = None, **kwargs: Any) Any

Load a formatted string or object into a python data type.

First action taken in format_results(). If a lookup needs to handling loading data to process it before it enters format_results(), is should use args.pop('load') to prevent the data from being loaded twice.

Parameters
  • value – What is being loaded.

  • parser – Name of the parser to use.

Returns

The loaded value.

classmethod parse(value: str) Tuple[str, Dict[str, str]]

Parse the value passed to a lookup in a standardized way.

Parameters

value – The raw value passed to a lookup.

Returns

The lookup query and a dict of arguments

classmethod transform(value: Any, *, to_type: Optional[typing_extensions.Literal[bool, str]] = 'str', **kwargs: Any) Any

Transform the result of a lookup into another datatype.

Last action taken in format_results(). If a lookup needs to handling transforming the data in a way that the base class can’t support it should overwrite this method of the base class to register different transform methods.

Parameters
  • value – What is to be transformed.

  • to_type – The type the value will be transformed into.

Returns

The transformed value.