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: LookupHandler[CfnginContext]

Lookup for AwsLambdaHook responses.

class Code[source]

Bases: LookupHandler[CfnginContext]

Lookup for AwsLambdaHook responses.

TYPE_NAME: ClassVar[str] = 'awslambda.Code'

Name that the Lookup is registered as.

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

Retrieve metadata for an AWS Lambda deployment package.

Parameters:
  • value – Value to resolve.

  • context – The current context object.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

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

class CodeSha256[source]

Bases: LookupHandler[CfnginContext]

Lookup for AwsLambdaHook responses.

TYPE_NAME: ClassVar[str] = 'awslambda.CodeSha256'

Name that the Lookup is registered as.

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

Retrieve metadata for an AWS Lambda deployment package.

Parameters:
  • value – Value to resolve.

  • context – The current context object.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

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

class CompatibleArchitectures[source]

Bases: LookupHandler[CfnginContext]

Lookup for AwsLambdaHook responses.

TYPE_NAME: ClassVar[str] = 'awslambda.CompatibleArchitectures'

Name that the Lookup is registered as.

classmethod handle(value: str, context: runway.context.CfnginContext, *args: Any, **kwargs: Any) list[str] | None[source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters:
  • value – Value to resolve.

  • context – The current context object.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

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

class CompatibleRuntimes[source]

Bases: LookupHandler[CfnginContext]

Lookup for AwsLambdaHook responses.

TYPE_NAME: ClassVar[str] = 'awslambda.CompatibleRuntimes'

Name that the Lookup is registered as.

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

Retrieve metadata for an AWS Lambda deployment package.

Parameters:
  • value – Value to resolve.

  • context – The current context object.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

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

class Content[source]

Bases: LookupHandler[CfnginContext]

Lookup for AwsLambdaHook responses.

TYPE_NAME: ClassVar[str] = 'awslambda.Content'

Name that the Lookup is registered as.

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

Retrieve metadata for an AWS Lambda deployment package.

Parameters:
  • value – Value to resolve.

  • context – The current context object.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

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

class LicenseInfo[source]

Bases: LookupHandler[CfnginContext]

Lookup for AwsLambdaHook responses.

TYPE_NAME: ClassVar[str] = 'awslambda.LicenseInfo'

Name that the Lookup is registered as.

classmethod handle(value: str, context: runway.context.CfnginContext, *args: Any, **kwargs: Any) str | None[source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters:
  • value – Value to resolve.

  • context – The current context object.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

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

class Runtime[source]

Bases: LookupHandler[CfnginContext]

Lookup for AwsLambdaHook responses.

TYPE_NAME: ClassVar[str] = 'awslambda.Runtime'

Name that the Lookup is registered as.

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

Retrieve metadata for an AWS Lambda deployment package.

Parameters:
  • value – Value to resolve.

  • context – The current context object.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

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

class S3Bucket[source]

Bases: LookupHandler[CfnginContext]

Lookup for AwsLambdaHook responses.

TYPE_NAME: ClassVar[str] = 'awslambda.S3Bucket'

Name that the Lookup is registered as.

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

Retrieve metadata for an AWS Lambda deployment package.

Parameters:
  • value – Value to resolve.

  • context – The current context object.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

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

class S3Key[source]

Bases: LookupHandler[CfnginContext]

Lookup for AwsLambdaHook responses.

TYPE_NAME: ClassVar[str] = 'awslambda.S3Key'

Name that the Lookup is registered as.

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

Retrieve metadata for an AWS Lambda deployment package.

Parameters:
  • value – Value to resolve.

  • context – The current context object.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

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

class S3ObjectVersion[source]

Bases: LookupHandler[CfnginContext]

Lookup for AwsLambdaHook responses.

TYPE_NAME: ClassVar[str] = 'awslambda.S3ObjectVersion'

Name that the Lookup is registered as.

classmethod handle(value: str, context: runway.context.CfnginContext, *args: Any, **kwargs: Any) str | None[source]

Retrieve metadata for an AWS Lambda deployment package.

Parameters:
  • value – Value to resolve.

  • context – The current context object.

  • *args – Variable length argument list.

  • **kwargs – Arbitrary keyword arguments.

Returns:

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

TYPE_NAME: ClassVar[str] = 'awslambda'

Name that the Lookup is registered as.

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: CfnginContext, **_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.