# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

from google.cloud.firestore_v1beta1.proto.admin import firestore_admin_pb2 as google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2
from google.cloud.firestore_v1beta1.proto.admin import index_pb2 as google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_index__pb2
from google.longrunning import operations_pb2 as google_dot_longrunning_dot_operations__pb2
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2


class FirestoreAdminStub(object):
  """The Cloud Firestore Admin API.

  This API provides several administrative services for Cloud Firestore.

  # Concepts

  Project, Database, Namespace, Collection, and Document are used as defined in
  the Google Cloud Firestore API.

  Operation: An Operation represents work being performed in the background.


  # Services

  ## Index

  The index service manages Cloud Firestore indexes.

  Index creation is performed asynchronously.
  An Operation resource is created for each such asynchronous operation.
  The state of the operation (including any errors encountered)
  may be queried via the Operation resource.

  ## Metadata

  Provides metadata and statistical information about data in Cloud Firestore.
  The data provided as part of this API may be stale.

  ## Operation

  The Operations collection provides a record of actions performed for the
  specified Project (including any Operations in progress). Operations are not
  created directly but through calls on other collections or resources.

  An Operation that is not yet done may be cancelled. The request to cancel is
  asynchronous and the Operation may continue to run for some time after the
  request to cancel is made.

  An Operation that is done may be deleted so that it is no longer listed as
  part of the Operation collection.

  Operations are created by service `FirestoreAdmin`, but are accessed via
  service `google.longrunning.Operations`.
  """

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

    Args:
      channel: A grpc.Channel.
    """
    self.CreateIndex = channel.unary_unary(
        '/google.firestore.admin.v1beta1.FirestoreAdmin/CreateIndex',
        request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.CreateIndexRequest.SerializeToString,
        response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString,
        )
    self.ListIndexes = channel.unary_unary(
        '/google.firestore.admin.v1beta1.FirestoreAdmin/ListIndexes',
        request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.ListIndexesRequest.SerializeToString,
        response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.ListIndexesResponse.FromString,
        )
    self.GetIndex = channel.unary_unary(
        '/google.firestore.admin.v1beta1.FirestoreAdmin/GetIndex',
        request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.GetIndexRequest.SerializeToString,
        response_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_index__pb2.Index.FromString,
        )
    self.DeleteIndex = channel.unary_unary(
        '/google.firestore.admin.v1beta1.FirestoreAdmin/DeleteIndex',
        request_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.DeleteIndexRequest.SerializeToString,
        response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
        )


class FirestoreAdminServicer(object):
  """The Cloud Firestore Admin API.

  This API provides several administrative services for Cloud Firestore.

  # Concepts

  Project, Database, Namespace, Collection, and Document are used as defined in
  the Google Cloud Firestore API.

  Operation: An Operation represents work being performed in the background.


  # Services

  ## Index

  The index service manages Cloud Firestore indexes.

  Index creation is performed asynchronously.
  An Operation resource is created for each such asynchronous operation.
  The state of the operation (including any errors encountered)
  may be queried via the Operation resource.

  ## Metadata

  Provides metadata and statistical information about data in Cloud Firestore.
  The data provided as part of this API may be stale.

  ## Operation

  The Operations collection provides a record of actions performed for the
  specified Project (including any Operations in progress). Operations are not
  created directly but through calls on other collections or resources.

  An Operation that is not yet done may be cancelled. The request to cancel is
  asynchronous and the Operation may continue to run for some time after the
  request to cancel is made.

  An Operation that is done may be deleted so that it is no longer listed as
  part of the Operation collection.

  Operations are created by service `FirestoreAdmin`, but are accessed via
  service `google.longrunning.Operations`.
  """

  def CreateIndex(self, request, context):
    """Creates the specified index.
    A newly created index's initial state is `CREATING`. On completion of the
    returned [google.longrunning.Operation][google.longrunning.Operation], the state will be `READY`.
    If the index already exists, the call will return an `ALREADY_EXISTS`
    status.

    During creation, the process could result in an error, in which case the
    index will move to the `ERROR` state. The process can be recovered by
    fixing the data that caused the error, removing the index with
    [delete][google.firestore.admin.v1beta1.FirestoreAdmin.DeleteIndex], then re-creating the index with
    [create][google.firestore.admin.v1beta1.FirestoreAdmin.CreateIndex].

    Indexes with a single field cannot be created.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def ListIndexes(self, request, context):
    """Lists the indexes that match the specified filters.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def GetIndex(self, request, context):
    """Gets an index.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')

  def DeleteIndex(self, request, context):
    """Deletes an index.
    """
    context.set_code(grpc.StatusCode.UNIMPLEMENTED)
    context.set_details('Method not implemented!')
    raise NotImplementedError('Method not implemented!')


def add_FirestoreAdminServicer_to_server(servicer, server):
  rpc_method_handlers = {
      'CreateIndex': grpc.unary_unary_rpc_method_handler(
          servicer.CreateIndex,
          request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.CreateIndexRequest.FromString,
          response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
      ),
      'ListIndexes': grpc.unary_unary_rpc_method_handler(
          servicer.ListIndexes,
          request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.ListIndexesRequest.FromString,
          response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.ListIndexesResponse.SerializeToString,
      ),
      'GetIndex': grpc.unary_unary_rpc_method_handler(
          servicer.GetIndex,
          request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.GetIndexRequest.FromString,
          response_serializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_index__pb2.Index.SerializeToString,
      ),
      'DeleteIndex': grpc.unary_unary_rpc_method_handler(
          servicer.DeleteIndex,
          request_deserializer=google_dot_cloud_dot_firestore__v1beta1_dot_proto_dot_admin_dot_firestore__admin__pb2.DeleteIndexRequest.FromString,
          response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
      ),
  }
  generic_handler = grpc.method_handlers_generic_handler(
      'google.firestore.admin.v1beta1.FirestoreAdmin', rpc_method_handlers)
  server.add_generic_rpc_handlers((generic_handler,))
