Conector para el Servicio de transferencia de almacenamiento

El conector de flujos de trabajo que define la función integrada que se usa para acceder al Servicio de transferencia de almacenamiento dentro de un flujo de trabajo.

Páginas de documentación que incluyen esta muestra de código

Para ver la muestra de código usada en contexto, consulta la siguiente documentación:

Muestra de código

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.

¿Qué sigue?

Para buscar y filtrar muestras de código para otros productos de Google Cloud, consulta el navegador de muestra de Google Cloud.