Storage Transfer Service and its protos. Transfers data between between Google Cloud Storage buckets or from a data source external to Google to a Cloud Storage bucket. v1
Package
@google-cloud/storage-transfer
Constructors
(constructor)(opts)
constructor(opts?: ClientOptions);
Construct an instance of StorageTransferServiceClient.
Parameter
Name | Description |
opts |
ClientOptions
|
Properties
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
auth
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
operationsClient
operationsClient: gax.OperationsClient;
port
static get port(): number;
The port for this API service.
scopes
static get scopes(): string[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;
The DNS address for this API service.
storageTransferServiceStub
storageTransferServiceStub?: Promise<{
[name: string]: Function;
}>;
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods
checkRunTransferJobProgress(name)
checkRunTransferJobProgress(name: string): Promise<LROperation<protos.google.protobuf.Empty, protos.google.storagetransfer.v1.TransferOperation>>;
Check the status of the long running operation returned by runTransferJob()
.
Parameter
Name | Description |
name |
string
The operation name that will be passed.
|
Returns
Type | Description |
Promise<LROperation<protos.google.protobuf.Empty, protos.google.storagetransfer.v1.TransferOperation>> | {Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.
|
Example
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the transfer job.
*/
// const jobName = 'abc123'
/**
* Required. The ID of the Google Cloud Platform Console project that owns the
* transfer job.
*/
// const projectId = 'abc123'
// Imports the Storagetransfer library
const {StorageTransferServiceClient} =
require('@google-cloud/storage-transfer').v1;
// Instantiates a client
const storagetransferClient = new StorageTransferServiceClient();
async function callRunTransferJob() {
// Construct request
const request = {
jobName,
projectId,
};
// Run request
const [operation] = await storagetransferClient.runTransferJob(request);
const [response] = await operation.promise();
console.log(response);
}
callRunTransferJob();
close()
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns
Type | Description |
Promise<void> | {Promise} A promise that resolves when the client is closed.
|
createTransferJob(request, options)
createTransferJob(request?: protos.google.storagetransfer.v1.ICreateTransferJobRequest, options?: CallOptions): Promise<[
protos.google.storagetransfer.v1.ITransferJob,
protos.google.storagetransfer.v1.ICreateTransferJobRequest | undefined,
{} | undefined
]>;
Creates a transfer job that runs periodically.
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.ICreateTransferJobRequest
The request object that will be sent.
|
options |
CallOptions
Call options. See CallOptions for more details.
|
Returns
Type | Description |
Promise<[
protos.google.storagetransfer.v1.ITransferJob,
protos.google.storagetransfer.v1.ICreateTransferJobRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [TransferJob]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.
|
Example
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The job to create.
*/
// const transferJob = {}
// Imports the Storagetransfer library
const {StorageTransferServiceClient} =
require('@google-cloud/storage-transfer').v1;
// Instantiates a client
const storagetransferClient = new StorageTransferServiceClient();
async function callCreateTransferJob() {
// Construct request
const request = {
transferJob,
};
// Run request
const response = await storagetransferClient.createTransferJob(request);
console.log(response);
}
callCreateTransferJob();
createTransferJob(request, options, callback)
createTransferJob(request: protos.google.storagetransfer.v1.ICreateTransferJobRequest, options: CallOptions, callback: Callback<protos.google.storagetransfer.v1.ITransferJob, protos.google.storagetransfer.v1.ICreateTransferJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.ICreateTransferJobRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.storagetransfer.v1.ITransferJob, protos.google.storagetransfer.v1.ICreateTransferJobRequest | null | undefined, {} | null | undefined>
|
Returns
createTransferJob(request, callback)
createTransferJob(request: protos.google.storagetransfer.v1.ICreateTransferJobRequest, callback: Callback<protos.google.storagetransfer.v1.ITransferJob, protos.google.storagetransfer.v1.ICreateTransferJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.ICreateTransferJobRequest
|
callback |
Callback<protos.google.storagetransfer.v1.ITransferJob, protos.google.storagetransfer.v1.ICreateTransferJobRequest | null | undefined, {} | null | undefined>
|
Returns
getGoogleServiceAccount(request, options)
getGoogleServiceAccount(request?: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, options?: CallOptions): Promise<[
protos.google.storagetransfer.v1.IGoogleServiceAccount,
(protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest | undefined),
{} | undefined
]>;
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 Platform Console 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.
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest
The request object that will be sent.
|
options |
CallOptions
Call options. See CallOptions for more details.
|
Returns
Type | Description |
Promise<[
protos.google.storagetransfer.v1.IGoogleServiceAccount,
(protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest | undefined),
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [GoogleServiceAccount]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.
|
Example
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The ID of the Google Cloud Platform Console project that the
* Google service account is associated with.
*/
// const projectId = 'abc123'
// Imports the Storagetransfer library
const {StorageTransferServiceClient} =
require('@google-cloud/storage-transfer').v1;
// Instantiates a client
const storagetransferClient = new StorageTransferServiceClient();
async function callGetGoogleServiceAccount() {
// Construct request
const request = {
projectId,
};
// Run request
const response = await storagetransferClient.getGoogleServiceAccount(
request
);
console.log(response);
}
callGetGoogleServiceAccount();
getGoogleServiceAccount(request, options, callback)
getGoogleServiceAccount(request: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, options: CallOptions, callback: Callback<protos.google.storagetransfer.v1.IGoogleServiceAccount, protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.storagetransfer.v1.IGoogleServiceAccount, protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest | null | undefined, {} | null | undefined>
|
Returns
getGoogleServiceAccount(request, callback)
getGoogleServiceAccount(request: protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest, callback: Callback<protos.google.storagetransfer.v1.IGoogleServiceAccount, protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest
|
callback |
Callback<protos.google.storagetransfer.v1.IGoogleServiceAccount, protos.google.storagetransfer.v1.IGetGoogleServiceAccountRequest | null | undefined, {} | null | undefined>
|
Returns
getProjectId()
getProjectId(): Promise<string>;
Returns
Type | Description |
Promise<string> | |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name | Description |
callback |
Callback<string, undefined, undefined>
|
Returns
getTransferJob(request, options)
getTransferJob(request?: protos.google.storagetransfer.v1.IGetTransferJobRequest, options?: CallOptions): Promise<[
protos.google.storagetransfer.v1.ITransferJob,
protos.google.storagetransfer.v1.IGetTransferJobRequest | undefined,
{} | undefined
]>;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IGetTransferJobRequest
The request object that will be sent.
|
options |
CallOptions
Call options. See CallOptions for more details.
|
Returns
Type | Description |
Promise<[
protos.google.storagetransfer.v1.ITransferJob,
protos.google.storagetransfer.v1.IGetTransferJobRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [TransferJob]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.
|
Example
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required.
* The job to get.
*/
// const jobName = 'abc123'
/**
* Required. The ID of the Google Cloud Platform Console project that owns the
* job.
*/
// const projectId = 'abc123'
// Imports the Storagetransfer library
const {StorageTransferServiceClient} =
require('@google-cloud/storage-transfer').v1;
// Instantiates a client
const storagetransferClient = new StorageTransferServiceClient();
async function callGetTransferJob() {
// Construct request
const request = {
jobName,
projectId,
};
// Run request
const response = await storagetransferClient.getTransferJob(request);
console.log(response);
}
callGetTransferJob();
getTransferJob(request, options, callback)
getTransferJob(request: protos.google.storagetransfer.v1.IGetTransferJobRequest, options: CallOptions, callback: Callback<protos.google.storagetransfer.v1.ITransferJob, protos.google.storagetransfer.v1.IGetTransferJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IGetTransferJobRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.storagetransfer.v1.ITransferJob, protos.google.storagetransfer.v1.IGetTransferJobRequest | null | undefined, {} | null | undefined>
|
Returns
getTransferJob(request, callback)
getTransferJob(request: protos.google.storagetransfer.v1.IGetTransferJobRequest, callback: Callback<protos.google.storagetransfer.v1.ITransferJob, protos.google.storagetransfer.v1.IGetTransferJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IGetTransferJobRequest
|
callback |
Callback<protos.google.storagetransfer.v1.ITransferJob, protos.google.storagetransfer.v1.IGetTransferJobRequest | null | undefined, {} | null | undefined>
|
Returns
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns
Type | Description |
Promise<{
[name: string]: Function;
}> | {Promise} A promise that resolves to an authenticated service stub.
|
listTransferJobs(request, options)
listTransferJobs(request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, options?: CallOptions): Promise<[
protos.google.storagetransfer.v1.ITransferJob[],
protos.google.storagetransfer.v1.IListTransferJobsRequest | null,
protos.google.storagetransfer.v1.IListTransferJobsResponse
]>;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IListTransferJobsRequest
The request object that will be sent.
|
options |
CallOptions
Call options. See CallOptions for more details.
|
Returns
Type | Description |
Promise<[
protos.google.storagetransfer.v1.ITransferJob[],
protos.google.storagetransfer.v1.IListTransferJobsRequest | null,
protos.google.storagetransfer.v1.IListTransferJobsResponse
]> | {Promise} - The promise which resolves to an array. The first element of the array is Array of [TransferJob]. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listTransferJobsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.
|
listTransferJobs(request, options, callback)
listTransferJobs(request: protos.google.storagetransfer.v1.IListTransferJobsRequest, options: CallOptions, callback: PaginationCallback<protos.google.storagetransfer.v1.IListTransferJobsRequest, protos.google.storagetransfer.v1.IListTransferJobsResponse | null | undefined, protos.google.storagetransfer.v1.ITransferJob>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IListTransferJobsRequest
|
options |
CallOptions
|
callback |
PaginationCallback<protos.google.storagetransfer.v1.IListTransferJobsRequest, protos.google.storagetransfer.v1.IListTransferJobsResponse | null | undefined, protos.google.storagetransfer.v1.ITransferJob>
|
Returns
listTransferJobs(request, callback)
listTransferJobs(request: protos.google.storagetransfer.v1.IListTransferJobsRequest, callback: PaginationCallback<protos.google.storagetransfer.v1.IListTransferJobsRequest, protos.google.storagetransfer.v1.IListTransferJobsResponse | null | undefined, protos.google.storagetransfer.v1.ITransferJob>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IListTransferJobsRequest
|
callback |
PaginationCallback<protos.google.storagetransfer.v1.IListTransferJobsRequest, protos.google.storagetransfer.v1.IListTransferJobsResponse | null | undefined, protos.google.storagetransfer.v1.ITransferJob>
|
Returns
listTransferJobsAsync(request, options)
listTransferJobsAsync(request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, options?: CallOptions): AsyncIterable<protos.google.storagetransfer.v1.ITransferJob>;
Equivalent to listTransferJobs
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IListTransferJobsRequest
The request object that will be sent.
|
options |
CallOptions
Call options. See CallOptions for more details.
|
Returns
Type | Description |
AsyncIterable<protos.google.storagetransfer.v1.ITransferJob> | {Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing [TransferJob]. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.
|
Example
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. A list of query parameters specified as JSON text in the form of:
* `{"projectId":"my_project_id",
* "jobNames":"jobid1","jobid2",...,
* "jobStatuses":"status1","status2",... }`
* Since `jobNames` and `jobStatuses` support multiple values, their values
* must be specified with array notation. `projectId` is required.
* `jobNames` and `jobStatuses` are optional. The valid values for
* `jobStatuses` are case-insensitive:
* ENABLED google.storagetransfer.v1.TransferJob.Status.ENABLED,
* DISABLED google.storagetransfer.v1.TransferJob.Status.DISABLED, and
* DELETED google.storagetransfer.v1.TransferJob.Status.DELETED.
*/
// const filter = 'abc123'
/**
* The list page size. The max allowed value is 256.
*/
// const pageSize = 1234
/**
* The list page token.
*/
// const pageToken = 'abc123'
// Imports the Storagetransfer library
const {StorageTransferServiceClient} =
require('@google-cloud/storage-transfer').v1;
// Instantiates a client
const storagetransferClient = new StorageTransferServiceClient();
async function callListTransferJobs() {
// Construct request
const request = {
filter,
};
// Run request
const iterable = await storagetransferClient.listTransferJobsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListTransferJobs();
listTransferJobsStream(request, options)
listTransferJobsStream(request?: protos.google.storagetransfer.v1.IListTransferJobsRequest, options?: CallOptions): Transform;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IListTransferJobsRequest
The request object that will be sent.
|
options |
CallOptions
Call options. See CallOptions for more details.
|
Returns
Type | Description |
Transform | {Stream} An object stream which emits an object representing [TransferJob] on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listTransferJobsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.
|
pauseTransferOperation(request, options)
pauseTransferOperation(request?: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, options?: CallOptions): Promise<[
protos.google.protobuf.IEmpty,
(protos.google.storagetransfer.v1.IPauseTransferOperationRequest | undefined),
{} | undefined
]>;
Pauses a transfer operation.
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IPauseTransferOperationRequest
The request object that will be sent.
|
options |
CallOptions
Call options. See CallOptions for more details.
|
Returns
Type | Description |
Promise<[
protos.google.protobuf.IEmpty,
(protos.google.storagetransfer.v1.IPauseTransferOperationRequest | undefined),
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [Empty]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.
|
Example
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the transfer operation.
*/
// const name = 'abc123'
// Imports the Storagetransfer library
const {StorageTransferServiceClient} =
require('@google-cloud/storage-transfer').v1;
// Instantiates a client
const storagetransferClient = new StorageTransferServiceClient();
async function callPauseTransferOperation() {
// Construct request
const request = {
name,
};
// Run request
const response = await storagetransferClient.pauseTransferOperation(
request
);
console.log(response);
}
callPauseTransferOperation();
pauseTransferOperation(request, options, callback)
pauseTransferOperation(request: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.IPauseTransferOperationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IPauseTransferOperationRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.IPauseTransferOperationRequest | null | undefined, {} | null | undefined>
|
Returns
pauseTransferOperation(request, callback)
pauseTransferOperation(request: protos.google.storagetransfer.v1.IPauseTransferOperationRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.IPauseTransferOperationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IPauseTransferOperationRequest
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.IPauseTransferOperationRequest | null | undefined, {} | null | undefined>
|
Returns
resumeTransferOperation(request, options)
resumeTransferOperation(request?: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, options?: CallOptions): Promise<[
protos.google.protobuf.IEmpty,
(protos.google.storagetransfer.v1.IResumeTransferOperationRequest | undefined),
{} | undefined
]>;
Resumes a transfer operation that is paused.
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IResumeTransferOperationRequest
The request object that will be sent.
|
options |
CallOptions
Call options. See CallOptions for more details.
|
Returns
Type | Description |
Promise<[
protos.google.protobuf.IEmpty,
(protos.google.storagetransfer.v1.IResumeTransferOperationRequest | undefined),
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [Empty]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.
|
Example
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the transfer operation.
*/
// const name = 'abc123'
// Imports the Storagetransfer library
const {StorageTransferServiceClient} =
require('@google-cloud/storage-transfer').v1;
// Instantiates a client
const storagetransferClient = new StorageTransferServiceClient();
async function callResumeTransferOperation() {
// Construct request
const request = {
name,
};
// Run request
const response = await storagetransferClient.resumeTransferOperation(
request
);
console.log(response);
}
callResumeTransferOperation();
resumeTransferOperation(request, options, callback)
resumeTransferOperation(request: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.IResumeTransferOperationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IResumeTransferOperationRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.IResumeTransferOperationRequest | null | undefined, {} | null | undefined>
|
Returns
resumeTransferOperation(request, callback)
resumeTransferOperation(request: protos.google.storagetransfer.v1.IResumeTransferOperationRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.IResumeTransferOperationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IResumeTransferOperationRequest
|
callback |
Callback<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.IResumeTransferOperationRequest | null | undefined, {} | null | undefined>
|
Returns
runTransferJob(request, options)
runTransferJob(request?: protos.google.storagetransfer.v1.IRunTransferJobRequest, options?: CallOptions): Promise<[
LROperation<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.ITransferOperation>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]>;
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 wil be returned.
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IRunTransferJobRequest
The request object that will be sent.
|
options |
CallOptions
Call options. See CallOptions for more details.
|
Returns
Type | Description |
Promise<[
LROperation<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.ITransferOperation>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.
|
Example
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the transfer job.
*/
// const jobName = 'abc123'
/**
* Required. The ID of the Google Cloud Platform Console project that owns the
* transfer job.
*/
// const projectId = 'abc123'
// Imports the Storagetransfer library
const {StorageTransferServiceClient} =
require('@google-cloud/storage-transfer').v1;
// Instantiates a client
const storagetransferClient = new StorageTransferServiceClient();
async function callRunTransferJob() {
// Construct request
const request = {
jobName,
projectId,
};
// Run request
const [operation] = await storagetransferClient.runTransferJob(request);
const [response] = await operation.promise();
console.log(response);
}
callRunTransferJob();
runTransferJob(request, options, callback)
runTransferJob(request: protos.google.storagetransfer.v1.IRunTransferJobRequest, options: CallOptions, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.ITransferOperation>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IRunTransferJobRequest
|
options |
CallOptions
|
callback |
Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.ITransferOperation>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns
runTransferJob(request, callback)
runTransferJob(request: protos.google.storagetransfer.v1.IRunTransferJobRequest, callback: Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.ITransferOperation>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IRunTransferJobRequest
|
callback |
Callback<LROperation<protos.google.protobuf.IEmpty, protos.google.storagetransfer.v1.ITransferOperation>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
|
Returns
updateTransferJob(request, options)
updateTransferJob(request?: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, options?: CallOptions): Promise<[
protos.google.storagetransfer.v1.ITransferJob,
protos.google.storagetransfer.v1.IUpdateTransferJobRequest | undefined,
{} | undefined
]>;
Updates a transfer job. Updating a job's transfer spec does not affect transfer operations that are running already.
**Note:** The job's field can be modified using this RPC (for example, to set a job's status to , , or ).
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IUpdateTransferJobRequest
The request object that will be sent.
|
options |
CallOptions
Call options. See CallOptions for more details.
|
Returns
Type | Description |
Promise<[
protos.google.storagetransfer.v1.ITransferJob,
protos.google.storagetransfer.v1.IUpdateTransferJobRequest | undefined,
{} | undefined
]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [TransferJob]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.
|
Example
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of job to update.
*/
// const jobName = 'abc123'
/**
* Required. The ID of the Google Cloud Platform Console project that owns the
* job.
*/
// const projectId = 'abc123'
/**
* Required. The job to update. `transferJob` is expected to specify only
* four fields:
* description google.storagetransfer.v1.TransferJob.description,
* transfer_spec google.storagetransfer.v1.TransferJob.transfer_spec,
* notification_config google.storagetransfer.v1.TransferJob.notification_config,
* and status google.storagetransfer.v1.TransferJob.status. An
* `UpdateTransferJobRequest` that specifies other fields are rejected with
* the error INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT. Updating a
* job status to
* DELETED google.storagetransfer.v1.TransferJob.Status.DELETED requires
* `storagetransfer.jobs.delete` permissions.
*/
// const transferJob = {}
/**
* The field mask of the fields in `transferJob` that are to be updated in
* this request. Fields in `transferJob` that can be updated are:
* description google.storagetransfer.v1.TransferJob.description,
* transfer_spec google.storagetransfer.v1.TransferJob.transfer_spec,
* notification_config google.storagetransfer.v1.TransferJob.notification_config,
* and status google.storagetransfer.v1.TransferJob.status. To update the
* `transfer_spec` of the job, a complete transfer specification must be
* provided. An incomplete specification missing any required fields is
* rejected with the error
* INVALID_ARGUMENT google.rpc.Code.INVALID_ARGUMENT.
*/
// const updateTransferJobFieldMask = {}
// Imports the Storagetransfer library
const {StorageTransferServiceClient} =
require('@google-cloud/storage-transfer').v1;
// Instantiates a client
const storagetransferClient = new StorageTransferServiceClient();
async function callUpdateTransferJob() {
// Construct request
const request = {
jobName,
projectId,
transferJob,
};
// Run request
const response = await storagetransferClient.updateTransferJob(request);
console.log(response);
}
callUpdateTransferJob();
updateTransferJob(request, options, callback)
updateTransferJob(request: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, options: CallOptions, callback: Callback<protos.google.storagetransfer.v1.ITransferJob, protos.google.storagetransfer.v1.IUpdateTransferJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IUpdateTransferJobRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.storagetransfer.v1.ITransferJob, protos.google.storagetransfer.v1.IUpdateTransferJobRequest | null | undefined, {} | null | undefined>
|
Returns
updateTransferJob(request, callback)
updateTransferJob(request: protos.google.storagetransfer.v1.IUpdateTransferJobRequest, callback: Callback<protos.google.storagetransfer.v1.ITransferJob, protos.google.storagetransfer.v1.IUpdateTransferJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name | Description |
request |
protos.google.storagetransfer.v1.IUpdateTransferJobRequest
|
callback |
Callback<protos.google.storagetransfer.v1.ITransferJob, protos.google.storagetransfer.v1.IUpdateTransferJobRequest | null | undefined, {} | null | undefined>
|
Returns