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

from ni.measurementlink.sessionmanagement.v1 import session_management_service_pb2 as ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2


class SessionManagementServiceStub(object):
    """Service to keep track of open sessions used by measurement services, and to allow measurement services to access sessions by I/O resource and site.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.ReserveSessions = channel.unary_unary(
                '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/ReserveSessions',
                request_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.ReserveSessionsRequest.SerializeToString,
                response_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.ReserveSessionsResponse.FromString,
                )
        self.UnreserveSessions = channel.unary_unary(
                '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/UnreserveSessions',
                request_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnreserveSessionsRequest.SerializeToString,
                response_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnreserveSessionsResponse.FromString,
                )
        self.RegisterSessions = channel.unary_unary(
                '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/RegisterSessions',
                request_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.RegisterSessionsRequest.SerializeToString,
                response_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.RegisterSessionsResponse.FromString,
                )
        self.UnregisterSessions = channel.unary_unary(
                '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/UnregisterSessions',
                request_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnregisterSessionsRequest.SerializeToString,
                response_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnregisterSessionsResponse.FromString,
                )
        self.ReserveAllRegisteredSessions = channel.unary_unary(
                '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/ReserveAllRegisteredSessions',
                request_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.ReserveAllRegisteredSessionsRequest.SerializeToString,
                response_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.ReserveAllRegisteredSessionsResponse.FromString,
                )
        self.RegisterMultiplexerSessions = channel.unary_unary(
                '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/RegisterMultiplexerSessions',
                request_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.RegisterMultiplexerSessionsRequest.SerializeToString,
                response_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.RegisterMultiplexerSessionsResponse.FromString,
                )
        self.UnregisterMultiplexerSessions = channel.unary_unary(
                '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/UnregisterMultiplexerSessions',
                request_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnregisterMultiplexerSessionsRequest.SerializeToString,
                response_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnregisterMultiplexerSessionsResponse.FromString,
                )
        self.GetMultiplexerSessions = channel.unary_unary(
                '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/GetMultiplexerSessions',
                request_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetMultiplexerSessionsRequest.SerializeToString,
                response_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetMultiplexerSessionsResponse.FromString,
                )
        self.GetAllRegisteredMultiplexerSessions = channel.unary_unary(
                '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/GetAllRegisteredMultiplexerSessions',
                request_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetAllRegisteredMultiplexerSessionsRequest.SerializeToString,
                response_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetAllRegisteredMultiplexerSessionsResponse.FromString,
                )
        self.GetSessions = channel.unary_unary(
                '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/GetSessions',
                request_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetSessionsRequest.SerializeToString,
                response_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetSessionsResponse.FromString,
                )


class SessionManagementServiceServicer(object):
    """Service to keep track of open sessions used by measurement services, and to allow measurement services to access sessions by I/O resource and site.
    """

    def ReserveSessions(self, request, context):
        """Reserve session(s) for the given I/O resources (pins, relays, channels), sites, and instrument type ID and returns the information needed to create or access the session.
        Also reserves the session so other processes cannot access it with a ReserveSessions() call.
        Status Codes for errors:
        - INVALID_ARGUMENT:
        - Pin Map Context references a site number that is not defined in the pin map
        - Pin or relay name does not match any pin, pin group, relay, or relay group names in the pin map
        - Timeout specified is less than -1.
        - NOT_FOUND:
        - Pin Map Context has a pin map ID that does not match any pin maps registered with the Pin Map Service.
        - UNAVAILABLE:
        - Session(s) were already reserved and didn't become available before the specified timeout expired.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def UnreserveSessions(self, request, context):
        """Unreserves sessions so they can be accessed by other clients.
        - RESOURCE_EXHAUSTED:
        - Error occurred while unreserving sessions.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def RegisterSessions(self, request, context):
        """Registers the sessions with this service. Indicates that the sessions are open and will need to be closed later.
        Status Codes for errors:
        - ALREADY_EXISTS:
        - Session by the same name is already registered.
        - INVALID_ARGUMENT:
        - Session names list has an empty string.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def UnregisterSessions(self, request, context):
        """Unregisters the sessions with this service. Indicates that the sessions have been closed and will need to be reopened before they can be used again.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ReserveAllRegisteredSessions(self, request, context):
        """Reserves and gets all sessions currently registered with this service.
        - INVALID_ARGUMENT:
        - Timeout specified is less than -1.
        - UNAVAILABLE:
        - Session(s) were already reserved and didn't become available before the specified timeout expired.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def RegisterMultiplexerSessions(self, request, context):
        """Registers the multiplexer sessions with this service. Indicates that the sessions are open and will need to be closed later.
        Status Codes for errors:
        - ALREADY_EXISTS:
        - Session by the same name is already registered.
        - INVALID_ARGUMENT:
        - Session names list has an empty string.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def UnregisterMultiplexerSessions(self, request, context):
        """Unregisters the multiplexer sessions with this service. Indicates that the sessions have been closed and will need to be reopened before they can be used again.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetMultiplexerSessions(self, request, context):
        """Gets all the connected multiplexer session(s) for the given pin map context and returns information needed to create or access the session.
        Status Codes for errors:
        - INVALID_ARGUMENT:
        - Pin Map Context references a site number that is not defined in the pin map.
        - NOT_FOUND:
        - Pin Map Context has a pin map ID that does not match any pin maps registered with the Pin Map Service.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetAllRegisteredMultiplexerSessions(self, request, context):
        """Gets all multiplexer sessions currently registered with this service.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetSessions(self, request, context):
        """Gets all reserved or registered sessions for the specified instrument and multiplexer types.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_SessionManagementServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'ReserveSessions': grpc.unary_unary_rpc_method_handler(
                    servicer.ReserveSessions,
                    request_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.ReserveSessionsRequest.FromString,
                    response_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.ReserveSessionsResponse.SerializeToString,
            ),
            'UnreserveSessions': grpc.unary_unary_rpc_method_handler(
                    servicer.UnreserveSessions,
                    request_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnreserveSessionsRequest.FromString,
                    response_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnreserveSessionsResponse.SerializeToString,
            ),
            'RegisterSessions': grpc.unary_unary_rpc_method_handler(
                    servicer.RegisterSessions,
                    request_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.RegisterSessionsRequest.FromString,
                    response_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.RegisterSessionsResponse.SerializeToString,
            ),
            'UnregisterSessions': grpc.unary_unary_rpc_method_handler(
                    servicer.UnregisterSessions,
                    request_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnregisterSessionsRequest.FromString,
                    response_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnregisterSessionsResponse.SerializeToString,
            ),
            'ReserveAllRegisteredSessions': grpc.unary_unary_rpc_method_handler(
                    servicer.ReserveAllRegisteredSessions,
                    request_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.ReserveAllRegisteredSessionsRequest.FromString,
                    response_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.ReserveAllRegisteredSessionsResponse.SerializeToString,
            ),
            'RegisterMultiplexerSessions': grpc.unary_unary_rpc_method_handler(
                    servicer.RegisterMultiplexerSessions,
                    request_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.RegisterMultiplexerSessionsRequest.FromString,
                    response_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.RegisterMultiplexerSessionsResponse.SerializeToString,
            ),
            'UnregisterMultiplexerSessions': grpc.unary_unary_rpc_method_handler(
                    servicer.UnregisterMultiplexerSessions,
                    request_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnregisterMultiplexerSessionsRequest.FromString,
                    response_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnregisterMultiplexerSessionsResponse.SerializeToString,
            ),
            'GetMultiplexerSessions': grpc.unary_unary_rpc_method_handler(
                    servicer.GetMultiplexerSessions,
                    request_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetMultiplexerSessionsRequest.FromString,
                    response_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetMultiplexerSessionsResponse.SerializeToString,
            ),
            'GetAllRegisteredMultiplexerSessions': grpc.unary_unary_rpc_method_handler(
                    servicer.GetAllRegisteredMultiplexerSessions,
                    request_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetAllRegisteredMultiplexerSessionsRequest.FromString,
                    response_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetAllRegisteredMultiplexerSessionsResponse.SerializeToString,
            ),
            'GetSessions': grpc.unary_unary_rpc_method_handler(
                    servicer.GetSessions,
                    request_deserializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetSessionsRequest.FromString,
                    response_serializer=ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetSessionsResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'ni.measurementlink.sessionmanagement.v1.SessionManagementService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class SessionManagementService(object):
    """Service to keep track of open sessions used by measurement services, and to allow measurement services to access sessions by I/O resource and site.
    """

    @staticmethod
    def ReserveSessions(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, '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/ReserveSessions',
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.ReserveSessionsRequest.SerializeToString,
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.ReserveSessionsResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def UnreserveSessions(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, '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/UnreserveSessions',
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnreserveSessionsRequest.SerializeToString,
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnreserveSessionsResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def RegisterSessions(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, '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/RegisterSessions',
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.RegisterSessionsRequest.SerializeToString,
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.RegisterSessionsResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def UnregisterSessions(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, '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/UnregisterSessions',
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnregisterSessionsRequest.SerializeToString,
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnregisterSessionsResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def ReserveAllRegisteredSessions(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, '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/ReserveAllRegisteredSessions',
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.ReserveAllRegisteredSessionsRequest.SerializeToString,
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.ReserveAllRegisteredSessionsResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def RegisterMultiplexerSessions(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, '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/RegisterMultiplexerSessions',
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.RegisterMultiplexerSessionsRequest.SerializeToString,
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.RegisterMultiplexerSessionsResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def UnregisterMultiplexerSessions(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, '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/UnregisterMultiplexerSessions',
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnregisterMultiplexerSessionsRequest.SerializeToString,
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.UnregisterMultiplexerSessionsResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetMultiplexerSessions(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, '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/GetMultiplexerSessions',
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetMultiplexerSessionsRequest.SerializeToString,
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetMultiplexerSessionsResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetAllRegisteredMultiplexerSessions(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, '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/GetAllRegisteredMultiplexerSessions',
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetAllRegisteredMultiplexerSessionsRequest.SerializeToString,
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetAllRegisteredMultiplexerSessionsResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetSessions(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, '/ni.measurementlink.sessionmanagement.v1.SessionManagementService/GetSessions',
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetSessionsRequest.SerializeToString,
            ni_dot_measurementlink_dot_sessionmanagement_dot_v1_dot_session__management__service__pb2.GetSessionsResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
