Skip to content

Commit 60db146

Browse files
fix(deps): require google-api-core>=1.32.0,>=2.8.0 (#739)
feat: add Session creator role docs: clarify transaction semantics feat: add audience parameter feat: Adding two new fields for Instance create_time and update_time
1 parent 188b37c commit 60db146

File tree

24 files changed

+335
-89
lines changed

24 files changed

+335
-89
lines changed

google/cloud/spanner_admin_database_v1/services/database_admin/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ def __init__(
530530
quota_project_id=client_options.quota_project_id,
531531
client_info=client_info,
532532
always_use_jwt_access=True,
533+
api_audience=client_options.api_audience,
533534
)
534535

535536
def list_databases(

google/cloud/spanner_admin_database_v1/services/database_admin/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def __init__(
6464
quota_project_id: Optional[str] = None,
6565
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6666
always_use_jwt_access: Optional[bool] = False,
67+
api_audience: Optional[str] = None,
6768
**kwargs,
6869
) -> None:
6970
"""Instantiate the transport.
@@ -91,11 +92,6 @@ def __init__(
9192
be used for service account credentials.
9293
"""
9394

94-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
95-
if ":" not in host:
96-
host += ":443"
97-
self._host = host
98-
9995
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
10096

10197
# Save the scopes.
@@ -116,6 +112,11 @@ def __init__(
116112
credentials, _ = google.auth.default(
117113
**scopes_kwargs, quota_project_id=quota_project_id
118114
)
115+
# Don't apply audience if the credentials file passed from user.
116+
if hasattr(credentials, "with_gdch_audience"):
117+
credentials = credentials.with_gdch_audience(
118+
api_audience if api_audience else host
119+
)
119120

120121
# If the credentials are service account credentials, then always try to use self signed JWT.
121122
if (
@@ -128,6 +129,11 @@ def __init__(
128129
# Save the credentials.
129130
self._credentials = credentials
130131

132+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
133+
if ":" not in host:
134+
host += ":443"
135+
self._host = host
136+
131137
def _prep_wrapped_messages(self, client_info):
132138
# Precompute the wrapped methods.
133139
self._wrapped_methods = {

google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def __init__(
7272
quota_project_id: Optional[str] = None,
7373
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
7474
always_use_jwt_access: Optional[bool] = False,
75+
api_audience: Optional[str] = None,
7576
) -> None:
7677
"""Instantiate the transport.
7778
@@ -168,6 +169,7 @@ def __init__(
168169
quota_project_id=quota_project_id,
169170
client_info=client_info,
170171
always_use_jwt_access=always_use_jwt_access,
172+
api_audience=api_audience,
171173
)
172174

173175
if not self._grpc_channel:

google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc_asyncio.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def __init__(
117117
quota_project_id=None,
118118
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
119119
always_use_jwt_access: Optional[bool] = False,
120+
api_audience: Optional[str] = None,
120121
) -> None:
121122
"""Instantiate the transport.
122123
@@ -213,6 +214,7 @@ def __init__(
213214
quota_project_id=quota_project_id,
214215
client_info=client_info,
215216
always_use_jwt_access=always_use_jwt_access,
217+
api_audience=api_audience,
216218
)
217219

218220
if not self._grpc_channel:

google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ class CreateDatabaseRequest(proto.Message):
294294
Cloud Spanner will encrypt/decrypt all data at
295295
rest using Google default encryption.
296296
database_dialect (google.cloud.spanner_admin_database_v1.types.DatabaseDialect):
297-
Output only. The dialect of the Cloud Spanner
297+
Optional. The dialect of the Cloud Spanner
298298
Database.
299299
"""
300300

google/cloud/spanner_admin_instance_v1/services/instance_admin/async_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
from google.iam.v1 import iam_policy_pb2 # type: ignore
3939
from google.iam.v1 import policy_pb2 # type: ignore
4040
from google.protobuf import field_mask_pb2 # type: ignore
41+
from google.protobuf import timestamp_pb2 # type: ignore
4142
from .transports.base import InstanceAdminTransport, DEFAULT_CLIENT_INFO
4243
from .transports.grpc_asyncio import InstanceAdminGrpcAsyncIOTransport
4344
from .client import InstanceAdminClient
@@ -916,7 +917,7 @@ async def update_instance(
916917
successful.
917918
918919
Authorization requires ``spanner.instances.update`` permission
919-
on resource
920+
on the resource
920921
[name][google.spanner.admin.instance.v1.Instance.name].
921922
922923
.. code-block:: python

google/cloud/spanner_admin_instance_v1/services/instance_admin/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
from google.iam.v1 import iam_policy_pb2 # type: ignore
4242
from google.iam.v1 import policy_pb2 # type: ignore
4343
from google.protobuf import field_mask_pb2 # type: ignore
44+
from google.protobuf import timestamp_pb2 # type: ignore
4445
from .transports.base import InstanceAdminTransport, DEFAULT_CLIENT_INFO
4546
from .transports.grpc import InstanceAdminGrpcTransport
4647
from .transports.grpc_asyncio import InstanceAdminGrpcAsyncIOTransport
@@ -463,6 +464,7 @@ def __init__(
463464
quota_project_id=client_options.quota_project_id,
464465
client_info=client_info,
465466
always_use_jwt_access=True,
467+
api_audience=client_options.api_audience,
466468
)
467469

468470
def list_instance_configs(
@@ -1109,7 +1111,7 @@ def update_instance(
11091111
successful.
11101112
11111113
Authorization requires ``spanner.instances.update`` permission
1112-
on resource
1114+
on the resource
11131115
[name][google.spanner.admin.instance.v1.Instance.name].
11141116
11151117
.. code-block:: python

google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/base.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ def __init__(
6262
quota_project_id: Optional[str] = None,
6363
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
6464
always_use_jwt_access: Optional[bool] = False,
65+
api_audience: Optional[str] = None,
6566
**kwargs,
6667
) -> None:
6768
"""Instantiate the transport.
@@ -89,11 +90,6 @@ def __init__(
8990
be used for service account credentials.
9091
"""
9192

92-
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
93-
if ":" not in host:
94-
host += ":443"
95-
self._host = host
96-
9793
scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
9894

9995
# Save the scopes.
@@ -114,6 +110,11 @@ def __init__(
114110
credentials, _ = google.auth.default(
115111
**scopes_kwargs, quota_project_id=quota_project_id
116112
)
113+
# Don't apply audience if the credentials file passed from user.
114+
if hasattr(credentials, "with_gdch_audience"):
115+
credentials = credentials.with_gdch_audience(
116+
api_audience if api_audience else host
117+
)
117118

118119
# If the credentials are service account credentials, then always try to use self signed JWT.
119120
if (
@@ -126,6 +127,11 @@ def __init__(
126127
# Save the credentials.
127128
self._credentials = credentials
128129

130+
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
131+
if ":" not in host:
132+
host += ":443"
133+
self._host = host
134+
129135
def _prep_wrapped_messages(self, client_info):
130136
# Precompute the wrapped methods.
131137
self._wrapped_methods = {

google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def __init__(
8383
quota_project_id: Optional[str] = None,
8484
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
8585
always_use_jwt_access: Optional[bool] = False,
86+
api_audience: Optional[str] = None,
8687
) -> None:
8788
"""Instantiate the transport.
8889
@@ -179,6 +180,7 @@ def __init__(
179180
quota_project_id=quota_project_id,
180181
client_info=client_info,
181182
always_use_jwt_access=always_use_jwt_access,
183+
api_audience=api_audience,
182184
)
183185

184186
if not self._grpc_channel:
@@ -500,7 +502,7 @@ def update_instance(
500502
successful.
501503
502504
Authorization requires ``spanner.instances.update`` permission
503-
on resource
505+
on the resource
504506
[name][google.spanner.admin.instance.v1.Instance.name].
505507
506508
Returns:

google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc_asyncio.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def __init__(
128128
quota_project_id=None,
129129
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
130130
always_use_jwt_access: Optional[bool] = False,
131+
api_audience: Optional[str] = None,
131132
) -> None:
132133
"""Instantiate the transport.
133134
@@ -224,6 +225,7 @@ def __init__(
224225
quota_project_id=quota_project_id,
225226
client_info=client_info,
226227
always_use_jwt_access=always_use_jwt_access,
228+
api_audience=api_audience,
227229
)
228230

229231
if not self._grpc_channel:
@@ -508,7 +510,7 @@ def update_instance(
508510
successful.
509511
510512
Authorization requires ``spanner.instances.update`` permission
511-
on resource
513+
on the resource
512514
[name][google.spanner.admin.instance.v1.Instance.name].
513515
514516
Returns:

0 commit comments

Comments
 (0)