Skip to content

factory

pyvider.schema.factory

TODO: Add module docstring.

Classes

Functions

a_null

a_null(
    schema_builder: PvsAttribute | PvsSchema,
) -> CtyValue

Creates a null CtyValue for a given schema attribute or object.

Source code in pyvider/schema/factory.py
def a_null(schema_builder: PvsAttribute | PvsSchema) -> CtyValue:
    """Creates a null CtyValue for a given schema attribute or object."""
    target_type: CtyType | None = None
    if isinstance(schema_builder, PvsAttribute):
        target_type = schema_builder.type
    elif isinstance(schema_builder, PvsSchema):
        target_type = schema_builder.block.to_cty_type()

    if target_type is None:
        raise TypeError("a_null() expects a schema builder instance like a_str() or s_resource()")
    return CtyValue.null(target_type)

a_unknown

a_unknown(
    schema_builder: PvsAttribute | PvsSchema,
) -> CtyValue

Creates an unknown CtyValue for a given schema attribute or object.

Source code in pyvider/schema/factory.py
def a_unknown(schema_builder: PvsAttribute | PvsSchema) -> CtyValue:
    """Creates an unknown CtyValue for a given schema attribute or object."""
    target_type: CtyType | None = None
    if isinstance(schema_builder, PvsAttribute):
        target_type = schema_builder.type
    elif isinstance(schema_builder, PvsSchema):
        target_type = schema_builder.block.to_cty_type()

    if target_type is None:
        raise TypeError("a_unknown() expects a schema builder instance like a_str() or s_resource()")
    return CtyValue.unknown(target_type)