Skip to content

Index

๐Ÿค– AI-Generated Content

This documentation was generated with AI assistance and is still being audited. Some, or potentially a lot, of this information may be inaccurate. Learn more.

pyvider.protocols.tfprotov6.handlers

Functions

ApplyResourceChangeHandler async

ApplyResourceChangeHandler(
    request: Request, context: Any
) -> pb.ApplyResourceChange.Response

Handle apply resource change request with metrics collection.

Source code in pyvider/protocols/tfprotov6/handlers/apply_resource_change.py
@resilient()
async def ApplyResourceChangeHandler(
    request: pb.ApplyResourceChange.Request, context: Any
) -> pb.ApplyResourceChange.Response:
    """Handle apply resource change request with metrics collection."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="ApplyResourceChange")

    try:
        return await _apply_resource_change_impl(request, context)
    except Exception:
        handler_errors.inc(handler="ApplyResourceChange")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="ApplyResourceChange")

CallFunctionHandler async

CallFunctionHandler(
    request: Request, context: Any
) -> pb.CallFunction.Response

Handles the CallFunction RPC request, acting as a robust dispatcher.

Source code in pyvider/protocols/tfprotov6/handlers/call_function.py
@resilient()
async def CallFunctionHandler(request: pb.CallFunction.Request, context: Any) -> pb.CallFunction.Response:
    """
    Handles the CallFunction RPC request, acting as a robust dispatcher.
    """
    start_time = time.perf_counter()
    handler_requests.inc(handler="CallFunction")

    try:
        return await _call_function_impl(request, context)
    except Exception:
        handler_errors.inc(handler="CallFunction")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="CallFunction")

CloseEphemeralResourceHandler async

CloseEphemeralResourceHandler(
    request: Request, context: Any
) -> pb.CloseEphemeralResource.Response

Handles closing an ephemeral resource.

Source code in pyvider/protocols/tfprotov6/handlers/close_ephemeral_resource.py
@resilient()
async def CloseEphemeralResourceHandler(
    request: pb.CloseEphemeralResource.Request, context: Any
) -> pb.CloseEphemeralResource.Response:
    """Handles closing an ephemeral resource."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="CloseEphemeralResource")

    try:
        return await _close_ephemeral_resource_impl(request, context)
    except Exception:
        handler_errors.inc(handler="CloseEphemeralResource")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="CloseEphemeralResource")

ConfigureProviderHandler async

ConfigureProviderHandler(
    request: Request, context: Any
) -> pb.ConfigureProvider.Response

Handles the ConfigureProvider RPC request.

This handler validates the provider configuration sent by Terraform and initializes the provider context, making it available for all subsequent component operations.

Source code in pyvider/protocols/tfprotov6/handlers/configure_provider.py
@resilient()
async def ConfigureProviderHandler(
    request: pb.ConfigureProvider.Request, context: Any
) -> pb.ConfigureProvider.Response:
    """
    Handles the ConfigureProvider RPC request.

    This handler validates the provider configuration sent by Terraform
    and initializes the provider context, making it available for all
    subsequent component operations.
    """
    start_time = time.perf_counter()
    handler_requests.inc(handler="ConfigureProvider")

    try:
        return await _configure_provider_impl(request, context)
    except Exception:
        handler_errors.inc(handler="ConfigureProvider")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="ConfigureProvider")

GetFunctionsHandler async

GetFunctionsHandler(
    request: Request, context: Any
) -> pb.GetFunctions.Response

Handle GetFunctions requests by returning all registered functions. This now uses a cached result to improve performance and reduce log noise.

Source code in pyvider/protocols/tfprotov6/handlers/get_functions.py
@resilient()
async def GetFunctionsHandler(request: pb.GetFunctions.Request, context: Any) -> pb.GetFunctions.Response:
    """
    Handle GetFunctions requests by returning all registered functions.
    This now uses a cached result to improve performance and reduce log noise.
    """
    start_time = time.perf_counter()
    handler_requests.inc(handler="GetFunctions")

    try:
        return await _get_functions_impl(request, context)
    except Exception:
        handler_errors.inc(handler="GetFunctions")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="GetFunctions")

GetMetadataHandler async

GetMetadataHandler(
    request: Request, context: Any
) -> pb.GetMetadata.Response

Get provider metadata with dynamically discovered resources.

Source code in pyvider/protocols/tfprotov6/handlers/get_metadata.py
@resilient()
async def GetMetadataHandler(request: pb.GetMetadata.Request, context: Any) -> pb.GetMetadata.Response:
    """Get provider metadata with dynamically discovered resources."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="GetMetadata")

    try:
        return await _get_metadata_impl(request, context)
    except Exception:
        handler_errors.inc(handler="GetMetadata")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="GetMetadata")

GetProviderSchemaHandler async

GetProviderSchemaHandler(
    request: Request, context: Any
) -> pb.GetProviderSchema.Response

Handles the GetProviderSchema RPC request using a robust, race-condition-free asyncio.Future to ensure the schema is computed only once.

Source code in pyvider/protocols/tfprotov6/handlers/get_provider_schema.py
@resilient()
async def GetProviderSchemaHandler(
    request: pb.GetProviderSchema.Request, context: Any
) -> pb.GetProviderSchema.Response:
    """
    Handles the GetProviderSchema RPC request using a robust, race-condition-free
    asyncio.Future to ensure the schema is computed only once.
    """
    start_time = time.perf_counter()
    handler_requests.inc(handler="GetProviderSchema")

    try:
        return await _get_provider_schema_impl(request, context)
    except Exception:
        handler_errors.inc(handler="GetProviderSchema")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="GetProviderSchema")

ImportResourceStateHandler async

ImportResourceStateHandler(
    request: Request, context: Any
) -> pb.ImportResourceState.Response

Handle import resource state request.

Source code in pyvider/protocols/tfprotov6/handlers/import_resource_state.py
@resilient()
async def ImportResourceStateHandler(
    request: pb.ImportResourceState.Request, context: Any
) -> pb.ImportResourceState.Response:
    """Handle import resource state request."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="ImportResourceState")

    try:
        return await _import_resource_state_impl(request, context)
    except Exception:
        handler_errors.inc(handler="ImportResourceState")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="ImportResourceState")

MoveResourceStateHandler async

MoveResourceStateHandler(
    request: Request, context: Any
) -> pb.MoveResourceState.Response

Handle move resource state request.

Source code in pyvider/protocols/tfprotov6/handlers/move_resource_state.py
@resilient()
async def MoveResourceStateHandler(
    request: pb.MoveResourceState.Request, context: Any
) -> pb.MoveResourceState.Response:
    """Handle move resource state request."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="MoveResourceState")

    try:
        return await _move_resource_state_impl(request, context)
    except Exception:
        handler_errors.inc(handler="MoveResourceState")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="MoveResourceState")

OpenEphemeralResourceHandler async

OpenEphemeralResourceHandler(
    request: Request, context: Any
) -> pb.OpenEphemeralResource.Response

Handles opening an ephemeral resource.

Source code in pyvider/protocols/tfprotov6/handlers/open_ephemeral_resource.py
@resilient()
async def OpenEphemeralResourceHandler(
    request: pb.OpenEphemeralResource.Request, context: Any
) -> pb.OpenEphemeralResource.Response:
    """Handles opening an ephemeral resource."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="OpenEphemeralResource")

    try:
        return await _open_ephemeral_resource_impl(request, context)
    except Exception:
        handler_errors.inc(handler="OpenEphemeralResource")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="OpenEphemeralResource")

PlanResourceChangeHandler async

PlanResourceChangeHandler(
    request: Request, context: Any
) -> pb.PlanResourceChange.Response

Handle plan resource change request.

Source code in pyvider/protocols/tfprotov6/handlers/plan_resource_change.py
@resilient()
async def PlanResourceChangeHandler(
    request: pb.PlanResourceChange.Request, context: Any
) -> pb.PlanResourceChange.Response:
    """Handle plan resource change request."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="PlanResourceChange")

    try:
        return await _plan_resource_change_impl(request, context)
    except Exception:
        handler_errors.inc(handler="PlanResourceChange")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="PlanResourceChange")

ReadDataSourceHandler async

ReadDataSourceHandler(
    request: Request, context: Any
) -> pb.ReadDataSource.Response

Handle read data source request.

Source code in pyvider/protocols/tfprotov6/handlers/read_data_source.py
@resilient()
async def ReadDataSourceHandler(
    request: pb.ReadDataSource.Request, context: Any
) -> pb.ReadDataSource.Response:
    """Handle read data source request."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="ReadDataSource")

    try:
        return await _read_data_source_impl(request, context)
    except Exception:
        handler_errors.inc(handler="ReadDataSource")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="ReadDataSource")

ReadResourceHandler async

ReadResourceHandler(
    request: Request, context: Any
) -> pb.ReadResource.Response

Handle read resource request.

Source code in pyvider/protocols/tfprotov6/handlers/read_resource.py
@resilient()
async def ReadResourceHandler(request: pb.ReadResource.Request, context: Any) -> pb.ReadResource.Response:
    """Handle read resource request."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="ReadResource")

    try:
        return await _read_resource_impl(request, context)
    except Exception:
        handler_errors.inc(handler="ReadResource")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="ReadResource")

RenewEphemeralResourceHandler async

RenewEphemeralResourceHandler(
    request: Request, context: Any
) -> pb.RenewEphemeralResource.Response

Handles renewing an ephemeral resource's lease.

Source code in pyvider/protocols/tfprotov6/handlers/renew_ephemeral_resource.py
@resilient()
async def RenewEphemeralResourceHandler(
    request: pb.RenewEphemeralResource.Request, context: Any
) -> pb.RenewEphemeralResource.Response:
    """Handles renewing an ephemeral resource's lease."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="RenewEphemeralResource")

    try:
        return await _renew_ephemeral_resource_impl(request, context)
    except Exception:
        handler_errors.inc(handler="RenewEphemeralResource")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="RenewEphemeralResource")

StopProviderHandler async

StopProviderHandler(
    request: Request, context: Any
) -> pb.StopProvider.Response

Handles the StopProvider RPC call from Terraform Core. This is the primary mechanism for Terraform to request a graceful plugin exit.

Source code in pyvider/protocols/tfprotov6/handlers/stop_provider.py
@resilient()
async def StopProviderHandler(request: pb.StopProvider.Request, context: Any) -> pb.StopProvider.Response:
    """
    Handles the StopProvider RPC call from Terraform Core.
    This is the primary mechanism for Terraform to request a graceful plugin exit.
    """
    start_time = time.perf_counter()
    handler_requests.inc(handler="StopProvider")

    try:
        return await _stop_provider_impl(request, context)
    except Exception:
        handler_errors.inc(handler="StopProvider")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="StopProvider")

UpgradeResourceStateHandler async

UpgradeResourceStateHandler(
    request: Request, context: Any
) -> pb.UpgradeResourceState.Response

Handle UpgradeResourceState requests. For now, this is a pass-through as we are not implementing schema versioning. It must return the state it was given, unmodified.

Source code in pyvider/protocols/tfprotov6/handlers/upgrade_resource_state.py
@resilient()
async def UpgradeResourceStateHandler(
    request: pb.UpgradeResourceState.Request, context: Any
) -> pb.UpgradeResourceState.Response:
    """
    Handle UpgradeResourceState requests. For now, this is a pass-through
    as we are not implementing schema versioning. It must return the state
    it was given, unmodified.
    """
    start_time = time.perf_counter()
    handler_requests.inc(handler="UpgradeResourceState")

    try:
        return await _upgrade_resource_state_impl(request, context)
    except Exception:
        handler_errors.inc(handler="UpgradeResourceState")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="UpgradeResourceState")

ValidateDataResourceConfigHandler async

ValidateDataResourceConfigHandler(
    request: Request, context: Any
) -> pb.ValidateDataResourceConfig.Response

Handle validate data resource config request.

Source code in pyvider/protocols/tfprotov6/handlers/validate_data_resource_config.py
@resilient()
async def ValidateDataResourceConfigHandler(
    request: pb.ValidateDataResourceConfig.Request, context: Any
) -> pb.ValidateDataResourceConfig.Response:
    """Handle validate data resource config request."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="ValidateDataResourceConfig")

    try:
        return await _validate_data_resource_config_impl(request, context)
    except Exception:
        handler_errors.inc(handler="ValidateDataResourceConfig")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="ValidateDataResourceConfig")

ValidateEphemeralResourceConfigHandler async

ValidateEphemeralResourceConfigHandler(
    request: Request, context: Any
) -> pb.ValidateEphemeralResourceConfig.Response

Handles validation of an ephemeral resource's configuration.

Source code in pyvider/protocols/tfprotov6/handlers/validate_ephemeral_resource_config.py
@resilient()
async def ValidateEphemeralResourceConfigHandler(
    request: pb.ValidateEphemeralResourceConfig.Request, context: Any
) -> pb.ValidateEphemeralResourceConfig.Response:
    """Handles validation of an ephemeral resource's configuration."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="ValidateEphemeralResourceConfig")

    try:
        return await _validate_ephemeral_resource_config_impl(request, context)
    except Exception:
        handler_errors.inc(handler="ValidateEphemeralResourceConfig")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="ValidateEphemeralResourceConfig")

ValidateProviderConfigHandler async

ValidateProviderConfigHandler(
    request: Request, context: Any
) -> pb.ValidateProviderConfig.Response

Handle ValidateProviderConfig requests.

Source code in pyvider/protocols/tfprotov6/handlers/validate_provider_config.py
@resilient()
async def ValidateProviderConfigHandler(
    request: pb.ValidateProviderConfig.Request, context: Any
) -> pb.ValidateProviderConfig.Response:
    """Handle ValidateProviderConfig requests."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="ValidateProviderConfig")

    try:
        return await _validate_provider_config_impl(request, context)
    except Exception:
        handler_errors.inc(handler="ValidateProviderConfig")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="ValidateProviderConfig")

ValidateResourceConfigHandler async

ValidateResourceConfigHandler(
    request: Request, context: Any
) -> pb.ValidateResourceConfig.Response

Handle validate resource config request.

Source code in pyvider/protocols/tfprotov6/handlers/validate_resource_config.py
@resilient()
async def ValidateResourceConfigHandler(
    request: pb.ValidateResourceConfig.Request, context: Any
) -> pb.ValidateResourceConfig.Response:
    """Handle validate resource config request."""
    start_time = time.perf_counter()
    handler_requests.inc(handler="ValidateResourceConfig")

    try:
        return await _validate_resource_config_impl(request, context)
    except Exception:
        handler_errors.inc(handler="ValidateResourceConfig")
        raise
    finally:
        duration = time.perf_counter() - start_time
        handler_duration.observe(duration, handler="ValidateResourceConfig")