diff --git a/firestore/google/cloud/firestore_admin_v1/__init__.py b/firestore/google/cloud/firestore_admin_v1/__init__.py new file mode 100644 index 000000000000..20eef5af0f8c --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/__init__.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from __future__ import absolute_import + +from google.cloud.firestore_admin_v1 import types +from google.cloud.firestore_admin_v1.gapic import enums +from google.cloud.firestore_admin_v1.gapic import firestore_admin_client + + +class FirestoreAdminClient(firestore_admin_client.FirestoreAdminClient): + __doc__ = firestore_admin_client.FirestoreAdminClient.__doc__ + enums = enums + + +__all__ = ("enums", "types", "FirestoreAdminClient") diff --git a/firestore/google/cloud/firestore_admin_v1/gapic/__init__.py b/firestore/google/cloud/firestore_admin_v1/gapic/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/firestore/google/cloud/firestore_admin_v1/gapic/enums.py b/firestore/google/cloud/firestore_admin_v1/gapic/enums.py new file mode 100644 index 000000000000..c8b31fc6255b --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/gapic/enums.py @@ -0,0 +1,138 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Wrappers for protocol buffer enum types.""" + +import enum + + +class OperationState(enum.IntEnum): + """ + Describes the state of the operation. + + Attributes: + OPERATION_STATE_UNSPECIFIED (int): Unspecified. + INITIALIZING (int): Request is being prepared for processing. + PROCESSING (int): Request is actively being processed. + CANCELLING (int): Request is in the process of being cancelled after user called + google.longrunning.Operations.CancelOperation on the operation. + FINALIZING (int): Request has been processed and is in its finalization stage. + SUCCESSFUL (int): Request has completed successfully. + FAILED (int): Request has finished being processed, but encountered an error. + CANCELLED (int): Request has finished being cancelled after user called + google.longrunning.Operations.CancelOperation. + """ + + OPERATION_STATE_UNSPECIFIED = 0 + INITIALIZING = 1 + PROCESSING = 2 + CANCELLING = 3 + FINALIZING = 4 + SUCCESSFUL = 5 + FAILED = 6 + CANCELLED = 7 + + +class FieldOperationMetadata(object): + class IndexConfigDelta(object): + class ChangeType(enum.IntEnum): + """ + Specifies how the index is changing. + + Attributes: + CHANGE_TYPE_UNSPECIFIED (int): The type of change is not specified or known. + ADD (int): The single field index is being added. + REMOVE (int): The single field index is being removed. + """ + + CHANGE_TYPE_UNSPECIFIED = 0 + ADD = 1 + REMOVE = 2 + + +class Index(object): + class QueryScope(enum.IntEnum): + """ + Query Scope defines the scope at which a query is run. This is specified + on a StructuredQuery's ``from`` field. + + Attributes: + QUERY_SCOPE_UNSPECIFIED (int): The query scope is unspecified. Not a valid option. + COLLECTION (int): Indexes with a collection query scope specified allow queries + against a collection that is the child of a specific document, specified + at query time, and that has the collection id specified by the index. + """ + + QUERY_SCOPE_UNSPECIFIED = 0 + COLLECTION = 1 + + class State(enum.IntEnum): + """ + The state of an index. During index creation, an index will be in the + ``CREATING`` state. If the index is created successfully, it will + transition to the ``READY`` state. If the index creation encounters a + problem, the index will transition to the ``NEEDS_REPAIR`` state. + + Attributes: + STATE_UNSPECIFIED (int): The state is unspecified. + CREATING (int): The index is being created. + There is an active long-running operation for the index. + The index is updated when writing a document. + Some index data may exist. + READY (int): The index is ready to be used. + The index is updated when writing a document. + The index is fully populated from all stored documents it applies to. + NEEDS_REPAIR (int): The index was being created, but something went wrong. + There is no active long-running operation for the index, + and the most recently finished long-running operation failed. + The index is not updated when writing a document. + Some index data may exist. + Use the google.longrunning.Operations API to determine why the operation + that last attempted to create this index failed, then re-create the + index. + """ + + STATE_UNSPECIFIED = 0 + CREATING = 1 + READY = 2 + NEEDS_REPAIR = 3 + + class IndexField(object): + class ArrayConfig(enum.IntEnum): + """ + The supported array value configurations. + + Attributes: + ARRAY_CONFIG_UNSPECIFIED (int): The index does not support additional array queries. + CONTAINS (int): The index supports array containment queries. + """ + + ARRAY_CONFIG_UNSPECIFIED = 0 + CONTAINS = 1 + + class Order(enum.IntEnum): + """ + The supported orderings. + + Attributes: + ORDER_UNSPECIFIED (int): The ordering is unspecified. Not a valid option. + ASCENDING (int): The field is ordered by ascending field value. + DESCENDING (int): The field is ordered by descending field value. + """ + + ORDER_UNSPECIFIED = 0 + ASCENDING = 1 + DESCENDING = 2 diff --git a/firestore/google/cloud/firestore_admin_v1/gapic/firestore_admin_client.py b/firestore/google/cloud/firestore_admin_v1/gapic/firestore_admin_client.py new file mode 100644 index 000000000000..6de6cbd825e9 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/gapic/firestore_admin_client.py @@ -0,0 +1,1016 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Accesses the google.firestore.admin.v1 FirestoreAdmin API.""" + +import functools +import pkg_resources +import warnings + +from google.oauth2 import service_account +import google.api_core.client_options +import google.api_core.gapic_v1.client_info +import google.api_core.gapic_v1.config +import google.api_core.gapic_v1.method +import google.api_core.gapic_v1.routing_header +import google.api_core.grpc_helpers +import google.api_core.page_iterator +import google.api_core.path_template +import grpc + +from google.cloud.firestore_admin_v1.gapic import enums +from google.cloud.firestore_admin_v1.gapic import firestore_admin_client_config +from google.cloud.firestore_admin_v1.gapic.transports import ( + firestore_admin_grpc_transport, +) +from google.cloud.firestore_admin_v1.proto import field_pb2 +from google.cloud.firestore_admin_v1.proto import firestore_admin_pb2 +from google.cloud.firestore_admin_v1.proto import firestore_admin_pb2_grpc +from google.cloud.firestore_admin_v1.proto import index_pb2 +from google.longrunning import operations_pb2 +from google.protobuf import empty_pb2 +from google.protobuf import field_mask_pb2 + + +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution( + "google-cloud-firestore" +).version + + +class FirestoreAdminClient(object): + """ + Operations are created by service ``FirestoreAdmin``, but are accessed + via service ``google.longrunning.Operations``. + """ + + SERVICE_ADDRESS = "firestore.googleapis.com:443" + """The default address of the service.""" + + # The name of the interface for this client. This is the key used to + # find the method configuration in the client_config dictionary. + _INTERFACE_NAME = "google.firestore.admin.v1.FirestoreAdmin" + + @classmethod + def from_service_account_file(cls, filename, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + FirestoreAdminClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @classmethod + def database_path(cls, project, database): + """Return a fully-qualified database string.""" + return google.api_core.path_template.expand( + "projects/{project}/databases/{database}", + project=project, + database=database, + ) + + @classmethod + def field_path(cls, project, database, collection_id, field_id): + """Return a fully-qualified field string.""" + return google.api_core.path_template.expand( + "projects/{project}/databases/{database}/collectionGroups/{collection_id}/fields/{field_id}", + project=project, + database=database, + collection_id=collection_id, + field_id=field_id, + ) + + @classmethod + def index_path(cls, project, database, collection_id, index_id): + """Return a fully-qualified index string.""" + return google.api_core.path_template.expand( + "projects/{project}/databases/{database}/collectionGroups/{collection_id}/indexes/{index_id}", + project=project, + database=database, + collection_id=collection_id, + index_id=index_id, + ) + + @classmethod + def parent_path(cls, project, database, collection_id): + """Return a fully-qualified parent string.""" + return google.api_core.path_template.expand( + "projects/{project}/databases/{database}/collectionGroups/{collection_id}", + project=project, + database=database, + collection_id=collection_id, + ) + + def __init__( + self, + transport=None, + channel=None, + credentials=None, + client_config=None, + client_info=None, + client_options=None, + ): + """Constructor. + + Args: + transport (Union[~.FirestoreAdminGrpcTransport, + Callable[[~.Credentials, type], ~.FirestoreAdminGrpcTransport]): A transport + instance, responsible for actually making the API calls. + The default transport uses the gRPC protocol. + This argument may also be a callable which returns a + transport instance. Callables will be sent the credentials + as the first argument and the default transport class as + the second argument. + channel (grpc.Channel): DEPRECATED. A ``Channel`` instance + through which to make calls. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception. + credentials (google.auth.credentials.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is mutually exclusive with providing a + transport instance to ``transport``; doing so will raise + an exception. + client_config (dict): DEPRECATED. A dictionary of call options for + each method. If not specified, the default configuration is used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + client_options (Union[dict, google.api_core.client_options.ClientOptions]): + Client options used to set user options on the client. API Endpoint + should be set through client_options. + """ + # Raise deprecation warnings for things we want to go away. + if client_config is not None: + warnings.warn( + "The `client_config` argument is deprecated.", + PendingDeprecationWarning, + stacklevel=2, + ) + else: + client_config = firestore_admin_client_config.config + + if channel: + warnings.warn( + "The `channel` argument is deprecated; use " "`transport` instead.", + PendingDeprecationWarning, + stacklevel=2, + ) + + api_endpoint = self.SERVICE_ADDRESS + if client_options: + if type(client_options) == dict: + client_options = google.api_core.client_options.from_dict( + client_options + ) + if client_options.api_endpoint: + api_endpoint = client_options.api_endpoint + + # Instantiate the transport. + # The transport is responsible for handling serialization and + # deserialization and actually sending data to the service. + if transport: + if callable(transport): + self.transport = transport( + credentials=credentials, + default_class=firestore_admin_grpc_transport.FirestoreAdminGrpcTransport, + address=api_endpoint, + ) + else: + if credentials: + raise ValueError( + "Received both a transport instance and " + "credentials; these are mutually exclusive." + ) + self.transport = transport + else: + self.transport = firestore_admin_grpc_transport.FirestoreAdminGrpcTransport( + address=api_endpoint, channel=channel, credentials=credentials + ) + + if client_info is None: + client_info = google.api_core.gapic_v1.client_info.ClientInfo( + gapic_version=_GAPIC_LIBRARY_VERSION + ) + else: + client_info.gapic_version = _GAPIC_LIBRARY_VERSION + self._client_info = client_info + + # Parse out the default settings for retry and timeout for each RPC + # from the client configuration. + # (Ordinarily, these are the defaults specified in the `*_config.py` + # file next to this one.) + self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( + client_config["interfaces"][self._INTERFACE_NAME] + ) + + # Save a dictionary of cached API call functions. + # These are the actual callables which invoke the proper + # transport methods, wrapped with `wrap_method` to add retry, + # timeout, and the like. + self._inner_api_calls = {} + + # Service calls + def create_index( + self, + parent, + index, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Creates a composite index. This returns a + ``google.longrunning.Operation`` which may be used to track the status + of the creation. The metadata for the operation will be the type + ``IndexOperationMetadata``. + + Example: + >>> from google.cloud import firestore_admin_v1 + >>> + >>> client = firestore_admin_v1.FirestoreAdminClient() + >>> + >>> parent = client.parent_path('[PROJECT]', '[DATABASE]', '[COLLECTION_ID]') + >>> + >>> # TODO: Initialize `index`: + >>> index = {} + >>> + >>> response = client.create_index(parent, index) + + Args: + parent (str): A parent name of the form + ``projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`` + index (Union[dict, ~google.cloud.firestore_admin_v1.types.Index]): The composite index to create. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.firestore_admin_v1.types.Index` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.firestore_admin_v1.types.Operation` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "create_index" not in self._inner_api_calls: + self._inner_api_calls[ + "create_index" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.create_index, + default_retry=self._method_configs["CreateIndex"].retry, + default_timeout=self._method_configs["CreateIndex"].timeout, + client_info=self._client_info, + ) + + request = firestore_admin_pb2.CreateIndexRequest(parent=parent, index=index) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["create_index"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def list_indexes( + self, + parent, + filter_=None, + page_size=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Lists composite indexes. + + Example: + >>> from google.cloud import firestore_admin_v1 + >>> + >>> client = firestore_admin_v1.FirestoreAdminClient() + >>> + >>> parent = client.parent_path('[PROJECT]', '[DATABASE]', '[COLLECTION_ID]') + >>> + >>> # Iterate over all results + >>> for element in client.list_indexes(parent): + ... # process element + ... pass + >>> + >>> + >>> # Alternatively: + >>> + >>> # Iterate over results one page at a time + >>> for page in client.list_indexes(parent).pages: + ... for element in page: + ... # process element + ... pass + + Args: + parent (str): A parent name of the form + ``projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`` + filter_ (str): The filter to apply to list results. + page_size (int): The maximum number of resources contained in the + underlying API response. If page streaming is performed per- + resource, this parameter does not affect the return value. If page + streaming is performed per-page, this determines the maximum number + of resources in a page. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.api_core.page_iterator.PageIterator` instance. + An iterable of :class:`~google.cloud.firestore_admin_v1.types.Index` instances. + You can also iterate over the pages of the response + using its `pages` property. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "list_indexes" not in self._inner_api_calls: + self._inner_api_calls[ + "list_indexes" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.list_indexes, + default_retry=self._method_configs["ListIndexes"].retry, + default_timeout=self._method_configs["ListIndexes"].timeout, + client_info=self._client_info, + ) + + request = firestore_admin_pb2.ListIndexesRequest( + parent=parent, filter=filter_, page_size=page_size + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + iterator = google.api_core.page_iterator.GRPCIterator( + client=None, + method=functools.partial( + self._inner_api_calls["list_indexes"], + retry=retry, + timeout=timeout, + metadata=metadata, + ), + request=request, + items_field="indexes", + request_token_field="page_token", + response_token_field="next_page_token", + ) + return iterator + + def get_index( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Gets a composite index. + + Example: + >>> from google.cloud import firestore_admin_v1 + >>> + >>> client = firestore_admin_v1.FirestoreAdminClient() + >>> + >>> name = client.index_path('[PROJECT]', '[DATABASE]', '[COLLECTION_ID]', '[INDEX_ID]') + >>> + >>> response = client.get_index(name) + + Args: + name (str): A name of the form + ``projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.firestore_admin_v1.types.Index` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "get_index" not in self._inner_api_calls: + self._inner_api_calls[ + "get_index" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_index, + default_retry=self._method_configs["GetIndex"].retry, + default_timeout=self._method_configs["GetIndex"].timeout, + client_info=self._client_info, + ) + + request = firestore_admin_pb2.GetIndexRequest(name=name) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["get_index"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def delete_index( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Deletes a composite index. + + Example: + >>> from google.cloud import firestore_admin_v1 + >>> + >>> client = firestore_admin_v1.FirestoreAdminClient() + >>> + >>> name = client.index_path('[PROJECT]', '[DATABASE]', '[COLLECTION_ID]', '[INDEX_ID]') + >>> + >>> client.delete_index(name) + + Args: + name (str): A name of the form + ``projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "delete_index" not in self._inner_api_calls: + self._inner_api_calls[ + "delete_index" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.delete_index, + default_retry=self._method_configs["DeleteIndex"].retry, + default_timeout=self._method_configs["DeleteIndex"].timeout, + client_info=self._client_info, + ) + + request = firestore_admin_pb2.DeleteIndexRequest(name=name) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + self._inner_api_calls["delete_index"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def import_documents( + self, + name, + collection_ids=None, + input_uri_prefix=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Imports documents into Google Cloud Firestore. Existing documents with the + same name are overwritten. The import occurs in the background and its + progress can be monitored and managed via the Operation resource that is + created. If an ImportDocuments operation is cancelled, it is possible + that a subset of the data has already been imported to Cloud Firestore. + + Example: + >>> from google.cloud import firestore_admin_v1 + >>> + >>> client = firestore_admin_v1.FirestoreAdminClient() + >>> + >>> name = client.database_path('[PROJECT]', '[DATABASE]') + >>> + >>> response = client.import_documents(name) + + Args: + name (str): Database to import into. Should be of the form: + ``projects/{project_id}/databases/{database_id}``. + collection_ids (list[str]): Which collection ids to import. Unspecified means all collections included + in the import. + input_uri_prefix (str): Location of the exported files. This must match the output\_uri\_prefix + of an ExportDocumentsResponse from an export that has completed + successfully. See: + ``google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix``. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.firestore_admin_v1.types.Operation` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "import_documents" not in self._inner_api_calls: + self._inner_api_calls[ + "import_documents" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.import_documents, + default_retry=self._method_configs["ImportDocuments"].retry, + default_timeout=self._method_configs["ImportDocuments"].timeout, + client_info=self._client_info, + ) + + request = firestore_admin_pb2.ImportDocumentsRequest( + name=name, collection_ids=collection_ids, input_uri_prefix=input_uri_prefix + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["import_documents"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def export_documents( + self, + name, + collection_ids=None, + output_uri_prefix=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Exports a copy of all or a subset of documents from Google Cloud Firestore + to another storage system, such as Google Cloud Storage. Recent updates to + documents may not be reflected in the export. The export occurs in the + background and its progress can be monitored and managed via the + Operation resource that is created. The output of an export may only be + used once the associated operation is done. If an export operation is + cancelled before completion it may leave partial data behind in Google + Cloud Storage. + + Example: + >>> from google.cloud import firestore_admin_v1 + >>> + >>> client = firestore_admin_v1.FirestoreAdminClient() + >>> + >>> name = client.database_path('[PROJECT]', '[DATABASE]') + >>> + >>> response = client.export_documents(name) + + Args: + name (str): Database to export. Should be of the form: + ``projects/{project_id}/databases/{database_id}``. + collection_ids (list[str]): Which collection ids to export. Unspecified means all collections. + output_uri_prefix (str): The output URI. Currently only supports Google Cloud Storage URIs of the + form: ``gs://BUCKET_NAME[/NAMESPACE_PATH]``, where ``BUCKET_NAME`` is + the name of the Google Cloud Storage bucket and ``NAMESPACE_PATH`` is an + optional Google Cloud Storage namespace path. When choosing a name, be + sure to consider Google Cloud Storage naming guidelines: + https://cloud.google.com/storage/docs/naming. If the URI is a bucket + (without a namespace path), a prefix will be generated based on the + start time. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.firestore_admin_v1.types.Operation` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "export_documents" not in self._inner_api_calls: + self._inner_api_calls[ + "export_documents" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.export_documents, + default_retry=self._method_configs["ExportDocuments"].retry, + default_timeout=self._method_configs["ExportDocuments"].timeout, + client_info=self._client_info, + ) + + request = firestore_admin_pb2.ExportDocumentsRequest( + name=name, + collection_ids=collection_ids, + output_uri_prefix=output_uri_prefix, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["export_documents"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def get_field( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Gets the metadata and configuration for a Field. + + Example: + >>> from google.cloud import firestore_admin_v1 + >>> + >>> client = firestore_admin_v1.FirestoreAdminClient() + >>> + >>> name = client.field_path('[PROJECT]', '[DATABASE]', '[COLLECTION_ID]', '[FIELD_ID]') + >>> + >>> response = client.get_field(name) + + Args: + name (str): A name of the form + ``projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.firestore_admin_v1.types.Field` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "get_field" not in self._inner_api_calls: + self._inner_api_calls[ + "get_field" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_field, + default_retry=self._method_configs["GetField"].retry, + default_timeout=self._method_configs["GetField"].timeout, + client_info=self._client_info, + ) + + request = firestore_admin_pb2.GetFieldRequest(name=name) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["get_field"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def list_fields( + self, + parent, + filter_=None, + page_size=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Lists the field configuration and metadata for this database. + + Currently, ``FirestoreAdmin.ListFields`` only supports listing fields + that have been explicitly overridden. To issue this query, call + ``FirestoreAdmin.ListFields`` with the filter set to + ``indexConfig.usesAncestorConfig:false``. + + Example: + >>> from google.cloud import firestore_admin_v1 + >>> + >>> client = firestore_admin_v1.FirestoreAdminClient() + >>> + >>> parent = client.parent_path('[PROJECT]', '[DATABASE]', '[COLLECTION_ID]') + >>> + >>> # Iterate over all results + >>> for element in client.list_fields(parent): + ... # process element + ... pass + >>> + >>> + >>> # Alternatively: + >>> + >>> # Iterate over results one page at a time + >>> for page in client.list_fields(parent).pages: + ... for element in page: + ... # process element + ... pass + + Args: + parent (str): A parent name of the form + ``projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`` + filter_ (str): The filter to apply to list results. Currently, + ``FirestoreAdmin.ListFields`` only supports listing fields that have + been explicitly overridden. To issue this query, call + ``FirestoreAdmin.ListFields`` with the filter set to + ``indexConfig.usesAncestorConfig:false``. + page_size (int): The maximum number of resources contained in the + underlying API response. If page streaming is performed per- + resource, this parameter does not affect the return value. If page + streaming is performed per-page, this determines the maximum number + of resources in a page. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.api_core.page_iterator.PageIterator` instance. + An iterable of :class:`~google.cloud.firestore_admin_v1.types.Field` instances. + You can also iterate over the pages of the response + using its `pages` property. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "list_fields" not in self._inner_api_calls: + self._inner_api_calls[ + "list_fields" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.list_fields, + default_retry=self._method_configs["ListFields"].retry, + default_timeout=self._method_configs["ListFields"].timeout, + client_info=self._client_info, + ) + + request = firestore_admin_pb2.ListFieldsRequest( + parent=parent, filter=filter_, page_size=page_size + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + iterator = google.api_core.page_iterator.GRPCIterator( + client=None, + method=functools.partial( + self._inner_api_calls["list_fields"], + retry=retry, + timeout=timeout, + metadata=metadata, + ), + request=request, + items_field="fields", + request_token_field="page_token", + response_token_field="next_page_token", + ) + return iterator + + def update_field( + self, + field, + update_mask=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Updates a field configuration. Currently, field updates apply only to + single field index configuration. However, calls to + ``FirestoreAdmin.UpdateField`` should provide a field mask to avoid + changing any configuration that the caller isn't aware of. The field + mask should be specified as: ``{ paths: "index_config" }``. + + This call returns a ``google.longrunning.Operation`` which may be used + to track the status of the field update. The metadata for the operation + will be the type ``FieldOperationMetadata``. + + To configure the default field settings for the database, use the + special ``Field`` with resource name: + ``projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*``. + + Example: + >>> from google.cloud import firestore_admin_v1 + >>> + >>> client = firestore_admin_v1.FirestoreAdminClient() + >>> + >>> # TODO: Initialize `field`: + >>> field = {} + >>> + >>> response = client.update_field(field) + + Args: + field (Union[dict, ~google.cloud.firestore_admin_v1.types.Field]): The field to be updated. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.firestore_admin_v1.types.Field` + update_mask (Union[dict, ~google.cloud.firestore_admin_v1.types.FieldMask]): A mask, relative to the field. If specified, only configuration + specified by this field\_mask will be updated in the field. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.firestore_admin_v1.types.FieldMask` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.firestore_admin_v1.types.Operation` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "update_field" not in self._inner_api_calls: + self._inner_api_calls[ + "update_field" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.update_field, + default_retry=self._method_configs["UpdateField"].retry, + default_timeout=self._method_configs["UpdateField"].timeout, + client_info=self._client_info, + ) + + request = firestore_admin_pb2.UpdateFieldRequest( + field=field, update_mask=update_mask + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("field.name", field.name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["update_field"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) diff --git a/firestore/google/cloud/firestore_admin_v1/gapic/firestore_admin_client_config.py b/firestore/google/cloud/firestore_admin_v1/gapic/firestore_admin_client_config.py new file mode 100644 index 000000000000..fa18df651135 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/gapic/firestore_admin_client_config.py @@ -0,0 +1,68 @@ +config = { + "interfaces": { + "google.firestore.admin.v1.FirestoreAdmin": { + "retry_codes": { + "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], + "non_idempotent": [], + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 20000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 20000, + "total_timeout_millis": 600000, + } + }, + "methods": { + "CreateIndex": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "ListIndexes": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "GetIndex": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "DeleteIndex": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "ImportDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "ExportDocuments": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "GetField": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "ListFields": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "UpdateField": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + }, + } + } +} diff --git a/firestore/google/cloud/firestore_admin_v1/gapic/transports/__init__.py b/firestore/google/cloud/firestore_admin_v1/gapic/transports/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/firestore/google/cloud/firestore_admin_v1/gapic/transports/firestore_admin_grpc_transport.py b/firestore/google/cloud/firestore_admin_v1/gapic/transports/firestore_admin_grpc_transport.py new file mode 100644 index 000000000000..98e1e6629935 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/gapic/transports/firestore_admin_grpc_transport.py @@ -0,0 +1,252 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import google.api_core.grpc_helpers + +from google.cloud.firestore_admin_v1.proto import firestore_admin_pb2_grpc + + +class FirestoreAdminGrpcTransport(object): + """gRPC transport class providing stubs for + google.firestore.admin.v1 FirestoreAdmin API. + + The transport provides access to the raw gRPC stubs, + which can be used to take advantage of advanced + features of gRPC. + """ + + # The scopes needed to make gRPC calls to all of the methods defined + # in this service. + _OAUTH_SCOPES = ( + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/datastore", + ) + + def __init__( + self, channel=None, credentials=None, address="firestore.googleapis.com:443" + ): + """Instantiate the transport class. + + Args: + channel (grpc.Channel): A ``Channel`` instance through + which to make calls. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception. + credentials (google.auth.credentials.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If none + are specified, the client will attempt to ascertain the + credentials from the environment. + address (str): The address where the service is hosted. + """ + # If both `channel` and `credentials` are specified, raise an + # exception (channels come with credentials baked in already). + if channel is not None and credentials is not None: + raise ValueError( + "The `channel` and `credentials` arguments are mutually " "exclusive." + ) + + # Create the channel. + if channel is None: + channel = self.create_channel(address=address, credentials=credentials) + + self._channel = channel + + # gRPC uses objects called "stubs" that are bound to the + # channel and provide a basic method for each RPC. + self._stubs = { + "firestore_admin_stub": firestore_admin_pb2_grpc.FirestoreAdminStub(channel) + } + + @classmethod + def create_channel( + cls, address="firestore.googleapis.com:443", credentials=None, **kwargs + ): + """Create and return a gRPC channel object. + + Args: + address (str): The host for the channel to use. + credentials (~.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + kwargs (dict): Keyword arguments, which are passed to the + channel creation. + + Returns: + grpc.Channel: A gRPC channel object. + """ + return google.api_core.grpc_helpers.create_channel( + address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs + ) + + @property + def channel(self): + """The gRPC channel used by the transport. + + Returns: + grpc.Channel: A gRPC channel object. + """ + return self._channel + + @property + def create_index(self): + """Return the gRPC stub for :meth:`FirestoreAdminClient.create_index`. + + Creates a composite index. This returns a + ``google.longrunning.Operation`` which may be used to track the status + of the creation. The metadata for the operation will be the type + ``IndexOperationMetadata``. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["firestore_admin_stub"].CreateIndex + + @property + def list_indexes(self): + """Return the gRPC stub for :meth:`FirestoreAdminClient.list_indexes`. + + Lists composite indexes. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["firestore_admin_stub"].ListIndexes + + @property + def get_index(self): + """Return the gRPC stub for :meth:`FirestoreAdminClient.get_index`. + + Gets a composite index. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["firestore_admin_stub"].GetIndex + + @property + def delete_index(self): + """Return the gRPC stub for :meth:`FirestoreAdminClient.delete_index`. + + Deletes a composite index. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["firestore_admin_stub"].DeleteIndex + + @property + def import_documents(self): + """Return the gRPC stub for :meth:`FirestoreAdminClient.import_documents`. + + Imports documents into Google Cloud Firestore. Existing documents with the + same name are overwritten. The import occurs in the background and its + progress can be monitored and managed via the Operation resource that is + created. If an ImportDocuments operation is cancelled, it is possible + that a subset of the data has already been imported to Cloud Firestore. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["firestore_admin_stub"].ImportDocuments + + @property + def export_documents(self): + """Return the gRPC stub for :meth:`FirestoreAdminClient.export_documents`. + + Exports a copy of all or a subset of documents from Google Cloud Firestore + to another storage system, such as Google Cloud Storage. Recent updates to + documents may not be reflected in the export. The export occurs in the + background and its progress can be monitored and managed via the + Operation resource that is created. The output of an export may only be + used once the associated operation is done. If an export operation is + cancelled before completion it may leave partial data behind in Google + Cloud Storage. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["firestore_admin_stub"].ExportDocuments + + @property + def get_field(self): + """Return the gRPC stub for :meth:`FirestoreAdminClient.get_field`. + + Gets the metadata and configuration for a Field. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["firestore_admin_stub"].GetField + + @property + def list_fields(self): + """Return the gRPC stub for :meth:`FirestoreAdminClient.list_fields`. + + Lists the field configuration and metadata for this database. + + Currently, ``FirestoreAdmin.ListFields`` only supports listing fields + that have been explicitly overridden. To issue this query, call + ``FirestoreAdmin.ListFields`` with the filter set to + ``indexConfig.usesAncestorConfig:false``. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["firestore_admin_stub"].ListFields + + @property + def update_field(self): + """Return the gRPC stub for :meth:`FirestoreAdminClient.update_field`. + + Updates a field configuration. Currently, field updates apply only to + single field index configuration. However, calls to + ``FirestoreAdmin.UpdateField`` should provide a field mask to avoid + changing any configuration that the caller isn't aware of. The field + mask should be specified as: ``{ paths: "index_config" }``. + + This call returns a ``google.longrunning.Operation`` which may be used + to track the status of the field update. The metadata for the operation + will be the type ``FieldOperationMetadata``. + + To configure the default field settings for the database, use the + special ``Field`` with resource name: + ``projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*``. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["firestore_admin_stub"].UpdateField diff --git a/firestore/google/cloud/firestore_admin_v1/proto/__init__.py b/firestore/google/cloud/firestore_admin_v1/proto/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/firestore/google/cloud/firestore_admin_v1/proto/field.proto b/firestore/google/cloud/firestore_admin_v1/proto/field.proto new file mode 100644 index 000000000000..a24e1aaf1dc4 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/field.proto @@ -0,0 +1,96 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/firestore/admin/v1/index.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1;admin"; +option java_multiple_files = true; +option java_outer_classname = "FieldProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; + + +// Represents a single field in the database. +// +// Fields are grouped by their "Collection Group", which represent all +// collections in the database with the same id. +message Field { + // The index configuration for this field. + message IndexConfig { + // The indexes supported for this field. + repeated Index indexes = 1; + + // Output only. + // When true, the `Field`'s index configuration is set from the + // configuration specified by the `ancestor_field`. + // When false, the `Field`'s index configuration is defined explicitly. + bool uses_ancestor_config = 2; + + // Output only. + // Specifies the resource name of the `Field` from which this field's + // index configuration is set (when `uses_ancestor_config` is true), + // or from which it *would* be set if this field had no index configuration + // (when `uses_ancestor_config` is false). + string ancestor_field = 3; + + // Output only + // When true, the `Field`'s index configuration is in the process of being + // reverted. Once complete, the index config will transition to the same + // state as the field specified by `ancestor_field`, at which point + // `uses_ancestor_config` will be `true` and `reverting` will be `false`. + bool reverting = 4; + } + + // A field name of the form + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}` + // + // A field path may be a simple field name, e.g. `address` or a path to fields + // within map_value , e.g. `address.city`, + // or a special field path. The only valid special field is `*`, which + // represents any field. + // + // Field paths may be quoted using ` (backtick). The only character that needs + // to be escaped within a quoted field path is the backtick character itself, + // escaped using a backslash. Special characters in field paths that + // must be quoted include: `*`, `.`, + // ``` (backtick), `[`, `]`, as well as any ascii symbolic characters. + // + // Examples: + // (Note: Comments here are written in markdown syntax, so there is an + // additional layer of backticks to represent a code block) + // `\`address.city\`` represents a field named `address.city`, not the map key + // `city` in the field `address`. + // `\`*\`` represents a field named `*`, not any field. + // + // A special `Field` contains the default indexing settings for all fields. + // This field's resource name is: + // `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*` + // Indexes defined on this `Field` will be applied to all fields which do not + // have their own `Field` index configuration. + string name = 1; + + // The index configuration for this field. If unset, field indexing will + // revert to the configuration defined by the `ancestor_field`. To + // explicitly remove all indexes for this field, specify an index config + // with an empty list of indexes. + IndexConfig index_config = 2; +} diff --git a/firestore/google/cloud/firestore_admin_v1/proto/field_pb2.py b/firestore/google/cloud/firestore_admin_v1/proto/field_pb2.py new file mode 100644 index 000000000000..6e07a77f567d --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/field_pb2.py @@ -0,0 +1,283 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/firestore/admin_v1/proto/field.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.cloud.firestore_admin_v1.proto import ( + index_pb2 as google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_index__pb2, +) +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="google/cloud/firestore/admin_v1/proto/field.proto", + package="google.firestore.admin.v1", + syntax="proto3", + serialized_options=_b( + "\n\035com.google.firestore.admin.v1B\nFieldProtoP\001Z>google.golang.org/genproto/googleapis/firestore/admin/v1;admin\242\002\004GCFS\252\002\037Google.Cloud.Firestore.Admin.V1\312\002\037Google\\Cloud\\Firestore\\Admin\\V1" + ), + serialized_pb=_b( + '\n1google/cloud/firestore/admin_v1/proto/field.proto\x12\x19google.firestore.admin.v1\x1a\x31google/cloud/firestore/admin_v1/proto/index.proto\x1a\x1cgoogle/api/annotations.proto"\xe5\x01\n\x05\x46ield\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x42\n\x0cindex_config\x18\x02 \x01(\x0b\x32,.google.firestore.admin.v1.Field.IndexConfig\x1a\x89\x01\n\x0bIndexConfig\x12\x31\n\x07indexes\x18\x01 \x03(\x0b\x32 .google.firestore.admin.v1.Index\x12\x1c\n\x14uses_ancestor_config\x18\x02 \x01(\x08\x12\x16\n\x0e\x61ncestor_field\x18\x03 \x01(\t\x12\x11\n\treverting\x18\x04 \x01(\x08\x42\xb8\x01\n\x1d\x63om.google.firestore.admin.v1B\nFieldProtoP\x01Z>google.golang.org/genproto/googleapis/firestore/admin/v1;admin\xa2\x02\x04GCFS\xaa\x02\x1fGoogle.Cloud.Firestore.Admin.V1\xca\x02\x1fGoogle\\Cloud\\Firestore\\Admin\\V1b\x06proto3' + ), + dependencies=[ + google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_index__pb2.DESCRIPTOR, + google_dot_api_dot_annotations__pb2.DESCRIPTOR, + ], +) + + +_FIELD_INDEXCONFIG = _descriptor.Descriptor( + name="IndexConfig", + full_name="google.firestore.admin.v1.Field.IndexConfig", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="indexes", + full_name="google.firestore.admin.v1.Field.IndexConfig.indexes", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="uses_ancestor_config", + full_name="google.firestore.admin.v1.Field.IndexConfig.uses_ancestor_config", + index=1, + number=2, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="ancestor_field", + full_name="google.firestore.admin.v1.Field.IndexConfig.ancestor_field", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="reverting", + full_name="google.firestore.admin.v1.Field.IndexConfig.reverting", + index=3, + number=4, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=254, + serialized_end=391, +) + +_FIELD = _descriptor.Descriptor( + name="Field", + full_name="google.firestore.admin.v1.Field", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.firestore.admin.v1.Field.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="index_config", + full_name="google.firestore.admin.v1.Field.index_config", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_FIELD_INDEXCONFIG], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=162, + serialized_end=391, +) + +_FIELD_INDEXCONFIG.fields_by_name[ + "indexes" +].message_type = ( + google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_index__pb2._INDEX +) +_FIELD_INDEXCONFIG.containing_type = _FIELD +_FIELD.fields_by_name["index_config"].message_type = _FIELD_INDEXCONFIG +DESCRIPTOR.message_types_by_name["Field"] = _FIELD +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Field = _reflection.GeneratedProtocolMessageType( + "Field", + (_message.Message,), + dict( + IndexConfig=_reflection.GeneratedProtocolMessageType( + "IndexConfig", + (_message.Message,), + dict( + DESCRIPTOR=_FIELD_INDEXCONFIG, + __module__="google.cloud.firestore.admin_v1.proto.field_pb2", + __doc__="""The index configuration for this field. + + + Attributes: + indexes: + The indexes supported for this field. + uses_ancestor_config: + Output only. When true, the ``Field``'s index configuration is + set from the configuration specified by the + ``ancestor_field``. When false, the ``Field``'s index + configuration is defined explicitly. + ancestor_field: + Output only. Specifies the resource name of the ``Field`` from + which this field's index configuration is set (when + ``uses_ancestor_config`` is true), or from which it *would* be + set if this field had no index configuration (when + ``uses_ancestor_config`` is false). + reverting: + Output only When true, the ``Field``'s index configuration is + in the process of being reverted. Once complete, the index + config will transition to the same state as the field + specified by ``ancestor_field``, at which point + ``uses_ancestor_config`` will be ``true`` and ``reverting`` + will be ``false``. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.Field.IndexConfig) + ), + ), + DESCRIPTOR=_FIELD, + __module__="google.cloud.firestore.admin_v1.proto.field_pb2", + __doc__="""Represents a single field in the database. + + Fields are grouped by their "Collection Group", which represent all + collections in the database with the same id. + + + Attributes: + name: + A field name of the form ``projects/{project_id}/databases/{da + tabase_id}/collectionGroups/{collection_id}/fields/{field_path + }`` A field path may be a simple field name, e.g. ``address`` + or a path to fields within map\_value , e.g. ``address.city``, + or a special field path. The only valid special field is + ``*``, which represents any field. Field paths may be quoted + using ``(backtick). The only character that needs to be + escaped within a quoted field path is the backtick character + itself, escaped using a backslash. Special characters in field + paths that must be quoted include:``\ \*\ ``,``.\ ``, ``` + (backtick),``\ [``,``]\`, as well as any ascii symbolic + characters. Examples: (Note: Comments here are written in + markdown syntax, so there is an additional layer of backticks + to represent a code block) ``\``\ address.city\`\ ``represents + a field named``\ address.city\ ``, not the map key``\ city\ + ``in the field``\ address\ ``.``\ \`\ *\`\ ``represents a + field named``*\ \`, not any field. A special ``Field`` + contains the default indexing settings for all fields. This + field's resource name is: ``projects/{project_id}/databases/{d + atabase_id}/collectionGroups/__default__/fields/*`` Indexes + defined on this ``Field`` will be applied to all fields which + do not have their own ``Field`` index configuration. + index_config: + The index configuration for this field. If unset, field + indexing will revert to the configuration defined by the + ``ancestor_field``. To explicitly remove all indexes for this + field, specify an index config with an empty list of indexes. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.Field) + ), +) +_sym_db.RegisterMessage(Field) +_sym_db.RegisterMessage(Field.IndexConfig) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/firestore/google/cloud/firestore_admin_v1/proto/field_pb2_grpc.py b/firestore/google/cloud/firestore_admin_v1/proto/field_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/field_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/firestore/google/cloud/firestore_admin_v1/proto/firestore_admin.proto b/firestore/google/cloud/firestore_admin_v1/proto/firestore_admin.proto new file mode 100644 index 000000000000..e753686b200e --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/firestore_admin.proto @@ -0,0 +1,274 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/api/annotations.proto"; +import "google/firestore/admin/v1/field.proto"; +import "google/firestore/admin/v1/index.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1;admin"; +option java_multiple_files = true; +option java_outer_classname = "FirestoreAdminProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; + + +// Operations are created by service `FirestoreAdmin`, but are accessed via +// service `google.longrunning.Operations`. +service FirestoreAdmin { + // Creates a composite index. This returns a [google.longrunning.Operation][google.longrunning.Operation] + // which may be used to track the status of the creation. The metadata for + // the operation will be the type [IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata]. + rpc CreateIndex(CreateIndexRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes" + body: "index" + }; + } + + // Lists composite indexes. + rpc ListIndexes(ListIndexesRequest) returns (ListIndexesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes" + }; + } + + // Gets a composite index. + rpc GetIndex(GetIndexRequest) returns (Index) { + option (google.api.http) = { + get: "/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}" + }; + } + + // Deletes a composite index. + rpc DeleteIndex(DeleteIndexRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}" + }; + } + + // Gets the metadata and configuration for a Field. + rpc GetField(GetFieldRequest) returns (Field) { + option (google.api.http) = { + get: "/v1/{name=projects/*/databases/*/collectionGroups/*/fields/*}" + }; + } + + // Updates a field configuration. Currently, field updates apply only to + // single field index configuration. However, calls to + // [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField] should provide a field mask to avoid + // changing any configuration that the caller isn't aware of. The field mask + // should be specified as: `{ paths: "index_config" }`. + // + // This call returns a [google.longrunning.Operation][google.longrunning.Operation] which may be used to + // track the status of the field update. The metadata for + // the operation will be the type [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata]. + // + // To configure the default field settings for the database, use + // the special `Field` with resource name: + // `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`. + rpc UpdateField(UpdateFieldRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{field.name=projects/*/databases/*/collectionGroups/*/fields/*}" + body: "field" + }; + } + + // Lists the field configuration and metadata for this database. + // + // Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] only supports listing fields + // that have been explicitly overridden. To issue this query, call + // [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the filter set to + // `indexConfig.usesAncestorConfig:false`. + rpc ListFields(ListFieldsRequest) returns (ListFieldsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/databases/*/collectionGroups/*}/fields" + }; + } + + // Exports a copy of all or a subset of documents from Google Cloud Firestore + // to another storage system, such as Google Cloud Storage. Recent updates to + // documents may not be reflected in the export. The export occurs in the + // background and its progress can be monitored and managed via the + // Operation resource that is created. The output of an export may only be + // used once the associated operation is done. If an export operation is + // cancelled before completion it may leave partial data behind in Google + // Cloud Storage. + rpc ExportDocuments(ExportDocumentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/databases/*}:exportDocuments" + body: "*" + }; + } + + // Imports documents into Google Cloud Firestore. Existing documents with the + // same name are overwritten. The import occurs in the background and its + // progress can be monitored and managed via the Operation resource that is + // created. If an ImportDocuments operation is cancelled, it is possible + // that a subset of the data has already been imported to Cloud Firestore. + rpc ImportDocuments(ImportDocumentsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/databases/*}:importDocuments" + body: "*" + }; + } +} + +// The request for [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex]. +message CreateIndexRequest { + // A parent name of the form + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + string parent = 1; + + // The composite index to create. + Index index = 2; +} + +// The request for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes]. +message ListIndexesRequest { + // A parent name of the form + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + string parent = 1; + + // The filter to apply to list results. + string filter = 2; + + // The number of results to return. + int32 page_size = 3; + + // A page token, returned from a previous call to + // [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes], that may be used to get the next + // page of results. + string page_token = 4; +} + +// The response for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes]. +message ListIndexesResponse { + // The requested indexes. + repeated Index indexes = 1; + + // A page token that may be used to request another page of results. If blank, + // this is the last page. + string next_page_token = 2; +} + +// The request for [FirestoreAdmin.GetIndex][google.firestore.admin.v1.FirestoreAdmin.GetIndex]. +message GetIndexRequest { + // A name of the form + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + string name = 1; +} + +// The request for [FirestoreAdmin.DeleteIndex][google.firestore.admin.v1.FirestoreAdmin.DeleteIndex]. +message DeleteIndexRequest { + // A name of the form + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + string name = 1; +} + +// The request for [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField]. +message UpdateFieldRequest { + // The field to be updated. + Field field = 1; + + // A mask, relative to the field. If specified, only configuration specified + // by this field_mask will be updated in the field. + google.protobuf.FieldMask update_mask = 2; +} + +// The request for [FirestoreAdmin.GetField][google.firestore.admin.v1.FirestoreAdmin.GetField]. +message GetFieldRequest { + // A name of the form + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}` + string name = 1; +} + +// The request for [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]. +message ListFieldsRequest { + // A parent name of the form + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` + string parent = 1; + + // The filter to apply to list results. Currently, + // [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] only supports listing fields + // that have been explicitly overridden. To issue this query, call + // [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the filter set to + // `indexConfig.usesAncestorConfig:false`. + string filter = 2; + + // The number of results to return. + int32 page_size = 3; + + // A page token, returned from a previous call to + // [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields], that may be used to get the next + // page of results. + string page_token = 4; +} + +// The response for [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]. +message ListFieldsResponse { + // The requested fields. + repeated Field fields = 1; + + // A page token that may be used to request another page of results. If blank, + // this is the last page. + string next_page_token = 2; +} + +// The request for [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1.FirestoreAdmin.ExportDocuments]. +message ExportDocumentsRequest { + // Database to export. Should be of the form: + // `projects/{project_id}/databases/{database_id}`. + string name = 1; + + // Which collection ids to export. Unspecified means all collections. + repeated string collection_ids = 2; + + // The output URI. Currently only supports Google Cloud Storage URIs of the + // form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name + // of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional + // Google Cloud Storage namespace path. When + // choosing a name, be sure to consider Google Cloud Storage naming + // guidelines: https://cloud.google.com/storage/docs/naming. + // If the URI is a bucket (without a namespace path), a prefix will be + // generated based on the start time. + string output_uri_prefix = 3; +} + +// The request for [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1.FirestoreAdmin.ImportDocuments]. +message ImportDocumentsRequest { + // Database to import into. Should be of the form: + // `projects/{project_id}/databases/{database_id}`. + string name = 1; + + // Which collection ids to import. Unspecified means all collections included + // in the import. + repeated string collection_ids = 2; + + // Location of the exported files. + // This must match the output_uri_prefix of an ExportDocumentsResponse from + // an export that has completed successfully. + // See: + // [google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix][google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix]. + string input_uri_prefix = 3; +} diff --git a/firestore/google/cloud/firestore_admin_v1/proto/firestore_admin_pb2.py b/firestore/google/cloud/firestore_admin_v1/proto/firestore_admin_pb2.py new file mode 100644 index 000000000000..7346c4b4e789 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/firestore_admin_pb2.py @@ -0,0 +1,1159 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/firestore/admin_v1/proto/firestore_admin.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.cloud.firestore_admin_v1.proto import ( + field_pb2 as google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_field__pb2, +) +from google.cloud.firestore_admin_v1.proto import ( + index_pb2 as google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_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 +from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="google/cloud/firestore/admin_v1/proto/firestore_admin.proto", + package="google.firestore.admin.v1", + syntax="proto3", + serialized_options=_b( + "\n\035com.google.firestore.admin.v1B\023FirestoreAdminProtoP\001Z>google.golang.org/genproto/googleapis/firestore/admin/v1;admin\242\002\004GCFS\252\002\037Google.Cloud.Firestore.Admin.V1\312\002\037Google\\Cloud\\Firestore\\Admin\\V1" + ), + serialized_pb=_b( + '\n;google/cloud/firestore/admin_v1/proto/firestore_admin.proto\x12\x19google.firestore.admin.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x31google/cloud/firestore/admin_v1/proto/field.proto\x1a\x31google/cloud/firestore/admin_v1/proto/index.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto"U\n\x12\x43reateIndexRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12/\n\x05index\x18\x02 \x01(\x0b\x32 .google.firestore.admin.v1.Index"[\n\x12ListIndexesRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x02 \x01(\t\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x12\n\npage_token\x18\x04 \x01(\t"a\n\x13ListIndexesResponse\x12\x31\n\x07indexes\x18\x01 \x03(\x0b\x32 .google.firestore.admin.v1.Index\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"\x1f\n\x0fGetIndexRequest\x12\x0c\n\x04name\x18\x01 \x01(\t""\n\x12\x44\x65leteIndexRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"v\n\x12UpdateFieldRequest\x12/\n\x05\x66ield\x18\x01 \x01(\x0b\x32 .google.firestore.admin.v1.Field\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"\x1f\n\x0fGetFieldRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"Z\n\x11ListFieldsRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x0e\n\x06\x66ilter\x18\x02 \x01(\t\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x12\n\npage_token\x18\x04 \x01(\t"_\n\x12ListFieldsResponse\x12\x30\n\x06\x66ields\x18\x01 \x03(\x0b\x32 .google.firestore.admin.v1.Field\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"Y\n\x16\x45xportDocumentsRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x16\n\x0e\x63ollection_ids\x18\x02 \x03(\t\x12\x19\n\x11output_uri_prefix\x18\x03 \x01(\t"X\n\x16ImportDocumentsRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x16\n\x0e\x63ollection_ids\x18\x02 \x03(\t\x12\x18\n\x10input_uri_prefix\x18\x03 \x01(\t2\x85\x0c\n\x0e\x46irestoreAdmin\x12\xaa\x01\n\x0b\x43reateIndex\x12-.google.firestore.admin.v1.CreateIndexRequest\x1a\x1d.google.longrunning.Operation"M\x82\xd3\xe4\x93\x02G">/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes:\x05index\x12\xb4\x01\n\x0bListIndexes\x12-.google.firestore.admin.v1.ListIndexesRequest\x1a..google.firestore.admin.v1.ListIndexesResponse"F\x82\xd3\xe4\x93\x02@\x12>/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes\x12\xa0\x01\n\x08GetIndex\x12*.google.firestore.admin.v1.GetIndexRequest\x1a .google.firestore.admin.v1.Index"F\x82\xd3\xe4\x93\x02@\x12>/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}\x12\x9c\x01\n\x0b\x44\x65leteIndex\x12-.google.firestore.admin.v1.DeleteIndexRequest\x1a\x16.google.protobuf.Empty"F\x82\xd3\xe4\x93\x02@*>/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}\x12\x9f\x01\n\x08GetField\x12*.google.firestore.admin.v1.GetFieldRequest\x1a .google.firestore.admin.v1.Field"E\x82\xd3\xe4\x93\x02?\x12=/v1/{name=projects/*/databases/*/collectionGroups/*/fields/*}\x12\xaf\x01\n\x0bUpdateField\x12-.google.firestore.admin.v1.UpdateFieldRequest\x1a\x1d.google.longrunning.Operation"R\x82\xd3\xe4\x93\x02L2C/v1/{field.name=projects/*/databases/*/collectionGroups/*/fields/*}:\x05\x66ield\x12\xb0\x01\n\nListFields\x12,.google.firestore.admin.v1.ListFieldsRequest\x1a-.google.firestore.admin.v1.ListFieldsResponse"E\x82\xd3\xe4\x93\x02?\x12=/v1/{parent=projects/*/databases/*/collectionGroups/*}/fields\x12\xa1\x01\n\x0f\x45xportDocuments\x12\x31.google.firestore.admin.v1.ExportDocumentsRequest\x1a\x1d.google.longrunning.Operation"<\x82\xd3\xe4\x93\x02\x36"1/v1/{name=projects/*/databases/*}:exportDocuments:\x01*\x12\xa1\x01\n\x0fImportDocuments\x12\x31.google.firestore.admin.v1.ImportDocumentsRequest\x1a\x1d.google.longrunning.Operation"<\x82\xd3\xe4\x93\x02\x36"1/v1/{name=projects/*/databases/*}:importDocuments:\x01*B\xc1\x01\n\x1d\x63om.google.firestore.admin.v1B\x13\x46irestoreAdminProtoP\x01Z>google.golang.org/genproto/googleapis/firestore/admin/v1;admin\xa2\x02\x04GCFS\xaa\x02\x1fGoogle.Cloud.Firestore.Admin.V1\xca\x02\x1fGoogle\\Cloud\\Firestore\\Admin\\V1b\x06proto3' + ), + dependencies=[ + google_dot_api_dot_annotations__pb2.DESCRIPTOR, + google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_field__pb2.DESCRIPTOR, + google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_index__pb2.DESCRIPTOR, + google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, + google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, + google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, + ], +) + + +_CREATEINDEXREQUEST = _descriptor.Descriptor( + name="CreateIndexRequest", + full_name="google.firestore.admin.v1.CreateIndexRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.firestore.admin.v1.CreateIndexRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="index", + full_name="google.firestore.admin.v1.CreateIndexRequest.index", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=322, + serialized_end=407, +) + + +_LISTINDEXESREQUEST = _descriptor.Descriptor( + name="ListIndexesRequest", + full_name="google.firestore.admin.v1.ListIndexesRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.firestore.admin.v1.ListIndexesRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="filter", + full_name="google.firestore.admin.v1.ListIndexesRequest.filter", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_size", + full_name="google.firestore.admin.v1.ListIndexesRequest.page_size", + index=2, + number=3, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_token", + full_name="google.firestore.admin.v1.ListIndexesRequest.page_token", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=409, + serialized_end=500, +) + + +_LISTINDEXESRESPONSE = _descriptor.Descriptor( + name="ListIndexesResponse", + full_name="google.firestore.admin.v1.ListIndexesResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="indexes", + full_name="google.firestore.admin.v1.ListIndexesResponse.indexes", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="next_page_token", + full_name="google.firestore.admin.v1.ListIndexesResponse.next_page_token", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=502, + serialized_end=599, +) + + +_GETINDEXREQUEST = _descriptor.Descriptor( + name="GetIndexRequest", + full_name="google.firestore.admin.v1.GetIndexRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.firestore.admin.v1.GetIndexRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=601, + serialized_end=632, +) + + +_DELETEINDEXREQUEST = _descriptor.Descriptor( + name="DeleteIndexRequest", + full_name="google.firestore.admin.v1.DeleteIndexRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.firestore.admin.v1.DeleteIndexRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=634, + serialized_end=668, +) + + +_UPDATEFIELDREQUEST = _descriptor.Descriptor( + name="UpdateFieldRequest", + full_name="google.firestore.admin.v1.UpdateFieldRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="field", + full_name="google.firestore.admin.v1.UpdateFieldRequest.field", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="update_mask", + full_name="google.firestore.admin.v1.UpdateFieldRequest.update_mask", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=670, + serialized_end=788, +) + + +_GETFIELDREQUEST = _descriptor.Descriptor( + name="GetFieldRequest", + full_name="google.firestore.admin.v1.GetFieldRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.firestore.admin.v1.GetFieldRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=790, + serialized_end=821, +) + + +_LISTFIELDSREQUEST = _descriptor.Descriptor( + name="ListFieldsRequest", + full_name="google.firestore.admin.v1.ListFieldsRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.firestore.admin.v1.ListFieldsRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="filter", + full_name="google.firestore.admin.v1.ListFieldsRequest.filter", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_size", + full_name="google.firestore.admin.v1.ListFieldsRequest.page_size", + index=2, + number=3, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_token", + full_name="google.firestore.admin.v1.ListFieldsRequest.page_token", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=823, + serialized_end=913, +) + + +_LISTFIELDSRESPONSE = _descriptor.Descriptor( + name="ListFieldsResponse", + full_name="google.firestore.admin.v1.ListFieldsResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="fields", + full_name="google.firestore.admin.v1.ListFieldsResponse.fields", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="next_page_token", + full_name="google.firestore.admin.v1.ListFieldsResponse.next_page_token", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=915, + serialized_end=1010, +) + + +_EXPORTDOCUMENTSREQUEST = _descriptor.Descriptor( + name="ExportDocumentsRequest", + full_name="google.firestore.admin.v1.ExportDocumentsRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.firestore.admin.v1.ExportDocumentsRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="collection_ids", + full_name="google.firestore.admin.v1.ExportDocumentsRequest.collection_ids", + index=1, + number=2, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="output_uri_prefix", + full_name="google.firestore.admin.v1.ExportDocumentsRequest.output_uri_prefix", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1012, + serialized_end=1101, +) + + +_IMPORTDOCUMENTSREQUEST = _descriptor.Descriptor( + name="ImportDocumentsRequest", + full_name="google.firestore.admin.v1.ImportDocumentsRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.firestore.admin.v1.ImportDocumentsRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="collection_ids", + full_name="google.firestore.admin.v1.ImportDocumentsRequest.collection_ids", + index=1, + number=2, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="input_uri_prefix", + full_name="google.firestore.admin.v1.ImportDocumentsRequest.input_uri_prefix", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1103, + serialized_end=1191, +) + +_CREATEINDEXREQUEST.fields_by_name[ + "index" +].message_type = ( + google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_index__pb2._INDEX +) +_LISTINDEXESRESPONSE.fields_by_name[ + "indexes" +].message_type = ( + google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_index__pb2._INDEX +) +_UPDATEFIELDREQUEST.fields_by_name[ + "field" +].message_type = ( + google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_field__pb2._FIELD +) +_UPDATEFIELDREQUEST.fields_by_name[ + "update_mask" +].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK +_LISTFIELDSRESPONSE.fields_by_name[ + "fields" +].message_type = ( + google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_field__pb2._FIELD +) +DESCRIPTOR.message_types_by_name["CreateIndexRequest"] = _CREATEINDEXREQUEST +DESCRIPTOR.message_types_by_name["ListIndexesRequest"] = _LISTINDEXESREQUEST +DESCRIPTOR.message_types_by_name["ListIndexesResponse"] = _LISTINDEXESRESPONSE +DESCRIPTOR.message_types_by_name["GetIndexRequest"] = _GETINDEXREQUEST +DESCRIPTOR.message_types_by_name["DeleteIndexRequest"] = _DELETEINDEXREQUEST +DESCRIPTOR.message_types_by_name["UpdateFieldRequest"] = _UPDATEFIELDREQUEST +DESCRIPTOR.message_types_by_name["GetFieldRequest"] = _GETFIELDREQUEST +DESCRIPTOR.message_types_by_name["ListFieldsRequest"] = _LISTFIELDSREQUEST +DESCRIPTOR.message_types_by_name["ListFieldsResponse"] = _LISTFIELDSRESPONSE +DESCRIPTOR.message_types_by_name["ExportDocumentsRequest"] = _EXPORTDOCUMENTSREQUEST +DESCRIPTOR.message_types_by_name["ImportDocumentsRequest"] = _IMPORTDOCUMENTSREQUEST +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +CreateIndexRequest = _reflection.GeneratedProtocolMessageType( + "CreateIndexRequest", + (_message.Message,), + dict( + DESCRIPTOR=_CREATEINDEXREQUEST, + __module__="google.cloud.firestore.admin_v1.proto.firestore_admin_pb2", + __doc__="""The request for + [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex]. + + + Attributes: + parent: + A parent name of the form ``projects/{project_id}/databases/{d + atabase_id}/collectionGroups/{collection_id}`` + index: + The composite index to create. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.CreateIndexRequest) + ), +) +_sym_db.RegisterMessage(CreateIndexRequest) + +ListIndexesRequest = _reflection.GeneratedProtocolMessageType( + "ListIndexesRequest", + (_message.Message,), + dict( + DESCRIPTOR=_LISTINDEXESREQUEST, + __module__="google.cloud.firestore.admin_v1.proto.firestore_admin_pb2", + __doc__="""The request for + [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes]. + + + Attributes: + parent: + A parent name of the form ``projects/{project_id}/databases/{d + atabase_id}/collectionGroups/{collection_id}`` + filter: + The filter to apply to list results. + page_size: + The number of results to return. + page_token: + A page token, returned from a previous call to [FirestoreAdmin + .ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListInd + exes], that may be used to get the next page of results. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.ListIndexesRequest) + ), +) +_sym_db.RegisterMessage(ListIndexesRequest) + +ListIndexesResponse = _reflection.GeneratedProtocolMessageType( + "ListIndexesResponse", + (_message.Message,), + dict( + DESCRIPTOR=_LISTINDEXESRESPONSE, + __module__="google.cloud.firestore.admin_v1.proto.firestore_admin_pb2", + __doc__="""The response for + [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes]. + + + Attributes: + indexes: + The requested indexes. + next_page_token: + A page token that may be used to request another page of + results. If blank, this is the last page. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.ListIndexesResponse) + ), +) +_sym_db.RegisterMessage(ListIndexesResponse) + +GetIndexRequest = _reflection.GeneratedProtocolMessageType( + "GetIndexRequest", + (_message.Message,), + dict( + DESCRIPTOR=_GETINDEXREQUEST, + __module__="google.cloud.firestore.admin_v1.proto.firestore_admin_pb2", + __doc__="""The request for + [FirestoreAdmin.GetIndex][google.firestore.admin.v1.FirestoreAdmin.GetIndex]. + + + Attributes: + name: + A name of the form ``projects/{project_id}/databases/{database + _id}/collectionGroups/{collection_id}/indexes/{index_id}`` + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.GetIndexRequest) + ), +) +_sym_db.RegisterMessage(GetIndexRequest) + +DeleteIndexRequest = _reflection.GeneratedProtocolMessageType( + "DeleteIndexRequest", + (_message.Message,), + dict( + DESCRIPTOR=_DELETEINDEXREQUEST, + __module__="google.cloud.firestore.admin_v1.proto.firestore_admin_pb2", + __doc__="""The request for + [FirestoreAdmin.DeleteIndex][google.firestore.admin.v1.FirestoreAdmin.DeleteIndex]. + + + Attributes: + name: + A name of the form ``projects/{project_id}/databases/{database + _id}/collectionGroups/{collection_id}/indexes/{index_id}`` + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.DeleteIndexRequest) + ), +) +_sym_db.RegisterMessage(DeleteIndexRequest) + +UpdateFieldRequest = _reflection.GeneratedProtocolMessageType( + "UpdateFieldRequest", + (_message.Message,), + dict( + DESCRIPTOR=_UPDATEFIELDREQUEST, + __module__="google.cloud.firestore.admin_v1.proto.firestore_admin_pb2", + __doc__="""The request for + [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField]. + + + Attributes: + field: + The field to be updated. + update_mask: + A mask, relative to the field. If specified, only + configuration specified by this field\_mask will be updated in + the field. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.UpdateFieldRequest) + ), +) +_sym_db.RegisterMessage(UpdateFieldRequest) + +GetFieldRequest = _reflection.GeneratedProtocolMessageType( + "GetFieldRequest", + (_message.Message,), + dict( + DESCRIPTOR=_GETFIELDREQUEST, + __module__="google.cloud.firestore.admin_v1.proto.firestore_admin_pb2", + __doc__="""The request for + [FirestoreAdmin.GetField][google.firestore.admin.v1.FirestoreAdmin.GetField]. + + + Attributes: + name: + A name of the form ``projects/{project_id}/databases/{database + _id}/collectionGroups/{collection_id}/fields/{field_id}`` + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.GetFieldRequest) + ), +) +_sym_db.RegisterMessage(GetFieldRequest) + +ListFieldsRequest = _reflection.GeneratedProtocolMessageType( + "ListFieldsRequest", + (_message.Message,), + dict( + DESCRIPTOR=_LISTFIELDSREQUEST, + __module__="google.cloud.firestore.admin_v1.proto.firestore_admin_pb2", + __doc__="""The request for + [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]. + + + Attributes: + parent: + A parent name of the form ``projects/{project_id}/databases/{d + atabase_id}/collectionGroups/{collection_id}`` + filter: + The filter to apply to list results. Currently, [FirestoreAdmi + n.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFie + lds] only supports listing fields that have been explicitly + overridden. To issue this query, call [FirestoreAdmin.ListFiel + ds][google.firestore.admin.v1.FirestoreAdmin.ListFields] with + the filter set to ``indexConfig.usesAncestorConfig:false``. + page_size: + The number of results to return. + page_token: + A page token, returned from a previous call to [FirestoreAdmin + .ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFiel + ds], that may be used to get the next page of results. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.ListFieldsRequest) + ), +) +_sym_db.RegisterMessage(ListFieldsRequest) + +ListFieldsResponse = _reflection.GeneratedProtocolMessageType( + "ListFieldsResponse", + (_message.Message,), + dict( + DESCRIPTOR=_LISTFIELDSRESPONSE, + __module__="google.cloud.firestore.admin_v1.proto.firestore_admin_pb2", + __doc__="""The response for + [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields]. + + + Attributes: + fields: + The requested fields. + next_page_token: + A page token that may be used to request another page of + results. If blank, this is the last page. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.ListFieldsResponse) + ), +) +_sym_db.RegisterMessage(ListFieldsResponse) + +ExportDocumentsRequest = _reflection.GeneratedProtocolMessageType( + "ExportDocumentsRequest", + (_message.Message,), + dict( + DESCRIPTOR=_EXPORTDOCUMENTSREQUEST, + __module__="google.cloud.firestore.admin_v1.proto.firestore_admin_pb2", + __doc__="""The request for + [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1.FirestoreAdmin.ExportDocuments]. + + + Attributes: + name: + Database to export. Should be of the form: + ``projects/{project_id}/databases/{database_id}``. + collection_ids: + Which collection ids to export. Unspecified means all + collections. + output_uri_prefix: + The output URI. Currently only supports Google Cloud Storage + URIs of the form: ``gs://BUCKET_NAME[/NAMESPACE_PATH]``, where + ``BUCKET_NAME`` is the name of the Google Cloud Storage bucket + and ``NAMESPACE_PATH`` is an optional Google Cloud Storage + namespace path. When choosing a name, be sure to consider + Google Cloud Storage naming guidelines: + https://cloud.google.com/storage/docs/naming. If the URI is a + bucket (without a namespace path), a prefix will be generated + based on the start time. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.ExportDocumentsRequest) + ), +) +_sym_db.RegisterMessage(ExportDocumentsRequest) + +ImportDocumentsRequest = _reflection.GeneratedProtocolMessageType( + "ImportDocumentsRequest", + (_message.Message,), + dict( + DESCRIPTOR=_IMPORTDOCUMENTSREQUEST, + __module__="google.cloud.firestore.admin_v1.proto.firestore_admin_pb2", + __doc__="""The request for + [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1.FirestoreAdmin.ImportDocuments]. + + + Attributes: + name: + Database to import into. Should be of the form: + ``projects/{project_id}/databases/{database_id}``. + collection_ids: + Which collection ids to import. Unspecified means all + collections included in the import. + input_uri_prefix: + Location of the exported files. This must match the + output\_uri\_prefix of an ExportDocumentsResponse from an + export that has completed successfully. See: [google.firestore + .admin.v1.ExportDocumentsResponse.output\_uri\_prefix][google. + firestore.admin.v1.ExportDocumentsResponse.output\_uri\_prefix + ]. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.ImportDocumentsRequest) + ), +) +_sym_db.RegisterMessage(ImportDocumentsRequest) + + +DESCRIPTOR._options = None + +_FIRESTOREADMIN = _descriptor.ServiceDescriptor( + name="FirestoreAdmin", + full_name="google.firestore.admin.v1.FirestoreAdmin", + file=DESCRIPTOR, + index=0, + serialized_options=None, + serialized_start=1194, + serialized_end=2735, + methods=[ + _descriptor.MethodDescriptor( + name="CreateIndex", + full_name="google.firestore.admin.v1.FirestoreAdmin.CreateIndex", + index=0, + containing_service=None, + input_type=_CREATEINDEXREQUEST, + output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, + serialized_options=_b( + '\202\323\344\223\002G">/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes:\005index' + ), + ), + _descriptor.MethodDescriptor( + name="ListIndexes", + full_name="google.firestore.admin.v1.FirestoreAdmin.ListIndexes", + index=1, + containing_service=None, + input_type=_LISTINDEXESREQUEST, + output_type=_LISTINDEXESRESPONSE, + serialized_options=_b( + "\202\323\344\223\002@\022>/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes" + ), + ), + _descriptor.MethodDescriptor( + name="GetIndex", + full_name="google.firestore.admin.v1.FirestoreAdmin.GetIndex", + index=2, + containing_service=None, + input_type=_GETINDEXREQUEST, + output_type=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_index__pb2._INDEX, + serialized_options=_b( + "\202\323\344\223\002@\022>/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}" + ), + ), + _descriptor.MethodDescriptor( + name="DeleteIndex", + full_name="google.firestore.admin.v1.FirestoreAdmin.DeleteIndex", + index=3, + containing_service=None, + input_type=_DELETEINDEXREQUEST, + output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, + serialized_options=_b( + "\202\323\344\223\002@*>/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}" + ), + ), + _descriptor.MethodDescriptor( + name="GetField", + full_name="google.firestore.admin.v1.FirestoreAdmin.GetField", + index=4, + containing_service=None, + input_type=_GETFIELDREQUEST, + output_type=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_field__pb2._FIELD, + serialized_options=_b( + "\202\323\344\223\002?\022=/v1/{name=projects/*/databases/*/collectionGroups/*/fields/*}" + ), + ), + _descriptor.MethodDescriptor( + name="UpdateField", + full_name="google.firestore.admin.v1.FirestoreAdmin.UpdateField", + index=5, + containing_service=None, + input_type=_UPDATEFIELDREQUEST, + output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, + serialized_options=_b( + "\202\323\344\223\002L2C/v1/{field.name=projects/*/databases/*/collectionGroups/*/fields/*}:\005field" + ), + ), + _descriptor.MethodDescriptor( + name="ListFields", + full_name="google.firestore.admin.v1.FirestoreAdmin.ListFields", + index=6, + containing_service=None, + input_type=_LISTFIELDSREQUEST, + output_type=_LISTFIELDSRESPONSE, + serialized_options=_b( + "\202\323\344\223\002?\022=/v1/{parent=projects/*/databases/*/collectionGroups/*}/fields" + ), + ), + _descriptor.MethodDescriptor( + name="ExportDocuments", + full_name="google.firestore.admin.v1.FirestoreAdmin.ExportDocuments", + index=7, + containing_service=None, + input_type=_EXPORTDOCUMENTSREQUEST, + output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, + serialized_options=_b( + '\202\323\344\223\0026"1/v1/{name=projects/*/databases/*}:exportDocuments:\001*' + ), + ), + _descriptor.MethodDescriptor( + name="ImportDocuments", + full_name="google.firestore.admin.v1.FirestoreAdmin.ImportDocuments", + index=8, + containing_service=None, + input_type=_IMPORTDOCUMENTSREQUEST, + output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, + serialized_options=_b( + '\202\323\344\223\0026"1/v1/{name=projects/*/databases/*}:importDocuments:\001*' + ), + ), + ], +) +_sym_db.RegisterServiceDescriptor(_FIRESTOREADMIN) + +DESCRIPTOR.services_by_name["FirestoreAdmin"] = _FIRESTOREADMIN + +# @@protoc_insertion_point(module_scope) diff --git a/firestore/google/cloud/firestore_admin_v1/proto/firestore_admin_pb2_grpc.py b/firestore/google/cloud/firestore_admin_v1/proto/firestore_admin_pb2_grpc.py new file mode 100644 index 000000000000..269e920b3ac2 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/firestore_admin_pb2_grpc.py @@ -0,0 +1,227 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc + +from google.cloud.firestore_admin_v1.proto import ( + field_pb2 as google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_field__pb2, +) +from google.cloud.firestore_admin_v1.proto import ( + firestore_admin_pb2 as google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2, +) +from google.cloud.firestore_admin_v1.proto import ( + index_pb2 as google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_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): + """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.v1.FirestoreAdmin/CreateIndex", + request_serializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.CreateIndexRequest.SerializeToString, + response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, + ) + self.ListIndexes = channel.unary_unary( + "/google.firestore.admin.v1.FirestoreAdmin/ListIndexes", + request_serializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.ListIndexesRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.ListIndexesResponse.FromString, + ) + self.GetIndex = channel.unary_unary( + "/google.firestore.admin.v1.FirestoreAdmin/GetIndex", + request_serializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.GetIndexRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_index__pb2.Index.FromString, + ) + self.DeleteIndex = channel.unary_unary( + "/google.firestore.admin.v1.FirestoreAdmin/DeleteIndex", + request_serializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.DeleteIndexRequest.SerializeToString, + response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, + ) + self.GetField = channel.unary_unary( + "/google.firestore.admin.v1.FirestoreAdmin/GetField", + request_serializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.GetFieldRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_field__pb2.Field.FromString, + ) + self.UpdateField = channel.unary_unary( + "/google.firestore.admin.v1.FirestoreAdmin/UpdateField", + request_serializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.UpdateFieldRequest.SerializeToString, + response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, + ) + self.ListFields = channel.unary_unary( + "/google.firestore.admin.v1.FirestoreAdmin/ListFields", + request_serializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.ListFieldsRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.ListFieldsResponse.FromString, + ) + self.ExportDocuments = channel.unary_unary( + "/google.firestore.admin.v1.FirestoreAdmin/ExportDocuments", + request_serializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.ExportDocumentsRequest.SerializeToString, + response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, + ) + self.ImportDocuments = channel.unary_unary( + "/google.firestore.admin.v1.FirestoreAdmin/ImportDocuments", + request_serializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.ImportDocumentsRequest.SerializeToString, + response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, + ) + + +class FirestoreAdminServicer(object): + """Operations are created by service `FirestoreAdmin`, but are accessed via + service `google.longrunning.Operations`. + """ + + def CreateIndex(self, request, context): + """Creates a composite index. This returns a [google.longrunning.Operation][google.longrunning.Operation] + which may be used to track the status of the creation. The metadata for + the operation will be the type [IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata]. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def ListIndexes(self, request, context): + """Lists composite indexes. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def GetIndex(self, request, context): + """Gets a composite index. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def DeleteIndex(self, request, context): + """Deletes a composite index. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def GetField(self, request, context): + """Gets the metadata and configuration for a Field. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def UpdateField(self, request, context): + """Updates a field configuration. Currently, field updates apply only to + single field index configuration. However, calls to + [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField] should provide a field mask to avoid + changing any configuration that the caller isn't aware of. The field mask + should be specified as: `{ paths: "index_config" }`. + + This call returns a [google.longrunning.Operation][google.longrunning.Operation] which may be used to + track the status of the field update. The metadata for + the operation will be the type [FieldOperationMetadata][google.firestore.admin.v1.FieldOperationMetadata]. + + To configure the default field settings for the database, use + the special `Field` with resource name: + `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def ListFields(self, request, context): + """Lists the field configuration and metadata for this database. + + Currently, [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] only supports listing fields + that have been explicitly overridden. To issue this query, call + [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields] with the filter set to + `indexConfig.usesAncestorConfig:false`. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def ExportDocuments(self, request, context): + """Exports a copy of all or a subset of documents from Google Cloud Firestore + to another storage system, such as Google Cloud Storage. Recent updates to + documents may not be reflected in the export. The export occurs in the + background and its progress can be monitored and managed via the + Operation resource that is created. The output of an export may only be + used once the associated operation is done. If an export operation is + cancelled before completion it may leave partial data behind in Google + Cloud Storage. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def ImportDocuments(self, request, context): + """Imports documents into Google Cloud Firestore. Existing documents with the + same name are overwritten. The import occurs in the background and its + progress can be monitored and managed via the Operation resource that is + created. If an ImportDocuments operation is cancelled, it is possible + that a subset of the data has already been imported to Cloud Firestore. + """ + 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_dot_admin__v1_dot_proto_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_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.ListIndexesRequest.FromString, + response_serializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.ListIndexesResponse.SerializeToString, + ), + "GetIndex": grpc.unary_unary_rpc_method_handler( + servicer.GetIndex, + request_deserializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.GetIndexRequest.FromString, + response_serializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_index__pb2.Index.SerializeToString, + ), + "DeleteIndex": grpc.unary_unary_rpc_method_handler( + servicer.DeleteIndex, + request_deserializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.DeleteIndexRequest.FromString, + response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, + ), + "GetField": grpc.unary_unary_rpc_method_handler( + servicer.GetField, + request_deserializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.GetFieldRequest.FromString, + response_serializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_field__pb2.Field.SerializeToString, + ), + "UpdateField": grpc.unary_unary_rpc_method_handler( + servicer.UpdateField, + request_deserializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.UpdateFieldRequest.FromString, + response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, + ), + "ListFields": grpc.unary_unary_rpc_method_handler( + servicer.ListFields, + request_deserializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.ListFieldsRequest.FromString, + response_serializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.ListFieldsResponse.SerializeToString, + ), + "ExportDocuments": grpc.unary_unary_rpc_method_handler( + servicer.ExportDocuments, + request_deserializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.ExportDocumentsRequest.FromString, + response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, + ), + "ImportDocuments": grpc.unary_unary_rpc_method_handler( + servicer.ImportDocuments, + request_deserializer=google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_firestore__admin__pb2.ImportDocumentsRequest.FromString, + response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + "google.firestore.admin.v1.FirestoreAdmin", rpc_method_handlers + ) + server.add_generic_rpc_handlers((generic_handler,)) diff --git a/firestore/google/cloud/firestore_admin_v1/proto/index.proto b/firestore/google/cloud/firestore_admin_v1/proto/index.proto new file mode 100644 index 000000000000..94941d3a0707 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/index.proto @@ -0,0 +1,149 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1;admin"; +option java_multiple_files = true; +option java_outer_classname = "IndexProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; + + +// Cloud Firestore indexes enable simple and complex queries against +// documents in a database. +message Index { + // A field in an index. + // The field_path describes which field is indexed, the value_mode describes + // how the field value is indexed. + message IndexField { + // The supported orderings. + enum Order { + // The ordering is unspecified. Not a valid option. + ORDER_UNSPECIFIED = 0; + + // The field is ordered by ascending field value. + ASCENDING = 1; + + // The field is ordered by descending field value. + DESCENDING = 2; + } + + // The supported array value configurations. + enum ArrayConfig { + // The index does not support additional array queries. + ARRAY_CONFIG_UNSPECIFIED = 0; + + // The index supports array containment queries. + CONTAINS = 1; + } + + // Can be __name__. + // For single field indexes, this must match the name of the field or may + // be omitted. + string field_path = 1; + + // How the field value is indexed. + oneof value_mode { + // Indicates that this field supports ordering by the specified order or + // comparing using =, <, <=, >, >=. + Order order = 2; + + // Indicates that this field supports operations on `array_value`s. + ArrayConfig array_config = 3; + } + } + + // Query Scope defines the scope at which a query is run. This is specified on + // a StructuredQuery's `from` field. + enum QueryScope { + // The query scope is unspecified. Not a valid option. + QUERY_SCOPE_UNSPECIFIED = 0; + + // Indexes with a collection query scope specified allow queries + // against a collection that is the child of a specific document, specified + // at query time, and that has the collection id specified by the index. + COLLECTION = 1; + } + + // The state of an index. During index creation, an index will be in the + // `CREATING` state. If the index is created successfully, it will transition + // to the `READY` state. If the index creation encounters a problem, the index + // will transition to the `NEEDS_REPAIR` state. + enum State { + // The state is unspecified. + STATE_UNSPECIFIED = 0; + + // The index is being created. + // There is an active long-running operation for the index. + // The index is updated when writing a document. + // Some index data may exist. + CREATING = 1; + + // The index is ready to be used. + // The index is updated when writing a document. + // The index is fully populated from all stored documents it applies to. + READY = 2; + + // The index was being created, but something went wrong. + // There is no active long-running operation for the index, + // and the most recently finished long-running operation failed. + // The index is not updated when writing a document. + // Some index data may exist. + // Use the google.longrunning.Operations API to determine why the operation + // that last attempted to create this index failed, then re-create the + // index. + NEEDS_REPAIR = 3; + } + + // Output only. + // A server defined name for this index. + // The form of this name for composite indexes will be: + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id}` + // For single field indexes, this field will be empty. + string name = 1; + + // Indexes with a collection query scope specified allow queries + // against a collection that is the child of a specific document, specified at + // query time, and that has the same collection id. + // + // Indexes with a collection group query scope specified allow queries against + // all collections descended from a specific document, specified at query + // time, and that have the same collection id as this index. + QueryScope query_scope = 2; + + // The fields supported by this index. + // + // For composite indexes, this is always 2 or more fields. + // The last field entry is always for the field path `__name__`. If, on + // creation, `__name__` was not specified as the last field, it will be added + // automatically with the same direction as that of the last field defined. If + // the final field in a composite index is not directional, the `__name__` + // will be ordered ASCENDING (unless explicitly specified). + // + // For single field indexes, this will always be exactly one entry with a + // field path equal to the field path of the associated field. + repeated IndexField fields = 3; + + // Output only. + // The serving state of the index. + State state = 4; +} diff --git a/firestore/google/cloud/firestore_admin_v1/proto/index_pb2.py b/firestore/google/cloud/firestore_admin_v1/proto/index_pb2.py new file mode 100644 index 000000000000..cb089c09a31b --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/index_pb2.py @@ -0,0 +1,415 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/firestore/admin_v1/proto/index.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="google/cloud/firestore/admin_v1/proto/index.proto", + package="google.firestore.admin.v1", + syntax="proto3", + serialized_options=_b( + "\n\035com.google.firestore.admin.v1B\nIndexProtoP\001Z>google.golang.org/genproto/googleapis/firestore/admin/v1;admin\242\002\004GCFS\252\002\037Google.Cloud.Firestore.Admin.V1\312\002\037Google\\Cloud\\Firestore\\Admin\\V1" + ), + serialized_pb=_b( + '\n1google/cloud/firestore/admin_v1/proto/index.proto\x12\x19google.firestore.admin.v1\x1a\x1cgoogle/api/annotations.proto"\x91\x05\n\x05Index\x12\x0c\n\x04name\x18\x01 \x01(\t\x12@\n\x0bquery_scope\x18\x02 \x01(\x0e\x32+.google.firestore.admin.v1.Index.QueryScope\x12;\n\x06\x66ields\x18\x03 \x03(\x0b\x32+.google.firestore.admin.v1.Index.IndexField\x12\x35\n\x05state\x18\x04 \x01(\x0e\x32&.google.firestore.admin.v1.Index.State\x1a\xbd\x02\n\nIndexField\x12\x12\n\nfield_path\x18\x01 \x01(\t\x12\x42\n\x05order\x18\x02 \x01(\x0e\x32\x31.google.firestore.admin.v1.Index.IndexField.OrderH\x00\x12O\n\x0c\x61rray_config\x18\x03 \x01(\x0e\x32\x37.google.firestore.admin.v1.Index.IndexField.ArrayConfigH\x00"=\n\x05Order\x12\x15\n\x11ORDER_UNSPECIFIED\x10\x00\x12\r\n\tASCENDING\x10\x01\x12\x0e\n\nDESCENDING\x10\x02"9\n\x0b\x41rrayConfig\x12\x1c\n\x18\x41RRAY_CONFIG_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x43ONTAINS\x10\x01\x42\x0c\n\nvalue_mode"9\n\nQueryScope\x12\x1b\n\x17QUERY_SCOPE_UNSPECIFIED\x10\x00\x12\x0e\n\nCOLLECTION\x10\x01"I\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x43REATING\x10\x01\x12\t\n\x05READY\x10\x02\x12\x10\n\x0cNEEDS_REPAIR\x10\x03\x42\xb8\x01\n\x1d\x63om.google.firestore.admin.v1B\nIndexProtoP\x01Z>google.golang.org/genproto/googleapis/firestore/admin/v1;admin\xa2\x02\x04GCFS\xaa\x02\x1fGoogle.Cloud.Firestore.Admin.V1\xca\x02\x1fGoogle\\Cloud\\Firestore\\Admin\\V1b\x06proto3' + ), + dependencies=[google_dot_api_dot_annotations__pb2.DESCRIPTOR], +) + + +_INDEX_INDEXFIELD_ORDER = _descriptor.EnumDescriptor( + name="Order", + full_name="google.firestore.admin.v1.Index.IndexField.Order", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="ORDER_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="ASCENDING", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="DESCENDING", index=2, number=2, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=500, + serialized_end=561, +) +_sym_db.RegisterEnumDescriptor(_INDEX_INDEXFIELD_ORDER) + +_INDEX_INDEXFIELD_ARRAYCONFIG = _descriptor.EnumDescriptor( + name="ArrayConfig", + full_name="google.firestore.admin.v1.Index.IndexField.ArrayConfig", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="ARRAY_CONFIG_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="CONTAINS", index=1, number=1, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=563, + serialized_end=620, +) +_sym_db.RegisterEnumDescriptor(_INDEX_INDEXFIELD_ARRAYCONFIG) + +_INDEX_QUERYSCOPE = _descriptor.EnumDescriptor( + name="QueryScope", + full_name="google.firestore.admin.v1.Index.QueryScope", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="QUERY_SCOPE_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="COLLECTION", index=1, number=1, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=636, + serialized_end=693, +) +_sym_db.RegisterEnumDescriptor(_INDEX_QUERYSCOPE) + +_INDEX_STATE = _descriptor.EnumDescriptor( + name="State", + full_name="google.firestore.admin.v1.Index.State", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="STATE_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="CREATING", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="READY", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="NEEDS_REPAIR", index=3, number=3, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=695, + serialized_end=768, +) +_sym_db.RegisterEnumDescriptor(_INDEX_STATE) + + +_INDEX_INDEXFIELD = _descriptor.Descriptor( + name="IndexField", + full_name="google.firestore.admin.v1.Index.IndexField", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="field_path", + full_name="google.firestore.admin.v1.Index.IndexField.field_path", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="order", + full_name="google.firestore.admin.v1.Index.IndexField.order", + index=1, + number=2, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="array_config", + full_name="google.firestore.admin.v1.Index.IndexField.array_config", + index=2, + number=3, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[_INDEX_INDEXFIELD_ORDER, _INDEX_INDEXFIELD_ARRAYCONFIG], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="value_mode", + full_name="google.firestore.admin.v1.Index.IndexField.value_mode", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=317, + serialized_end=634, +) + +_INDEX = _descriptor.Descriptor( + name="Index", + full_name="google.firestore.admin.v1.Index", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.firestore.admin.v1.Index.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="query_scope", + full_name="google.firestore.admin.v1.Index.query_scope", + index=1, + number=2, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="fields", + full_name="google.firestore.admin.v1.Index.fields", + index=2, + number=3, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="state", + full_name="google.firestore.admin.v1.Index.state", + index=3, + number=4, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_INDEX_INDEXFIELD], + enum_types=[_INDEX_QUERYSCOPE, _INDEX_STATE], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=111, + serialized_end=768, +) + +_INDEX_INDEXFIELD.fields_by_name["order"].enum_type = _INDEX_INDEXFIELD_ORDER +_INDEX_INDEXFIELD.fields_by_name[ + "array_config" +].enum_type = _INDEX_INDEXFIELD_ARRAYCONFIG +_INDEX_INDEXFIELD.containing_type = _INDEX +_INDEX_INDEXFIELD_ORDER.containing_type = _INDEX_INDEXFIELD +_INDEX_INDEXFIELD_ARRAYCONFIG.containing_type = _INDEX_INDEXFIELD +_INDEX_INDEXFIELD.oneofs_by_name["value_mode"].fields.append( + _INDEX_INDEXFIELD.fields_by_name["order"] +) +_INDEX_INDEXFIELD.fields_by_name[ + "order" +].containing_oneof = _INDEX_INDEXFIELD.oneofs_by_name["value_mode"] +_INDEX_INDEXFIELD.oneofs_by_name["value_mode"].fields.append( + _INDEX_INDEXFIELD.fields_by_name["array_config"] +) +_INDEX_INDEXFIELD.fields_by_name[ + "array_config" +].containing_oneof = _INDEX_INDEXFIELD.oneofs_by_name["value_mode"] +_INDEX.fields_by_name["query_scope"].enum_type = _INDEX_QUERYSCOPE +_INDEX.fields_by_name["fields"].message_type = _INDEX_INDEXFIELD +_INDEX.fields_by_name["state"].enum_type = _INDEX_STATE +_INDEX_QUERYSCOPE.containing_type = _INDEX +_INDEX_STATE.containing_type = _INDEX +DESCRIPTOR.message_types_by_name["Index"] = _INDEX +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Index = _reflection.GeneratedProtocolMessageType( + "Index", + (_message.Message,), + dict( + IndexField=_reflection.GeneratedProtocolMessageType( + "IndexField", + (_message.Message,), + dict( + DESCRIPTOR=_INDEX_INDEXFIELD, + __module__="google.cloud.firestore.admin_v1.proto.index_pb2", + __doc__="""A field in an index. The field\_path describes which field is indexed, + the value\_mode describes how the field value is indexed. + + + Attributes: + field_path: + Can be **name**. For single field indexes, this must match the + name of the field or may be omitted. + value_mode: + How the field value is indexed. + order: + Indicates that this field supports ordering by the specified + order or comparing using =, <, <=, >, >=. + array_config: + Indicates that this field supports operations on + ``array_value``\ s. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.Index.IndexField) + ), + ), + DESCRIPTOR=_INDEX, + __module__="google.cloud.firestore.admin_v1.proto.index_pb2", + __doc__="""Cloud Firestore indexes enable simple and complex queries against + documents in a database. + + + Attributes: + name: + Output only. A server defined name for this index. The form of + this name for composite indexes will be: ``projects/{project_i + d}/databases/{database_id}/collectionGroups/{collection_id}/in + dexes/{composite_index_id}`` For single field indexes, this + field will be empty. + query_scope: + Indexes with a collection query scope specified allow queries + against a collection that is the child of a specific document, + specified at query time, and that has the same collection id. + Indexes with a collection group query scope specified allow + queries against all collections descended from a specific + document, specified at query time, and that have the same + collection id as this index. + fields: + The fields supported by this index. For composite indexes, + this is always 2 or more fields. The last field entry is + always for the field path ``__name__``. If, on creation, + ``__name__`` was not specified as the last field, it will be + added automatically with the same direction as that of the + last field defined. If the final field in a composite index is + not directional, the ``__name__`` will be ordered ASCENDING + (unless explicitly specified). For single field indexes, this + will always be exactly one entry with a field path equal to + the field path of the associated field. + state: + Output only. The serving state of the index. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.Index) + ), +) +_sym_db.RegisterMessage(Index) +_sym_db.RegisterMessage(Index.IndexField) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/firestore/google/cloud/firestore_admin_v1/proto/index_pb2_grpc.py b/firestore/google/cloud/firestore_admin_v1/proto/index_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/index_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/firestore/google/cloud/firestore_admin_v1/proto/location.proto b/firestore/google/cloud/firestore_admin_v1/proto/location.proto new file mode 100644 index 000000000000..7b56051a5c36 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/location.proto @@ -0,0 +1,35 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/type/latlng.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1;admin"; +option java_multiple_files = true; +option java_outer_classname = "LocationProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; + + +// The metadata message for [google.cloud.location.Location.metadata][google.cloud.location.Location.metadata]. +message LocationMetadata { + +} diff --git a/firestore/google/cloud/firestore_admin_v1/proto/location_pb2.py b/firestore/google/cloud/firestore_admin_v1/proto/location_pb2.py new file mode 100644 index 000000000000..0c9643a3ab6b --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/location_pb2.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/firestore/admin_v1/proto/location.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.type import latlng_pb2 as google_dot_type_dot_latlng__pb2 +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="google/cloud/firestore/admin_v1/proto/location.proto", + package="google.firestore.admin.v1", + syntax="proto3", + serialized_options=_b( + "\n\035com.google.firestore.admin.v1B\rLocationProtoP\001Z>google.golang.org/genproto/googleapis/firestore/admin/v1;admin\242\002\004GCFS\252\002\037Google.Cloud.Firestore.Admin.V1\312\002\037Google\\Cloud\\Firestore\\Admin\\V1" + ), + serialized_pb=_b( + '\n4google/cloud/firestore/admin_v1/proto/location.proto\x12\x19google.firestore.admin.v1\x1a\x18google/type/latlng.proto\x1a\x1cgoogle/api/annotations.proto"\x12\n\x10LocationMetadataB\xbb\x01\n\x1d\x63om.google.firestore.admin.v1B\rLocationProtoP\x01Z>google.golang.org/genproto/googleapis/firestore/admin/v1;admin\xa2\x02\x04GCFS\xaa\x02\x1fGoogle.Cloud.Firestore.Admin.V1\xca\x02\x1fGoogle\\Cloud\\Firestore\\Admin\\V1b\x06proto3' + ), + dependencies=[ + google_dot_type_dot_latlng__pb2.DESCRIPTOR, + google_dot_api_dot_annotations__pb2.DESCRIPTOR, + ], +) + + +_LOCATIONMETADATA = _descriptor.Descriptor( + name="LocationMetadata", + full_name="google.firestore.admin.v1.LocationMetadata", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=139, + serialized_end=157, +) + +DESCRIPTOR.message_types_by_name["LocationMetadata"] = _LOCATIONMETADATA +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +LocationMetadata = _reflection.GeneratedProtocolMessageType( + "LocationMetadata", + (_message.Message,), + dict( + DESCRIPTOR=_LOCATIONMETADATA, + __module__="google.cloud.firestore.admin_v1.proto.location_pb2", + __doc__="""The metadata message for + [google.cloud.location.Location.metadata][google.cloud.location.Location.metadata]. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.LocationMetadata) + ), +) +_sym_db.RegisterMessage(LocationMetadata) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/firestore/google/cloud/firestore_admin_v1/proto/location_pb2_grpc.py b/firestore/google/cloud/firestore_admin_v1/proto/location_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/location_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/firestore/google/cloud/firestore_admin_v1/proto/operation.proto b/firestore/google/cloud/firestore_admin_v1/proto/operation.proto new file mode 100644 index 000000000000..d333d9b7de25 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/operation.proto @@ -0,0 +1,204 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.firestore.admin.v1; + +import "google/firestore/admin/v1/index.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.Firestore.Admin.V1"; +option go_package = "google.golang.org/genproto/googleapis/firestore/admin/v1;admin"; +option java_multiple_files = true; +option java_outer_classname = "OperationProto"; +option java_package = "com.google.firestore.admin.v1"; +option objc_class_prefix = "GCFS"; +option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1"; + + +// Metadata for [google.longrunning.Operation][google.longrunning.Operation] results from +// [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex]. +message IndexOperationMetadata { + // The time this operation started. + google.protobuf.Timestamp start_time = 1; + + // The time this operation completed. Will be unset if operation still in + // progress. + google.protobuf.Timestamp end_time = 2; + + // The index resource that this operation is acting on. For example: + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}` + string index = 3; + + // The state of the operation. + OperationState state = 4; + + // The progress, in documents, of this operation. + Progress progress_documents = 5; + + // The progress, in bytes, of this operation. + Progress progress_bytes = 6; +} + +// Metadata for [google.longrunning.Operation][google.longrunning.Operation] results from +// [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField]. +message FieldOperationMetadata { + // Information about an index configuration change. + message IndexConfigDelta { + // Specifies how the index is changing. + enum ChangeType { + // The type of change is not specified or known. + CHANGE_TYPE_UNSPECIFIED = 0; + + // The single field index is being added. + ADD = 1; + + // The single field index is being removed. + REMOVE = 2; + } + + // Specifies how the index is changing. + ChangeType change_type = 1; + + // The index being changed. + Index index = 2; + } + + // The time this operation started. + google.protobuf.Timestamp start_time = 1; + + // The time this operation completed. Will be unset if operation still in + // progress. + google.protobuf.Timestamp end_time = 2; + + // The field resource that this operation is acting on. For example: + // `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_path}` + string field = 3; + + // A list of [IndexConfigDelta][google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta], which describe the intent of this + // operation. + repeated IndexConfigDelta index_config_deltas = 4; + + // The state of the operation. + OperationState state = 5; + + // The progress, in documents, of this operation. + Progress progress_documents = 6; + + // The progress, in bytes, of this operation. + Progress progress_bytes = 7; +} + +// Metadata for [google.longrunning.Operation][google.longrunning.Operation] results from +// [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1.FirestoreAdmin.ExportDocuments]. +message ExportDocumentsMetadata { + // The time this operation started. + google.protobuf.Timestamp start_time = 1; + + // The time this operation completed. Will be unset if operation still in + // progress. + google.protobuf.Timestamp end_time = 2; + + // The state of the export operation. + OperationState operation_state = 3; + + // The progress, in documents, of this operation. + Progress progress_documents = 4; + + // The progress, in bytes, of this operation. + Progress progress_bytes = 5; + + // Which collection ids are being exported. + repeated string collection_ids = 6; + + // Where the entities are being exported to. + string output_uri_prefix = 7; +} + +// Metadata for [google.longrunning.Operation][google.longrunning.Operation] results from +// [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1.FirestoreAdmin.ImportDocuments]. +message ImportDocumentsMetadata { + // The time this operation started. + google.protobuf.Timestamp start_time = 1; + + // The time this operation completed. Will be unset if operation still in + // progress. + google.protobuf.Timestamp end_time = 2; + + // The state of the import operation. + OperationState operation_state = 3; + + // The progress, in documents, of this operation. + Progress progress_documents = 4; + + // The progress, in bytes, of this operation. + Progress progress_bytes = 5; + + // Which collection ids are being imported. + repeated string collection_ids = 6; + + // The location of the documents being imported. + string input_uri_prefix = 7; +} + +// Returned in the [google.longrunning.Operation][google.longrunning.Operation] response field. +message ExportDocumentsResponse { + // Location of the output files. This can be used to begin an import + // into Cloud Firestore (this project or another project) after the operation + // completes successfully. + string output_uri_prefix = 1; +} + +// Describes the state of the operation. +enum OperationState { + // Unspecified. + OPERATION_STATE_UNSPECIFIED = 0; + + // Request is being prepared for processing. + INITIALIZING = 1; + + // Request is actively being processed. + PROCESSING = 2; + + // Request is in the process of being cancelled after user called + // google.longrunning.Operations.CancelOperation on the operation. + CANCELLING = 3; + + // Request has been processed and is in its finalization stage. + FINALIZING = 4; + + // Request has completed successfully. + SUCCESSFUL = 5; + + // Request has finished being processed, but encountered an error. + FAILED = 6; + + // Request has finished being cancelled after user called + // google.longrunning.Operations.CancelOperation. + CANCELLED = 7; +} + +// Describes the progress of the operation. +// Unit of work is generic and must be interpreted based on where [Progress][google.firestore.admin.v1.Progress] +// is used. +message Progress { + // The amount of work estimated. + int64 estimated_work = 1; + + // The amount of work completed. + int64 completed_work = 2; +} diff --git a/firestore/google/cloud/firestore_admin_v1/proto/operation_pb2.py b/firestore/google/cloud/firestore_admin_v1/proto/operation_pb2.py new file mode 100644 index 000000000000..7993aa91dc73 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/operation_pb2.py @@ -0,0 +1,1110 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/firestore/admin_v1/proto/operation.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.cloud.firestore_admin_v1.proto import ( + index_pb2 as google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_index__pb2, +) +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="google/cloud/firestore/admin_v1/proto/operation.proto", + package="google.firestore.admin.v1", + syntax="proto3", + serialized_options=_b( + "\n\035com.google.firestore.admin.v1B\016OperationProtoP\001Z>google.golang.org/genproto/googleapis/firestore/admin/v1;admin\242\002\004GCFS\252\002\037Google.Cloud.Firestore.Admin.V1\312\002\037Google\\Cloud\\Firestore\\Admin\\V1" + ), + serialized_pb=_b( + '\n5google/cloud/firestore/admin_v1/proto/operation.proto\x12\x19google.firestore.admin.v1\x1a\x31google/cloud/firestore/admin_v1/proto/index.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1cgoogle/api/annotations.proto"\xbd\x02\n\x16IndexOperationMetadata\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\r\n\x05index\x18\x03 \x01(\t\x12\x38\n\x05state\x18\x04 \x01(\x0e\x32).google.firestore.admin.v1.OperationState\x12?\n\x12progress_documents\x18\x05 \x01(\x0b\x32#.google.firestore.admin.v1.Progress\x12;\n\x0eprogress_bytes\x18\x06 \x01(\x0b\x32#.google.firestore.admin.v1.Progress"\x88\x05\n\x16\x46ieldOperationMetadata\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\r\n\x05\x66ield\x18\x03 \x01(\t\x12_\n\x13index_config_deltas\x18\x04 \x03(\x0b\x32\x42.google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta\x12\x38\n\x05state\x18\x05 \x01(\x0e\x32).google.firestore.admin.v1.OperationState\x12?\n\x12progress_documents\x18\x06 \x01(\x0b\x32#.google.firestore.admin.v1.Progress\x12;\n\x0eprogress_bytes\x18\x07 \x01(\x0b\x32#.google.firestore.admin.v1.Progress\x1a\xe7\x01\n\x10IndexConfigDelta\x12\x62\n\x0b\x63hange_type\x18\x01 \x01(\x0e\x32M.google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.ChangeType\x12/\n\x05index\x18\x02 \x01(\x0b\x32 .google.firestore.admin.v1.Index">\n\nChangeType\x12\x1b\n\x17\x43HANGE_TYPE_UNSPECIFIED\x10\x00\x12\x07\n\x03\x41\x44\x44\x10\x01\x12\n\n\x06REMOVE\x10\x02"\xec\x02\n\x17\x45xportDocumentsMetadata\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x42\n\x0foperation_state\x18\x03 \x01(\x0e\x32).google.firestore.admin.v1.OperationState\x12?\n\x12progress_documents\x18\x04 \x01(\x0b\x32#.google.firestore.admin.v1.Progress\x12;\n\x0eprogress_bytes\x18\x05 \x01(\x0b\x32#.google.firestore.admin.v1.Progress\x12\x16\n\x0e\x63ollection_ids\x18\x06 \x03(\t\x12\x19\n\x11output_uri_prefix\x18\x07 \x01(\t"\xeb\x02\n\x17ImportDocumentsMetadata\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x42\n\x0foperation_state\x18\x03 \x01(\x0e\x32).google.firestore.admin.v1.OperationState\x12?\n\x12progress_documents\x18\x04 \x01(\x0b\x32#.google.firestore.admin.v1.Progress\x12;\n\x0eprogress_bytes\x18\x05 \x01(\x0b\x32#.google.firestore.admin.v1.Progress\x12\x16\n\x0e\x63ollection_ids\x18\x06 \x03(\t\x12\x18\n\x10input_uri_prefix\x18\x07 \x01(\t"4\n\x17\x45xportDocumentsResponse\x12\x19\n\x11output_uri_prefix\x18\x01 \x01(\t":\n\x08Progress\x12\x16\n\x0e\x65stimated_work\x18\x01 \x01(\x03\x12\x16\n\x0e\x63ompleted_work\x18\x02 \x01(\x03*\x9e\x01\n\x0eOperationState\x12\x1f\n\x1bOPERATION_STATE_UNSPECIFIED\x10\x00\x12\x10\n\x0cINITIALIZING\x10\x01\x12\x0e\n\nPROCESSING\x10\x02\x12\x0e\n\nCANCELLING\x10\x03\x12\x0e\n\nFINALIZING\x10\x04\x12\x0e\n\nSUCCESSFUL\x10\x05\x12\n\n\x06\x46\x41ILED\x10\x06\x12\r\n\tCANCELLED\x10\x07\x42\xbc\x01\n\x1d\x63om.google.firestore.admin.v1B\x0eOperationProtoP\x01Z>google.golang.org/genproto/googleapis/firestore/admin/v1;admin\xa2\x02\x04GCFS\xaa\x02\x1fGoogle.Cloud.Firestore.Admin.V1\xca\x02\x1fGoogle\\Cloud\\Firestore\\Admin\\V1b\x06proto3' + ), + dependencies=[ + google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_index__pb2.DESCRIPTOR, + google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, + google_dot_api_dot_annotations__pb2.DESCRIPTOR, + ], +) + +_OPERATIONSTATE = _descriptor.EnumDescriptor( + name="OperationState", + full_name="google.firestore.admin.v1.OperationState", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="OPERATION_STATE_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="INITIALIZING", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="PROCESSING", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="CANCELLING", index=3, number=3, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="FINALIZING", index=4, number=4, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="SUCCESSFUL", index=5, number=5, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="FAILED", index=6, number=6, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="CANCELLED", index=7, number=7, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=2017, + serialized_end=2175, +) +_sym_db.RegisterEnumDescriptor(_OPERATIONSTATE) + +OperationState = enum_type_wrapper.EnumTypeWrapper(_OPERATIONSTATE) +OPERATION_STATE_UNSPECIFIED = 0 +INITIALIZING = 1 +PROCESSING = 2 +CANCELLING = 3 +FINALIZING = 4 +SUCCESSFUL = 5 +FAILED = 6 +CANCELLED = 7 + + +_FIELDOPERATIONMETADATA_INDEXCONFIGDELTA_CHANGETYPE = _descriptor.EnumDescriptor( + name="ChangeType", + full_name="google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.ChangeType", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="CHANGE_TYPE_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="ADD", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="REMOVE", index=2, number=2, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=1105, + serialized_end=1167, +) +_sym_db.RegisterEnumDescriptor(_FIELDOPERATIONMETADATA_INDEXCONFIGDELTA_CHANGETYPE) + + +_INDEXOPERATIONMETADATA = _descriptor.Descriptor( + name="IndexOperationMetadata", + full_name="google.firestore.admin.v1.IndexOperationMetadata", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="start_time", + full_name="google.firestore.admin.v1.IndexOperationMetadata.start_time", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="end_time", + full_name="google.firestore.admin.v1.IndexOperationMetadata.end_time", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="index", + full_name="google.firestore.admin.v1.IndexOperationMetadata.index", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="state", + full_name="google.firestore.admin.v1.IndexOperationMetadata.state", + index=3, + number=4, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="progress_documents", + full_name="google.firestore.admin.v1.IndexOperationMetadata.progress_documents", + index=4, + number=5, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="progress_bytes", + full_name="google.firestore.admin.v1.IndexOperationMetadata.progress_bytes", + index=5, + number=6, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=199, + serialized_end=516, +) + + +_FIELDOPERATIONMETADATA_INDEXCONFIGDELTA = _descriptor.Descriptor( + name="IndexConfigDelta", + full_name="google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="change_type", + full_name="google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.change_type", + index=0, + number=1, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="index", + full_name="google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta.index", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[_FIELDOPERATIONMETADATA_INDEXCONFIGDELTA_CHANGETYPE], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=936, + serialized_end=1167, +) + +_FIELDOPERATIONMETADATA = _descriptor.Descriptor( + name="FieldOperationMetadata", + full_name="google.firestore.admin.v1.FieldOperationMetadata", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="start_time", + full_name="google.firestore.admin.v1.FieldOperationMetadata.start_time", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="end_time", + full_name="google.firestore.admin.v1.FieldOperationMetadata.end_time", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="field", + full_name="google.firestore.admin.v1.FieldOperationMetadata.field", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="index_config_deltas", + full_name="google.firestore.admin.v1.FieldOperationMetadata.index_config_deltas", + index=3, + number=4, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="state", + full_name="google.firestore.admin.v1.FieldOperationMetadata.state", + index=4, + number=5, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="progress_documents", + full_name="google.firestore.admin.v1.FieldOperationMetadata.progress_documents", + index=5, + number=6, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="progress_bytes", + full_name="google.firestore.admin.v1.FieldOperationMetadata.progress_bytes", + index=6, + number=7, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_FIELDOPERATIONMETADATA_INDEXCONFIGDELTA], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=519, + serialized_end=1167, +) + + +_EXPORTDOCUMENTSMETADATA = _descriptor.Descriptor( + name="ExportDocumentsMetadata", + full_name="google.firestore.admin.v1.ExportDocumentsMetadata", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="start_time", + full_name="google.firestore.admin.v1.ExportDocumentsMetadata.start_time", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="end_time", + full_name="google.firestore.admin.v1.ExportDocumentsMetadata.end_time", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="operation_state", + full_name="google.firestore.admin.v1.ExportDocumentsMetadata.operation_state", + index=2, + number=3, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="progress_documents", + full_name="google.firestore.admin.v1.ExportDocumentsMetadata.progress_documents", + index=3, + number=4, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="progress_bytes", + full_name="google.firestore.admin.v1.ExportDocumentsMetadata.progress_bytes", + index=4, + number=5, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="collection_ids", + full_name="google.firestore.admin.v1.ExportDocumentsMetadata.collection_ids", + index=5, + number=6, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="output_uri_prefix", + full_name="google.firestore.admin.v1.ExportDocumentsMetadata.output_uri_prefix", + index=6, + number=7, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1170, + serialized_end=1534, +) + + +_IMPORTDOCUMENTSMETADATA = _descriptor.Descriptor( + name="ImportDocumentsMetadata", + full_name="google.firestore.admin.v1.ImportDocumentsMetadata", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="start_time", + full_name="google.firestore.admin.v1.ImportDocumentsMetadata.start_time", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="end_time", + full_name="google.firestore.admin.v1.ImportDocumentsMetadata.end_time", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="operation_state", + full_name="google.firestore.admin.v1.ImportDocumentsMetadata.operation_state", + index=2, + number=3, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="progress_documents", + full_name="google.firestore.admin.v1.ImportDocumentsMetadata.progress_documents", + index=3, + number=4, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="progress_bytes", + full_name="google.firestore.admin.v1.ImportDocumentsMetadata.progress_bytes", + index=4, + number=5, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="collection_ids", + full_name="google.firestore.admin.v1.ImportDocumentsMetadata.collection_ids", + index=5, + number=6, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="input_uri_prefix", + full_name="google.firestore.admin.v1.ImportDocumentsMetadata.input_uri_prefix", + index=6, + number=7, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1537, + serialized_end=1900, +) + + +_EXPORTDOCUMENTSRESPONSE = _descriptor.Descriptor( + name="ExportDocumentsResponse", + full_name="google.firestore.admin.v1.ExportDocumentsResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="output_uri_prefix", + full_name="google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1902, + serialized_end=1954, +) + + +_PROGRESS = _descriptor.Descriptor( + name="Progress", + full_name="google.firestore.admin.v1.Progress", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="estimated_work", + full_name="google.firestore.admin.v1.Progress.estimated_work", + index=0, + number=1, + type=3, + cpp_type=2, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="completed_work", + full_name="google.firestore.admin.v1.Progress.completed_work", + index=1, + number=2, + type=3, + cpp_type=2, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1956, + serialized_end=2014, +) + +_INDEXOPERATIONMETADATA.fields_by_name[ + "start_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_INDEXOPERATIONMETADATA.fields_by_name[ + "end_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_INDEXOPERATIONMETADATA.fields_by_name["state"].enum_type = _OPERATIONSTATE +_INDEXOPERATIONMETADATA.fields_by_name["progress_documents"].message_type = _PROGRESS +_INDEXOPERATIONMETADATA.fields_by_name["progress_bytes"].message_type = _PROGRESS +_FIELDOPERATIONMETADATA_INDEXCONFIGDELTA.fields_by_name[ + "change_type" +].enum_type = _FIELDOPERATIONMETADATA_INDEXCONFIGDELTA_CHANGETYPE +_FIELDOPERATIONMETADATA_INDEXCONFIGDELTA.fields_by_name[ + "index" +].message_type = ( + google_dot_cloud_dot_firestore_dot_admin__v1_dot_proto_dot_index__pb2._INDEX +) +_FIELDOPERATIONMETADATA_INDEXCONFIGDELTA.containing_type = _FIELDOPERATIONMETADATA +_FIELDOPERATIONMETADATA_INDEXCONFIGDELTA_CHANGETYPE.containing_type = ( + _FIELDOPERATIONMETADATA_INDEXCONFIGDELTA +) +_FIELDOPERATIONMETADATA.fields_by_name[ + "start_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_FIELDOPERATIONMETADATA.fields_by_name[ + "end_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_FIELDOPERATIONMETADATA.fields_by_name[ + "index_config_deltas" +].message_type = _FIELDOPERATIONMETADATA_INDEXCONFIGDELTA +_FIELDOPERATIONMETADATA.fields_by_name["state"].enum_type = _OPERATIONSTATE +_FIELDOPERATIONMETADATA.fields_by_name["progress_documents"].message_type = _PROGRESS +_FIELDOPERATIONMETADATA.fields_by_name["progress_bytes"].message_type = _PROGRESS +_EXPORTDOCUMENTSMETADATA.fields_by_name[ + "start_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_EXPORTDOCUMENTSMETADATA.fields_by_name[ + "end_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_EXPORTDOCUMENTSMETADATA.fields_by_name["operation_state"].enum_type = _OPERATIONSTATE +_EXPORTDOCUMENTSMETADATA.fields_by_name["progress_documents"].message_type = _PROGRESS +_EXPORTDOCUMENTSMETADATA.fields_by_name["progress_bytes"].message_type = _PROGRESS +_IMPORTDOCUMENTSMETADATA.fields_by_name[ + "start_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_IMPORTDOCUMENTSMETADATA.fields_by_name[ + "end_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_IMPORTDOCUMENTSMETADATA.fields_by_name["operation_state"].enum_type = _OPERATIONSTATE +_IMPORTDOCUMENTSMETADATA.fields_by_name["progress_documents"].message_type = _PROGRESS +_IMPORTDOCUMENTSMETADATA.fields_by_name["progress_bytes"].message_type = _PROGRESS +DESCRIPTOR.message_types_by_name["IndexOperationMetadata"] = _INDEXOPERATIONMETADATA +DESCRIPTOR.message_types_by_name["FieldOperationMetadata"] = _FIELDOPERATIONMETADATA +DESCRIPTOR.message_types_by_name["ExportDocumentsMetadata"] = _EXPORTDOCUMENTSMETADATA +DESCRIPTOR.message_types_by_name["ImportDocumentsMetadata"] = _IMPORTDOCUMENTSMETADATA +DESCRIPTOR.message_types_by_name["ExportDocumentsResponse"] = _EXPORTDOCUMENTSRESPONSE +DESCRIPTOR.message_types_by_name["Progress"] = _PROGRESS +DESCRIPTOR.enum_types_by_name["OperationState"] = _OPERATIONSTATE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +IndexOperationMetadata = _reflection.GeneratedProtocolMessageType( + "IndexOperationMetadata", + (_message.Message,), + dict( + DESCRIPTOR=_INDEXOPERATIONMETADATA, + __module__="google.cloud.firestore.admin_v1.proto.operation_pb2", + __doc__="""Metadata for + [google.longrunning.Operation][google.longrunning.Operation] results + from + [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex]. + + + Attributes: + start_time: + The time this operation started. + end_time: + The time this operation completed. Will be unset if operation + still in progress. + index: + The index resource that this operation is acting on. For + example: ``projects/{project_id}/databases/{database_id}/colle + ctionGroups/{collection_id}/indexes/{index_id}`` + state: + The state of the operation. + progress_documents: + The progress, in documents, of this operation. + progress_bytes: + The progress, in bytes, of this operation. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.IndexOperationMetadata) + ), +) +_sym_db.RegisterMessage(IndexOperationMetadata) + +FieldOperationMetadata = _reflection.GeneratedProtocolMessageType( + "FieldOperationMetadata", + (_message.Message,), + dict( + IndexConfigDelta=_reflection.GeneratedProtocolMessageType( + "IndexConfigDelta", + (_message.Message,), + dict( + DESCRIPTOR=_FIELDOPERATIONMETADATA_INDEXCONFIGDELTA, + __module__="google.cloud.firestore.admin_v1.proto.operation_pb2", + __doc__="""Information about an index configuration change. + + + Attributes: + change_type: + Specifies how the index is changing. + index: + The index being changed. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.FieldOperationMetadata.IndexConfigDelta) + ), + ), + DESCRIPTOR=_FIELDOPERATIONMETADATA, + __module__="google.cloud.firestore.admin_v1.proto.operation_pb2", + __doc__="""Metadata for + [google.longrunning.Operation][google.longrunning.Operation] results + from + [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField]. + + + Attributes: + start_time: + The time this operation started. + end_time: + The time this operation completed. Will be unset if operation + still in progress. + field: + The field resource that this operation is acting on. For + example: ``projects/{project_id}/databases/{database_id}/colle + ctionGroups/{collection_id}/fields/{field_path}`` + index_config_deltas: + A list of [IndexConfigDelta][google.firestore.admin.v1.FieldOp + erationMetadata.IndexConfigDelta], which describe the intent + of this operation. + state: + The state of the operation. + progress_documents: + The progress, in documents, of this operation. + progress_bytes: + The progress, in bytes, of this operation. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.FieldOperationMetadata) + ), +) +_sym_db.RegisterMessage(FieldOperationMetadata) +_sym_db.RegisterMessage(FieldOperationMetadata.IndexConfigDelta) + +ExportDocumentsMetadata = _reflection.GeneratedProtocolMessageType( + "ExportDocumentsMetadata", + (_message.Message,), + dict( + DESCRIPTOR=_EXPORTDOCUMENTSMETADATA, + __module__="google.cloud.firestore.admin_v1.proto.operation_pb2", + __doc__="""Metadata for + [google.longrunning.Operation][google.longrunning.Operation] results + from + [FirestoreAdmin.ExportDocuments][google.firestore.admin.v1.FirestoreAdmin.ExportDocuments]. + + + Attributes: + start_time: + The time this operation started. + end_time: + The time this operation completed. Will be unset if operation + still in progress. + operation_state: + The state of the export operation. + progress_documents: + The progress, in documents, of this operation. + progress_bytes: + The progress, in bytes, of this operation. + collection_ids: + Which collection ids are being exported. + output_uri_prefix: + Where the entities are being exported to. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.ExportDocumentsMetadata) + ), +) +_sym_db.RegisterMessage(ExportDocumentsMetadata) + +ImportDocumentsMetadata = _reflection.GeneratedProtocolMessageType( + "ImportDocumentsMetadata", + (_message.Message,), + dict( + DESCRIPTOR=_IMPORTDOCUMENTSMETADATA, + __module__="google.cloud.firestore.admin_v1.proto.operation_pb2", + __doc__="""Metadata for + [google.longrunning.Operation][google.longrunning.Operation] results + from + [FirestoreAdmin.ImportDocuments][google.firestore.admin.v1.FirestoreAdmin.ImportDocuments]. + + + Attributes: + start_time: + The time this operation started. + end_time: + The time this operation completed. Will be unset if operation + still in progress. + operation_state: + The state of the import operation. + progress_documents: + The progress, in documents, of this operation. + progress_bytes: + The progress, in bytes, of this operation. + collection_ids: + Which collection ids are being imported. + input_uri_prefix: + The location of the documents being imported. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.ImportDocumentsMetadata) + ), +) +_sym_db.RegisterMessage(ImportDocumentsMetadata) + +ExportDocumentsResponse = _reflection.GeneratedProtocolMessageType( + "ExportDocumentsResponse", + (_message.Message,), + dict( + DESCRIPTOR=_EXPORTDOCUMENTSRESPONSE, + __module__="google.cloud.firestore.admin_v1.proto.operation_pb2", + __doc__="""Returned in the + [google.longrunning.Operation][google.longrunning.Operation] response + field. + + + Attributes: + output_uri_prefix: + Location of the output files. This can be used to begin an + import into Cloud Firestore (this project or another project) + after the operation completes successfully. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.ExportDocumentsResponse) + ), +) +_sym_db.RegisterMessage(ExportDocumentsResponse) + +Progress = _reflection.GeneratedProtocolMessageType( + "Progress", + (_message.Message,), + dict( + DESCRIPTOR=_PROGRESS, + __module__="google.cloud.firestore.admin_v1.proto.operation_pb2", + __doc__="""Describes the progress of the operation. Unit of work is generic and + must be interpreted based on where + [Progress][google.firestore.admin.v1.Progress] is used. + + + Attributes: + estimated_work: + The amount of work estimated. + completed_work: + The amount of work completed. + """, + # @@protoc_insertion_point(class_scope:google.firestore.admin.v1.Progress) + ), +) +_sym_db.RegisterMessage(Progress) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/firestore/google/cloud/firestore_admin_v1/proto/operation_pb2_grpc.py b/firestore/google/cloud/firestore_admin_v1/proto/operation_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/proto/operation_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/firestore/google/cloud/firestore_admin_v1/types.py b/firestore/google/cloud/firestore_admin_v1/types.py new file mode 100644 index 000000000000..53fdbebc6aa4 --- /dev/null +++ b/firestore/google/cloud/firestore_admin_v1/types.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from __future__ import absolute_import +import sys + +from google.api_core.protobuf_helpers import get_messages + +from google.cloud.firestore_admin_v1.proto import field_pb2 +from google.cloud.firestore_admin_v1.proto import firestore_admin_pb2 +from google.cloud.firestore_admin_v1.proto import index_pb2 +from google.cloud.firestore_admin_v1.proto import location_pb2 +from google.cloud.firestore_admin_v1.proto import operation_pb2 +from google.longrunning import operations_pb2 +from google.protobuf import any_pb2 +from google.protobuf import empty_pb2 +from google.protobuf import field_mask_pb2 +from google.protobuf import timestamp_pb2 +from google.rpc import status_pb2 + + +_shared_modules = [ + operations_pb2, + any_pb2, + empty_pb2, + field_mask_pb2, + timestamp_pb2, + status_pb2, +] + +_local_modules = [ + field_pb2, + firestore_admin_pb2, + index_pb2, + location_pb2, + operation_pb2, +] + +names = [] + +for module in _shared_modules: # pragma: NO COVER + for name, message in get_messages(module).items(): + setattr(sys.modules[__name__], name, message) + names.append(name) +for module in _local_modules: + for name, message in get_messages(module).items(): + message.__module__ = "google.cloud.firestore_admin_v1.types" + setattr(sys.modules[__name__], name, message) + names.append(name) + + +__all__ = tuple(sorted(names)) diff --git a/firestore/synth.metadata b/firestore/synth.metadata index ab373c1aa7e1..e523cb1d24a7 100644 --- a/firestore/synth.metadata +++ b/firestore/synth.metadata @@ -1,19 +1,19 @@ { - "updateTime": "2019-07-03T12:27:13.986685Z", + "updateTime": "2019-07-22T19:51:16.956918Z", "sources": [ { "generator": { "name": "artman", - "version": "0.29.3", - "dockerImage": "googleapis/artman@sha256:8900f94a81adaab0238965aa8a7b3648791f4f3a95ee65adc6a56cfcc3753101" + "version": "0.30.1", + "dockerImage": "googleapis/artman@sha256:f1a2e851e5e012c59e1da4125480bb19878f86a4e7fac4f375f2e819956b5aa3" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "69916b6ffbb7717fa009033351777d0c9909fb79", - "internalRef": "256241904" + "sha": "43e06784d56d2daf68fb2e3c654ead2193e318f3", + "internalRef": "259382992" } }, { @@ -44,6 +44,16 @@ "generator": "gapic", "config": "google/firestore/artman_firestore_v1.yaml" } + }, + { + "client": { + "source": "googleapis", + "apiName": "firestore_admin", + "apiVersion": "v1", + "language": "python", + "generator": "gapic", + "config": "google/firestore/admin/artman_firestore_v1.yaml" + } } ] } \ No newline at end of file diff --git a/firestore/synth.py b/firestore/synth.py index fe9410a0ad71..a0ee3fd2273b 100644 --- a/firestore/synth.py +++ b/firestore/synth.py @@ -22,6 +22,10 @@ ("v1beta1", "artman_firestore.yaml"), ("v1", "artman_firestore_v1.yaml"), ] +admin_versions = [ + ("v1", "artman_firestore_v1.yaml"), +] + # ---------------------------------------------------------------------------- # Generate firestore GAPIC layer @@ -51,6 +55,33 @@ "client = firestore_client.FirestoreClient", ) + +# ---------------------------------------------------------------------------- +# Generate firestore admin GAPIC layer +# ---------------------------------------------------------------------------- +for version, artman_config in admin_versions: + library = gapic.py_library( + "firestore_admin", + f"{version}", + config_path=f"/google/firestore/admin/{artman_config}", + artman_output_name=f"firestore-admin-{version}", + include_protos=True, + ) + s.move(library / f"google/cloud/firestore_admin_{version}") + s.move(library / "tests") + + s.replace( + f"google/cloud/firestore_admin_{version}/gapic/firestore_admin_client.py", + "'google-cloud-firestore-admin'", + "'google-cloud-firestore'", + ) + + s.replace( + "google/**/*.py", + f"from google\.cloud\.firestore\.admin_{version}.proto", + f"from google.cloud.firestore_admin_{version}.proto", + ) + # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- diff --git a/firestore/tests/unit/gapic/v1/test_firestore_admin_client_v1.py b/firestore/tests/unit/gapic/v1/test_firestore_admin_client_v1.py new file mode 100644 index 000000000000..325557582924 --- /dev/null +++ b/firestore/tests/unit/gapic/v1/test_firestore_admin_client_v1.py @@ -0,0 +1,430 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Unit tests.""" + +import mock +import pytest + +from google.cloud import firestore_admin_v1 +from google.cloud.firestore_admin_v1.proto import field_pb2 +from google.cloud.firestore_admin_v1.proto import firestore_admin_pb2 +from google.cloud.firestore_admin_v1.proto import index_pb2 +from google.longrunning import operations_pb2 +from google.protobuf import empty_pb2 + + +class MultiCallableStub(object): + """Stub for the grpc.UnaryUnaryMultiCallable interface.""" + + def __init__(self, method, channel_stub): + self.method = method + self.channel_stub = channel_stub + + def __call__(self, request, timeout=None, metadata=None, credentials=None): + self.channel_stub.requests.append((self.method, request)) + + response = None + if self.channel_stub.responses: + response = self.channel_stub.responses.pop() + + if isinstance(response, Exception): + raise response + + if response: + return response + + +class ChannelStub(object): + """Stub for the grpc.Channel interface.""" + + def __init__(self, responses=[]): + self.responses = responses + self.requests = [] + + def unary_unary(self, method, request_serializer=None, response_deserializer=None): + return MultiCallableStub(method, self) + + +class CustomException(Exception): + pass + + +class TestFirestoreAdminClient(object): + def test_create_index(self): + # Setup Expected Response + name = "name3373707" + done = True + expected_response = {"name": name, "done": done} + expected_response = operations_pb2.Operation(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup Request + parent = client.parent_path("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]") + index = {} + + response = client.create_index(parent, index) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = firestore_admin_pb2.CreateIndexRequest( + parent=parent, index=index + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_create_index_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup request + parent = client.parent_path("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]") + index = {} + + with pytest.raises(CustomException): + client.create_index(parent, index) + + def test_list_indexes(self): + # Setup Expected Response + next_page_token = "" + indexes_element = {} + indexes = [indexes_element] + expected_response = {"next_page_token": next_page_token, "indexes": indexes} + expected_response = firestore_admin_pb2.ListIndexesResponse(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup Request + parent = client.parent_path("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]") + + paged_list_response = client.list_indexes(parent) + resources = list(paged_list_response) + assert len(resources) == 1 + + assert expected_response.indexes[0] == resources[0] + + assert len(channel.requests) == 1 + expected_request = firestore_admin_pb2.ListIndexesRequest(parent=parent) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_list_indexes_exception(self): + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup request + parent = client.parent_path("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]") + + paged_list_response = client.list_indexes(parent) + with pytest.raises(CustomException): + list(paged_list_response) + + def test_get_index(self): + # Setup Expected Response + name_2 = "name2-1052831874" + expected_response = {"name": name_2} + expected_response = index_pb2.Index(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup Request + name = client.index_path( + "[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]" + ) + + response = client.get_index(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = firestore_admin_pb2.GetIndexRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_get_index_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup request + name = client.index_path( + "[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]" + ) + + with pytest.raises(CustomException): + client.get_index(name) + + def test_delete_index(self): + channel = ChannelStub() + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup Request + name = client.index_path( + "[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]" + ) + + client.delete_index(name) + + assert len(channel.requests) == 1 + expected_request = firestore_admin_pb2.DeleteIndexRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_delete_index_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup request + name = client.index_path( + "[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[INDEX_ID]" + ) + + with pytest.raises(CustomException): + client.delete_index(name) + + def test_import_documents(self): + # Setup Expected Response + name_2 = "name2-1052831874" + done = True + expected_response = {"name": name_2, "done": done} + expected_response = operations_pb2.Operation(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup Request + name = client.database_path("[PROJECT]", "[DATABASE]") + + response = client.import_documents(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = firestore_admin_pb2.ImportDocumentsRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_import_documents_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup request + name = client.database_path("[PROJECT]", "[DATABASE]") + + with pytest.raises(CustomException): + client.import_documents(name) + + def test_export_documents(self): + # Setup Expected Response + name_2 = "name2-1052831874" + done = True + expected_response = {"name": name_2, "done": done} + expected_response = operations_pb2.Operation(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup Request + name = client.database_path("[PROJECT]", "[DATABASE]") + + response = client.export_documents(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = firestore_admin_pb2.ExportDocumentsRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_export_documents_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup request + name = client.database_path("[PROJECT]", "[DATABASE]") + + with pytest.raises(CustomException): + client.export_documents(name) + + def test_get_field(self): + # Setup Expected Response + name_2 = "name2-1052831874" + expected_response = {"name": name_2} + expected_response = field_pb2.Field(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup Request + name = client.field_path( + "[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[FIELD_ID]" + ) + + response = client.get_field(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = firestore_admin_pb2.GetFieldRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_get_field_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup request + name = client.field_path( + "[PROJECT]", "[DATABASE]", "[COLLECTION_ID]", "[FIELD_ID]" + ) + + with pytest.raises(CustomException): + client.get_field(name) + + def test_list_fields(self): + # Setup Expected Response + next_page_token = "" + fields_element = {} + fields = [fields_element] + expected_response = {"next_page_token": next_page_token, "fields": fields} + expected_response = firestore_admin_pb2.ListFieldsResponse(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup Request + parent = client.parent_path("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]") + + paged_list_response = client.list_fields(parent) + resources = list(paged_list_response) + assert len(resources) == 1 + + assert expected_response.fields[0] == resources[0] + + assert len(channel.requests) == 1 + expected_request = firestore_admin_pb2.ListFieldsRequest(parent=parent) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_list_fields_exception(self): + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup request + parent = client.parent_path("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]") + + paged_list_response = client.list_fields(parent) + with pytest.raises(CustomException): + list(paged_list_response) + + def test_update_field(self): + # Setup Expected Response + name = "name3373707" + done = True + expected_response = {"name": name, "done": done} + expected_response = operations_pb2.Operation(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup Request + field = {} + + response = client.update_field(field) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = firestore_admin_pb2.UpdateFieldRequest(field=field) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_update_field_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = firestore_admin_v1.FirestoreAdminClient() + + # Setup request + field = {} + + with pytest.raises(CustomException): + client.update_field(field)