简体   繁体   中英

How to delete a GCP storage transfer job in python

I want to create a small python program (Cloud Functions) to create, run and delete a few GCP storage transfer services.

I can create a GCP storage transfer job as follows,

from google.cloud import storage_transfer

transfer_job_request = storage_transfer.CreateTransferJobRequest({
    'transfer_job': {
        'project_id': project_id,
        'status': storage_transfer.TransferJob.Status.ENABLED,
        'transfer_spec': {
            'gcs_data_source': {
                'bucket_name': 'source-bucket-name',
            },
            'gcs_data_sink': {
                'bucket_name': 'sink-bucket-name',
            }
        }
    }
})

However, I can not find any apis to delete a GCP storage tansfer job in either Google api or python library documents.

How to delete a GCP storage tansfer job programmably?

Thanks.

Resolved.

I found update_transfer_job (patch API) method, which can change a job status to DELETED .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM