# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import warnings

from kessel.inventory.v1beta2 import check_for_update_request_pb2 as kessel_dot_inventory_dot_v1beta2_dot_check__for__update__request__pb2
from kessel.inventory.v1beta2 import check_for_update_response_pb2 as kessel_dot_inventory_dot_v1beta2_dot_check__for__update__response__pb2
from kessel.inventory.v1beta2 import check_request_pb2 as kessel_dot_inventory_dot_v1beta2_dot_check__request__pb2
from kessel.inventory.v1beta2 import check_response_pb2 as kessel_dot_inventory_dot_v1beta2_dot_check__response__pb2
from kessel.inventory.v1beta2 import delete_resource_request_pb2 as kessel_dot_inventory_dot_v1beta2_dot_delete__resource__request__pb2
from kessel.inventory.v1beta2 import delete_resource_response_pb2 as kessel_dot_inventory_dot_v1beta2_dot_delete__resource__response__pb2
from kessel.inventory.v1beta2 import report_resource_request_pb2 as kessel_dot_inventory_dot_v1beta2_dot_report__resource__request__pb2
from kessel.inventory.v1beta2 import report_resource_response_pb2 as kessel_dot_inventory_dot_v1beta2_dot_report__resource__response__pb2
from kessel.inventory.v1beta2 import streamed_list_objects_request_pb2 as kessel_dot_inventory_dot_v1beta2_dot_streamed__list__objects__request__pb2
from kessel.inventory.v1beta2 import streamed_list_objects_response_pb2 as kessel_dot_inventory_dot_v1beta2_dot_streamed__list__objects__response__pb2

GRPC_GENERATED_VERSION = '1.73.0'
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower
    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + f' but the generated code in kessel/inventory/v1beta2/inventory_service_pb2_grpc.py depends on'
        + f' grpcio>={GRPC_GENERATED_VERSION}.'
        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
    )


class KesselInventoryServiceStub(object):
    """KesselInventoryService provides APIs to perform relationship checks
    and manage inventory resource lifecycles (reporting and deletion).
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.Check = channel.unary_unary(
                '/kessel.inventory.v1beta2.KesselInventoryService/Check',
                request_serializer=kessel_dot_inventory_dot_v1beta2_dot_check__request__pb2.CheckRequest.SerializeToString,
                response_deserializer=kessel_dot_inventory_dot_v1beta2_dot_check__response__pb2.CheckResponse.FromString,
                _registered_method=True)
        self.CheckForUpdate = channel.unary_unary(
                '/kessel.inventory.v1beta2.KesselInventoryService/CheckForUpdate',
                request_serializer=kessel_dot_inventory_dot_v1beta2_dot_check__for__update__request__pb2.CheckForUpdateRequest.SerializeToString,
                response_deserializer=kessel_dot_inventory_dot_v1beta2_dot_check__for__update__response__pb2.CheckForUpdateResponse.FromString,
                _registered_method=True)
        self.ReportResource = channel.unary_unary(
                '/kessel.inventory.v1beta2.KesselInventoryService/ReportResource',
                request_serializer=kessel_dot_inventory_dot_v1beta2_dot_report__resource__request__pb2.ReportResourceRequest.SerializeToString,
                response_deserializer=kessel_dot_inventory_dot_v1beta2_dot_report__resource__response__pb2.ReportResourceResponse.FromString,
                _registered_method=True)
        self.DeleteResource = channel.unary_unary(
                '/kessel.inventory.v1beta2.KesselInventoryService/DeleteResource',
                request_serializer=kessel_dot_inventory_dot_v1beta2_dot_delete__resource__request__pb2.DeleteResourceRequest.SerializeToString,
                response_deserializer=kessel_dot_inventory_dot_v1beta2_dot_delete__resource__response__pb2.DeleteResourceResponse.FromString,
                _registered_method=True)
        self.StreamedListObjects = channel.unary_stream(
                '/kessel.inventory.v1beta2.KesselInventoryService/StreamedListObjects',
                request_serializer=kessel_dot_inventory_dot_v1beta2_dot_streamed__list__objects__request__pb2.StreamedListObjectsRequest.SerializeToString,
                response_deserializer=kessel_dot_inventory_dot_v1beta2_dot_streamed__list__objects__response__pb2.StreamedListObjectsResponse.FromString,
                _registered_method=True)


class KesselInventoryServiceServicer(object):
    """KesselInventoryService provides APIs to perform relationship checks
    and manage inventory resource lifecycles (reporting and deletion).
    """

    def Check(self, request, context):
        """Performs an relationship check to determine whether a subject has a specific
        permission or relationship on a resource.

        This API evaluates whether the provided subject is a member of the specified relation
        (e.g., "viewer", "editor", "admin") on the target object. It answers the question:
        "Does subject *X* have relation *Y* on object *Z*?"

        Common use cases include enforcing read access, conditional UI visibility,
        or authorization gating for downstream API calls.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def CheckForUpdate(self, request, context):
        """Performs a strongly consistent relationship check to determine whether a subject
        has a specific relation to an object (representing, for example, a permission).

        This API answers the question:
        "Is subject *X* currently authorized to update or modify resource *Y*?"
        Unlike the basic `Check` endpoint, this method guarantees a fully up-to-date
        view of the relationship state (e.g., not relying on cached or eventually consistent data).

        It is intended to be used just prior to sensitive operation (e.g., update, delete)
        which depend on the current state of the relationship.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ReportResource(self, request, context):
        """Reports to Kessel Inventory that a Resource has been created or has been updated.

        Reporters can use this API to report facts about their resources in order to
        facilitate integration, correlation, and access control.

        Each call can include:
        - Reporter-specific attributes and relationships (`representations.reporter`)
        - Shared attributes and relationships common to all reporters (`representations.common`)
        - Identifiers and metadata that allow correlation to an existing resource

        Multiple reporters may report representations for the same resource.
        Kessel Inventory correlates these
        based on correlation keys provided for a given resource type

        All versions of your reported facts will be retained and can be queried as needed

        The relationships reported through this API are used to determine relationship check outcomes
        via the Check and CheckForUpdate APIs.

        Reporters are responsible for ensuring delivery guarantees and message ordering
        appropriate to the sensitivity and consistency needs of their use case.

        This API does **not** guarantee immediate read-your-writes consistency by default.
        If a reporter requires newly submitted resources or relationships to be visible
        in subsequent checks (e.g., `Check`), the request must explicitly set
        `write_visibility = IMMEDIATE`.


        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def DeleteResource(self, request, context):
        """Reports to Kessel Inventory that a Reporter's representation of a Resource has been deleted.

        This operation is typically used when a resource has been decommissioned or
        is no longer reported by any authorized system.

        As a result, relationship checks performed via the `Check` and
        `CheckForUpdate` APIs will no longer resolve positively for the deleted
        resource. Any decisions that depend on relationships tied to
        this resource will be affected.

        As an example, it can revoke previously granted access across the system.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def StreamedListObjects(self, request, context):
        """Streams a list of objects where the given subject has the specified relation.

        This relationship query answers the question:
        "Which objects of type *X* does subject *Y* have the *Z* relation to?"

        It is often used to power user-facing dashboards, filtered UIs, or policy-driven
        access lists. The result is streamed incrementally to support large datasets and
        reduce client-side latency or memory pressure.

        Pagination and consistency controls allow fine-tuned performance and data freshness.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_KesselInventoryServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Check': grpc.unary_unary_rpc_method_handler(
                    servicer.Check,
                    request_deserializer=kessel_dot_inventory_dot_v1beta2_dot_check__request__pb2.CheckRequest.FromString,
                    response_serializer=kessel_dot_inventory_dot_v1beta2_dot_check__response__pb2.CheckResponse.SerializeToString,
            ),
            'CheckForUpdate': grpc.unary_unary_rpc_method_handler(
                    servicer.CheckForUpdate,
                    request_deserializer=kessel_dot_inventory_dot_v1beta2_dot_check__for__update__request__pb2.CheckForUpdateRequest.FromString,
                    response_serializer=kessel_dot_inventory_dot_v1beta2_dot_check__for__update__response__pb2.CheckForUpdateResponse.SerializeToString,
            ),
            'ReportResource': grpc.unary_unary_rpc_method_handler(
                    servicer.ReportResource,
                    request_deserializer=kessel_dot_inventory_dot_v1beta2_dot_report__resource__request__pb2.ReportResourceRequest.FromString,
                    response_serializer=kessel_dot_inventory_dot_v1beta2_dot_report__resource__response__pb2.ReportResourceResponse.SerializeToString,
            ),
            'DeleteResource': grpc.unary_unary_rpc_method_handler(
                    servicer.DeleteResource,
                    request_deserializer=kessel_dot_inventory_dot_v1beta2_dot_delete__resource__request__pb2.DeleteResourceRequest.FromString,
                    response_serializer=kessel_dot_inventory_dot_v1beta2_dot_delete__resource__response__pb2.DeleteResourceResponse.SerializeToString,
            ),
            'StreamedListObjects': grpc.unary_stream_rpc_method_handler(
                    servicer.StreamedListObjects,
                    request_deserializer=kessel_dot_inventory_dot_v1beta2_dot_streamed__list__objects__request__pb2.StreamedListObjectsRequest.FromString,
                    response_serializer=kessel_dot_inventory_dot_v1beta2_dot_streamed__list__objects__response__pb2.StreamedListObjectsResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'kessel.inventory.v1beta2.KesselInventoryService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('kessel.inventory.v1beta2.KesselInventoryService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class KesselInventoryService(object):
    """KesselInventoryService provides APIs to perform relationship checks
    and manage inventory resource lifecycles (reporting and deletion).
    """

    @staticmethod
    def Check(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/kessel.inventory.v1beta2.KesselInventoryService/Check',
            kessel_dot_inventory_dot_v1beta2_dot_check__request__pb2.CheckRequest.SerializeToString,
            kessel_dot_inventory_dot_v1beta2_dot_check__response__pb2.CheckResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def CheckForUpdate(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/kessel.inventory.v1beta2.KesselInventoryService/CheckForUpdate',
            kessel_dot_inventory_dot_v1beta2_dot_check__for__update__request__pb2.CheckForUpdateRequest.SerializeToString,
            kessel_dot_inventory_dot_v1beta2_dot_check__for__update__response__pb2.CheckForUpdateResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ReportResource(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/kessel.inventory.v1beta2.KesselInventoryService/ReportResource',
            kessel_dot_inventory_dot_v1beta2_dot_report__resource__request__pb2.ReportResourceRequest.SerializeToString,
            kessel_dot_inventory_dot_v1beta2_dot_report__resource__response__pb2.ReportResourceResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def DeleteResource(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/kessel.inventory.v1beta2.KesselInventoryService/DeleteResource',
            kessel_dot_inventory_dot_v1beta2_dot_delete__resource__request__pb2.DeleteResourceRequest.SerializeToString,
            kessel_dot_inventory_dot_v1beta2_dot_delete__resource__response__pb2.DeleteResourceResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def StreamedListObjects(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_stream(
            request,
            target,
            '/kessel.inventory.v1beta2.KesselInventoryService/StreamedListObjects',
            kessel_dot_inventory_dot_v1beta2_dot_streamed__list__objects__request__pb2.StreamedListObjectsRequest.SerializeToString,
            kessel_dot_inventory_dot_v1beta2_dot_streamed__list__objects__response__pb2.StreamedListObjectsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
