Skip to content

Commit

Permalink
fix(deps): require google-api-core>=1.32.0,>=2.8.0 (#739)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
gcf-owl-bot[bot] committed Jul 19, 2022
1 parent 188b37c commit 60db146
Show file tree
Hide file tree
Showing 24 changed files with 335 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,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 list_databases(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,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 @@ -91,11 +92,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 @@ -116,6 +112,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 @@ -128,6 +129,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 @@ -72,6 +72,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 @@ -168,6 +169,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 @@ -117,6 +117,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 @@ -213,6 +214,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 @@ -294,7 +294,7 @@ class CreateDatabaseRequest(proto.Message):
Cloud Spanner will encrypt/decrypt all data at
rest using Google default encryption.
database_dialect (google.cloud.spanner_admin_database_v1.types.DatabaseDialect):
Output only. The dialect of the Cloud Spanner
Optional. The dialect of the Cloud Spanner
Database.
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from .transports.base import InstanceAdminTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import InstanceAdminGrpcAsyncIOTransport
from .client import InstanceAdminClient
Expand Down Expand Up @@ -916,7 +917,7 @@ async def update_instance(
successful.
Authorization requires ``spanner.instances.update`` permission
on resource
on the resource
[name][google.spanner.admin.instance.v1.Instance.name].
.. code-block:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
from google.iam.v1 import iam_policy_pb2 # type: ignore
from google.iam.v1 import policy_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from .transports.base import InstanceAdminTransport, DEFAULT_CLIENT_INFO
from .transports.grpc import InstanceAdminGrpcTransport
from .transports.grpc_asyncio import InstanceAdminGrpcAsyncIOTransport
Expand Down Expand Up @@ -463,6 +464,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 list_instance_configs(
Expand Down Expand Up @@ -1109,7 +1111,7 @@ def update_instance(
successful.
Authorization requires ``spanner.instances.update`` permission
on resource
on the resource
[name][google.spanner.admin.instance.v1.Instance.name].
.. code-block:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,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 @@ -89,11 +90,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 @@ -114,6 +110,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 @@ -126,6 +127,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 @@ -83,6 +83,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 @@ -179,6 +180,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 Expand Up @@ -500,7 +502,7 @@ def update_instance(
successful.
Authorization requires ``spanner.instances.update`` permission
on resource
on the resource
[name][google.spanner.admin.instance.v1.Instance.name].
Returns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,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 @@ -224,6 +225,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 Expand Up @@ -508,7 +510,7 @@ def update_instance(
successful.
Authorization requires ``spanner.instances.update`` permission
on resource
on the resource
[name][google.spanner.admin.instance.v1.Instance.name].
Returns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class InstanceConfig(proto.Message):
name (str):
A unique identifier for the instance configuration. Values
are of the form
``projects/<project>/instanceConfigs/[a-z][-a-z0-9]*``
``projects/<project>/instanceConfigs/[a-z][-a-z0-9]*``.
display_name (str):
The name of this instance configuration as it
appears in UIs.
Expand All @@ -100,7 +100,7 @@ class InstanceConfig(proto.Message):
instance configuration and their replication
properties.
leader_options (Sequence[str]):
Allowed values of the default_leader schema option for
Allowed values of the "default_leader" schema option for
databases in instances that use this instance configuration.
"""

Expand Down Expand Up @@ -149,18 +149,23 @@ class Instance(proto.Message):
per project and between 4 and 30 characters in
length.
node_count (int):
Required. The number of nodes allocated to this instance.
This may be zero in API responses for instances that are not
yet in state ``READY``.
The number of nodes allocated to this instance. At most one
of either node_count or processing_units should be present
in the message. This may be zero in API responses for
instances that are not yet in state ``READY``.
See `the
documentation <https://cloud.google.com/spanner/docs/instances#node_count>`__
for more information about nodes.
documentation <https://cloud.google.com/spanner/docs/compute-capacity>`__
for more information about nodes and processing units.
processing_units (int):
The number of processing units allocated to this instance.
At most one of processing_units or node_count should be
present in the message. This may be zero in API responses
for instances that are not yet in state ``READY``.
See `the
documentation <https://cloud.google.com/spanner/docs/compute-capacity>`__
for more information about nodes and processing units.
state (google.cloud.spanner_admin_instance_v1.types.Instance.State):
Output only. The current instance state. For
[CreateInstance][google.spanner.admin.instance.v1.InstanceAdmin.CreateInstance],
Expand All @@ -179,10 +184,10 @@ class Instance(proto.Message):
- Label keys must be between 1 and 63 characters long and
must conform to the following regular expression:
``[a-z]([-a-z0-9]*[a-z0-9])?``.
``[a-z][a-z0-9_-]{0,62}``.
- Label values must be between 0 and 63 characters long and
must conform to the regular expression
``([a-z]([-a-z0-9]*[a-z0-9])?)?``.
``[a-z0-9_-]{0,63}``.
- No more than 64 labels can be associated with a given
resource.
Expand All @@ -198,6 +203,12 @@ class Instance(proto.Message):
were to allow "*" in a future release.
endpoint_uris (Sequence[str]):
Deprecated. This field is not populated.
create_time (google.protobuf.timestamp_pb2.Timestamp):
Output only. The time at which the instance
was created.
update_time (google.protobuf.timestamp_pb2.Timestamp):
Output only. The time at which the instance
was most recently updated.
"""

class State(proto.Enum):
Expand Down Expand Up @@ -240,6 +251,16 @@ class State(proto.Enum):
proto.STRING,
number=8,
)
create_time = proto.Field(
proto.MESSAGE,
number=11,
message=timestamp_pb2.Timestamp,
)
update_time = proto.Field(
proto.MESSAGE,
number=12,
message=timestamp_pb2.Timestamp,
)


class ListInstanceConfigsRequest(proto.Message):
Expand Down
1 change: 1 addition & 0 deletions google/cloud/spanner_v1/services/spanner/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,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_session(
Expand Down
16 changes: 11 additions & 5 deletions google/cloud/spanner_v1/services/spanner/transports/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,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 @@ -88,11 +89,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 @@ -113,6 +109,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 @@ -125,6 +126,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
2 changes: 2 additions & 0 deletions google/cloud/spanner_v1/services/spanner/transports/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,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 @@ -159,6 +160,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
Loading

0 comments on commit 60db146

Please sign in to comment.