Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for ssl credentials; add throttled field to UpdateDatabaseDdlMetadata #161

Merged
merged 2 commits into from Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/spanner_admin_database_v1/types.rst
Expand Up @@ -3,3 +3,4 @@ Types for Google Cloud Spanner Admin Database v1 API

.. automodule:: google.cloud.spanner_admin_database_v1.types
:members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/spanner_admin_instance_v1/types.rst
Expand Up @@ -3,3 +3,4 @@ Types for Google Cloud Spanner Admin Instance v1 API

.. automodule:: google.cloud.spanner_admin_instance_v1.types
:members:
:show-inheritance:
1 change: 1 addition & 0 deletions docs/spanner_v1/types.rst
Expand Up @@ -3,3 +3,4 @@ Types for Google Cloud Spanner v1 API

.. automodule:: google.cloud.spanner_v1.types
:members:
:show-inheritance:
Expand Up @@ -514,6 +514,11 @@ message UpdateDatabaseDdlMetadata {
// succeeded so far, where `commit_timestamps[i]` is the commit
// timestamp for the statement `statements[i]`.
repeated google.protobuf.Timestamp commit_timestamps = 3;

// Output only. When true, indicates that the operation is throttled e.g
// due to resource constraints. When resources become available the operation
// will resume and this field will be false again.
bool throttled = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
}

// The request for [DropDatabase][google.spanner.admin.database.v1.DatabaseAdmin.DropDatabase].
Expand Down
Expand Up @@ -113,13 +113,16 @@ def __init__(
google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
and ``credentials_file`` are passed.
"""
self._ssl_channel_credentials = ssl_channel_credentials

if channel:
# Sanity check: Ensure that channel and credentials are not both
# provided.
credentials = False

# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
elif api_mtls_endpoint:
warnings.warn(
"api_mtls_endpoint and client_cert_source are deprecated",
Expand Down Expand Up @@ -156,6 +159,7 @@ def __init__(
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
)
self._ssl_channel_credentials = ssl_credentials
else:
host = host if ":" in host else host + ":443"

Expand Down
Expand Up @@ -158,13 +158,16 @@ def __init__(
google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
and ``credentials_file`` are passed.
"""
self._ssl_channel_credentials = ssl_channel_credentials

if channel:
# Sanity check: Ensure that channel and credentials are not both
# provided.
credentials = False

# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
elif api_mtls_endpoint:
warnings.warn(
"api_mtls_endpoint and client_cert_source are deprecated",
Expand Down Expand Up @@ -201,6 +204,7 @@ def __init__(
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
)
self._ssl_channel_credentials = ssl_credentials
else:
host = host if ":" in host else host + ":443"

Expand Down
Expand Up @@ -287,6 +287,12 @@ class UpdateDatabaseDdlMetadata(proto.Message):
Reports the commit timestamps of all statements that have
succeeded so far, where ``commit_timestamps[i]`` is the
commit timestamp for the statement ``statements[i]``.
throttled (bool):
Output only. When true, indicates that the
operation is throttled e.g due to resource
constraints. When resources become available the
operation will resume and this field will be
false again.
"""

database = proto.Field(proto.STRING, number=1)
Expand All @@ -297,6 +303,8 @@ class UpdateDatabaseDdlMetadata(proto.Message):
proto.MESSAGE, number=3, message=timestamp.Timestamp,
)

throttled = proto.Field(proto.BOOL, number=4)


class DropDatabaseRequest(proto.Message):
r"""The request for
Expand Down
Expand Up @@ -126,13 +126,16 @@ def __init__(
google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
and ``credentials_file`` are passed.
"""
self._ssl_channel_credentials = ssl_channel_credentials

if channel:
# Sanity check: Ensure that channel and credentials are not both
# provided.
credentials = False

# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
elif api_mtls_endpoint:
warnings.warn(
"api_mtls_endpoint and client_cert_source are deprecated",
Expand Down Expand Up @@ -169,6 +172,7 @@ def __init__(
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
)
self._ssl_channel_credentials = ssl_credentials
else:
host = host if ":" in host else host + ":443"

Expand Down
Expand Up @@ -171,13 +171,16 @@ def __init__(
google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
and ``credentials_file`` are passed.
"""
self._ssl_channel_credentials = ssl_channel_credentials

if channel:
# Sanity check: Ensure that channel and credentials are not both
# provided.
credentials = False

# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
elif api_mtls_endpoint:
warnings.warn(
"api_mtls_endpoint and client_cert_source are deprecated",
Expand Down Expand Up @@ -214,6 +217,7 @@ def __init__(
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
)
self._ssl_channel_credentials = ssl_credentials
else:
host = host if ":" in host else host + ":443"

Expand Down
4 changes: 4 additions & 0 deletions google/cloud/spanner_v1/services/spanner/transports/grpc.py
Expand Up @@ -106,13 +106,16 @@ def __init__(
google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
and ``credentials_file`` are passed.
"""
self._ssl_channel_credentials = ssl_channel_credentials

if channel:
# Sanity check: Ensure that channel and credentials are not both
# provided.
credentials = False

# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
elif api_mtls_endpoint:
warnings.warn(
"api_mtls_endpoint and client_cert_source are deprecated",
Expand Down Expand Up @@ -149,6 +152,7 @@ def __init__(
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
)
self._ssl_channel_credentials = ssl_credentials
else:
host = host if ":" in host else host + ":443"

Expand Down
Expand Up @@ -151,13 +151,16 @@ def __init__(
google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
and ``credentials_file`` are passed.
"""
self._ssl_channel_credentials = ssl_channel_credentials

if channel:
# Sanity check: Ensure that channel and credentials are not both
# provided.
credentials = False

# If a channel was explicitly provided, set it.
self._grpc_channel = channel
self._ssl_channel_credentials = None
elif api_mtls_endpoint:
warnings.warn(
"api_mtls_endpoint and client_cert_source are deprecated",
Expand Down Expand Up @@ -194,6 +197,7 @@ def __init__(
scopes=scopes or self.AUTH_SCOPES,
quota_project_id=quota_project_id,
)
self._ssl_channel_credentials = ssl_credentials
else:
host = host if ":" in host else host + ":443"

Expand Down
1 change: 1 addition & 0 deletions scripts/fixup_spanner_admin_database_v1_keywords.py
@@ -1,3 +1,4 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
Expand Down
1 change: 1 addition & 0 deletions scripts/fixup_spanner_admin_instance_v1_keywords.py
@@ -1,3 +1,4 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
Expand Down
1 change: 1 addition & 0 deletions scripts/fixup_spanner_v1_keywords.py
@@ -1,3 +1,4 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
Expand Down
151 changes: 149 additions & 2 deletions synth.metadata
Expand Up @@ -3,8 +3,16 @@
{
"git": {
"name": ".",
"remote": "git@github.com:larkee/python-spanner.git",
"sha": "1d3e65af688c31937b0110223679607c19c328e9"
"remote": "https://github.com/googleapis/python-spanner.git",
"sha": "af5a3c65fbf81a93c1b4d4a8a9f65f06e96df325"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "53eb2512a55caabcbad1898225080a2a3dfcb6aa",
"internalRef": "346818879"
}
},
{
Expand Down Expand Up @@ -50,5 +58,144 @@
"generator": "bazel"
}
}
],
"generatedFiles": [
".flake8",
".github/CONTRIBUTING.md",
".github/ISSUE_TEMPLATE/bug_report.md",
".github/ISSUE_TEMPLATE/feature_request.md",
".github/ISSUE_TEMPLATE/support_request.md",
".github/PULL_REQUEST_TEMPLATE.md",
".github/release-please.yml",
".github/snippet-bot.yml",
".gitignore",
".kokoro/build.sh",
".kokoro/continuous/common.cfg",
".kokoro/continuous/continuous.cfg",
".kokoro/docker/docs/Dockerfile",
".kokoro/docker/docs/fetch_gpg_keys.sh",
".kokoro/docs/common.cfg",
".kokoro/docs/docs-presubmit.cfg",
".kokoro/docs/docs.cfg",
".kokoro/populate-secrets.sh",
".kokoro/presubmit/common.cfg",
".kokoro/presubmit/presubmit.cfg",
".kokoro/publish-docs.sh",
".kokoro/release.sh",
".kokoro/release/common.cfg",
".kokoro/release/release.cfg",
".kokoro/samples/lint/common.cfg",
".kokoro/samples/lint/continuous.cfg",
".kokoro/samples/lint/periodic.cfg",
".kokoro/samples/lint/presubmit.cfg",
".kokoro/samples/python3.6/common.cfg",
".kokoro/samples/python3.6/continuous.cfg",
".kokoro/samples/python3.6/periodic.cfg",
".kokoro/samples/python3.6/presubmit.cfg",
".kokoro/samples/python3.7/common.cfg",
".kokoro/samples/python3.7/continuous.cfg",
".kokoro/samples/python3.7/periodic.cfg",
".kokoro/samples/python3.7/presubmit.cfg",
".kokoro/samples/python3.8/common.cfg",
".kokoro/samples/python3.8/continuous.cfg",
".kokoro/samples/python3.8/periodic.cfg",
".kokoro/samples/python3.8/presubmit.cfg",
".kokoro/test-samples.sh",
".kokoro/trampoline.sh",
".kokoro/trampoline_v2.sh",
".trampolinerc",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.rst",
"LICENSE",
"MANIFEST.in",
"docs/_static/custom.css",
"docs/_templates/layout.html",
"docs/conf.py",
"docs/multiprocessing.rst",
"docs/spanner_admin_database_v1/services.rst",
"docs/spanner_admin_database_v1/types.rst",
"docs/spanner_admin_instance_v1/services.rst",
"docs/spanner_admin_instance_v1/types.rst",
"docs/spanner_v1/services.rst",
"docs/spanner_v1/types.rst",
"google/cloud/spanner_admin_database_v1/__init__.py",
"google/cloud/spanner_admin_database_v1/proto/backup.proto",
"google/cloud/spanner_admin_database_v1/proto/common.proto",
"google/cloud/spanner_admin_database_v1/proto/spanner_database_admin.proto",
"google/cloud/spanner_admin_database_v1/py.typed",
"google/cloud/spanner_admin_database_v1/services/__init__.py",
"google/cloud/spanner_admin_database_v1/services/database_admin/__init__.py",
"google/cloud/spanner_admin_database_v1/services/database_admin/async_client.py",
"google/cloud/spanner_admin_database_v1/services/database_admin/client.py",
"google/cloud/spanner_admin_database_v1/services/database_admin/pagers.py",
"google/cloud/spanner_admin_database_v1/services/database_admin/transports/__init__.py",
"google/cloud/spanner_admin_database_v1/services/database_admin/transports/base.py",
"google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc.py",
"google/cloud/spanner_admin_database_v1/services/database_admin/transports/grpc_asyncio.py",
"google/cloud/spanner_admin_database_v1/types/__init__.py",
"google/cloud/spanner_admin_database_v1/types/backup.py",
"google/cloud/spanner_admin_database_v1/types/common.py",
"google/cloud/spanner_admin_database_v1/types/spanner_database_admin.py",
"google/cloud/spanner_admin_instance_v1/__init__.py",
"google/cloud/spanner_admin_instance_v1/proto/spanner_instance_admin.proto",
"google/cloud/spanner_admin_instance_v1/py.typed",
"google/cloud/spanner_admin_instance_v1/services/__init__.py",
"google/cloud/spanner_admin_instance_v1/services/instance_admin/__init__.py",
"google/cloud/spanner_admin_instance_v1/services/instance_admin/async_client.py",
"google/cloud/spanner_admin_instance_v1/services/instance_admin/client.py",
"google/cloud/spanner_admin_instance_v1/services/instance_admin/pagers.py",
"google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/__init__.py",
"google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/base.py",
"google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc.py",
"google/cloud/spanner_admin_instance_v1/services/instance_admin/transports/grpc_asyncio.py",
"google/cloud/spanner_admin_instance_v1/types/__init__.py",
"google/cloud/spanner_admin_instance_v1/types/spanner_instance_admin.py",
"google/cloud/spanner_v1/proto/keys.proto",
"google/cloud/spanner_v1/proto/mutation.proto",
"google/cloud/spanner_v1/proto/query_plan.proto",
"google/cloud/spanner_v1/proto/result_set.proto",
"google/cloud/spanner_v1/proto/spanner.proto",
"google/cloud/spanner_v1/proto/transaction.proto",
"google/cloud/spanner_v1/proto/type.proto",
"google/cloud/spanner_v1/py.typed",
"google/cloud/spanner_v1/services/__init__.py",
"google/cloud/spanner_v1/services/spanner/__init__.py",
"google/cloud/spanner_v1/services/spanner/async_client.py",
"google/cloud/spanner_v1/services/spanner/client.py",
"google/cloud/spanner_v1/services/spanner/pagers.py",
"google/cloud/spanner_v1/services/spanner/transports/__init__.py",
"google/cloud/spanner_v1/services/spanner/transports/base.py",
"google/cloud/spanner_v1/services/spanner/transports/grpc.py",
"google/cloud/spanner_v1/services/spanner/transports/grpc_asyncio.py",
"google/cloud/spanner_v1/types/__init__.py",
"google/cloud/spanner_v1/types/keys.py",
"google/cloud/spanner_v1/types/mutation.py",
"google/cloud/spanner_v1/types/query_plan.py",
"google/cloud/spanner_v1/types/result_set.py",
"google/cloud/spanner_v1/types/spanner.py",
"google/cloud/spanner_v1/types/transaction.py",
"google/cloud/spanner_v1/types/type.py",
"renovate.json",
"samples/AUTHORING_GUIDE.md",
"samples/CONTRIBUTING.md",
"samples/samples/noxfile.py",
"scripts/decrypt-secrets.sh",
"scripts/fixup_spanner_admin_database_v1_keywords.py",
"scripts/fixup_spanner_admin_instance_v1_keywords.py",
"scripts/fixup_spanner_v1_keywords.py",
"scripts/readme-gen/readme_gen.py",
"scripts/readme-gen/templates/README.tmpl.rst",
"scripts/readme-gen/templates/auth.tmpl.rst",
"scripts/readme-gen/templates/auth_api_key.tmpl.rst",
"scripts/readme-gen/templates/install_deps.tmpl.rst",
"scripts/readme-gen/templates/install_portaudio.tmpl.rst",
"setup.cfg",
"testing/.gitignore",
"tests/unit/gapic/spanner_admin_database_v1/__init__.py",
"tests/unit/gapic/spanner_admin_database_v1/test_database_admin.py",
"tests/unit/gapic/spanner_admin_instance_v1/__init__.py",
"tests/unit/gapic/spanner_admin_instance_v1/test_instance_admin.py",
"tests/unit/gapic/spanner_v1/__init__.py",
"tests/unit/gapic/spanner_v1/test_spanner.py"
]
}