Skip to content

Commit

Permalink
fix(deps): require google-api-core>=1.32.0,>=2.8.0 (#607)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 459095142

Source-Link: googleapis/googleapis@4f1be99

Source-Link: googleapis/googleapis-gen@ae686d9
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWU2ODZkOWNkZTRmYzNlMzZkMGFjMDJlZmI4NjQzYjE1ODkwYzFlZCJ9

feat: add audience parameter
PiperOrigin-RevId: 456827138

Source-Link: googleapis/googleapis@23f1a15

Source-Link: googleapis/googleapis-gen@4075a85
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDA3NWE4NTE0ZjY3NjY5MWVjMTU2Njg4YTViYmYxODNhYTk4OTNjZSJ9

PiperOrigin-RevId: 453719952

Source-Link: googleapis/googleapis@bdea286

Source-Link: googleapis/googleapis-gen@03f0c73
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDNmMGM3M2EyYTljMDY0ZTZmNDk5MzU5ZmY0ZWQwNWUxODc2Mjc0MSJ9
  • Loading branch information
gcf-owl-bot[bot] authored Jul 14, 2022
1 parent 033e624 commit 40dce54
Show file tree
Hide file tree
Showing 15 changed files with 165 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ def __init__(
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=True,
api_audience=client_options.api_audience,
)

def create_index(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
**kwargs,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -90,11 +91,6 @@ def __init__(
be used for service account credentials.
"""

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
self._host = host

scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
Expand All @@ -115,6 +111,11 @@ def __init__(
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
)
# Don't apply audience if the credentials file passed from user.
if hasattr(credentials, "with_gdch_audience"):
credentials = credentials.with_gdch_audience(
api_audience if api_audience else host
)

# If the credentials are service account credentials, then always try to use self signed JWT.
if (
Expand All @@ -127,6 +128,11 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
self._host = host

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def __init__(
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -190,6 +191,7 @@ def __init__(
quota_project_id=quota_project_id,
client_info=client_info,
always_use_jwt_access=always_use_jwt_access,
api_audience=api_audience,
)

if not self._grpc_channel:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def __init__(
quota_project_id=None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -235,6 +236,7 @@ def __init__(
quota_project_id=quota_project_id,
client_info=client_info,
always_use_jwt_access=always_use_jwt_access,
api_audience=api_audience,
)

if not self._grpc_channel:
Expand Down
1 change: 1 addition & 0 deletions google/cloud/firestore_v1/services/firestore/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ def __init__(
quota_project_id=client_options.quota_project_id,
client_info=client_info,
always_use_jwt_access=True,
api_audience=client_options.api_audience,
)

def get_document(
Expand Down
16 changes: 11 additions & 5 deletions google/cloud/firestore_v1/services/firestore/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def __init__(
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
**kwargs,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -87,11 +88,6 @@ def __init__(
be used for service account credentials.
"""

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
self._host = host

scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}

# Save the scopes.
Expand All @@ -112,6 +108,11 @@ def __init__(
credentials, _ = google.auth.default(
**scopes_kwargs, quota_project_id=quota_project_id
)
# Don't apply audience if the credentials file passed from user.
if hasattr(credentials, "with_gdch_audience"):
credentials = credentials.with_gdch_audience(
api_audience if api_audience else host
)

# If the credentials are service account credentials, then always try to use self signed JWT.
if (
Expand All @@ -124,6 +125,11 @@ def __init__(
# Save the credentials.
self._credentials = credentials

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
self._host = host

def _prep_wrapped_messages(self, client_info):
# Precompute the wrapped methods.
self._wrapped_methods = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def __init__(
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -163,6 +164,7 @@ def __init__(
quota_project_id=quota_project_id,
client_info=client_info,
always_use_jwt_access=always_use_jwt_access,
api_audience=api_audience,
)

if not self._grpc_channel:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def __init__(
quota_project_id=None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
always_use_jwt_access: Optional[bool] = False,
api_audience: Optional[str] = None,
) -> None:
"""Instantiate the transport.
Expand Down Expand Up @@ -208,6 +209,7 @@ def __init__(
quota_project_id=quota_project_id,
client_info=client_info,
always_use_jwt_access=always_use_jwt_access,
api_audience=api_audience,
)

if not self._grpc_channel:
Expand Down
25 changes: 25 additions & 0 deletions google/cloud/firestore_v1/types/firestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,11 @@ class PartitionQueryRequest(proto.Message):
A second call to PartitionQuery will return up to 2
partitions, to complete the total of 10 specified in
``partition_count``.
read_time (google.protobuf.timestamp_pb2.Timestamp):
Reads documents as they were at the given
time. This may not be older than 270 seconds.
This field is a member of `oneof`_ ``consistency_selector``.
"""

parent = proto.Field(
Expand All @@ -845,6 +850,12 @@ class PartitionQueryRequest(proto.Message):
proto.INT32,
number=5,
)
read_time = proto.Field(
proto.MESSAGE,
number=6,
oneof="consistency_selector",
message=timestamp_pb2.Timestamp,
)


class PartitionQueryResponse(proto.Message):
Expand Down Expand Up @@ -1330,6 +1341,9 @@ class ListCollectionIdsRequest(proto.Message):
r"""The request for
[Firestore.ListCollectionIds][google.firestore.v1.Firestore.ListCollectionIds].
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
parent (str):
Required. The parent document. In the format:
Expand All @@ -1341,6 +1355,11 @@ class ListCollectionIdsRequest(proto.Message):
page_token (str):
A page token. Must be a value from
[ListCollectionIdsResponse][google.firestore.v1.ListCollectionIdsResponse].
read_time (google.protobuf.timestamp_pb2.Timestamp):
Reads documents as they were at the given
time. This may not be older than 270 seconds.
This field is a member of `oneof`_ ``consistency_selector``.
"""

parent = proto.Field(
Expand All @@ -1355,6 +1374,12 @@ class ListCollectionIdsRequest(proto.Message):
proto.STRING,
number=3,
)
read_time = proto.Field(
proto.MESSAGE,
number=4,
oneof="consistency_selector",
message=timestamp_pb2.Timestamp,
)


class ListCollectionIdsResponse(proto.Message):
Expand Down
4 changes: 2 additions & 2 deletions scripts/fixup_firestore_v1_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ class firestoreCallTransformer(cst.CSTTransformer):
'create_document': ('parent', 'collection_id', 'document', 'document_id', 'mask', ),
'delete_document': ('name', 'current_document', ),
'get_document': ('name', 'mask', 'transaction', 'read_time', ),
'list_collection_ids': ('parent', 'page_size', 'page_token', ),
'list_collection_ids': ('parent', 'page_size', 'page_token', 'read_time', ),
'list_documents': ('parent', 'collection_id', 'page_size', 'page_token', 'order_by', 'mask', 'transaction', 'read_time', 'show_missing', ),
'listen': ('database', 'add_target', 'remove_target', 'labels', ),
'partition_query': ('parent', 'structured_query', 'partition_count', 'page_token', 'page_size', ),
'partition_query': ('parent', 'structured_query', 'partition_count', 'page_token', 'page_size', 'read_time', ),
'rollback': ('database', 'transaction', ),
'run_query': ('parent', 'structured_query', 'transaction', 'new_transaction', 'read_time', ),
'update_document': ('document', 'update_mask', 'mask', 'current_document', ),
Expand Down
8 changes: 1 addition & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,7 @@
version = "2.5.3"
release_status = "Development Status :: 5 - Production/Stable"
dependencies = [
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
"google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0",
# NOTE: Maintainers, please do not require google-api-core>=2.x.x
# Until this issue is closed
# https://github.com/googleapis/google-cloud-python/issues/10566
"google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*",
"google-cloud-core >= 1.4.1, <3.0.0dev",
"proto-plus >= 1.20.5, <2.0.0dev",
"protobuf >= 3.19.0, <4.0.0dev",
Expand Down
11 changes: 0 additions & 11 deletions testing/constraints-3.6.txt

This file was deleted.

2 changes: 1 addition & 1 deletion testing/constraints-3.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev",
# Then this file should have foo==1.14.0
google-api-core==1.31.5
google-api-core==1.32.0
google-cloud-core==1.4.1
proto-plus==1.20.5
protobuf==3.19.0 # transitive from `google-api-core`
Loading

0 comments on commit 40dce54

Please sign in to comment.