0

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.

takaomag
  • 1,545
  • 1
  • 16
  • 26
  • Resolved. I found update_transfer_job (patch API) method, which can change status to DELETED. https://cloud.google.com/python/docs/reference/storagetransfer/latest/google.cloud.storage_transfer_v1.services.storage_transfer_service.StorageTransferServiceClient#google_cloud_storage_transfer_v1_services_storage_transfer_service_StorageTransferServiceClient_update_transfer_job – takaomag Aug 01 '22 at 12:40
  • You can post your answer so the question will be marked as sovled – Ricco D Aug 01 '22 at 21:16

1 Answers1

1

Resolved.

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

takaomag
  • 1,545
  • 1
  • 16
  • 26