Cloud Run Task Control Plane API. v2
Package
@google-cloud/runConstructors
(constructor)(opts, gaxInstance)
constructor
(
opts
?:
ClientOptions
,
gaxInstance
?:
typeof
gax
|
typeof
gax
.
fallback
);
Construct an instance of TasksClient.
opts
ClientOptions
gaxInstance
typeof gax
| typeof fallback
: loaded instance of google-gax
. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new TasksClient({fallback: true}, gax); ```
Properties
apiEndpoint
get
apiEndpoint
()
:
string
;
The DNS address for this API service.
apiEndpoint
static
get
apiEndpoint
()
:
string
;
The DNS address for this API service - same as servicePath.
auth
auth
:
gax
.
GoogleAuth
;
descriptors
descriptors
:
Descriptors
;
innerApiCalls
innerApiCalls
:
{
[
name
:
string
]
:
Function
;
};
locationsClient
locationsClient
:
LocationsClient
;
pathTemplates
pathTemplates
:
{
[
name
:
string
]
:
gax
.
PathTemplate
;
};
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.
tasksStub
tasksStub
?:
Promise
< {
[
name
:
string
]
:
Function
;
}>;
universeDomain
get
universeDomain
()
:
string
;
warn
warn
:
(
code
:
string
,
message
:
string
,
warnType
?:
string
)
=
>
void
;
Methods
close()
close
()
:
Promise<void>
;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Promise
<void>
{Promise} A promise that resolves when the client is closed.
cryptoKeyPath(project, location, keyRing, cryptoKey)
cryptoKeyPath
(
project
:
string
,
location
:
string
,
keyRing
:
string
,
cryptoKey
:
string
)
:
string
;
Return a fully-qualified cryptoKey resource name string.
project
string
location
string
keyRing
string
cryptoKey
string
string
{string} Resource name string.
executionPath(project, location, job, execution)
executionPath
(
project
:
string
,
location
:
string
,
job
:
string
,
execution
:
string
)
:
string
;
Return a fully-qualified execution resource name string.
project
string
location
string
job
string
execution
string
string
{string} Resource name string.
getLocation(request, options, callback)
getLocation
(
request
:
LocationProtos
.
google
.
cloud
.
location
.
IGetLocationRequest
,
options
?:
gax
.
CallOptions
|
Callback<LocationProtos
.
google
.
cloud
.
location
.
ILocation
,
LocationProtos
.
google
.
cloud
.
location
.
IGetLocationRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> ,
callback
?:
Callback<LocationProtos
.
google
.
cloud
.
location
.
ILocation
,
LocationProtos
.
google
.
cloud
.
location
.
IGetLocationRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
Promise<LocationProtos
.
google
.
cloud
.
location
.
ILocation
> ;
Gets information about a location.
request
LocationProtos.google.cloud.location.IGetLocationRequest
The request object that will be sent.
options
CallOptions
| Callback
< google.cloud.location.ILocation
, google.cloud.location.IGetLocationRequest
| null | undefined, {} | null | undefined>
Call options. See CallOptions for more details.
callback
Callback
< google.cloud.location.ILocation
, google.cloud.location.IGetLocationRequest
| null | undefined, {} | null | undefined>
Promise
< google.cloud.location.ILocation
>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
const
[
response
]
=
await
client
.
getLocation
(
request
);
getProjectId()
getProjectId
()
:
Promise<string>
;
Promise
<string>
getProjectId(callback)
getProjectId
(
callback
:
Callback<string
,
undefined
,
undefined
> )
:
void
;
callback
Callback
<string, undefined, undefined>
void
getTask(request, options)
getTask
(
request
?:
protos
.
google
.
cloud
.
run
.
v2
.
IGetTaskRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
cloud
.
run
.
v2
.
ITask
,
protos
.
google
.
cloud
.
run
.
v2
.
IGetTaskRequest
|
undefined
,
{}
|
undefined
]>;
Gets information about a Task.
request
options
Promise
<[ protos.google.cloud.run.v2.ITask
, protos.google.cloud.run.v2.IGetTaskRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing Task . Please see the documentation for more details and examples.
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The full name of the Task.
* Format:
* projects/{project}/locations/{location}/jobs/{job}/executions/{execution}/tasks/{task}
*/
// const name = 'abc123'
// Imports the Run library
const
{
TasksClient
}
=
require
(
' @google-cloud/run
'
).
v2
;
// Instantiates a client
const
runClient
=
new
TasksClient
();
async
function
callGetTask
()
{
// Construct request
const
request
=
{
name
,
};
// Run request
const
response
=
await
runClient
.
getTask
(
request
);
console
.
log
(
response
);
}
callGetTask
();
getTask(request, options, callback)
getTask
(
request
:
protos
.
google
.
cloud
.
run
.
v2
.
IGetTaskRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
cloud
.
run
.
v2
.
ITask
,
protos
.
google
.
cloud
.
run
.
v2
.
IGetTaskRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.cloud.run.v2.ITask
, protos.google.cloud.run.v2.IGetTaskRequest
| null | undefined, {} | null | undefined>
void
getTask(request, callback)
getTask
(
request
:
protos
.
google
.
cloud
.
run
.
v2
.
IGetTaskRequest
,
callback
:
Callback<protos
.
google
.
cloud
.
run
.
v2
.
ITask
,
protos
.
google
.
cloud
.
run
.
v2
.
IGetTaskRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.cloud.run.v2.ITask
, protos.google.cloud.run.v2.IGetTaskRequest
| null | undefined, {} | null | undefined>
void
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.
Promise
<{
[name: string]: Function
;
}>
{Promise} A promise that resolves to an authenticated service stub.
jobPath(project, location, job)
jobPath
(
project
:
string
,
location
:
string
,
job
:
string
)
:
string
;
Return a fully-qualified job resource name string.
project
string
location
string
job
string
string
{string} Resource name string.
listLocationsAsync(request, options)
listLocationsAsync
(
request
:
LocationProtos
.
google
.
cloud
.
location
.
IListLocationsRequest
,
options
?:
CallOptions
)
:
AsyncIterable<LocationProtos
.
google
.
cloud
.
location
.
ILocation
> ;
Lists information about the supported locations for this service. Returns an iterable object.
for
- await
- of
syntax is used with the iterable to get response elements on-demand.
request
LocationProtos.google.cloud.location.IListLocationsRequest
The request object that will be sent.
options
AsyncIterable
< google.cloud.location.ILocation
>
{Object} An iterable Object that allows async iteration . When you iterate the returned iterable, each element will be an object representing . 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 for more details and examples.
const
iterable
=
client
.
listLocationsAsync
(
request
);
for
await
(
const
response
of
iterable
)
{
// process response
}
listTasks(request, options)
listTasks
(
request
?:
protos
.
google
.
cloud
.
run
.
v2
.
IListTasksRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
cloud
.
run
.
v2
.
ITask
[],
protos
.
google
.
cloud
.
run
.
v2
.
IListTasksRequest
|
null
,
protos
.
google
.
cloud
.
run
.
v2
.
IListTasksResponse
]>;
Lists Tasks from an Execution of a Job.
request
options
Promise
<[ protos.google.cloud.run.v2.ITask
[], protos.google.cloud.run.v2.IListTasksRequest
| null, protos.google.cloud.run.v2.IListTasksResponse
]>
{Promise} - The promise which resolves to an array. The first element of the array is Array of Task
. 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 listTasksAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
listTasks(request, options, callback)
listTasks
(
request
:
protos
.
google
.
cloud
.
run
.
v2
.
IListTasksRequest
,
options
:
CallOptions
,
callback
:
PaginationCallback<protos
.
google
.
cloud
.
run
.
v2
.
IListTasksRequest
,
protos
.
google
.
cloud
.
run
.
v2
.
IListTasksResponse
|
null
|
undefined
,
protos
.
google
.
cloud
.
run
.
v2
.
ITask
> )
:
void
;
request
options
CallOptions
callback
PaginationCallback
< protos.google.cloud.run.v2.IListTasksRequest
, protos.google.cloud.run.v2.IListTasksResponse
| null | undefined, protos.google.cloud.run.v2.ITask
>
void
listTasks(request, callback)
listTasks
(
request
:
protos
.
google
.
cloud
.
run
.
v2
.
IListTasksRequest
,
callback
:
PaginationCallback<protos
.
google
.
cloud
.
run
.
v2
.
IListTasksRequest
,
protos
.
google
.
cloud
.
run
.
v2
.
IListTasksResponse
|
null
|
undefined
,
protos
.
google
.
cloud
.
run
.
v2
.
ITask
> )
:
void
;
request
callback
PaginationCallback
< protos.google.cloud.run.v2.IListTasksRequest
, protos.google.cloud.run.v2.IListTasksResponse
| null | undefined, protos.google.cloud.run.v2.ITask
>
void
listTasksAsync(request, options)
listTasksAsync
(
request
?:
protos
.
google
.
cloud
.
run
.
v2
.
IListTasksRequest
,
options
?:
CallOptions
)
:
AsyncIterable<protos
.
google
.
cloud
.
run
.
v2
.
ITask
> ;
Equivalent to listTasks
, but returns an iterable object.
for
- await
- of
syntax is used with the iterable to get response elements on-demand.
request
options
AsyncIterable
< protos.google.cloud.run.v2.ITask
>
{Object} An iterable Object that allows async iteration . When you iterate the returned iterable, each element will be an object representing Task . 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 for more details and examples.
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The Execution from which the Tasks should be listed.
* To list all Tasks across Executions of a Job, use "-" instead of Execution
* name. To list all Tasks across Jobs, use "-" instead of Job name. Format:
* projects/{project}/locations/{location}/jobs/{job}/executions/{execution}
*/
// const parent = 'abc123'
/**
* Maximum number of Tasks to return in this call.
*/
// const pageSize = 1234
/**
* A page token received from a previous call to ListTasks.
* All other parameters must match.
*/
// const pageToken = 'abc123'
/**
* If true, returns deleted (but unexpired) resources along with active ones.
*/
// const showDeleted = true
// Imports the Run library
const
{
TasksClient
}
=
require
(
' @google-cloud/run
'
).
v2
;
// Instantiates a client
const
runClient
=
new
TasksClient
();
async
function
callListTasks
()
{
// Construct request
const
request
=
{
parent
,
};
// Run request
const
iterable
=
runClient
.
listTasksAsync
(
request
);
for
await
(
const
response
of
iterable
)
{
console
.
log
(
response
);
}
}
callListTasks
();
listTasksStream(request, options)
listTasksStream
(
request
?:
protos
.
google
.
cloud
.
run
.
v2
.
IListTasksRequest
,
options
?:
CallOptions
)
:
Transform
;
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
request
options
Transform
{Stream} An object stream which emits an object representing Task
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 listTasksAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
locationPath(project, location)
locationPath
(
project
:
string
,
location
:
string
)
:
string
;
Return a fully-qualified location resource name string.
project
string
location
string
string
{string} Resource name string.
matchCryptoKeyFromCryptoKeyName(cryptoKeyName)
matchCryptoKeyFromCryptoKeyName
(
cryptoKeyName
:
string
)
:
string
|
number
;
Parse the crypto_key from CryptoKey resource.
cryptoKeyName
string
A fully-qualified path representing CryptoKey resource.
string | number
{string} A string representing the crypto_key.
matchExecutionFromExecutionName(executionName)
matchExecutionFromExecutionName
(
executionName
:
string
)
:
string
|
number
;
Parse the execution from Execution resource.
executionName
string
A fully-qualified path representing Execution resource.
string | number
{string} A string representing the execution.
matchExecutionFromTaskName(taskName)
matchExecutionFromTaskName
(
taskName
:
string
)
:
string
|
number
;
Parse the execution from Task resource.
taskName
string
A fully-qualified path representing Task resource.
string | number
{string} A string representing the execution.
matchJobFromExecutionName(executionName)
matchJobFromExecutionName
(
executionName
:
string
)
:
string
|
number
;
Parse the job from Execution resource.
executionName
string
A fully-qualified path representing Execution resource.
string | number
{string} A string representing the job.
matchJobFromJobName(jobName)
matchJobFromJobName
(
jobName
:
string
)
:
string
|
number
;
Parse the job from Job resource.
jobName
string
A fully-qualified path representing Job resource.
string | number
{string} A string representing the job.
matchJobFromTaskName(taskName)
matchJobFromTaskName
(
taskName
:
string
)
:
string
|
number
;
Parse the job from Task resource.
taskName
string
A fully-qualified path representing Task resource.
string | number
{string} A string representing the job.
matchKeyRingFromCryptoKeyName(cryptoKeyName)
matchKeyRingFromCryptoKeyName
(
cryptoKeyName
:
string
)
:
string
|
number
;
Parse the key_ring from CryptoKey resource.
cryptoKeyName
string
A fully-qualified path representing CryptoKey resource.
string | number
{string} A string representing the key_ring.
matchLocationFromCryptoKeyName(cryptoKeyName)
matchLocationFromCryptoKeyName
(
cryptoKeyName
:
string
)
:
string
|
number
;
Parse the location from CryptoKey resource.
cryptoKeyName
string
A fully-qualified path representing CryptoKey resource.
string | number
{string} A string representing the location.
matchLocationFromExecutionName(executionName)
matchLocationFromExecutionName
(
executionName
:
string
)
:
string
|
number
;
Parse the location from Execution resource.
executionName
string
A fully-qualified path representing Execution resource.
string | number
{string} A string representing the location.
matchLocationFromJobName(jobName)
matchLocationFromJobName
(
jobName
:
string
)
:
string
|
number
;
Parse the location from Job resource.
jobName
string
A fully-qualified path representing Job resource.
string | number
{string} A string representing the location.
matchLocationFromLocationName(locationName)
matchLocationFromLocationName
(
locationName
:
string
)
:
string
|
number
;
Parse the location from Location resource.
locationName
string
A fully-qualified path representing Location resource.
string | number
{string} A string representing the location.
matchLocationFromRevisionName(revisionName)
matchLocationFromRevisionName
(
revisionName
:
string
)
:
string
|
number
;
Parse the location from Revision resource.
revisionName
string
A fully-qualified path representing Revision resource.
string | number
{string} A string representing the location.
matchLocationFromServiceName(serviceName)
matchLocationFromServiceName
(
serviceName
:
string
)
:
string
|
number
;
Parse the location from Service resource.
serviceName
string
A fully-qualified path representing Service resource.
string | number
{string} A string representing the location.
matchLocationFromTaskName(taskName)
matchLocationFromTaskName
(
taskName
:
string
)
:
string
|
number
;
Parse the location from Task resource.
taskName
string
A fully-qualified path representing Task resource.
string | number
{string} A string representing the location.
matchProjectFromCryptoKeyName(cryptoKeyName)
matchProjectFromCryptoKeyName
(
cryptoKeyName
:
string
)
:
string
|
number
;
Parse the project from CryptoKey resource.
cryptoKeyName
string
A fully-qualified path representing CryptoKey resource.
string | number
{string} A string representing the project.
matchProjectFromExecutionName(executionName)
matchProjectFromExecutionName
(
executionName
:
string
)
:
string
|
number
;
Parse the project from Execution resource.
executionName
string
A fully-qualified path representing Execution resource.
string | number
{string} A string representing the project.
matchProjectFromJobName(jobName)
matchProjectFromJobName
(
jobName
:
string
)
:
string
|
number
;
Parse the project from Job resource.
jobName
string
A fully-qualified path representing Job resource.
string | number
{string} A string representing the project.
matchProjectFromLocationName(locationName)
matchProjectFromLocationName
(
locationName
:
string
)
:
string
|
number
;
Parse the project from Location resource.
locationName
string
A fully-qualified path representing Location resource.
string | number
{string} A string representing the project.
matchProjectFromProjectName(projectName)
matchProjectFromProjectName
(
projectName
:
string
)
:
string
|
number
;
Parse the project from Project resource.
projectName
string
A fully-qualified path representing Project resource.
string | number
{string} A string representing the project.
matchProjectFromRevisionName(revisionName)
matchProjectFromRevisionName
(
revisionName
:
string
)
:
string
|
number
;
Parse the project from Revision resource.
revisionName
string
A fully-qualified path representing Revision resource.
string | number
{string} A string representing the project.
matchProjectFromServiceName(serviceName)
matchProjectFromServiceName
(
serviceName
:
string
)
:
string
|
number
;
Parse the project from Service resource.
serviceName
string
A fully-qualified path representing Service resource.
string | number
{string} A string representing the project.
matchProjectFromTaskName(taskName)
matchProjectFromTaskName
(
taskName
:
string
)
:
string
|
number
;
Parse the project from Task resource.
taskName
string
A fully-qualified path representing Task resource.
string | number
{string} A string representing the project.
matchRevisionFromRevisionName(revisionName)
matchRevisionFromRevisionName
(
revisionName
:
string
)
:
string
|
number
;
Parse the revision from Revision resource.
revisionName
string
A fully-qualified path representing Revision resource.
string | number
{string} A string representing the revision.
matchServiceFromRevisionName(revisionName)
matchServiceFromRevisionName
(
revisionName
:
string
)
:
string
|
number
;
Parse the service from Revision resource.
revisionName
string
A fully-qualified path representing Revision resource.
string | number
{string} A string representing the service.
matchServiceFromServiceName(serviceName)
matchServiceFromServiceName
(
serviceName
:
string
)
:
string
|
number
;
Parse the service from Service resource.
serviceName
string
A fully-qualified path representing Service resource.
string | number
{string} A string representing the service.
matchTaskFromTaskName(taskName)
matchTaskFromTaskName
(
taskName
:
string
)
:
string
|
number
;
Parse the task from Task resource.
taskName
string
A fully-qualified path representing Task resource.
string | number
{string} A string representing the task.
projectPath(project)
projectPath
(
project
:
string
)
:
string
;
Return a fully-qualified project resource name string.
project
string
string
{string} Resource name string.
revisionPath(project, location, service, revision)
revisionPath
(
project
:
string
,
location
:
string
,
service
:
string
,
revision
:
string
)
:
string
;
Return a fully-qualified revision resource name string.
project
string
location
string
service
string
revision
string
string
{string} Resource name string.
servicePath(project, location, service)
servicePath
(
project
:
string
,
location
:
string
,
service
:
string
)
:
string
;
Return a fully-qualified service resource name string.
project
string
location
string
service
string
string
{string} Resource name string.
taskPath(project, location, job, execution, task)
taskPath
(
project
:
string
,
location
:
string
,
job
:
string
,
execution
:
string
,
task
:
string
)
:
string
;
Return a fully-qualified task resource name string.
project
string
location
string
job
string
execution
string
task
string
string
{string} Resource name string.