Skip to content

Commit 20d6e4c

Browse files
feat: [google-cloud-storage-transfer] support cross-bucket replication (#13372)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 707205525 Source-Link: googleapis/googleapis@67495ab Source-Link: googleapis/googleapis-gen@9c2deac Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXN0b3JhZ2UtdHJhbnNmZXIvLk93bEJvdC55YW1sIiwiaCI6IjljMmRlYWM5NDBjZWQyOGQ2OGM4Mjk2ZDRhZWIxMzEzOWQ4YWM5MTQifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Victor Chudnovsky <[email protected]>
1 parent 019d41e commit 20d6e4c

File tree

9 files changed

+109
-14
lines changed

9 files changed

+109
-14
lines changed

packages/google-cloud-storage-transfer/google/cloud/storage_transfer/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
NotificationConfig,
6262
ObjectConditions,
6363
PosixFilesystem,
64+
ReplicationSpec,
6465
S3CompatibleMetadata,
6566
Schedule,
6667
TransferCounters,
@@ -108,6 +109,7 @@
108109
"NotificationConfig",
109110
"ObjectConditions",
110111
"PosixFilesystem",
112+
"ReplicationSpec",
111113
"S3CompatibleMetadata",
112114
"Schedule",
113115
"TransferCounters",

packages/google-cloud-storage-transfer/google/cloud/storage_transfer/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.14.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-storage-transfer/google/cloud/storage_transfer_v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
NotificationConfig,
6060
ObjectConditions,
6161
PosixFilesystem,
62+
ReplicationSpec,
6263
S3CompatibleMetadata,
6364
Schedule,
6465
TransferCounters,
@@ -101,6 +102,7 @@
101102
"ObjectConditions",
102103
"PauseTransferOperationRequest",
103104
"PosixFilesystem",
105+
"ReplicationSpec",
104106
"ResumeTransferOperationRequest",
105107
"RunTransferJobRequest",
106108
"S3CompatibleMetadata",

packages/google-cloud-storage-transfer/google/cloud/storage_transfer_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.14.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-storage-transfer/google/cloud/storage_transfer_v1/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
NotificationConfig,
5151
ObjectConditions,
5252
PosixFilesystem,
53+
ReplicationSpec,
5354
S3CompatibleMetadata,
5455
Schedule,
5556
TransferCounters,
@@ -95,6 +96,7 @@
9596
"NotificationConfig",
9697
"ObjectConditions",
9798
"PosixFilesystem",
99+
"ReplicationSpec",
98100
"S3CompatibleMetadata",
99101
"Schedule",
100102
"TransferCounters",

packages/google-cloud-storage-transfer/google/cloud/storage_transfer_v1/types/transfer.py

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,36 @@ class ListTransferJobsRequest(proto.Message):
185185
filter (str):
186186
Required. A list of query parameters specified as JSON text
187187
in the form of:
188-
``{"projectId":"my_project_id", "jobNames":["jobid1","jobid2",...], "jobStatuses":["status1","status2",...]}``
189-
190-
Since ``jobNames`` and ``jobStatuses`` support multiple
191-
values, their values must be specified with array notation.
192-
``projectId`` is required. ``jobNames`` and ``jobStatuses``
193-
are optional. The valid values for ``jobStatuses`` are
194-
case-insensitive:
195-
[ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED],
196-
[DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED],
197-
and
198-
[DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED].
188+
189+
::
190+
191+
{
192+
"projectId":"my_project_id",
193+
"jobNames":["jobid1","jobid2",...],
194+
"jobStatuses":["status1","status2",...],
195+
"dataBackend":"QUERY_REPLICATION_CONFIGS",
196+
"sourceBucket":"source-bucket-name",
197+
"sinkBucket":"sink-bucket-name",
198+
}
199+
200+
The JSON formatting in the example is for display only;
201+
provide the query parameters without spaces or line breaks.
202+
203+
- ``projectId`` is required.
204+
- Since ``jobNames`` and ``jobStatuses`` support multiple
205+
values, their values must be specified with array
206+
notation. ``jobNames`` and ``jobStatuses`` are optional.
207+
Valid values are case-insensitive:
208+
209+
- [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED]
210+
- [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED]
211+
- [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED]
212+
213+
- Specify ``"dataBackend":"QUERY_REPLICATION_CONFIGS"`` to
214+
return a list of cross-bucket replication jobs.
215+
- Limit the results to jobs from a particular bucket with
216+
``sourceBucket`` and/or to a particular bucket with
217+
``sinkBucket``.
199218
page_size (int):
200219
The list page size. The max allowed value is
201220
256.

packages/google-cloud-storage-transfer/google/cloud/storage_transfer_v1/types/transfer_types.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"AgentPool",
4343
"TransferOptions",
4444
"TransferSpec",
45+
"ReplicationSpec",
4546
"MetadataOptions",
4647
"TransferManifest",
4748
"Schedule",
@@ -1113,6 +1114,62 @@ class TransferSpec(proto.Message):
11131114
)
11141115

11151116

1117+
class ReplicationSpec(proto.Message):
1118+
r"""Specifies the configuration for a cross-bucket replication
1119+
job. Cross-bucket replication copies new or updated objects from
1120+
a source Cloud Storage bucket to a destination Cloud Storage
1121+
bucket. Existing objects in the source bucket are not copied by
1122+
a new cross-bucket replication job.
1123+
1124+
1125+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1126+
1127+
Attributes:
1128+
gcs_data_source (google.cloud.storage_transfer_v1.types.GcsData):
1129+
The Cloud Storage bucket from which to
1130+
replicate objects.
1131+
1132+
This field is a member of `oneof`_ ``data_source``.
1133+
gcs_data_sink (google.cloud.storage_transfer_v1.types.GcsData):
1134+
The Cloud Storage bucket to which to
1135+
replicate objects.
1136+
1137+
This field is a member of `oneof`_ ``data_sink``.
1138+
object_conditions (google.cloud.storage_transfer_v1.types.ObjectConditions):
1139+
Object conditions that determine which objects are
1140+
transferred. For replication jobs, only ``include_prefixes``
1141+
and ``exclude_prefixes`` are supported.
1142+
transfer_options (google.cloud.storage_transfer_v1.types.TransferOptions):
1143+
Specifies the metadata options to be applied during
1144+
replication. Delete options are not supported. If a delete
1145+
option is specified, the request fails with an
1146+
[INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error.
1147+
"""
1148+
1149+
gcs_data_source: "GcsData" = proto.Field(
1150+
proto.MESSAGE,
1151+
number=1,
1152+
oneof="data_source",
1153+
message="GcsData",
1154+
)
1155+
gcs_data_sink: "GcsData" = proto.Field(
1156+
proto.MESSAGE,
1157+
number=2,
1158+
oneof="data_sink",
1159+
message="GcsData",
1160+
)
1161+
object_conditions: "ObjectConditions" = proto.Field(
1162+
proto.MESSAGE,
1163+
number=3,
1164+
message="ObjectConditions",
1165+
)
1166+
transfer_options: "TransferOptions" = proto.Field(
1167+
proto.MESSAGE,
1168+
number=4,
1169+
message="TransferOptions",
1170+
)
1171+
1172+
11161173
class MetadataOptions(proto.Message):
11171174
r"""Specifies the metadata options for running a transfer.
11181175
@@ -1604,6 +1661,8 @@ class TransferJob(proto.Message):
16041661
the job.
16051662
transfer_spec (google.cloud.storage_transfer_v1.types.TransferSpec):
16061663
Transfer specification.
1664+
replication_spec (google.cloud.storage_transfer_v1.types.ReplicationSpec):
1665+
Replication specification.
16071666
notification_config (google.cloud.storage_transfer_v1.types.NotificationConfig):
16081667
Notification configuration.
16091668
logging_config (google.cloud.storage_transfer_v1.types.LoggingConfig):
@@ -1686,6 +1745,11 @@ class Status(proto.Enum):
16861745
number=4,
16871746
message="TransferSpec",
16881747
)
1748+
replication_spec: "ReplicationSpec" = proto.Field(
1749+
proto.MESSAGE,
1750+
number=17,
1751+
message="ReplicationSpec",
1752+
)
16891753
notification_config: "NotificationConfig" = proto.Field(
16901754
proto.MESSAGE,
16911755
number=11,

packages/google-cloud-storage-transfer/samples/generated_samples/snippet_metadata_google.storagetransfer.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-storage-transfer",
11-
"version": "1.14.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-storage-transfer/tests/unit/gapic/storage_transfer_v1/test_storage_transfer_service.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8766,6 +8766,12 @@ def test_create_transfer_job_rest_call_success(request_type):
87668766
"source_agent_pool_name": "source_agent_pool_name_value",
87678767
"sink_agent_pool_name": "sink_agent_pool_name_value",
87688768
},
8769+
"replication_spec": {
8770+
"gcs_data_source": {},
8771+
"gcs_data_sink": {},
8772+
"object_conditions": {},
8773+
"transfer_options": {},
8774+
},
87698775
"notification_config": {
87708776
"pubsub_topic": "pubsub_topic_value",
87718777
"event_types": [1],

0 commit comments

Comments
 (0)