Skip to content

Commit

Permalink
feat: [google-cloud-bigquery-datatransfer]Add scheduleOptionsV2 and E…
Browse files Browse the repository at this point in the history
…rror fields for TransferConfig (#13116)

BEGIN_COMMIT_OVERRIDE
feat:Add scheduleOptionsV2 and Error fields for TransferConfig
END_COMMIT_OVERRIDE

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 680586383

Source-Link:
googleapis/googleapis@463b5a6

Source-Link:
googleapis/googleapis-gen@68d602f
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpZ3F1ZXJ5LWRhdGF0cmFuc2Zlci8uT3dsQm90LnlhbWwiLCJoIjoiNjhkNjAyZmNhODZjZmJmNzY1MzYxMmY1MGM1Y2Y5ZTMxMDUwNjVjOSJ9

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: ohmayr <omairnaveed@ymail.com>
  • Loading branch information
3 people authored Oct 4, 2024
1 parent 7f9bc3a commit 052585c
Show file tree
Hide file tree
Showing 8 changed files with 217 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@
from google.cloud.bigquery_datatransfer_v1.types.transfer import (
EmailPreferences,
EncryptionConfiguration,
EventDrivenSchedule,
ManualSchedule,
ScheduleOptions,
ScheduleOptionsV2,
TimeBasedSchedule,
TransferConfig,
TransferMessage,
TransferRun,
Expand Down Expand Up @@ -93,7 +97,11 @@
"UpdateTransferConfigRequest",
"EmailPreferences",
"EncryptionConfiguration",
"EventDrivenSchedule",
"ManualSchedule",
"ScheduleOptions",
"ScheduleOptionsV2",
"TimeBasedSchedule",
"TransferConfig",
"TransferMessage",
"TransferRun",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "3.15.7" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@
from .types.transfer import (
EmailPreferences,
EncryptionConfiguration,
EventDrivenSchedule,
ManualSchedule,
ScheduleOptions,
ScheduleOptionsV2,
TimeBasedSchedule,
TransferConfig,
TransferMessage,
TransferRun,
Expand All @@ -74,6 +78,7 @@
"EmailPreferences",
"EncryptionConfiguration",
"EnrollDataSourcesRequest",
"EventDrivenSchedule",
"GetDataSourceRequest",
"GetTransferConfigRequest",
"GetTransferRunRequest",
Expand All @@ -85,11 +90,14 @@
"ListTransferLogsResponse",
"ListTransferRunsRequest",
"ListTransferRunsResponse",
"ManualSchedule",
"ScheduleOptions",
"ScheduleOptionsV2",
"ScheduleTransferRunsRequest",
"ScheduleTransferRunsResponse",
"StartManualTransferRunsRequest",
"StartManualTransferRunsResponse",
"TimeBasedSchedule",
"TransferConfig",
"TransferMessage",
"TransferRun",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "3.15.7" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@
from .transfer import (
EmailPreferences,
EncryptionConfiguration,
EventDrivenSchedule,
ManualSchedule,
ScheduleOptions,
ScheduleOptionsV2,
TimeBasedSchedule,
TransferConfig,
TransferMessage,
TransferRun,
Expand Down Expand Up @@ -80,7 +84,11 @@
"UpdateTransferConfigRequest",
"EmailPreferences",
"EncryptionConfiguration",
"EventDrivenSchedule",
"ManualSchedule",
"ScheduleOptions",
"ScheduleOptionsV2",
"TimeBasedSchedule",
"TransferConfig",
"TransferMessage",
"TransferRun",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
"TransferState",
"EmailPreferences",
"ScheduleOptions",
"ScheduleOptionsV2",
"TimeBasedSchedule",
"ManualSchedule",
"EventDrivenSchedule",
"UserInfo",
"TransferConfig",
"EncryptionConfiguration",
Expand Down Expand Up @@ -144,6 +148,130 @@ class ScheduleOptions(proto.Message):
)


class ScheduleOptionsV2(proto.Message):
r"""V2 options customizing different types of data transfer
schedule. This field supports existing time-based and manual
transfer schedule. Also supports Event-Driven transfer schedule.
ScheduleOptionsV2 cannot be used together with
ScheduleOptions/Schedule.
This message has `oneof`_ fields (mutually exclusive fields).
For each oneof, at most one member field can be set at the same time.
Setting any member of the oneof automatically clears all other
members.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
time_based_schedule (google.cloud.bigquery_datatransfer_v1.types.TimeBasedSchedule):
Time based transfer schedule options. This is
the default schedule option.
This field is a member of `oneof`_ ``schedule``.
manual_schedule (google.cloud.bigquery_datatransfer_v1.types.ManualSchedule):
Manual transfer schedule. If set, the transfer run will not
be auto-scheduled by the system, unless the client invokes
StartManualTransferRuns. This is equivalent to
disable_auto_scheduling = true.
This field is a member of `oneof`_ ``schedule``.
event_driven_schedule (google.cloud.bigquery_datatransfer_v1.types.EventDrivenSchedule):
Event driven transfer schedule options. If
set, the transfer will be scheduled upon events
arrial.
This field is a member of `oneof`_ ``schedule``.
"""

time_based_schedule: "TimeBasedSchedule" = proto.Field(
proto.MESSAGE,
number=1,
oneof="schedule",
message="TimeBasedSchedule",
)
manual_schedule: "ManualSchedule" = proto.Field(
proto.MESSAGE,
number=2,
oneof="schedule",
message="ManualSchedule",
)
event_driven_schedule: "EventDrivenSchedule" = proto.Field(
proto.MESSAGE,
number=3,
oneof="schedule",
message="EventDrivenSchedule",
)


class TimeBasedSchedule(proto.Message):
r"""Options customizing the time based transfer schedule.
Options are migrated from the original ScheduleOptions message.
Attributes:
schedule (str):
Data transfer schedule. If the data source does not support
a custom schedule, this should be empty. If it is empty, the
default value for the data source will be used. The
specified times are in UTC. Examples of valid format:
``1st,3rd monday of month 15:30``,
``every wed,fri of jan,jun 13:15``, and
``first sunday of quarter 00:00``. See more explanation
about the format here:
https://cloud.google.com/appengine/docs/flexible/python/scheduling-jobs-with-cron-yaml#the_schedule_format
NOTE: The minimum interval time between recurring transfers
depends on the data source; refer to the documentation for
your data source.
start_time (google.protobuf.timestamp_pb2.Timestamp):
Specifies time to start scheduling transfer
runs. The first run will be scheduled at or
after the start time according to a recurrence
pattern defined in the schedule string. The
start time can be changed at any moment.
end_time (google.protobuf.timestamp_pb2.Timestamp):
Defines time to stop scheduling transfer
runs. A transfer run cannot be scheduled at or
after the end time. The end time can be changed
at any moment.
"""

schedule: str = proto.Field(
proto.STRING,
number=1,
)
start_time: timestamp_pb2.Timestamp = proto.Field(
proto.MESSAGE,
number=2,
message=timestamp_pb2.Timestamp,
)
end_time: timestamp_pb2.Timestamp = proto.Field(
proto.MESSAGE,
number=3,
message=timestamp_pb2.Timestamp,
)


class ManualSchedule(proto.Message):
r"""Options customizing manual transfers schedule."""


class EventDrivenSchedule(proto.Message):
r"""Options customizing EventDriven transfers schedule.
Attributes:
pubsub_subscription (str):
Pub/Sub subscription name used to receive
events. Only Google Cloud Storage data source
support this option. Format:
projects/{project}/subscriptions/{subscription}
"""

pubsub_subscription: str = proto.Field(
proto.STRING,
number=1,
)


class UserInfo(proto.Message):
r"""Information about a user.
Expand Down Expand Up @@ -222,6 +350,11 @@ class TransferConfig(proto.Message):
schedule_options (google.cloud.bigquery_datatransfer_v1.types.ScheduleOptions):
Options customizing the data transfer
schedule.
schedule_options_v2 (google.cloud.bigquery_datatransfer_v1.types.ScheduleOptionsV2):
Options customizing different types of data transfer
schedule. This field replaces "schedule" and
"schedule_options" fields. ScheduleOptionsV2 cannot be used
together with ScheduleOptions/Schedule.
data_refresh_window_days (int):
The number of days to look back to automatically refresh the
data. For example, if ``data_refresh_window_days = 10``,
Expand Down Expand Up @@ -274,6 +407,10 @@ class TransferConfig(proto.Message):
effect. Write methods will apply the key if it
is present, or otherwise try to apply project
default keys if it is absent.
error (google.rpc.status_pb2.Status):
Output only. Error code with detailed
information about reason of the latest config
failure.
"""

name: str = proto.Field(
Expand Down Expand Up @@ -307,6 +444,11 @@ class TransferConfig(proto.Message):
number=24,
message="ScheduleOptions",
)
schedule_options_v2: "ScheduleOptionsV2" = proto.Field(
proto.MESSAGE,
number=31,
message="ScheduleOptionsV2",
)
data_refresh_window_days: int = proto.Field(
proto.INT32,
number=12,
Expand Down Expand Up @@ -358,6 +500,11 @@ class TransferConfig(proto.Message):
number=28,
message="EncryptionConfiguration",
)
error: status_pb2.Status = proto.Field(
proto.MESSAGE,
number=32,
message=status_pb2.Status,
)


class EncryptionConfiguration(proto.Message):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-bigquery-datatransfer",
"version": "3.15.7"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from google.auth.exceptions import MutualTLSChannelError
from google.cloud.location import locations_pb2
from google.oauth2 import service_account
from google.protobuf import any_pb2 # type: ignore
from google.protobuf import duration_pb2 # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import json_format
Expand Down Expand Up @@ -8880,6 +8881,17 @@ def test_create_transfer_config_rest(request_type):
"start_time": {"seconds": 751, "nanos": 543},
"end_time": {},
},
"schedule_options_v2": {
"time_based_schedule": {
"schedule": "schedule_value",
"start_time": {},
"end_time": {},
},
"manual_schedule": {},
"event_driven_schedule": {
"pubsub_subscription": "pubsub_subscription_value"
},
},
"data_refresh_window_days": 2543,
"disabled": True,
"update_time": {},
Expand All @@ -8891,6 +8903,16 @@ def test_create_transfer_config_rest(request_type):
"email_preferences": {"enable_failure_email": True},
"owner_info": {"email": "email_value"},
"encryption_configuration": {"kms_key_name": {"value": "value_value"}},
"error": {
"code": 411,
"message": "message_value",
"details": [
{
"type_url": "type.googleapis.com/google.protobuf.Duration",
"value": b"\x08\x0c\x10\xdb\x07",
}
],
},
}
# The version of a generated dependency at test runtime may differ from the version used during generation.
# Delete any fields which are not present in the current runtime dependency
Expand Down Expand Up @@ -9327,6 +9349,17 @@ def test_update_transfer_config_rest(request_type):
"start_time": {"seconds": 751, "nanos": 543},
"end_time": {},
},
"schedule_options_v2": {
"time_based_schedule": {
"schedule": "schedule_value",
"start_time": {},
"end_time": {},
},
"manual_schedule": {},
"event_driven_schedule": {
"pubsub_subscription": "pubsub_subscription_value"
},
},
"data_refresh_window_days": 2543,
"disabled": True,
"update_time": {},
Expand All @@ -9338,6 +9371,16 @@ def test_update_transfer_config_rest(request_type):
"email_preferences": {"enable_failure_email": True},
"owner_info": {"email": "email_value"},
"encryption_configuration": {"kms_key_name": {"value": "value_value"}},
"error": {
"code": 411,
"message": "message_value",
"details": [
{
"type_url": "type.googleapis.com/google.protobuf.Duration",
"value": b"\x08\x0c\x10\xdb\x07",
}
],
},
}
# The version of a generated dependency at test runtime may differ from the version used during generation.
# Delete any fields which are not present in the current runtime dependency
Expand Down

0 comments on commit 052585c

Please sign in to comment.