runway.cfngin.lookups.handlers.file module

File lookup.

pydantic model runway.cfngin.lookups.handlers.file.ArgsDataModel[source]

Bases: BaseModel

Arguments data model.

Show JSON schema
{
   "title": "ArgsDataModel",
   "description": "Arguments data model.",
   "type": "object",
   "properties": {
      "codec": {
         "title": "Codec",
         "type": "string"
      }
   },
   "required": [
      "codec"
   ]
}

field codec: str = PydanticUndefined

Codec that will be used to parse and/or manipulate the data.

class runway.cfngin.lookups.handlers.file.FileLookup[source]

Bases: LookupHandler[Any]

File lookup.

TYPE_NAME: ClassVar[str] = 'file'

Name that the Lookup is registered as.

classmethod handle(value: str, *_args: Any, **_kwargs: Any) Any[source]

Translate a filename into the file contents.

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 match the expected regex.

runway.cfngin.lookups.handlers.file.json_codec(raw: str, parameterized: bool = False) Any[source]

JSON codec.

runway.cfngin.lookups.handlers.file.parameterized_codec(raw: str, b64: Literal[False] = False) GenericHelperFn[source]
runway.cfngin.lookups.handlers.file.parameterized_codec(raw: str, b64: Literal[True]) Base64

Parameterize a string, possibly encoding it as Base64 afterwards.

Parameters:
  • raw – String to be processed. Byte strings will be interpreted as UTF-8.

  • b64 – Whether to wrap the output in a Base64 CloudFormation call.

Returns:

Output to be included in a CloudFormation template.

Return type:

troposphere.AWSHelperFn

runway.cfngin.lookups.handlers.file.yaml_codec(raw: str, parameterized: bool = False) Any[source]

YAML codec.