Connecteur pour le service de transfert de stockage

Connecteur de workflows qui définit la fonction intégrée utilisée pour accéder au service de transfert de stockage dans un workflow.

Pages de documentation incluant cet exemple de code

Pour afficher l'exemple de code utilisé en contexte, consultez la documentation suivante :

Exemple de code

YAML

# This workflow demonstrates how to use the Cloud Storage Transfer connector.
# The workflow creates a storage transfer job that transfers data between two buckets,
# runs the job, and deletes the job.
# Expected successful output: "SUCCESS"

- init:
    assign:
    - project_id: ${sys.get_env("GOOGLE_CLOUD_PROJECT_ID")}
    - transferjob_name: "transferJobs/dummy-transfer-job"
    - src_bucket_name: "[fill in with the source bucket name]"
    - sink_bucket_name: "[fill in with the destination bucket name]"
- create_transferjob:
    call: googleapis.storagetransfer.v1.transferJobs.create
    args:
      body:
        name: ${transferjob_name}
        description: "A job that transfers data between src and sink buckets."
        projectId: ${project_id}
        transferSpec:
          gcsDataSink:
            bucketName: ${sink_bucket_name}
            path: ""
          gcsDataSource:
            bucketName: ${src_bucket_name}
            path: ""
        status: "DISABLED"
- enable_transferjob:
    call: googleapis.storagetransfer.v1.transferJobs.patch
    args:
      jobName: ${transferjob_name}
      body:
        projectId: ${project_id}
        transferJob:
          status: "ENABLED"
- run_job:
    call: googleapis.storagetransfer.v1.transferJobs.run
    args:
      jobName: ${transferjob_name}
      body:
        projectId: ${project_id}
    result: r
- delete_transferjob:
    # After a transfer job is set to this state, the job and all
    # the transfer executions are subject to garbage collection.
    # Transfer jobs become eligible for garbage collection 30 days
    # after their status is set to DELETED.
    call: googleapis.storagetransfer.v1.transferJobs.patch
    args:
      jobName: ${transferjob_name}
      body:
        projectId: ${project_id}
        transferJob:
          status: "DELETED"
- the_end:
    return: "SUCCESS"# then deletes the job.

Étape suivante

Pour rechercher et filtrer des exemples de code pour d'autres produits Google Cloud, consultez l'exemple de navigateur Google Cloud.