Skip to content

Commit 5a17963

Browse files
authored
chore: librarian generate pull request: 20260213T191645Z (#1168)
PR created by the Librarian CLI to generate Cloud Client Libraries code from protos. BEGIN_COMMIT BEGIN_NESTED_COMMIT feat: Expose the `Database.firestore_data_access_mode` parameter PiperOrigin-RevId: 865444806 Library-IDs: google-cloud-firestore Source-link: [googleapis/googleapis@760ef858](googleapis/googleapis@760ef858) END_NESTED_COMMIT BEGIN_NESTED_COMMIT feat: Expose the `Database.mongodb_compatible_data_access_mode` parameter PiperOrigin-RevId: 865444806 Library-IDs: google-cloud-firestore Source-link: [googleapis/googleapis@760ef858](googleapis/googleapis@760ef858) END_NESTED_COMMIT BEGIN_NESTED_COMMIT feat: Expose the `Database.realtime_updates_mode` parameter PiperOrigin-RevId: 865444806 Library-IDs: google-cloud-firestore Source-link: [googleapis/googleapis@760ef858](googleapis/googleapis@760ef858) END_NESTED_COMMIT BEGIN_NESTED_COMMIT feat: Expose the `Index.unique` parameter PiperOrigin-RevId: 865444806 Library-IDs: google-cloud-firestore Source-link: [googleapis/googleapis@760ef858](googleapis/googleapis@760ef858) END_NESTED_COMMIT BEGIN_NESTED_COMMIT docs: Update documentation on several parameters, especially when relating to the new `enterprise` database edition PiperOrigin-RevId: 865444806 Library-IDs: google-cloud-firestore Source-link: [googleapis/googleapis@760ef858](googleapis/googleapis@760ef858) END_NESTED_COMMIT END_COMMIT This pull request is generated with proto changes between [googleapis/googleapis@1a9d00be](googleapis/googleapis@1a9d00b) (exclusive) and [googleapis/googleapis@760ef858](googleapis/googleapis@760ef85) (inclusive). Librarian Version: v0.7.0 Language Image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:b8058df4c45e9a6e07f6b4d65b458d0d059241dd34c814f151c8bf6b89211209
1 parent 15230d2 commit 5a17963

File tree

10 files changed

+280
-36
lines changed

10 files changed

+280
-36
lines changed

packages/google-cloud-firestore/.librarian/state.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-li
22
libraries:
33
- id: google-cloud-firestore
44
version: 2.23.0
5-
last_generated_commit: 1a9d00bed77e6db82ff67764ffe14e3b5209f5cd
5+
last_generated_commit: 055f92c9384689eb0bb32d035d3bc6d98c8347c0
66
apis:
77
- path: google/firestore/v1
88
service_config: firestore_v1.yaml

packages/google-cloud-firestore/google/cloud/firestore_admin_v1/services/firestore_admin/async_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from google.cloud.firestore_admin_v1.types import index
5858
from google.cloud.firestore_admin_v1.types import index as gfa_index
5959
from google.cloud.firestore_admin_v1.types import operation as gfa_operation
60+
from google.cloud.firestore_admin_v1.types import realtime_updates
6061
from google.cloud.firestore_admin_v1.types import schedule
6162
from google.cloud.firestore_admin_v1.types import user_creds
6263
from google.cloud.firestore_admin_v1.types import user_creds as gfa_user_creds
@@ -1721,7 +1722,8 @@ async def sample_create_database():
17211722
last a letter or a number. Must not be UUID-like
17221723
/[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
17231724
1724-
"(default)" database ID is also valid.
1725+
"(default)" database ID is also valid if the database is
1726+
Standard edition.
17251727
17261728
This corresponds to the ``database_id`` field
17271729
on the ``request`` instance; if ``request`` is provided, this

packages/google-cloud-firestore/google/cloud/firestore_admin_v1/services/firestore_admin/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
from google.cloud.firestore_admin_v1.types import index
7474
from google.cloud.firestore_admin_v1.types import index as gfa_index
7575
from google.cloud.firestore_admin_v1.types import operation as gfa_operation
76+
from google.cloud.firestore_admin_v1.types import realtime_updates
7677
from google.cloud.firestore_admin_v1.types import schedule
7778
from google.cloud.firestore_admin_v1.types import user_creds
7879
from google.cloud.firestore_admin_v1.types import user_creds as gfa_user_creds
@@ -2281,7 +2282,8 @@ def sample_create_database():
22812282
last a letter or a number. Must not be UUID-like
22822283
/[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
22832284
2284-
"(default)" database ID is also valid.
2285+
"(default)" database ID is also valid if the database is
2286+
Standard edition.
22852287
22862288
This corresponds to the ``database_id`` field
22872289
on the ``request`` instance; if ``request`` is provided, this

packages/google-cloud-firestore/google/cloud/firestore_admin_v1/types/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
RestoreDatabaseMetadata,
8585
OperationState,
8686
)
87+
from .realtime_updates import (
88+
RealtimeUpdatesMode,
89+
)
8790
from .schedule import (
8891
BackupSchedule,
8992
DailyRecurrence,
@@ -154,6 +157,7 @@
154157
"Progress",
155158
"RestoreDatabaseMetadata",
156159
"OperationState",
160+
"RealtimeUpdatesMode",
157161
"BackupSchedule",
158162
"DailyRecurrence",
159163
"WeeklyRecurrence",

packages/google-cloud-firestore/google/cloud/firestore_admin_v1/types/database.py

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import proto # type: ignore
2121

22+
from google.cloud.firestore_admin_v1.types import realtime_updates
2223
from google.protobuf import duration_pb2 # type: ignore
2324
from google.protobuf import timestamp_pb2 # type: ignore
2425

@@ -68,6 +69,10 @@ class Database(proto.Message):
6869
concurrency_mode (google.cloud.firestore_admin_v1.types.Database.ConcurrencyMode):
6970
The concurrency control mode to use for this
7071
database.
72+
If unspecified in a CreateDatabase request, this
73+
will default based on the database edition:
74+
Optimistic for Enterprise and Pessimistic for
75+
all other databases.
7176
version_retention_period (google.protobuf.duration_pb2.Duration):
7277
Output only. The period during which past versions of data
7378
are retained in the database.
@@ -151,6 +156,22 @@ class Database(proto.Message):
151156
has an up-to-date value before proceeding.
152157
database_edition (google.cloud.firestore_admin_v1.types.Database.DatabaseEdition):
153158
Immutable. The edition of the database.
159+
realtime_updates_mode (google.cloud.firestore_admin_v1.types.RealtimeUpdatesMode):
160+
Immutable. The default Realtime Updates mode
161+
to use for this database.
162+
firestore_data_access_mode (google.cloud.firestore_admin_v1.types.Database.DataAccessMode):
163+
Optional. The Firestore API data access mode to use for this
164+
database. If not set on write:
165+
166+
- the default value is DATA_ACCESS_MODE_DISABLED for
167+
Enterprise Edition.
168+
- the default value is DATA_ACCESS_MODE_ENABLED for Standard
169+
Edition.
170+
mongodb_compatible_data_access_mode (google.cloud.firestore_admin_v1.types.Database.DataAccessMode):
171+
Optional. The MongoDB compatible API data access mode to use
172+
for this database. If not set on write, the default value is
173+
DATA_ACCESS_MODE_ENABLED for Enterprise Edition. The value
174+
is always DATA_ACCESS_MODE_DISABLED for Standard Edition.
154175
"""
155176

156177
class DatabaseType(proto.Enum):
@@ -183,20 +204,25 @@ class ConcurrencyMode(proto.Enum):
183204
Use optimistic concurrency control by
184205
default. This mode is available for Cloud
185206
Firestore databases.
207+
208+
This is the default setting for Cloud Firestore
209+
Enterprise Edition databases.
186210
PESSIMISTIC (2):
187211
Use pessimistic concurrency control by
188212
default. This mode is available for Cloud
189213
Firestore databases.
190214
191-
This is the default setting for Cloud Firestore.
215+
This is the default setting for Cloud Firestore
216+
Standard Edition databases.
192217
OPTIMISTIC_WITH_ENTITY_GROUPS (3):
193218
Use optimistic concurrency control with
194219
entity groups by default.
195-
This is the only available mode for Cloud
196-
Datastore.
220+
This mode is enabled for some databases that
221+
were automatically upgraded from Cloud Datastore
222+
to Cloud Firestore with Datastore Mode.
197223
198-
This mode is also available for Cloud Firestore
199-
with Datastore Mode but is not recommended.
224+
It is not recommended for any new databases, and
225+
not supported for Firestore Native databases.
200226
"""
201227
CONCURRENCY_MODE_UNSPECIFIED = 0
202228
OPTIMISTIC = 1
@@ -284,6 +310,23 @@ class DatabaseEdition(proto.Enum):
284310
STANDARD = 1
285311
ENTERPRISE = 2
286312

313+
class DataAccessMode(proto.Enum):
314+
r"""The data access mode.
315+
316+
Values:
317+
DATA_ACCESS_MODE_UNSPECIFIED (0):
318+
Not Used.
319+
DATA_ACCESS_MODE_ENABLED (1):
320+
Accessing the database through the API is
321+
allowed.
322+
DATA_ACCESS_MODE_DISABLED (2):
323+
Accessing the database through the API is
324+
disallowed.
325+
"""
326+
DATA_ACCESS_MODE_UNSPECIFIED = 0
327+
DATA_ACCESS_MODE_ENABLED = 1
328+
DATA_ACCESS_MODE_DISABLED = 2
329+
287330
class CmekConfig(proto.Message):
288331
r"""The CMEK (Customer Managed Encryption Key) configuration for
289332
a Firestore database. If not present, the database is secured by
@@ -369,7 +412,8 @@ class EncryptionConfig(proto.Message):
369412
r"""Encryption configuration for a new database being created from
370413
another source.
371414
372-
The source could be a [Backup][google.firestore.admin.v1.Backup] .
415+
The source could be a [Backup][google.firestore.admin.v1.Backup] or
416+
a [PitrSnapshot][google.firestore.admin.v1.PitrSnapshot].
373417
374418
This message has `oneof`_ fields (mutually exclusive fields).
375419
For each oneof, at most one member field can be set at the same time.
@@ -550,6 +594,21 @@ class CustomerManagedEncryptionOptions(proto.Message):
550594
number=28,
551595
enum=DatabaseEdition,
552596
)
597+
realtime_updates_mode: realtime_updates.RealtimeUpdatesMode = proto.Field(
598+
proto.ENUM,
599+
number=31,
600+
enum=realtime_updates.RealtimeUpdatesMode,
601+
)
602+
firestore_data_access_mode: DataAccessMode = proto.Field(
603+
proto.ENUM,
604+
number=33,
605+
enum=DataAccessMode,
606+
)
607+
mongodb_compatible_data_access_mode: DataAccessMode = proto.Field(
608+
proto.ENUM,
609+
number=34,
610+
enum=DataAccessMode,
611+
)
553612

554613

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

packages/google-cloud-firestore/google/cloud/firestore_admin_v1/types/field.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,13 @@ class TtlConfig(proto.Message):
125125
``Field`` set.
126126
127127
Storing a timestamp value into a TTL-enabled field will be treated
128-
as the document's absolute expiration time. Timestamp values in the
129-
past indicate that the document is eligible for immediate
130-
expiration. Using any other data type or leaving the field absent
131-
will disable expiration for the individual document.
128+
as the document's absolute expiration time. For Enterprise edition
129+
databases, the timestamp value may also be stored in an array value
130+
in the TTL-enabled field.
131+
132+
Timestamp values in the past indicate that the document is eligible
133+
for immediate expiration. Using any other data type or leaving the
134+
field absent will disable expiration for the individual document.
132135
133136
Attributes:
134137
state (google.cloud.firestore_admin_v1.types.Field.TtlConfig.State):

packages/google-cloud-firestore/google/cloud/firestore_admin_v1/types/firestore_admin.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ class CreateDatabaseRequest(proto.Message):
120120
letter or a number. Must not be UUID-like
121121
/[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
122122
123-
"(default)" database ID is also valid.
123+
"(default)" database ID is also valid if the database is
124+
Standard edition.
124125
"""
125126

126127
parent: str = proto.Field(
@@ -747,9 +748,9 @@ class ExportDocumentsRequest(proto.Message):
747748
Required. Database to export. Should be of the form:
748749
``projects/{project_id}/databases/{database_id}``.
749750
collection_ids (MutableSequence[str]):
750-
Which collection IDs to export. Unspecified
751-
means all collections. Each collection ID in
752-
this list must be unique.
751+
IDs of the collection groups to export.
752+
Unspecified means all collection groups. Each
753+
collection group in this list must be unique.
753754
output_uri_prefix (str):
754755
The output URI. Currently only supports Google Cloud Storage
755756
URIs of the form: ``gs://BUCKET_NAME[/NAMESPACE_PATH]``,
@@ -813,9 +814,10 @@ class ImportDocumentsRequest(proto.Message):
813814
Required. Database to import into. Should be of the form:
814815
``projects/{project_id}/databases/{database_id}``.
815816
collection_ids (MutableSequence[str]):
816-
Which collection IDs to import. Unspecified
817-
means all collections included in the import.
818-
Each collection ID in this list must be unique.
817+
IDs of the collection groups to import.
818+
Unspecified means all collection groups that
819+
were included in the export. Each collection
820+
group in this list must be unique.
819821
input_uri_prefix (str):
820822
Location of the exported files. This must match the
821823
output_uri_prefix of an ExportDocumentsResponse from an
@@ -1032,7 +1034,8 @@ class RestoreDatabaseRequest(proto.Message):
10321034
letter or a number. Must not be UUID-like
10331035
/[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
10341036
1035-
"(default)" database ID is also valid.
1037+
"(default)" database ID is also valid if the database is
1038+
Standard edition.
10361039
backup (str):
10371040
Required. Backup to restore from. Must be from the same
10381041
project as the parent.
@@ -1100,7 +1103,8 @@ class CloneDatabaseRequest(proto.Message):
11001103
letter or a number. Must not be UUID-like
11011104
/[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}/.
11021105
1103-
"(default)" database ID is also valid.
1106+
"(default)" database ID is also valid if the database is
1107+
Standard edition.
11041108
pitr_snapshot (google.cloud.firestore_admin_v1.types.PitrSnapshot):
11051109
Required. Specification of the PITR data to
11061110
clone from. The source database must exist.

packages/google-cloud-firestore/google/cloud/firestore_admin_v1/types/index.py

Lines changed: 68 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ class Index(proto.Message):
8585
MONGODB_COMPATIBLE_API ApiScope.
8686
shard_count (int):
8787
Optional. The number of shards for the index.
88+
unique (bool):
89+
Optional. Whether it is an unique index.
90+
Unique index ensures all values for the indexed
91+
field(s) are unique across documents.
8892
"""
8993

9094
class QueryScope(proto.Enum):
@@ -179,23 +183,69 @@ class Density(proto.Enum):
179183
Unspecified. It will use database default
180184
setting. This value is input only.
181185
SPARSE_ALL (1):
182-
In order for an index entry to be added, the document must
183-
contain all fields specified in the index.
186+
An index entry will only exist if ALL fields are present in
187+
the document.
184188
185-
This is the only allowed value for indexes having ApiScope
186-
``ANY_API`` and ``DATASTORE_MODE_API``.
189+
This is both the default and only allowed value for Standard
190+
Edition databases (for both Cloud Firestore ``ANY_API`` and
191+
Cloud Datastore ``DATASTORE_MODE_API``).
192+
193+
Take for example the following document:
194+
195+
::
196+
197+
{
198+
"__name__": "...",
199+
"a": 1,
200+
"b": 2,
201+
"c": 3
202+
}
203+
204+
an index on ``(a ASC, b ASC, c ASC, __name__ ASC)`` will
205+
generate an index entry for this document since ``a``, 'b',
206+
``c``, and ``__name__`` are all present but an index of
207+
``(a ASC, d ASC, __name__ ASC)`` will not generate an index
208+
entry for this document since ``d`` is missing.
209+
210+
This means that such indexes can only be used to serve a
211+
query when the query has either implicit or explicit
212+
requirements that all fields from the index are present.
187213
SPARSE_ANY (2):
188-
In order for an index entry to be added, the
189-
document must contain at least one of the fields
190-
specified in the index. Non-existent fields are
191-
treated as having a NULL value when generating
192-
index entries.
214+
An index entry will exist if ANY field are present in the
215+
document.
216+
217+
This is used as the definition of a sparse index for
218+
Enterprise Edition databases.
219+
220+
Take for example the following document:
221+
222+
::
223+
224+
{
225+
"__name__": "...",
226+
"a": 1,
227+
"b": 2,
228+
"c": 3
229+
}
230+
231+
an index on ``(a ASC, d ASC)`` will generate an index entry
232+
for this document since ``a`` is present, and will fill in
233+
an ``unset`` value for ``d``. An index on ``(d ASC, e ASC)``
234+
will not generate any index entry as neither ``d`` nor ``e``
235+
are present.
236+
237+
An index that contains ``__name__`` will generate an index
238+
entry for all documents since Firestore guarantees that all
239+
documents have a ``__name__`` field.
193240
DENSE (3):
194-
An index entry will be added regardless of
195-
whether the document contains any of the fields
196-
specified in the index. Non-existent fields are
197-
treated as having a NULL value when generating
198-
index entries.
241+
An index entry will exist regardless of if the fields are
242+
present or not.
243+
244+
This is the default density for an Enterprise Edition
245+
database.
246+
247+
The index will store ``unset`` values for fields that are
248+
not present in the document.
199249
"""
200250
DENSITY_UNSPECIFIED = 0
201251
SPARSE_ALL = 1
@@ -361,6 +411,10 @@ class FlatIndex(proto.Message):
361411
proto.INT32,
362412
number=8,
363413
)
414+
unique: bool = proto.Field(
415+
proto.BOOL,
416+
number=10,
417+
)
364418

365419

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

0 commit comments

Comments
 (0)