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

from yandex.cloud.mdb.postgresql.v1 import perf_diag_service_pb2 as yandex_dot_cloud_dot_mdb_dot_postgresql_dot_v1_dot_perf__diag__service__pb2


class PerformanceDiagnosticsServiceStub(object):
    """A set of methods for PostgreSQL performance diagnostics.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.ListRawSessionStates = channel.unary_unary(
                '/yandex.cloud.mdb.postgresql.v1.PerformanceDiagnosticsService/ListRawSessionStates',
                request_serializer=yandex_dot_cloud_dot_mdb_dot_postgresql_dot_v1_dot_perf__diag__service__pb2.ListRawSessionStatesRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_mdb_dot_postgresql_dot_v1_dot_perf__diag__service__pb2.ListRawSessionStatesResponse.FromString,
                )
        self.ListRawStatements = channel.unary_unary(
                '/yandex.cloud.mdb.postgresql.v1.PerformanceDiagnosticsService/ListRawStatements',
                request_serializer=yandex_dot_cloud_dot_mdb_dot_postgresql_dot_v1_dot_perf__diag__service__pb2.ListRawStatementsRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_mdb_dot_postgresql_dot_v1_dot_perf__diag__service__pb2.ListRawStatementsResponse.FromString,
                )


class PerformanceDiagnosticsServiceServicer(object):
    """A set of methods for PostgreSQL performance diagnostics.
    """

    def ListRawSessionStates(self, request, context):
        """Retrieves raw statistics on sessions. Corresponds to the [pg_stat_activity view](https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ListRawStatements(self, request, context):
        """Retrieves statistics on planning and execution of SQL statements (queries).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_PerformanceDiagnosticsServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'ListRawSessionStates': grpc.unary_unary_rpc_method_handler(
                    servicer.ListRawSessionStates,
                    request_deserializer=yandex_dot_cloud_dot_mdb_dot_postgresql_dot_v1_dot_perf__diag__service__pb2.ListRawSessionStatesRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_mdb_dot_postgresql_dot_v1_dot_perf__diag__service__pb2.ListRawSessionStatesResponse.SerializeToString,
            ),
            'ListRawStatements': grpc.unary_unary_rpc_method_handler(
                    servicer.ListRawStatements,
                    request_deserializer=yandex_dot_cloud_dot_mdb_dot_postgresql_dot_v1_dot_perf__diag__service__pb2.ListRawStatementsRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_mdb_dot_postgresql_dot_v1_dot_perf__diag__service__pb2.ListRawStatementsResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'yandex.cloud.mdb.postgresql.v1.PerformanceDiagnosticsService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class PerformanceDiagnosticsService(object):
    """A set of methods for PostgreSQL performance diagnostics.
    """

    @staticmethod
    def ListRawSessionStates(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, '/yandex.cloud.mdb.postgresql.v1.PerformanceDiagnosticsService/ListRawSessionStates',
            yandex_dot_cloud_dot_mdb_dot_postgresql_dot_v1_dot_perf__diag__service__pb2.ListRawSessionStatesRequest.SerializeToString,
            yandex_dot_cloud_dot_mdb_dot_postgresql_dot_v1_dot_perf__diag__service__pb2.ListRawSessionStatesResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def ListRawStatements(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, '/yandex.cloud.mdb.postgresql.v1.PerformanceDiagnosticsService/ListRawStatements',
            yandex_dot_cloud_dot_mdb_dot_postgresql_dot_v1_dot_perf__diag__service__pb2.ListRawStatementsRequest.SerializeToString,
            yandex_dot_cloud_dot_mdb_dot_postgresql_dot_v1_dot_perf__diag__service__pb2.ListRawStatementsResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
