1
votes

I am using node.js utility of google cloud transfer api to transfer data from s3 bucket to my Google Cloud bucket using

#1
storagetransfer.transferJobs.create(request, function (err, response)

And once it is completed i want to proceed with with some functionality. To check the status of transfer Job there is an api

#2
storagetransfer.transferOperations.get(request, function(err, response)

which takes

var request = {
    // The name of the operation resource.
    name: 'transferOperations/my-transfer-operation',

    auth: authClient,
  };

as parameter. I cant seem to find what is the value that need to be input'ed in place of "my-transfer-operation"

The response received from "storagetransfer.transferJobs.create" has a data object with {name: 'transferJobs/2469904309496821948'}, but this value is not working for "my-transfer-operation" value.

I need to get value of "my-transfer-operation" which can be used a parameter for getting status of my transfer job using #2 api.

source : https://cloud.google.com/storage-transfer/docs/reference/rest/v1/transferOperations/get

1
Have you checked transferJobs.get? It might be the method you need, instead of transferOperations.get cloud.google.com/storage-transfer/docs/reference/rest/v1/…alextru
Yes i have checked the transferJobs.get ,this Api return the static status i.e enabled/Deleted. while i wanted to know whats the ongoing transfer status,and once it is completed, then the "COMPLETE" status.So that once it is completed i can go ahead create csv out of imported data.prakhar nigam

1 Answers

1
votes

You can use transferOperations.list, which you can test here, putting in the request name : 'transferOperations' and filter : "{"project_id" : "<your-project-id>"}".

The response will contain an array of operations with a structure starting like

{ 
  "operations": [
    {
      "name": "transferOperations/transferJobs-<id-from-transferJobName>-<another-id>",
      "metadata": {
         ...
         "status": "<some-status>", //e.g. IN_PROGRESS
         ...
         },
    ...

and that long name, containing the id you were trying to use, is what you need to input to transferOperations.get. You can also obtain the status directly from that response, as you see.