Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .librarian/state.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-li
libraries:
- id: google-cloud-firestore
version: 2.23.0
last_generated_commit: 1a9d00bed77e6db82ff67764ffe14e3b5209f5cd
last_generated_commit: 055f92c9384689eb0bb32d035d3bc6d98c8347c0
apis:
- path: google/firestore/v1
service_config: firestore_v1.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
from google.cloud.firestore_admin_v1.types import index
from google.cloud.firestore_admin_v1.types import index as gfa_index
from google.cloud.firestore_admin_v1.types import operation as gfa_operation
from google.cloud.firestore_admin_v1.types import realtime_updates
from google.cloud.firestore_admin_v1.types import schedule
from google.cloud.firestore_admin_v1.types import user_creds
from google.cloud.firestore_admin_v1.types import user_creds as gfa_user_creds
Expand Down Expand Up @@ -1721,7 +1722,8 @@ async def sample_create_database():
last a letter or a number. Must not be UUID-like
/[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.

"(default)" database ID is also valid.
"(default)" database ID is also valid if the database is
Standard edition.

This corresponds to the ``database_id`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
from google.cloud.firestore_admin_v1.types import index
from google.cloud.firestore_admin_v1.types import index as gfa_index
from google.cloud.firestore_admin_v1.types import operation as gfa_operation
from google.cloud.firestore_admin_v1.types import realtime_updates
from google.cloud.firestore_admin_v1.types import schedule
from google.cloud.firestore_admin_v1.types import user_creds
from google.cloud.firestore_admin_v1.types import user_creds as gfa_user_creds
Expand Down Expand Up @@ -2281,7 +2282,8 @@ def sample_create_database():
last a letter or a number. Must not be UUID-like
/[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.

"(default)" database ID is also valid.
"(default)" database ID is also valid if the database is
Standard edition.

This corresponds to the ``database_id`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/firestore_admin_v1/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@
RestoreDatabaseMetadata,
OperationState,
)
from .realtime_updates import (
RealtimeUpdatesMode,
)
from .schedule import (
BackupSchedule,
DailyRecurrence,
Expand Down Expand Up @@ -154,6 +157,7 @@
"Progress",
"RestoreDatabaseMetadata",
"OperationState",
"RealtimeUpdatesMode",
"BackupSchedule",
"DailyRecurrence",
"WeeklyRecurrence",
Expand Down
71 changes: 65 additions & 6 deletions google/cloud/firestore_admin_v1/types/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import proto # type: ignore

from google.cloud.firestore_admin_v1.types import realtime_updates
from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore

Expand Down Expand Up @@ -68,6 +69,10 @@ class Database(proto.Message):
concurrency_mode (google.cloud.firestore_admin_v1.types.Database.ConcurrencyMode):
The concurrency control mode to use for this
database.
If unspecified in a CreateDatabase request, this
will default based on the database edition:
Optimistic for Enterprise and Pessimistic for
all other databases.
version_retention_period (google.protobuf.duration_pb2.Duration):
Output only. The period during which past versions of data
are retained in the database.
Expand Down Expand Up @@ -151,6 +156,22 @@ class Database(proto.Message):
has an up-to-date value before proceeding.
database_edition (google.cloud.firestore_admin_v1.types.Database.DatabaseEdition):
Immutable. The edition of the database.
realtime_updates_mode (google.cloud.firestore_admin_v1.types.RealtimeUpdatesMode):
Immutable. The default Realtime Updates mode
to use for this database.
firestore_data_access_mode (google.cloud.firestore_admin_v1.types.Database.DataAccessMode):
Optional. The Firestore API data access mode to use for this
database. If not set on write:

- the default value is DATA_ACCESS_MODE_DISABLED for
Enterprise Edition.
- the default value is DATA_ACCESS_MODE_ENABLED for Standard
Edition.
mongodb_compatible_data_access_mode (google.cloud.firestore_admin_v1.types.Database.DataAccessMode):
Optional. The MongoDB compatible API data access mode to use
for this database. If not set on write, the default value is
DATA_ACCESS_MODE_ENABLED for Enterprise Edition. The value
is always DATA_ACCESS_MODE_DISABLED for Standard Edition.
"""

class DatabaseType(proto.Enum):
Expand Down Expand Up @@ -183,20 +204,25 @@ class ConcurrencyMode(proto.Enum):
Use optimistic concurrency control by
default. This mode is available for Cloud
Firestore databases.

This is the default setting for Cloud Firestore
Enterprise Edition databases.
PESSIMISTIC (2):
Use pessimistic concurrency control by
default. This mode is available for Cloud
Firestore databases.

This is the default setting for Cloud Firestore.
This is the default setting for Cloud Firestore
Standard Edition databases.
OPTIMISTIC_WITH_ENTITY_GROUPS (3):
Use optimistic concurrency control with
entity groups by default.
This is the only available mode for Cloud
Datastore.
This mode is enabled for some databases that
were automatically upgraded from Cloud Datastore
to Cloud Firestore with Datastore Mode.

This mode is also available for Cloud Firestore
with Datastore Mode but is not recommended.
It is not recommended for any new databases, and
not supported for Firestore Native databases.
"""
CONCURRENCY_MODE_UNSPECIFIED = 0
OPTIMISTIC = 1
Expand Down Expand Up @@ -284,6 +310,23 @@ class DatabaseEdition(proto.Enum):
STANDARD = 1
ENTERPRISE = 2

class DataAccessMode(proto.Enum):
r"""The data access mode.

Values:
DATA_ACCESS_MODE_UNSPECIFIED (0):
Not Used.
DATA_ACCESS_MODE_ENABLED (1):
Accessing the database through the API is
allowed.
DATA_ACCESS_MODE_DISABLED (2):
Accessing the database through the API is
disallowed.
"""
DATA_ACCESS_MODE_UNSPECIFIED = 0
DATA_ACCESS_MODE_ENABLED = 1
DATA_ACCESS_MODE_DISABLED = 2

class CmekConfig(proto.Message):
r"""The CMEK (Customer Managed Encryption Key) configuration for
a Firestore database. If not present, the database is secured by
Expand Down Expand Up @@ -369,7 +412,8 @@ class EncryptionConfig(proto.Message):
r"""Encryption configuration for a new database being created from
another source.

The source could be a [Backup][google.firestore.admin.v1.Backup] .
The source could be a [Backup][google.firestore.admin.v1.Backup] or
a [PitrSnapshot][google.firestore.admin.v1.PitrSnapshot].

This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Expand Down Expand Up @@ -550,6 +594,21 @@ class CustomerManagedEncryptionOptions(proto.Message):
number=28,
enum=DatabaseEdition,
)
realtime_updates_mode: realtime_updates.RealtimeUpdatesMode = proto.Field(
proto.ENUM,
number=31,
enum=realtime_updates.RealtimeUpdatesMode,
)
firestore_data_access_mode: DataAccessMode = proto.Field(
proto.ENUM,
number=33,
enum=DataAccessMode,
)
mongodb_compatible_data_access_mode: DataAccessMode = proto.Field(
proto.ENUM,
number=34,
enum=DataAccessMode,
)


__all__ = tuple(sorted(__protobuf__.manifest))
11 changes: 7 additions & 4 deletions google/cloud/firestore_admin_v1/types/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,13 @@ class TtlConfig(proto.Message):
``Field`` set.

Storing a timestamp value into a TTL-enabled field will be treated
as the document's absolute expiration time. Timestamp values in the
past indicate that the document is eligible for immediate
expiration. Using any other data type or leaving the field absent
will disable expiration for the individual document.
as the document's absolute expiration time. For Enterprise edition
databases, the timestamp value may also be stored in an array value
in the TTL-enabled field.

Timestamp values in the past indicate that the document is eligible
for immediate expiration. Using any other data type or leaving the
field absent will disable expiration for the individual document.

Attributes:
state (google.cloud.firestore_admin_v1.types.Field.TtlConfig.State):
Expand Down
22 changes: 13 additions & 9 deletions google/cloud/firestore_admin_v1/types/firestore_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ class CreateDatabaseRequest(proto.Message):
letter or a number. Must not be UUID-like
/[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.

"(default)" database ID is also valid.
"(default)" database ID is also valid if the database is
Standard edition.
"""

parent: str = proto.Field(
Expand Down Expand Up @@ -747,9 +748,9 @@ class ExportDocumentsRequest(proto.Message):
Required. Database to export. Should be of the form:
``projects/{project_id}/databases/{database_id}``.
collection_ids (MutableSequence[str]):
Which collection IDs to export. Unspecified
means all collections. Each collection ID in
this list must be unique.
IDs of the collection groups to export.
Unspecified means all collection groups. Each
collection group in this list must be unique.
output_uri_prefix (str):
The output URI. Currently only supports Google Cloud Storage
URIs of the form: ``gs://BUCKET_NAME[/NAMESPACE_PATH]``,
Expand Down Expand Up @@ -813,9 +814,10 @@ class ImportDocumentsRequest(proto.Message):
Required. Database to import into. Should be of the form:
``projects/{project_id}/databases/{database_id}``.
collection_ids (MutableSequence[str]):
Which collection IDs to import. Unspecified
means all collections included in the import.
Each collection ID in this list must be unique.
IDs of the collection groups to import.
Unspecified means all collection groups that
were included in the export. Each collection
group in this list must be unique.
input_uri_prefix (str):
Location of the exported files. This must match the
output_uri_prefix of an ExportDocumentsResponse from an
Expand Down Expand Up @@ -1032,7 +1034,8 @@ class RestoreDatabaseRequest(proto.Message):
letter or a number. Must not be UUID-like
/[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.

"(default)" database ID is also valid.
"(default)" database ID is also valid if the database is
Standard edition.
backup (str):
Required. Backup to restore from. Must be from the same
project as the parent.
Expand Down Expand Up @@ -1100,7 +1103,8 @@ class CloneDatabaseRequest(proto.Message):
letter or a number. Must not be UUID-like
/[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.

"(default)" database ID is also valid.
"(default)" database ID is also valid if the database is
Standard edition.
pitr_snapshot (google.cloud.firestore_admin_v1.types.PitrSnapshot):
Required. Specification of the PITR data to
clone from. The source database must exist.
Expand Down
82 changes: 68 additions & 14 deletions google/cloud/firestore_admin_v1/types/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ class Index(proto.Message):
MONGODB_COMPATIBLE_API ApiScope.
shard_count (int):
Optional. The number of shards for the index.
unique (bool):
Optional. Whether it is an unique index.
Unique index ensures all values for the indexed
field(s) are unique across documents.
"""

class QueryScope(proto.Enum):
Expand Down Expand Up @@ -179,23 +183,69 @@ class Density(proto.Enum):
Unspecified. It will use database default
setting. This value is input only.
SPARSE_ALL (1):
In order for an index entry to be added, the document must
contain all fields specified in the index.
An index entry will only exist if ALL fields are present in
the document.

This is the only allowed value for indexes having ApiScope
``ANY_API`` and ``DATASTORE_MODE_API``.
This is both the default and only allowed value for Standard
Edition databases (for both Cloud Firestore ``ANY_API`` and
Cloud Datastore ``DATASTORE_MODE_API``).

Take for example the following document:

::

{
"__name__": "...",
"a": 1,
"b": 2,
"c": 3
}

an index on ``(a ASC, b ASC, c ASC, __name__ ASC)`` will
generate an index entry for this document since ``a``, 'b',
``c``, and ``__name__`` are all present but an index of
Comment on lines +205 to +206

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a small typo in the docstring. The field b is enclosed in single quotes ('b') instead of double backticks (b), which is inconsistent with the other fields in the example.

Suggested change
generate an index entry for this document since ``a``, 'b',
``c``, and ``__name__`` are all present but an index of
generate an index entry for this document since ``a``, ``b``,
``c``, and ``__name__`` are all present but an index of

``(a ASC, d ASC, __name__ ASC)`` will not generate an index
entry for this document since ``d`` is missing.

This means that such indexes can only be used to serve a
query when the query has either implicit or explicit
requirements that all fields from the index are present.
SPARSE_ANY (2):
In order for an index entry to be added, the
document must contain at least one of the fields
specified in the index. Non-existent fields are
treated as having a NULL value when generating
index entries.
An index entry will exist if ANY field are present in the
document.

This is used as the definition of a sparse index for
Enterprise Edition databases.

Take for example the following document:

::

{
"__name__": "...",
"a": 1,
"b": 2,
"c": 3
}

an index on ``(a ASC, d ASC)`` will generate an index entry
for this document since ``a`` is present, and will fill in
an ``unset`` value for ``d``. An index on ``(d ASC, e ASC)``
will not generate any index entry as neither ``d`` nor ``e``
are present.

An index that contains ``__name__`` will generate an index
entry for all documents since Firestore guarantees that all
documents have a ``__name__`` field.
DENSE (3):
An index entry will be added regardless of
whether the document contains any of the fields
specified in the index. Non-existent fields are
treated as having a NULL value when generating
index entries.
An index entry will exist regardless of if the fields are
present or not.

This is the default density for an Enterprise Edition
database.

The index will store ``unset`` values for fields that are
not present in the document.
"""
DENSITY_UNSPECIFIED = 0
SPARSE_ALL = 1
Expand Down Expand Up @@ -361,6 +411,10 @@ class FlatIndex(proto.Message):
proto.INT32,
number=8,
)
unique: bool = proto.Field(
proto.BOOL,
number=10,
)


__all__ = tuple(sorted(__protobuf__.manifest))
Loading
Loading