Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

feat: add cloud spanner connection support #93

Merged
merged 2 commits into from Jul 13, 2021
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
4 changes: 4 additions & 0 deletions google/cloud/bigquery_connection/__init__.py
Expand Up @@ -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
Expand All @@ -36,8 +38,10 @@
__all__ = (
"ConnectionServiceClient",
"ConnectionServiceAsyncClient",
"AwsAccessRole",
"AwsCrossAccountRole",
"AwsProperties",
"CloudSpannerProperties",
"CloudSqlCredential",
"CloudSqlProperties",
"Connection",
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/bigquery_connection_v1/__init__.py
Expand Up @@ -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
Expand All @@ -31,8 +33,10 @@

__all__ = (
"ConnectionServiceAsyncClient",
"AwsAccessRole",
"AwsCrossAccountRole",
"AwsProperties",
"CloudSpannerProperties",
"CloudSqlCredential",
"CloudSqlProperties",
"Connection",
Expand Down
4 changes: 4 additions & 0 deletions google/cloud/bigquery_connection_v1/types/__init__.py
Expand Up @@ -14,8 +14,10 @@
# limitations under the License.
#
from .connection import (
AwsAccessRole,
AwsCrossAccountRole,
AwsProperties,
CloudSpannerProperties,
CloudSqlCredential,
CloudSqlProperties,
Connection,
Expand All @@ -28,8 +30,10 @@
)

__all__ = (
"AwsAccessRole",
"AwsCrossAccountRole",
"AwsProperties",
"CloudSpannerProperties",
"CloudSqlCredential",
"CloudSqlProperties",
"Connection",
Expand Down
47 changes: 47 additions & 0 deletions google/cloud/bigquery_connection_v1/types/connection.py
Expand Up @@ -30,8 +30,10 @@
"Connection",
"CloudSqlProperties",
"CloudSqlCredential",
"CloudSpannerProperties",
"AwsProperties",
"AwsCrossAccountRole",
"AwsAccessRole",
},
)

Expand Down Expand Up @@ -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.
Expand All @@ -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,)
Expand Down Expand Up @@ -222,13 +229,31 @@ 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:
cross_account_role (google.cloud.bigquery_connection_v1.types.AwsCrossAccountRole):
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(
Expand All @@ -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):
Expand All @@ -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))