def _toml_table_to_layer_build_definition( uuid: str, toml_table: tomlkit.items.Table) -> "LayerBuildDefinition": """ Converts given toml table into LayerBuildDefinition instance Parameters ---------- uuid: str key of the toml_table instance toml_table: tomlkit.items.Table layer build definition as toml table Returns ------- LayerBuildDefinition LayerBuildDefinition of given toml table """ layer_build_definition = LayerBuildDefinition( toml_table[LAYER_NAME_FIELD], toml_table[CODE_URI_FIELD], toml_table[BUILD_METHOD_FIELD], toml_table[COMPATIBLE_RUNTIMES_FIELD], toml_table.get(SOURCE_MD5_FIELD, ""), dict(toml_table.get(ENV_VARS_FIELD, {})), ) layer_build_definition.uuid = uuid return layer_build_definition
def _toml_table_to_function_build_definition( uuid: str, toml_table: tomlkit.items.Table) -> "FunctionBuildDefinition": """ Converts given toml table into FunctionBuildDefinition instance Parameters ---------- uuid: str key of the function toml_table instance toml_table: tomlkit.items.Table function build definition as toml table Returns ------- FunctionBuildDefinition FunctionBuildDefinition of given toml table """ function_build_definition = FunctionBuildDefinition( toml_table.get(RUNTIME_FIELD), toml_table.get(CODE_URI_FIELD), toml_table.get(PACKAGETYPE_FIELD, ZIP), dict(toml_table.get(METADATA_FIELD, {})), toml_table.get(SOURCE_MD5_FIELD, ""), ) function_build_definition.uuid = uuid return function_build_definition