1.0.20220808 • Published 2 years ago

@maxim_mazurok/gapi.client.storagetransfer v1.0.20220808

Weekly downloads
86
License
MIT
Repository
github
Last release
2 years ago

TypeScript typings for Storage Transfer API v1

Transfers data from external data sources to a Google Cloud Storage bucket or between Google Cloud Storage buckets. For detailed description please check documentation.

Installing

Install typings for Storage Transfer API:

npm install @types/gapi.client.storagetransfer@v1 --save-dev

Usage

You need to initialize Google API client in your code:

gapi.load('client', () => {
  // now we can use gapi.client
  // ...
});

Then load api client wrapper:

gapi.client.load('storagetransfer', 'v1', () => {
  // now we can use gapi.client.storagetransfer
  // ...
});

Don't forget to authenticate your client before sending any request to resources:

// declare client_id registered in Google Developers Console
var client_id = '',
  scope = [ 
      // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
      'https://www.googleapis.com/auth/cloud-platform',
    ],
    immediate = true;
// ...

gapi.auth.authorize(
  { client_id: client_id, scope: scope, immediate: immediate },
  authResult => {
    if (authResult && !authResult.error) {
        /* handle successful authorization */
    } else {
        /* handle authorization error */
    }
});

After that you can use Storage Transfer API resources:

/*
Returns the Google service account that is used by Storage Transfer Service to access buckets in the project where transfers run or in other projects. Each Google service account is associated with one Google Cloud project. Users should add this service account to the Google Cloud Storage bucket ACLs to grant access to Storage Transfer Service. This service account is created and owned by Storage Transfer Service and can only be used by Storage Transfer Service.
*/
await gapi.client.storagetransfer.googleServiceAccounts.get({ projectId: "projectId",  });

/*
Creates a transfer job that runs periodically.
*/
await gapi.client.storagetransfer.transferJobs.create({  });

/*
Gets a transfer job.
*/
await gapi.client.storagetransfer.transferJobs.get({ jobName: "jobName", projectId: "projectId",  });

/*
Lists transfer jobs.
*/
await gapi.client.storagetransfer.transferJobs.list({ filter: "filter",  });

/*
Updates a transfer job. Updating a job's transfer spec does not affect transfer operations that are running already. **Note:** The job's status field can be modified using this RPC (for example, to set a job's status to DELETED, DISABLED, or ENABLED).
*/
await gapi.client.storagetransfer.transferJobs.patch({ jobName: "jobName",  });

/*
Attempts to start a new TransferOperation for the current TransferJob. A TransferJob has a maximum of one active TransferOperation. If this method is called while a TransferOperation is active, an error will be returned.
*/
await gapi.client.storagetransfer.transferJobs.run({ jobName: "jobName",  });

/*
Cancels a transfer. Use the transferOperations.get method to check if the cancellation succeeded or if the operation completed despite the `cancel` request. When you cancel an operation, the currently running transfer is interrupted. For recurring transfer jobs, the next instance of the transfer job will still run. For example, if your job is configured to run every day at 1pm and you cancel Monday's operation at 1:05pm, Monday's transfer will stop. However, a transfer job will still be attempted on Tuesday. This applies only to currently running operations. If an operation is not currently running, `cancel` does nothing. *Caution:* Canceling a transfer job can leave your data in an unknown state. We recommend that you restore the state at both the destination and the source after the `cancel` request completes so that your data is in a consistent state. When you cancel a job, the next job computes a delta of files and may repair any inconsistent state. For instance, if you run a job every day, and today's job found 10 new files and transferred five files before you canceled the job, tomorrow's transfer operation will compute a new delta with the five files that were not copied today plus any new files discovered tomorrow.
*/
await gapi.client.storagetransfer.transferOperations.cancel({ name: "name",  });

/*
Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
*/
await gapi.client.storagetransfer.transferOperations.get({ name: "name",  });

/*
Lists transfer operations. Operations are ordered by their creation time in reverse chronological order.
*/
await gapi.client.storagetransfer.transferOperations.list({ filter: "filter", name: "name",  });

/*
Pauses a transfer operation.
*/
await gapi.client.storagetransfer.transferOperations.pause({ name: "name",  });

/*
Resumes a transfer operation that is paused.
*/
await gapi.client.storagetransfer.transferOperations.resume({ name: "name",  });
1.0.20220616

2 years ago

1.0.20220620

2 years ago

1.0.20220706

2 years ago

1.0.20220623

2 years ago

1.0.20220714

2 years ago

1.0.20220720

2 years ago

1.0.20220727

2 years ago

1.0.20220609

2 years ago

1.0.20220808

2 years ago

1.0.20220505

2 years ago

1.0.20220428

2 years ago

1.0.20220511

2 years ago

1.0.20220518

2 years ago

1.0.20220603

2 years ago

1.0.20220525

2 years ago

1.0.20220415

2 years ago

1.0.20220421

2 years ago

1.0.20220317

2 years ago

1.0.20220324

2 years ago

1.0.20220407

2 years ago

1.0.20220331

2 years ago

1.0.20220303

2 years ago

1.0.20220223

2 years ago

1.0.20220310

2 years ago

1.0.20220216

2 years ago

1.0.20220105

2 years ago

1.0.20220113

2 years ago

1.0.20220119

2 years ago

1.0.20220203

2 years ago

1.0.20220127

2 years ago

1.0.20220215

2 years ago

1.0.20211111

2 years ago

1.0.20211108

3 years ago

1.0.20211202

2 years ago

1.0.20211130

2 years ago

1.0.20211217

2 years ago

1.0.20211210

2 years ago

1.0.20211211

2 years ago

1.0.20211105

3 years ago

1.0.20211028

3 years ago

1.0.20211021

3 years ago

1.0.20211018

3 years ago

1.0.20211002

3 years ago

1.0.20210924

3 years ago

1.0.20210918

3 years ago

1.0.20210910

3 years ago

1.0.20210903

3 years ago

1.0.20210831

3 years ago

1.0.20210819

3 years ago

1.0.20210812

3 years ago

1.0.20210805

3 years ago

1.0.20210729

3 years ago

1.0.20210726

3 years ago

1.0.20210715

3 years ago

1.0.20210712

3 years ago

1.0.20210708

3 years ago

1.0.20210701

3 years ago

1.0.20210624

3 years ago

1.0.20210617

3 years ago

1.0.20210610

3 years ago

1.0.20210602

3 years ago

1.0.20210527

3 years ago

1.0.20210520

3 years ago

1.0.20210506

3 years ago

1.0.20210429

3 years ago

1.0.20210427

3 years ago

1.0.20210415

3 years ago

1.0.20210408

3 years ago

1.0.20210403

3 years ago

1.0.20210325

3 years ago

1.0.20210316

3 years ago

1.0.20210311

3 years ago

1.0.20210304

3 years ago

1.0.20210227

3 years ago

1.0.20210218

3 years ago

1.0.20210211

3 years ago

1.0.20210204

3 years ago

1.0.20210128

3 years ago

1.0.20210121

3 years ago

1.0.20210115

3 years ago

1.0.20210113

3 years ago

1.0.20201231

3 years ago

1.0.20201210

3 years ago

1.0.20201126

3 years ago

1.0.20201112

3 years ago

1.0.20201105

3 years ago