# Copyright (c) 2017-2023 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
# fmt: off
# isort: skip_file
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from . import identity_provider_config_service_pb2 as com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2


class IdentityProviderConfigServiceStub(object):
    """Identity Provider Config Service makes it possible for participant node administrators
    to setup and manage additional identity providers at runtime.

    This allows using access tokens from identity providers unknown at deployment time. When an identity
    provider is configured, independent IDP administrators can manage their own set of parties and users.
    Such parties and users have a matching `identity_provider_id` defined and are inaccessible to
    administrators from other identity providers. A user will only be authenticated if the corresponding JWT
    token is issued by the appropriate identity provider.
    Users and parties without `identity_provider_id` defined are assumed to be using the default identity provider,
    which is configured statically at the participant node's deployment time.

    The Ledger API uses the "iss" claim of a JWT token to match the token to a specific IDP. If there is no match,
    the default IDP is assumed.

    The fields of request messages (and sub-messages) are marked either as ``Optional`` or ``Required``:
    (1) ``Optional`` denoting the client may leave the field unset when sending a request.
    (2) ``Required`` denoting the client must set the field to a non-default value when sending a request.

    An identity provider config resource is described by the ``IdentityProviderConfig`` message,
    An identity provider config resource, once it has been created, can be modified.
    In order to update the properties represented by the ``IdentityProviderConfig`` message use the ``UpdateIdentityProviderConfig`` RPC.
    The only fields that can be modified are those marked as ``Modifiable``.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.CreateIdentityProviderConfig = channel.unary_unary(
                '/com.daml.ledger.api.v1.admin.IdentityProviderConfigService/CreateIdentityProviderConfig',
                request_serializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.CreateIdentityProviderConfigRequest.SerializeToString,
                response_deserializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.CreateIdentityProviderConfigResponse.FromString,
                )
        self.GetIdentityProviderConfig = channel.unary_unary(
                '/com.daml.ledger.api.v1.admin.IdentityProviderConfigService/GetIdentityProviderConfig',
                request_serializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.GetIdentityProviderConfigRequest.SerializeToString,
                response_deserializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.GetIdentityProviderConfigResponse.FromString,
                )
        self.UpdateIdentityProviderConfig = channel.unary_unary(
                '/com.daml.ledger.api.v1.admin.IdentityProviderConfigService/UpdateIdentityProviderConfig',
                request_serializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.UpdateIdentityProviderConfigRequest.SerializeToString,
                response_deserializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.UpdateIdentityProviderConfigResponse.FromString,
                )
        self.ListIdentityProviderConfigs = channel.unary_unary(
                '/com.daml.ledger.api.v1.admin.IdentityProviderConfigService/ListIdentityProviderConfigs',
                request_serializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.ListIdentityProviderConfigsRequest.SerializeToString,
                response_deserializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.ListIdentityProviderConfigsResponse.FromString,
                )
        self.DeleteIdentityProviderConfig = channel.unary_unary(
                '/com.daml.ledger.api.v1.admin.IdentityProviderConfigService/DeleteIdentityProviderConfig',
                request_serializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.DeleteIdentityProviderConfigRequest.SerializeToString,
                response_deserializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.DeleteIdentityProviderConfigResponse.FromString,
                )


class IdentityProviderConfigServiceServicer(object):
    """Identity Provider Config Service makes it possible for participant node administrators
    to setup and manage additional identity providers at runtime.

    This allows using access tokens from identity providers unknown at deployment time. When an identity
    provider is configured, independent IDP administrators can manage their own set of parties and users.
    Such parties and users have a matching `identity_provider_id` defined and are inaccessible to
    administrators from other identity providers. A user will only be authenticated if the corresponding JWT
    token is issued by the appropriate identity provider.
    Users and parties without `identity_provider_id` defined are assumed to be using the default identity provider,
    which is configured statically at the participant node's deployment time.

    The Ledger API uses the "iss" claim of a JWT token to match the token to a specific IDP. If there is no match,
    the default IDP is assumed.

    The fields of request messages (and sub-messages) are marked either as ``Optional`` or ``Required``:
    (1) ``Optional`` denoting the client may leave the field unset when sending a request.
    (2) ``Required`` denoting the client must set the field to a non-default value when sending a request.

    An identity provider config resource is described by the ``IdentityProviderConfig`` message,
    An identity provider config resource, once it has been created, can be modified.
    In order to update the properties represented by the ``IdentityProviderConfig`` message use the ``UpdateIdentityProviderConfig`` RPC.
    The only fields that can be modified are those marked as ``Modifiable``.
    """

    def CreateIdentityProviderConfig(self, request, context):
        """Create a new identity provider configuration.
        The request will fail if the maximum allowed number of separate configurations is reached.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetIdentityProviderConfig(self, request, context):
        """Get the identity provider configuration data by id.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def UpdateIdentityProviderConfig(self, request, context):
        """Update selected modifiable attribute of an identity provider config resource described
        by the ``IdentityProviderConfig`` message.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ListIdentityProviderConfigs(self, request, context):
        """List all existing identity provider configurations.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def DeleteIdentityProviderConfig(self, request, context):
        """Delete an existing identity provider configuration.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_IdentityProviderConfigServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'CreateIdentityProviderConfig': grpc.unary_unary_rpc_method_handler(
                    servicer.CreateIdentityProviderConfig,
                    request_deserializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.CreateIdentityProviderConfigRequest.FromString,
                    response_serializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.CreateIdentityProviderConfigResponse.SerializeToString,
            ),
            'GetIdentityProviderConfig': grpc.unary_unary_rpc_method_handler(
                    servicer.GetIdentityProviderConfig,
                    request_deserializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.GetIdentityProviderConfigRequest.FromString,
                    response_serializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.GetIdentityProviderConfigResponse.SerializeToString,
            ),
            'UpdateIdentityProviderConfig': grpc.unary_unary_rpc_method_handler(
                    servicer.UpdateIdentityProviderConfig,
                    request_deserializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.UpdateIdentityProviderConfigRequest.FromString,
                    response_serializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.UpdateIdentityProviderConfigResponse.SerializeToString,
            ),
            'ListIdentityProviderConfigs': grpc.unary_unary_rpc_method_handler(
                    servicer.ListIdentityProviderConfigs,
                    request_deserializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.ListIdentityProviderConfigsRequest.FromString,
                    response_serializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.ListIdentityProviderConfigsResponse.SerializeToString,
            ),
            'DeleteIdentityProviderConfig': grpc.unary_unary_rpc_method_handler(
                    servicer.DeleteIdentityProviderConfig,
                    request_deserializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.DeleteIdentityProviderConfigRequest.FromString,
                    response_serializer=com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.DeleteIdentityProviderConfigResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'com.daml.ledger.api.v1.admin.IdentityProviderConfigService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class IdentityProviderConfigService(object):
    """Identity Provider Config Service makes it possible for participant node administrators
    to setup and manage additional identity providers at runtime.

    This allows using access tokens from identity providers unknown at deployment time. When an identity
    provider is configured, independent IDP administrators can manage their own set of parties and users.
    Such parties and users have a matching `identity_provider_id` defined and are inaccessible to
    administrators from other identity providers. A user will only be authenticated if the corresponding JWT
    token is issued by the appropriate identity provider.
    Users and parties without `identity_provider_id` defined are assumed to be using the default identity provider,
    which is configured statically at the participant node's deployment time.

    The Ledger API uses the "iss" claim of a JWT token to match the token to a specific IDP. If there is no match,
    the default IDP is assumed.

    The fields of request messages (and sub-messages) are marked either as ``Optional`` or ``Required``:
    (1) ``Optional`` denoting the client may leave the field unset when sending a request.
    (2) ``Required`` denoting the client must set the field to a non-default value when sending a request.

    An identity provider config resource is described by the ``IdentityProviderConfig`` message,
    An identity provider config resource, once it has been created, can be modified.
    In order to update the properties represented by the ``IdentityProviderConfig`` message use the ``UpdateIdentityProviderConfig`` RPC.
    The only fields that can be modified are those marked as ``Modifiable``.
    """

    @staticmethod
    def CreateIdentityProviderConfig(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, '/com.daml.ledger.api.v1.admin.IdentityProviderConfigService/CreateIdentityProviderConfig',
            com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.CreateIdentityProviderConfigRequest.SerializeToString,
            com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.CreateIdentityProviderConfigResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetIdentityProviderConfig(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, '/com.daml.ledger.api.v1.admin.IdentityProviderConfigService/GetIdentityProviderConfig',
            com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.GetIdentityProviderConfigRequest.SerializeToString,
            com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.GetIdentityProviderConfigResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def UpdateIdentityProviderConfig(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, '/com.daml.ledger.api.v1.admin.IdentityProviderConfigService/UpdateIdentityProviderConfig',
            com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.UpdateIdentityProviderConfigRequest.SerializeToString,
            com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.UpdateIdentityProviderConfigResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def ListIdentityProviderConfigs(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, '/com.daml.ledger.api.v1.admin.IdentityProviderConfigService/ListIdentityProviderConfigs',
            com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.ListIdentityProviderConfigsRequest.SerializeToString,
            com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.ListIdentityProviderConfigsResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def DeleteIdentityProviderConfig(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, '/com.daml.ledger.api.v1.admin.IdentityProviderConfigService/DeleteIdentityProviderConfig',
            com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.DeleteIdentityProviderConfigRequest.SerializeToString,
            com_dot_daml_dot_ledger_dot_api_dot_v1_dot_admin_dot_identity__provider__config__service__pb2.DeleteIdentityProviderConfigResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
