runway.cfngin.lookups.handlers.dynamodb module¶
DynamoDB lookup.
- pydantic model runway.cfngin.lookups.handlers.dynamodb.ArgsDataModel[source]¶
Bases:
BaseModel
Arguments data model.
Show JSON schema
{ "title": "ArgsDataModel", "description": "Arguments data model.", "type": "object", "properties": { "region": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Region" } } }
- class runway.cfngin.lookups.handlers.dynamodb.DynamodbLookup[source]¶
Bases:
LookupHandler
[CfnginContext
]DynamoDB lookup.
- classmethod handle(value: str, context: runway.context.CfnginContext, *_DynamodbLookup__args: Any, **_DynamodbLookup__kwargs: Any) Any [source]¶
Get a value from a DynamoDB table.
- Parameters:
value – Parameter(s) given to this lookup.
[<region>:]<tablename>@<partitionkey>:<keyvalue>.<keyvalue>...
context – Context instance.
- Raises:
ValueError – The value provided to the lookup resulted in an error.
Note
The region is optional, and defaults to the environment’s
AWS_DEFAULT_REGION
if not specified.
- classmethod parse(value: str) tuple[str, ParsedArgsTypeDef] [source]¶
Parse the value passed to the lookup.
This overrides the default parsing to account for special requirements.
- Parameters:
value – The raw value passed to a lookup.
- Returns:
The lookup query and a dict of arguments
- Raises:
ValueError – The value provided does not appear to contain the name of a DynamoDB Table. The name of a Table is required.
- classmethod parse_query(value: str) QueryDataModel [source]¶
Parse query string to extract. Does not support arguments in
value
.- Raises:
ValueError – The argument provided does not match the expected format defined with a regex pattern.
- class runway.cfngin.lookups.handlers.dynamodb.ParsedLookupKey[source]¶
Bases:
TypedDict
Return value of _lookup_key_parse.
- pydantic model runway.cfngin.lookups.handlers.dynamodb.QueryDataModel[source]¶
Bases:
BaseModel
Arguments data model.
Show JSON schema
{ "title": "QueryDataModel", "description": "Arguments data model.", "type": "object", "properties": { "attribute": { "title": "Attribute", "type": "string" }, "partition_key": { "title": "Partition Key", "type": "string" }, "partition_key_value": { "title": "Partition Key Value", "type": "string" }, "table_name": { "title": "Table Name", "type": "string" } }, "required": [ "attribute", "partition_key", "partition_key_value", "table_name" ] }
- field attribute: str = PydanticUndefined¶
The attribute to be returned by this lookup. Supports additional syntax to retrieve a nested value.
- property item_key: dict[str, AttributeValueTypeDef]¶
Value to pass to boto3
.get_item()
call as theKey
argument.- Raises:
ValueError – The value of
partition_key_value
doesn’t match the required regex and so it can’t be parsed.