Skip to content

Commit

Permalink
feat: [google-cloud-storage-transfer] support cross-bucket replication (
Browse files Browse the repository at this point in the history
#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 <vchudnov@google.com>
  • Loading branch information
3 people authored Dec 18, 2024
1 parent 019d41e commit 20d6e4c
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
NotificationConfig,
ObjectConditions,
PosixFilesystem,
ReplicationSpec,
S3CompatibleMetadata,
Schedule,
TransferCounters,
Expand Down Expand Up @@ -108,6 +109,7 @@
"NotificationConfig",
"ObjectConditions",
"PosixFilesystem",
"ReplicationSpec",
"S3CompatibleMetadata",
"Schedule",
"TransferCounters",
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__ = "1.14.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
NotificationConfig,
ObjectConditions,
PosixFilesystem,
ReplicationSpec,
S3CompatibleMetadata,
Schedule,
TransferCounters,
Expand Down Expand Up @@ -101,6 +102,7 @@
"ObjectConditions",
"PauseTransferOperationRequest",
"PosixFilesystem",
"ReplicationSpec",
"ResumeTransferOperationRequest",
"RunTransferJobRequest",
"S3CompatibleMetadata",
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__ = "1.14.0" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
NotificationConfig,
ObjectConditions,
PosixFilesystem,
ReplicationSpec,
S3CompatibleMetadata,
Schedule,
TransferCounters,
Expand Down Expand Up @@ -95,6 +96,7 @@
"NotificationConfig",
"ObjectConditions",
"PosixFilesystem",
"ReplicationSpec",
"S3CompatibleMetadata",
"Schedule",
"TransferCounters",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,36 @@ class ListTransferJobsRequest(proto.Message):
filter (str):
Required. A list of query parameters specified as JSON text
in the form of:
``{"projectId":"my_project_id", "jobNames":["jobid1","jobid2",...], "jobStatuses":["status1","status2",...]}``
Since ``jobNames`` and ``jobStatuses`` support multiple
values, their values must be specified with array notation.
``projectId`` is required. ``jobNames`` and ``jobStatuses``
are optional. The valid values for ``jobStatuses`` are
case-insensitive:
[ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED],
[DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED],
and
[DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED].
::
{
"projectId":"my_project_id",
"jobNames":["jobid1","jobid2",...],
"jobStatuses":["status1","status2",...],
"dataBackend":"QUERY_REPLICATION_CONFIGS",
"sourceBucket":"source-bucket-name",
"sinkBucket":"sink-bucket-name",
}
The JSON formatting in the example is for display only;
provide the query parameters without spaces or line breaks.
- ``projectId`` is required.
- Since ``jobNames`` and ``jobStatuses`` support multiple
values, their values must be specified with array
notation. ``jobNames`` and ``jobStatuses`` are optional.
Valid values are case-insensitive:
- [ENABLED][google.storagetransfer.v1.TransferJob.Status.ENABLED]
- [DISABLED][google.storagetransfer.v1.TransferJob.Status.DISABLED]
- [DELETED][google.storagetransfer.v1.TransferJob.Status.DELETED]
- Specify ``"dataBackend":"QUERY_REPLICATION_CONFIGS"`` to
return a list of cross-bucket replication jobs.
- Limit the results to jobs from a particular bucket with
``sourceBucket`` and/or to a particular bucket with
``sinkBucket``.
page_size (int):
The list page size. The max allowed value is
256.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"AgentPool",
"TransferOptions",
"TransferSpec",
"ReplicationSpec",
"MetadataOptions",
"TransferManifest",
"Schedule",
Expand Down Expand Up @@ -1113,6 +1114,62 @@ class TransferSpec(proto.Message):
)


class ReplicationSpec(proto.Message):
r"""Specifies the configuration for a cross-bucket replication
job. Cross-bucket replication copies new or updated objects from
a source Cloud Storage bucket to a destination Cloud Storage
bucket. Existing objects in the source bucket are not copied by
a new cross-bucket replication job.
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
Attributes:
gcs_data_source (google.cloud.storage_transfer_v1.types.GcsData):
The Cloud Storage bucket from which to
replicate objects.
This field is a member of `oneof`_ ``data_source``.
gcs_data_sink (google.cloud.storage_transfer_v1.types.GcsData):
The Cloud Storage bucket to which to
replicate objects.
This field is a member of `oneof`_ ``data_sink``.
object_conditions (google.cloud.storage_transfer_v1.types.ObjectConditions):
Object conditions that determine which objects are
transferred. For replication jobs, only ``include_prefixes``
and ``exclude_prefixes`` are supported.
transfer_options (google.cloud.storage_transfer_v1.types.TransferOptions):
Specifies the metadata options to be applied during
replication. Delete options are not supported. If a delete
option is specified, the request fails with an
[INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT] error.
"""

gcs_data_source: "GcsData" = proto.Field(
proto.MESSAGE,
number=1,
oneof="data_source",
message="GcsData",
)
gcs_data_sink: "GcsData" = proto.Field(
proto.MESSAGE,
number=2,
oneof="data_sink",
message="GcsData",
)
object_conditions: "ObjectConditions" = proto.Field(
proto.MESSAGE,
number=3,
message="ObjectConditions",
)
transfer_options: "TransferOptions" = proto.Field(
proto.MESSAGE,
number=4,
message="TransferOptions",
)


class MetadataOptions(proto.Message):
r"""Specifies the metadata options for running a transfer.
Expand Down Expand Up @@ -1604,6 +1661,8 @@ class TransferJob(proto.Message):
the job.
transfer_spec (google.cloud.storage_transfer_v1.types.TransferSpec):
Transfer specification.
replication_spec (google.cloud.storage_transfer_v1.types.ReplicationSpec):
Replication specification.
notification_config (google.cloud.storage_transfer_v1.types.NotificationConfig):
Notification configuration.
logging_config (google.cloud.storage_transfer_v1.types.LoggingConfig):
Expand Down Expand Up @@ -1686,6 +1745,11 @@ class Status(proto.Enum):
number=4,
message="TransferSpec",
)
replication_spec: "ReplicationSpec" = proto.Field(
proto.MESSAGE,
number=17,
message="ReplicationSpec",
)
notification_config: "NotificationConfig" = proto.Field(
proto.MESSAGE,
number=11,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-storage-transfer",
"version": "1.14.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8766,6 +8766,12 @@ def test_create_transfer_job_rest_call_success(request_type):
"source_agent_pool_name": "source_agent_pool_name_value",
"sink_agent_pool_name": "sink_agent_pool_name_value",
},
"replication_spec": {
"gcs_data_source": {},
"gcs_data_sink": {},
"object_conditions": {},
"transfer_options": {},
},
"notification_config": {
"pubsub_topic": "pubsub_topic_value",
"event_types": [1],
Expand Down

0 comments on commit 20d6e4c

Please sign in to comment.