Added delete option to database storage.

This commit is contained in:
Batuhan Berk Başoğlu 2020-10-12 12:10:01 -04:00
parent 308604a33c
commit 963b5bc68b
1868 changed files with 192402 additions and 13278 deletions

View file

@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
#
# Copyright 2020 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
import warnings
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
if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7. "
"More details about Python 2 support for Google Cloud Client Libraries "
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)
class FirestoreAdminClient(firestore_admin_client.FirestoreAdminClient):
__doc__ = firestore_admin_client.FirestoreAdminClient.__doc__
enums = enums
__all__ = (
"enums",
"types",
"FirestoreAdminClient",
)

View file

@ -0,0 +1,142 @@
# -*- coding: utf-8 -*-
#
# Copyright 2020 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.
COLLECTION_GROUP (int): Indexes with a collection group query scope specified allow queries
against all collections that has the collection id specified by the
index.
"""
QUERY_SCOPE_UNSPECIFIED = 0
COLLECTION = 1
COLLECTION_GROUP = 2
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

View file

@ -0,0 +1,69 @@
config = {
"interfaces": {
"google.firestore.admin.v1.FirestoreAdmin": {
"retry_codes": {
"idempotent": ["DEADLINE_EXCEEDED", "INTERNAL", "UNAVAILABLE"],
"non_idempotent": [],
"idempotent2": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
},
"retry_params": {
"default": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 60000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 60000,
"total_timeout_millis": 600000,
}
},
"methods": {
"DeleteIndex": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
},
"UpdateField": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default",
},
"CreateIndex": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default",
},
"ListIndexes": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent2",
"retry_params_name": "default",
},
"GetIndex": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent2",
"retry_params_name": "default",
},
"GetField": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent2",
"retry_params_name": "default",
},
"ListFields": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent2",
"retry_params_name": "default",
},
"ExportDocuments": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default",
},
"ImportDocuments": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default",
},
},
}
}
}

View file

@ -0,0 +1,269 @@
# -*- coding: utf-8 -*-
#
# Copyright 2020 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
import google.api_core.operations_v1
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,
options={
"grpc.max_send_message_length": -1,
"grpc.max_receive_message_length": -1,
}.items(),
)
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
),
}
# Because this API includes a method that returns a
# long-running operation (proto: google.longrunning.Operation),
# instantiate an LRO client.
self._operations_client = google.api_core.operations_v1.OperationsClient(
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 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 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
@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 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 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 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

View file

@ -0,0 +1,100 @@
// 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/resource.proto";
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";
option ruby_package = "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 {
option (google.api.resource) = {
type: "firestore.googleapis.com/Field"
pattern: "projects/{project}/databases/{database}/collectionGroups/{collection}/fields/{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;
}

View file

@ -0,0 +1,285 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/firestore_admin_v1/proto/field.proto
"""Generated protocol buffer code."""
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 resource_pb2 as google_dot_api_dot_resource__pb2
from google.cloud.firestore_admin_v1.proto import (
index_pb2 as google_dot_cloud_dot_firestore__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\352\002#Google::Cloud::Firestore::Admin::V1",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n1google/cloud/firestore_admin_v1/proto/field.proto\x12\x19google.firestore.admin.v1\x1a\x19google/api/resource.proto\x1a\x31google/cloud/firestore_admin_v1/proto/index.proto\x1a\x1cgoogle/api/annotations.proto"\xe0\x02\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:y\xea\x41v\n\x1e\x66irestore.googleapis.com/Field\x12Tprojects/{project}/databases/{database}/collectionGroups/{collection}/fields/{field}B\xde\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\\V1\xea\x02#Google::Cloud::Firestore::Admin::V1b\x06proto3',
dependencies=[
google_dot_api_dot_resource__pb2.DESCRIPTOR,
google_dot_cloud_dot_firestore__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,
create_key=_descriptor._internal_create_key,
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,
create_key=_descriptor._internal_create_key,
),
_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,
create_key=_descriptor._internal_create_key,
),
_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,
create_key=_descriptor._internal_create_key,
),
_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,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[],
enum_types=[],
serialized_options=None,
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=281,
serialized_end=418,
)
_FIELD = _descriptor.Descriptor(
name="Field",
full_name="google.firestore.admin.v1.Field",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
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,
create_key=_descriptor._internal_create_key,
),
_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,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[_FIELD_INDEXCONFIG,],
enum_types=[],
serialized_options=b"\352Av\n\036firestore.googleapis.com/Field\022Tprojects/{project}/databases/{database}/collectionGroups/{collection}/fields/{field}",
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=189,
serialized_end=541,
)
_FIELD_INDEXCONFIG.fields_by_name[
"indexes"
].message_type = (
google_dot_cloud_dot_firestore__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,),
{
"IndexConfig": _reflection.GeneratedProtocolMessageType(
"IndexConfig",
(_message.Message,),
{
"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 fields 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:``\ \*\ ``,``.\ :literal:`,
``` (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
fields 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
_FIELD._options = None
# @@protoc_insertion_point(module_scope)

View file

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

View file

@ -0,0 +1,355 @@
// 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/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.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";
option ruby_package = "Google::Cloud::Firestore::Admin::V1";
option (google.api.resource_definition) = {
type: "firestore.googleapis.com/Database"
pattern: "projects/{project}/databases/{database}"
};
option (google.api.resource_definition) = {
type: "firestore.googleapis.com/CollectionGroup"
pattern: "projects/{project}/databases/{database}/collectionGroups/{collection}"
};
// Operations are created by service `FirestoreAdmin`, but are accessed via
// service `google.longrunning.Operations`.
service FirestoreAdmin {
option (google.api.default_host) = "firestore.googleapis.com";
option (google.api.oauth_scopes) =
"https://www.googleapis.com/auth/cloud-platform,"
"https://www.googleapis.com/auth/datastore";
// 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"
};
option (google.api.method_signature) = "parent,index";
option (google.longrunning.operation_info) = {
response_type: "Index"
metadata_type: "IndexOperationMetadata"
};
}
// Lists composite indexes.
rpc ListIndexes(ListIndexesRequest) returns (ListIndexesResponse) {
option (google.api.http) = {
get: "/v1/{parent=projects/*/databases/*/collectionGroups/*}/indexes"
};
option (google.api.method_signature) = "parent";
}
// Gets a composite index.
rpc GetIndex(GetIndexRequest) returns (Index) {
option (google.api.http) = {
get: "/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}"
};
option (google.api.method_signature) = "name";
}
// Deletes a composite index.
rpc DeleteIndex(DeleteIndexRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
delete: "/v1/{name=projects/*/databases/*/collectionGroups/*/indexes/*}"
};
option (google.api.method_signature) = "name";
}
// Gets the metadata and configuration for a Field.
rpc GetField(GetFieldRequest) returns (Field) {
option (google.api.http) = {
get: "/v1/{name=projects/*/databases/*/collectionGroups/*/fields/*}"
};
option (google.api.method_signature) = "name";
}
// 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"
};
option (google.api.method_signature) = "field";
option (google.longrunning.operation_info) = {
response_type: "Field"
metadata_type: "FieldOperationMetadata"
};
}
// 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"
};
option (google.api.method_signature) = "parent";
}
// 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: "*"
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
response_type: "ExportDocumentsResponse"
metadata_type: "ExportDocumentsMetadata"
};
}
// 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: "*"
};
option (google.api.method_signature) = "name";
option (google.longrunning.operation_info) = {
response_type: "google.protobuf.Empty"
metadata_type: "ImportDocumentsMetadata"
};
}
}
// The request for [FirestoreAdmin.CreateIndex][google.firestore.admin.v1.FirestoreAdmin.CreateIndex].
message CreateIndexRequest {
// Required. A parent name of the form
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/CollectionGroup"
}
];
// Required. The composite index to create.
Index index = 2 [(google.api.field_behavior) = REQUIRED];
}
// The request for [FirestoreAdmin.ListIndexes][google.firestore.admin.v1.FirestoreAdmin.ListIndexes].
message ListIndexesRequest {
// Required. A parent name of the form
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/CollectionGroup"
}
];
// 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 {
// Required. A name of the form
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Index"
}
];
}
// The request for [FirestoreAdmin.DeleteIndex][google.firestore.admin.v1.FirestoreAdmin.DeleteIndex].
message DeleteIndexRequest {
// Required. A name of the form
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Index"
}
];
}
// The request for [FirestoreAdmin.UpdateField][google.firestore.admin.v1.FirestoreAdmin.UpdateField].
message UpdateFieldRequest {
// Required. The field to be updated.
Field field = 1 [(google.api.field_behavior) = REQUIRED];
// 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 {
// Required. A name of the form
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Field"
}
];
}
// The request for [FirestoreAdmin.ListFields][google.firestore.admin.v1.FirestoreAdmin.ListFields].
message ListFieldsRequest {
// Required. A parent name of the form
// `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
string parent = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/CollectionGroup"
}
];
// 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 {
// Required. Database to export. Should be of the form:
// `projects/{project_id}/databases/{database_id}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Database"
}
];
// 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 {
// Required. Database to import into. Should be of the form:
// `projects/{project_id}/databases/{database_id}`.
string name = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = {
type: "firestore.googleapis.com/Database"
}
];
// 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;
}

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,478 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from google.cloud.firestore_admin_v1.proto import (
field_pb2 as google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_field__pb2,
)
from google.cloud.firestore_admin_v1.proto import (
firestore_admin_pb2 as google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_firestore__admin__pb2,
)
from google.cloud.firestore_admin_v1.proto import (
index_pb2 as google_dot_cloud_dot_firestore__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__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__admin__v1_dot_proto_dot_firestore__admin__pb2.ListIndexesRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__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__admin__v1_dot_proto_dot_firestore__admin__pb2.GetIndexRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__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__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__admin__v1_dot_proto_dot_firestore__admin__pb2.GetFieldRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__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__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__admin__v1_dot_proto_dot_firestore__admin__pb2.ListFieldsRequest.SerializeToString,
response_deserializer=google_dot_cloud_dot_firestore__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__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__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__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__admin__v1_dot_proto_dot_firestore__admin__pb2.ListIndexesRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__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__admin__v1_dot_proto_dot_firestore__admin__pb2.GetIndexRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__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__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__admin__v1_dot_proto_dot_firestore__admin__pb2.GetFieldRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__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__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__admin__v1_dot_proto_dot_firestore__admin__pb2.ListFieldsRequest.FromString,
response_serializer=google_dot_cloud_dot_firestore__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__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__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,))
# This class is part of an EXPERIMENTAL API.
class FirestoreAdmin(object):
"""Operations are created by service `FirestoreAdmin`, but are accessed via
service `google.longrunning.Operations`.
"""
@staticmethod
def CreateIndex(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.admin.v1.FirestoreAdmin/CreateIndex",
google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_firestore__admin__pb2.CreateIndexRequest.SerializeToString,
google_dot_longrunning_dot_operations__pb2.Operation.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def ListIndexes(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.admin.v1.FirestoreAdmin/ListIndexes",
google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_firestore__admin__pb2.ListIndexesRequest.SerializeToString,
google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_firestore__admin__pb2.ListIndexesResponse.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def GetIndex(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.admin.v1.FirestoreAdmin/GetIndex",
google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_firestore__admin__pb2.GetIndexRequest.SerializeToString,
google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_index__pb2.Index.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def DeleteIndex(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.admin.v1.FirestoreAdmin/DeleteIndex",
google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_firestore__admin__pb2.DeleteIndexRequest.SerializeToString,
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def GetField(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.admin.v1.FirestoreAdmin/GetField",
google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_firestore__admin__pb2.GetFieldRequest.SerializeToString,
google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_field__pb2.Field.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def UpdateField(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.admin.v1.FirestoreAdmin/UpdateField",
google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_firestore__admin__pb2.UpdateFieldRequest.SerializeToString,
google_dot_longrunning_dot_operations__pb2.Operation.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def ListFields(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.admin.v1.FirestoreAdmin/ListFields",
google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_firestore__admin__pb2.ListFieldsRequest.SerializeToString,
google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_firestore__admin__pb2.ListFieldsResponse.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def ExportDocuments(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.admin.v1.FirestoreAdmin/ExportDocuments",
google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_firestore__admin__pb2.ExportDocumentsRequest.SerializeToString,
google_dot_longrunning_dot_operations__pb2.Operation.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)
@staticmethod
def ImportDocuments(
request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None,
):
return grpc.experimental.unary_unary(
request,
target,
"/google.firestore.admin.v1.FirestoreAdmin/ImportDocuments",
google_dot_cloud_dot_firestore__admin__v1_dot_proto_dot_firestore__admin__pb2.ImportDocumentsRequest.SerializeToString,
google_dot_longrunning_dot_operations__pb2.Operation.FromString,
options,
channel_credentials,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
)

View file

@ -0,0 +1,158 @@
// 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/resource.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 = "IndexProto";
option java_package = "com.google.firestore.admin.v1";
option objc_class_prefix = "GCFS";
option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
option ruby_package = "Google::Cloud::Firestore::Admin::V1";
// Cloud Firestore indexes enable simple and complex queries against
// documents in a database.
message Index {
option (google.api.resource) = {
type: "firestore.googleapis.com/Index"
pattern: "projects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{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;
// Indexes with a collection group query scope specified allow queries
// against all collections that has the collection id specified by the
// index.
COLLECTION_GROUP = 2;
}
// 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;
}

View file

@ -0,0 +1,473 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/firestore_admin_v1/proto/index.proto
"""Generated protocol buffer code."""
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 resource_pb2 as google_dot_api_dot_resource__pb2
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\352\002#Google::Cloud::Firestore::Admin::V1",
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n1google/cloud/firestore_admin_v1/proto/index.proto\x12\x19google.firestore.admin.v1\x1a\x19google/api/resource.proto\x1a\x1cgoogle/api/annotations.proto"\xa3\x06\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"O\n\nQueryScope\x12\x1b\n\x17QUERY_SCOPE_UNSPECIFIED\x10\x00\x12\x0e\n\nCOLLECTION\x10\x01\x12\x14\n\x10\x43OLLECTION_GROUP\x10\x02"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:z\xea\x41w\n\x1e\x66irestore.googleapis.com/Index\x12Uprojects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{index}B\xde\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\\V1\xea\x02#Google::Cloud::Firestore::Admin::V1b\x06proto3',
dependencies=[
google_dot_api_dot_resource__pb2.DESCRIPTOR,
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,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name="ORDER_UNSPECIFIED",
index=0,
number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.EnumValueDescriptor(
name="ASCENDING",
index=1,
number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.EnumValueDescriptor(
name="DESCENDING",
index=2,
number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key,
),
],
containing_type=None,
serialized_options=None,
serialized_start=527,
serialized_end=588,
)
_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,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name="ARRAY_CONFIG_UNSPECIFIED",
index=0,
number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.EnumValueDescriptor(
name="CONTAINS",
index=1,
number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key,
),
],
containing_type=None,
serialized_options=None,
serialized_start=590,
serialized_end=647,
)
_sym_db.RegisterEnumDescriptor(_INDEX_INDEXFIELD_ARRAYCONFIG)
_INDEX_QUERYSCOPE = _descriptor.EnumDescriptor(
name="QueryScope",
full_name="google.firestore.admin.v1.Index.QueryScope",
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name="QUERY_SCOPE_UNSPECIFIED",
index=0,
number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.EnumValueDescriptor(
name="COLLECTION",
index=1,
number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.EnumValueDescriptor(
name="COLLECTION_GROUP",
index=2,
number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key,
),
],
containing_type=None,
serialized_options=None,
serialized_start=663,
serialized_end=742,
)
_sym_db.RegisterEnumDescriptor(_INDEX_QUERYSCOPE)
_INDEX_STATE = _descriptor.EnumDescriptor(
name="State",
full_name="google.firestore.admin.v1.Index.State",
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name="STATE_UNSPECIFIED",
index=0,
number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.EnumValueDescriptor(
name="CREATING",
index=1,
number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.EnumValueDescriptor(
name="READY",
index=2,
number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key,
),
_descriptor.EnumValueDescriptor(
name="NEEDS_REPAIR",
index=3,
number=3,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key,
),
],
containing_type=None,
serialized_options=None,
serialized_start=744,
serialized_end=817,
)
_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,
create_key=_descriptor._internal_create_key,
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,
create_key=_descriptor._internal_create_key,
),
_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,
create_key=_descriptor._internal_create_key,
),
_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,
create_key=_descriptor._internal_create_key,
),
],
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,
create_key=_descriptor._internal_create_key,
fields=[],
),
],
serialized_start=344,
serialized_end=661,
)
_INDEX = _descriptor.Descriptor(
name="Index",
full_name="google.firestore.admin.v1.Index",
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
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,
create_key=_descriptor._internal_create_key,
),
_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,
create_key=_descriptor._internal_create_key,
),
_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,
create_key=_descriptor._internal_create_key,
),
_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,
create_key=_descriptor._internal_create_key,
),
],
extensions=[],
nested_types=[_INDEX_INDEXFIELD,],
enum_types=[_INDEX_QUERYSCOPE, _INDEX_STATE,],
serialized_options=b"\352Aw\n\036firestore.googleapis.com/Index\022Uprojects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{index}",
is_extendable=False,
syntax="proto3",
extension_ranges=[],
oneofs=[],
serialized_start=138,
serialized_end=941,
)
_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,),
{
"IndexField": _reflection.GeneratedProtocolMessageType(
"IndexField",
(_message.Message,),
{
"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
_INDEX._options = None
# @@protoc_insertion_point(module_scope)

View file

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

View file

@ -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";
option ruby_package = "Google::Cloud::Firestore::Admin::V1";
// The metadata message for [google.cloud.location.Location.metadata][google.cloud.location.Location.metadata].
message LocationMetadata {
}

View file

@ -0,0 +1,71 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/firestore_admin_v1/proto/location.proto
"""Generated protocol buffer code."""
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\352\002#Google::Cloud::Firestore::Admin::V1",
create_key=_descriptor._internal_create_key,
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\xe1\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\\V1\xea\x02#Google::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,
create_key=_descriptor._internal_create_key,
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,),
{
"DESCRIPTOR": _LOCATIONMETADATA,
"__module__": "google.cloud.firestore_admin_v1.proto.location_pb2",
"__doc__": """The metadata message for [google.cloud.location.Location.metadata][goo
gle.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)

View file

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

View file

@ -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";
option ruby_package = "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 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;
}
// 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;
}

File diff suppressed because it is too large Load diff

View file

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

View file

@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
#
# Copyright 2020 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))