Skip to content

Commit 4d90329

Browse files
docs(firestore): standardize use of 'required' and 'optional' in docstrings; add py2 deprecation warning; add 3.8 unit tests (via synth) (#10068)
1 parent 0e75d9e commit 4d90329

22 files changed

+800
-632
lines changed

firestore/google/cloud/firestore_admin_v1/__init__.py

+11
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,23 @@
1616

1717

1818
from __future__ import absolute_import
19+
import sys
20+
import warnings
1921

2022
from google.cloud.firestore_admin_v1 import types
2123
from google.cloud.firestore_admin_v1.gapic import enums
2224
from google.cloud.firestore_admin_v1.gapic import firestore_admin_client
2325

2426

27+
if sys.version_info[:2] == (2, 7):
28+
message = (
29+
"A future version of this library will drop support for Python 2.7."
30+
"More details about Python 2 support for Google Cloud Client Libraries"
31+
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
32+
)
33+
warnings.warn(message, DeprecationWarning)
34+
35+
2536
class FirestoreAdminClient(firestore_admin_client.FirestoreAdminClient):
2637
__doc__ = firestore_admin_client.FirestoreAdminClient.__doc__
2738
enums = enums

firestore/google/cloud/firestore_admin_v1/gapic/firestore_admin_client.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,9 @@ def create_index(
264264
>>> response = client.create_index(parent, index)
265265
266266
Args:
267-
parent (str): A parent name of the form
267+
parent (str): Required. A parent name of the form
268268
``projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}``
269-
index (Union[dict, ~google.cloud.firestore_admin_v1.types.Index]): The composite index to create.
269+
index (Union[dict, ~google.cloud.firestore_admin_v1.types.Index]): Required. The composite index to create.
270270
271271
If a dict is provided, it must be of the same form as the protobuf
272272
message :class:`~google.cloud.firestore_admin_v1.types.Index`
@@ -352,7 +352,7 @@ def list_indexes(
352352
... pass
353353
354354
Args:
355-
parent (str): A parent name of the form
355+
parent (str): Required. A parent name of the form
356356
``projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}``
357357
filter_ (str): The filter to apply to list results.
358358
page_size (int): The maximum number of resources contained in the
@@ -444,7 +444,7 @@ def get_index(
444444
>>> response = client.get_index(name)
445445
446446
Args:
447-
name (str): A name of the form
447+
name (str): Required. A name of the form
448448
``projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}``
449449
retry (Optional[google.api_core.retry.Retry]): A retry object used
450450
to retry requests. If ``None`` is specified, requests will
@@ -514,7 +514,7 @@ def delete_index(
514514
>>> client.delete_index(name)
515515
516516
Args:
517-
name (str): A name of the form
517+
name (str): Required. A name of the form
518518
``projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}``
519519
retry (Optional[google.api_core.retry.Retry]): A retry object used
520520
to retry requests. If ``None`` is specified, requests will
@@ -587,7 +587,7 @@ def import_documents(
587587
>>> response = client.import_documents(name)
588588
589589
Args:
590-
name (str): Database to import into. Should be of the form:
590+
name (str): Required. Database to import into. Should be of the form:
591591
``projects/{project_id}/databases/{database_id}``.
592592
collection_ids (list[str]): Which collection ids to import. Unspecified means all collections included
593593
in the import.
@@ -674,7 +674,7 @@ def export_documents(
674674
>>> response = client.export_documents(name)
675675
676676
Args:
677-
name (str): Database to export. Should be of the form:
677+
name (str): Required. Database to export. Should be of the form:
678678
``projects/{project_id}/databases/{database_id}``.
679679
collection_ids (list[str]): Which collection ids to export. Unspecified means all collections.
680680
output_uri_prefix (str): The output URI. Currently only supports Google Cloud Storage URIs of the
@@ -757,7 +757,7 @@ def get_field(
757757
>>> response = client.get_field(name)
758758
759759
Args:
760-
name (str): A name of the form
760+
name (str): Required. A name of the form
761761
``projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}``
762762
retry (Optional[google.api_core.retry.Retry]): A retry object used
763763
to retry requests. If ``None`` is specified, requests will
@@ -846,7 +846,7 @@ def list_fields(
846846
... pass
847847
848848
Args:
849-
parent (str): A parent name of the form
849+
parent (str): Required. A parent name of the form
850850
``projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}``
851851
filter_ (str): The filter to apply to list results. Currently,
852852
``FirestoreAdmin.ListFields`` only supports listing fields that have
@@ -956,7 +956,7 @@ def update_field(
956956
>>> response = client.update_field(field)
957957
958958
Args:
959-
field (Union[dict, ~google.cloud.firestore_admin_v1.types.Field]): The field to be updated.
959+
field (Union[dict, ~google.cloud.firestore_admin_v1.types.Field]): Required. The field to be updated.
960960
961961
If a dict is provided, it must be of the same form as the protobuf
962962
message :class:`~google.cloud.firestore_admin_v1.types.Field`

firestore/google/cloud/firestore_admin_v1/proto/field.proto

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ syntax = "proto3";
1717

1818
package google.firestore.admin.v1;
1919

20+
import "google/api/resource.proto";
2021
import "google/firestore/admin/v1/index.proto";
2122
import "google/api/annotations.proto";
2223

@@ -33,6 +34,11 @@ option php_namespace = "Google\\Cloud\\Firestore\\Admin\\V1";
3334
// Fields are grouped by their "Collection Group", which represent all
3435
// collections in the database with the same id.
3536
message Field {
37+
option (google.api.resource) = {
38+
type: "firestore.googleapis.com/Field"
39+
pattern: "projects/{project}/databases/{database}/collectionGroups/{collection}/fields/{field}"
40+
};
41+
3642
// The index configuration for this field.
3743
message IndexConfig {
3844
// The indexes supported for this field.

firestore/google/cloud/firestore_admin_v1/proto/field_pb2.py

+11-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)