From 3ae236928f0ac923367d5379daa59f366299397b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 13 Jul 2021 12:07:56 -0500 Subject: [PATCH] feat: add cloud spanner connection support (#93) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add cloud spanner connection support PiperOrigin-RevId: 384325792 Source-Link: https://github.com/googleapis/googleapis/commit/eba54922f4dd1a7e25ee44e0769a3af2ae2d2c0d Source-Link: https://github.com/googleapis/googleapis-gen/commit/6fdc90c3327a74656e7654a59e0ed4fafdda946e * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/master/packages/owl-bot/README.md Co-authored-by: Owl Bot --- google/cloud/bigquery_connection/__init__.py | 4 ++ .../cloud/bigquery_connection_v1/__init__.py | 4 ++ .../bigquery_connection_v1/types/__init__.py | 4 ++ .../types/connection.py | 47 +++++++++++++++++++ 4 files changed, 59 insertions(+) diff --git a/google/cloud/bigquery_connection/__init__.py b/google/cloud/bigquery_connection/__init__.py index 7e29fe8..c0d7cf4 100644 --- a/google/cloud/bigquery_connection/__init__.py +++ b/google/cloud/bigquery_connection/__init__.py @@ -21,8 +21,10 @@ ConnectionServiceAsyncClient, ) +from google.cloud.bigquery_connection_v1.types.connection import AwsAccessRole from google.cloud.bigquery_connection_v1.types.connection import AwsCrossAccountRole from google.cloud.bigquery_connection_v1.types.connection import AwsProperties +from google.cloud.bigquery_connection_v1.types.connection import CloudSpannerProperties from google.cloud.bigquery_connection_v1.types.connection import CloudSqlCredential from google.cloud.bigquery_connection_v1.types.connection import CloudSqlProperties from google.cloud.bigquery_connection_v1.types.connection import Connection @@ -36,8 +38,10 @@ __all__ = ( "ConnectionServiceClient", "ConnectionServiceAsyncClient", + "AwsAccessRole", "AwsCrossAccountRole", "AwsProperties", + "CloudSpannerProperties", "CloudSqlCredential", "CloudSqlProperties", "Connection", diff --git a/google/cloud/bigquery_connection_v1/__init__.py b/google/cloud/bigquery_connection_v1/__init__.py index bff96d6..0787092 100644 --- a/google/cloud/bigquery_connection_v1/__init__.py +++ b/google/cloud/bigquery_connection_v1/__init__.py @@ -17,8 +17,10 @@ from .services.connection_service import ConnectionServiceClient from .services.connection_service import ConnectionServiceAsyncClient +from .types.connection import AwsAccessRole from .types.connection import AwsCrossAccountRole from .types.connection import AwsProperties +from .types.connection import CloudSpannerProperties from .types.connection import CloudSqlCredential from .types.connection import CloudSqlProperties from .types.connection import Connection @@ -31,8 +33,10 @@ __all__ = ( "ConnectionServiceAsyncClient", + "AwsAccessRole", "AwsCrossAccountRole", "AwsProperties", + "CloudSpannerProperties", "CloudSqlCredential", "CloudSqlProperties", "Connection", diff --git a/google/cloud/bigquery_connection_v1/types/__init__.py b/google/cloud/bigquery_connection_v1/types/__init__.py index cfaf47a..00198a2 100644 --- a/google/cloud/bigquery_connection_v1/types/__init__.py +++ b/google/cloud/bigquery_connection_v1/types/__init__.py @@ -14,8 +14,10 @@ # limitations under the License. # from .connection import ( + AwsAccessRole, AwsCrossAccountRole, AwsProperties, + CloudSpannerProperties, CloudSqlCredential, CloudSqlProperties, Connection, @@ -28,8 +30,10 @@ ) __all__ = ( + "AwsAccessRole", "AwsCrossAccountRole", "AwsProperties", + "CloudSpannerProperties", "CloudSqlCredential", "CloudSqlProperties", "Connection", diff --git a/google/cloud/bigquery_connection_v1/types/connection.py b/google/cloud/bigquery_connection_v1/types/connection.py index 6e83042..12a3c85 100644 --- a/google/cloud/bigquery_connection_v1/types/connection.py +++ b/google/cloud/bigquery_connection_v1/types/connection.py @@ -30,8 +30,10 @@ "Connection", "CloudSqlProperties", "CloudSqlCredential", + "CloudSpannerProperties", "AwsProperties", "AwsCrossAccountRole", + "AwsAccessRole", }, ) @@ -158,6 +160,8 @@ class Connection(proto.Message): Cloud SQL properties. aws (google.cloud.bigquery_connection_v1.types.AwsProperties): Amazon Web Services (AWS) properties. + cloud_spanner (google.cloud.bigquery_connection_v1.types.CloudSpannerProperties): + Cloud Spanner properties. creation_time (int): Output only. The creation timestamp of the connection. @@ -178,6 +182,9 @@ class Connection(proto.Message): aws = proto.Field( proto.MESSAGE, number=8, oneof="properties", message="AwsProperties", ) + cloud_spanner = proto.Field( + proto.MESSAGE, number=21, oneof="properties", message="CloudSpannerProperties", + ) creation_time = proto.Field(proto.INT64, number=5,) last_modified_time = proto.Field(proto.INT64, number=6,) has_credential = proto.Field(proto.BOOL, number=7,) @@ -222,6 +229,21 @@ class CloudSqlCredential(proto.Message): password = proto.Field(proto.STRING, number=2,) +class CloudSpannerProperties(proto.Message): + r"""Connection properties specific to Cloud Spanner. + Attributes: + database (str): + Cloud Spanner database in the form + \`project/instance/database' + use_parallelism (bool): + If parallelism should be used when reading + from Cloud Spanner + """ + + database = proto.Field(proto.STRING, number=1,) + use_parallelism = proto.Field(proto.BOOL, number=2,) + + class AwsProperties(proto.Message): r"""Connection properties specific to Amazon Web Services (AWS). Attributes: @@ -229,6 +251,9 @@ class AwsProperties(proto.Message): Authentication using Google owned AWS IAM user's access key to assume into customer's AWS IAM Role. + access_role (google.cloud.bigquery_connection_v1.types.AwsAccessRole): + Authentication using Google owned service + account to assume into customer's AWS IAM Role. """ cross_account_role = proto.Field( @@ -237,6 +262,9 @@ class AwsProperties(proto.Message): oneof="authentication_method", message="AwsCrossAccountRole", ) + access_role = proto.Field( + proto.MESSAGE, number=3, oneof="authentication_method", message="AwsAccessRole", + ) class AwsCrossAccountRole(proto.Message): @@ -263,4 +291,23 @@ class AwsCrossAccountRole(proto.Message): external_id = proto.Field(proto.STRING, number=3,) +class AwsAccessRole(proto.Message): + r"""Authentication method for Amazon Web Services (AWS) that uses + Google owned Google service account to assume into customer's + AWS IAM Role. + + Attributes: + iam_role_id (str): + The user’s AWS IAM Role that trusts the + Google-owned AWS IAM user Connection. + identity (str): + A unique Google-owned and Google-generated + identity for the Connection. This identity will + be used to access the user's AWS IAM Role. + """ + + iam_role_id = proto.Field(proto.STRING, number=1,) + identity = proto.Field(proto.STRING, number=2,) + + __all__ = tuple(sorted(__protobuf__.manifest))