Thanks to visit codestin.com
Credit goes to github.com

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

feat: add EncryptionConfiguration to TransferConfig #486

Merged
merged 2 commits into from
Jul 31, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions google/cloud/bigquery_datatransfer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
)
from google.cloud.bigquery_datatransfer_v1.types.transfer import (
EmailPreferences,
EncryptionConfiguration,
ScheduleOptions,
TransferConfig,
TransferMessage,
Expand Down Expand Up @@ -89,6 +90,7 @@
"StartManualTransferRunsResponse",
"UpdateTransferConfigRequest",
"EmailPreferences",
"EncryptionConfiguration",
"ScheduleOptions",
"TransferConfig",
"TransferMessage",
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/bigquery_datatransfer_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
)
from .types.transfer import (
EmailPreferences,
EncryptionConfiguration,
ScheduleOptions,
TransferConfig,
TransferMessage,
Expand All @@ -70,6 +71,7 @@
"DeleteTransferConfigRequest",
"DeleteTransferRunRequest",
"EmailPreferences",
"EncryptionConfiguration",
"EnrollDataSourcesRequest",
"GetDataSourceRequest",
"GetTransferConfigRequest",
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/bigquery_datatransfer_v1/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
)
from .transfer import (
EmailPreferences,
EncryptionConfiguration,
ScheduleOptions,
TransferConfig,
TransferMessage,
Expand Down Expand Up @@ -76,6 +77,7 @@
"StartManualTransferRunsResponse",
"UpdateTransferConfigRequest",
"EmailPreferences",
"EncryptionConfiguration",
"ScheduleOptions",
"TransferConfig",
"TransferMessage",
Expand Down
15 changes: 11 additions & 4 deletions google/cloud/bigquery_datatransfer_v1/types/datatransfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ class Type(proto.Enum):
Deprecated. This field has no effect.
PLUS_PAGE (6):
Page ID for a Google+ Page.
LIST (7):
List of strings parameter.
"""
TYPE_UNSPECIFIED = 0
STRING = 1
Expand All @@ -130,6 +132,7 @@ class Type(proto.Enum):
BOOLEAN = 4
RECORD = 5
PLUS_PAGE = 6
LIST = 7

param_id: str = proto.Field(
proto.STRING,
Expand Down Expand Up @@ -1064,13 +1067,17 @@ class StartManualTransferRunsRequest(proto.Message):
``projects/{project_id}/transferConfigs/{config_id}`` or
``projects/{project_id}/locations/{location_id}/transferConfigs/{config_id}``.
requested_time_range (google.cloud.bigquery_datatransfer_v1.types.StartManualTransferRunsRequest.TimeRange):
Time range for the transfer runs that should
be started.
A time_range start and end timestamp for historical data
files or reports that are scheduled to be transferred by the
scheduled transfer run. requested_time_range must be a past
time and cannot include future time values.

This field is a member of `oneof`_ ``time``.
requested_run_time (google.protobuf.timestamp_pb2.Timestamp):
Specific run_time for a transfer run to be started. The
requested_run_time must not be in the future.
A run_time timestamp for historical data files or reports
that are scheduled to be transferred by the scheduled
transfer run. requested_run_time must be a past time and
cannot include future time values.

This field is a member of `oneof`_ ``time``.
"""
Expand Down
32 changes: 32 additions & 0 deletions google/cloud/bigquery_datatransfer_v1/types/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from google.protobuf import struct_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.protobuf import wrappers_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore
import proto # type: ignore

Expand All @@ -31,6 +32,7 @@
"ScheduleOptions",
"UserInfo",
"TransferConfig",
"EncryptionConfiguration",
"TransferRun",
"TransferMessage",
},
Expand Down Expand Up @@ -262,6 +264,15 @@ class TransferConfig(proto.Message):
populated.

This field is a member of `oneof`_ ``_owner_info``.
encryption_configuration (google.cloud.bigquery_datatransfer_v1.types.EncryptionConfiguration):
The encryption configuration part. Currently,
it is only used for the optional KMS key name.
The BigQuery service account of your project
must be granted permissions to use the key. Read
methods will return the key name applied in
effect. Write methods will apply the key if it
is present, or otherwise try to apply project
default keys if it is absent.
"""

name: str = proto.Field(
Expand Down Expand Up @@ -341,6 +352,27 @@ class TransferConfig(proto.Message):
optional=True,
message="UserInfo",
)
encryption_configuration: "EncryptionConfiguration" = proto.Field(
proto.MESSAGE,
number=28,
message="EncryptionConfiguration",
)


class EncryptionConfiguration(proto.Message):
r"""Represents the encryption configuration for a transfer.

Attributes:
kms_key_name (google.protobuf.wrappers_pb2.StringValue):
The name of the KMS key used for encrypting
BigQuery data.
"""

kms_key_name: wrappers_pb2.StringValue = proto.Field(
proto.MESSAGE,
number=1,
message=wrappers_pb2.StringValue,
)


class TransferRun(proto.Message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from google.protobuf import json_format
from google.protobuf import struct_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.protobuf import wrappers_pb2 # type: ignore
from google.rpc import status_pb2 # type: ignore
import grpc
from grpc.experimental import aio
Expand Down Expand Up @@ -5923,6 +5924,7 @@ def test_create_transfer_config_rest(request_type):
"notification_pubsub_topic": "notification_pubsub_topic_value",
"email_preferences": {"enable_failure_email": True},
"owner_info": {"email": "email_value"},
"encryption_configuration": {"kms_key_name": {"value": "value_value"}},
}
request = request_type(**request_init)

Expand Down Expand Up @@ -6165,6 +6167,7 @@ def test_create_transfer_config_rest_bad_request(
"notification_pubsub_topic": "notification_pubsub_topic_value",
"email_preferences": {"enable_failure_email": True},
"owner_info": {"email": "email_value"},
"encryption_configuration": {"kms_key_name": {"value": "value_value"}},
}
request = request_type(**request_init)

Expand Down Expand Up @@ -6285,6 +6288,7 @@ def test_update_transfer_config_rest(request_type):
"notification_pubsub_topic": "notification_pubsub_topic_value",
"email_preferences": {"enable_failure_email": True},
"owner_info": {"email": "email_value"},
"encryption_configuration": {"kms_key_name": {"value": "value_value"}},
}
request = request_type(**request_init)

Expand Down Expand Up @@ -6528,6 +6532,7 @@ def test_update_transfer_config_rest_bad_request(
"notification_pubsub_topic": "notification_pubsub_topic_value",
"email_preferences": {"enable_failure_email": True},
"owner_info": {"email": "email_value"},
"encryption_configuration": {"kms_key_name": {"value": "value_value"}},
}
request = request_type(**request_init)

Expand Down