The BatchController provides methods to manage batch workloads. v1
Package
@google-cloud/dataprocConstructors
(constructor)(opts, gaxInstance)
constructor
(
opts
?:
ClientOptions
,
gaxInstance
?:
typeof
gax
|
typeof
gax
.
fallback
);
Construct an instance of BatchControllerClient.
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 BatchControllerClient({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
;
batchControllerStub
batchControllerStub
?:
Promise
< {
[
name
:
string
]
:
Function
;
}>;
descriptors
descriptors
:
Descriptors
;
iamClient
iamClient
:
IamClient
;
innerApiCalls
innerApiCalls
:
{
[
name
:
string
]
:
Function
;
};
operationsClient
operationsClient
:
gax
.
OperationsClient
;
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.
universeDomain
get
universeDomain
()
:
string
;
warn
warn
:
(
code
:
string
,
message
:
string
,
warnType
?:
string
)
=
>
void
;
Methods
batchPath(project, location, batch)
batchPath
(
project
:
string
,
location
:
string
,
batch
:
string
)
:
string
;
Return a fully-qualified batch resource name string.
project
string
location
string
batch
string
string
{string} Resource name string.
cancelOperation(request, optionsOrCallback, callback)
cancelOperation
(
request
:
protos
.
google
.
longrunning
.
CancelOperationRequest
,
optionsOrCallback
?:
gax
.
CallOptions
|
Callback<protos
.
google
.
longrunning
.
CancelOperationRequest
,
protos
.
google
.
protobuf
.
Empty
,
{}
|
undefined
|
null
> ,
callback
?:
Callback<protos
.
google
.
longrunning
.
CancelOperationRequest
,
protos
.
google
.
protobuf
.
Empty
,
{}
|
undefined
|
null
> )
:
Promise<protos
.
google
.
protobuf
.
Empty
> ;
Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
. Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED
.
request
optionsOrCallback
CallOptions
| Callback
< protos.google.longrunning.CancelOperationRequest
, protos.google.protobuf.Empty
, {} | undefined | null>
callback
Callback
< protos.google.longrunning.CancelOperationRequest
, protos.google.protobuf.Empty
, {} | undefined | null>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
const
client
=
longrunning
.
operationsClient
();
await
client
.
cancelOperation
({
name
:
''
});
checkCreateBatchProgress(name)
checkCreateBatchProgress
(
name
:
string
)
:
Promise<LROperation<protos
.
google
.
cloud
.
dataproc
.
v1
.
Batch
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
BatchOperationMetadata
>> ;
Check the status of the long running operation returned by createBatch()
.
name
string
The operation name that will be passed.
Promise
< LROperation
< protos.google.cloud.dataproc.v1.Batch
, protos.google.cloud.dataproc.v1.BatchOperationMetadata
>>
{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 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 parent resource where this batch will be created.
*/
// const parent = 'abc123'
/**
* Required. The batch to create.
*/
// const batch = {}
/**
* Optional. The ID to use for the batch, which will become the final
* component of the batch's resource name.
* This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`.
*/
// const batchId = 'abc123'
/**
* Optional. A unique ID used to identify the request. If the service
* receives two
* CreateBatchRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s
* with the same request_id, the second request is ignored and the
* Operation that corresponds to the first Batch created and stored
* in the backend is returned.
* Recommendation: Set this value to a
* UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).
* The value must contain only letters (a-z, A-Z), numbers (0-9),
* underscores (_), and hyphens (-). The maximum length is 40 characters.
*/
// const requestId = 'abc123'
// Imports the Dataproc library
const
{
BatchControllerClient
}
=
require
(
' @google-cloud/dataproc
'
).
v1
;
// Instantiates a client
const
dataprocClient
=
new
BatchControllerClient
();
async
function
callCreateBatch
()
{
// Construct request
const
request
=
{
parent
,
batch
,
};
// Run request
const
[
operation
]
=
await
dataprocClient
.
createBatch
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callCreateBatch
();
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.
createBatch(request, options)
createBatch
(
request
?:
protos
.
google
.
cloud
.
dataproc
.
v1
.
ICreateBatchRequest
,
options
?:
CallOptions
)
:
Promise
< [
LROperation<protos
.
google
.
cloud
.
dataproc
.
v1
.
IBatch
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IBatchOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
undefined
,
{}
|
undefined
]>;
Creates a batch workload that executes asynchronously.
request
options
Promise
<[ LROperation
< protos.google.cloud.dataproc.v1.IBatch
, protos.google.cloud.dataproc.v1.IBatchOperationMetadata
>, 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
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 parent resource where this batch will be created.
*/
// const parent = 'abc123'
/**
* Required. The batch to create.
*/
// const batch = {}
/**
* Optional. The ID to use for the batch, which will become the final
* component of the batch's resource name.
* This value must be 4-63 characters. Valid characters are `/[a-z][0-9]-/`.
*/
// const batchId = 'abc123'
/**
* Optional. A unique ID used to identify the request. If the service
* receives two
* CreateBatchRequest (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateBatchRequest)s
* with the same request_id, the second request is ignored and the
* Operation that corresponds to the first Batch created and stored
* in the backend is returned.
* Recommendation: Set this value to a
* UUID (https://en.wikipedia.org/wiki/Universally_unique_identifier).
* The value must contain only letters (a-z, A-Z), numbers (0-9),
* underscores (_), and hyphens (-). The maximum length is 40 characters.
*/
// const requestId = 'abc123'
// Imports the Dataproc library
const
{
BatchControllerClient
}
=
require
(
' @google-cloud/dataproc
'
).
v1
;
// Instantiates a client
const
dataprocClient
=
new
BatchControllerClient
();
async
function
callCreateBatch
()
{
// Construct request
const
request
=
{
parent
,
batch
,
};
// Run request
const
[
operation
]
=
await
dataprocClient
.
createBatch
(
request
);
const
[
response
]
=
await
operation
.
promise
();
console
.
log
(
response
);
}
callCreateBatch
();
createBatch(request, options, callback)
createBatch
(
request
:
protos
.
google
.
cloud
.
dataproc
.
v1
.
ICreateBatchRequest
,
options
:
CallOptions
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
dataproc
.
v1
.
IBatch
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IBatchOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< LROperation
< protos.google.cloud.dataproc.v1.IBatch
, protos.google.cloud.dataproc.v1.IBatchOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
createBatch(request, callback)
createBatch
(
request
:
protos
.
google
.
cloud
.
dataproc
.
v1
.
ICreateBatchRequest
,
callback
:
Callback<LROperation<protos
.
google
.
cloud
.
dataproc
.
v1
.
IBatch
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IBatchOperationMetadata
> ,
protos
.
google
.
longrunning
.
IOperation
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< LROperation
< protos.google.cloud.dataproc.v1.IBatch
, protos.google.cloud.dataproc.v1.IBatchOperationMetadata
>, protos.google.longrunning.IOperation
| null | undefined, {} | null | undefined>
void
deleteBatch(request, options)
deleteBatch
(
request
?:
protos
.
google
.
cloud
.
dataproc
.
v1
.
IDeleteBatchRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IDeleteBatchRequest
|
undefined
,
{}
|
undefined
]>;
Deletes the batch workload resource. If the batch is not in terminal state, the delete fails and the response returns FAILED_PRECONDITION
.
request
options
Promise
<[ protos.google.protobuf.IEmpty
, protos.google.cloud.dataproc.v1.IDeleteBatchRequest
| 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 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 fully qualified name of the batch to retrieve
* in the format
* "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
*/
// const name = 'abc123'
// Imports the Dataproc library
const
{
BatchControllerClient
}
=
require
(
' @google-cloud/dataproc
'
).
v1
;
// Instantiates a client
const
dataprocClient
=
new
BatchControllerClient
();
async
function
callDeleteBatch
()
{
// Construct request
const
request
=
{
name
,
};
// Run request
const
response
=
await
dataprocClient
.
deleteBatch
(
request
);
console
.
log
(
response
);
}
callDeleteBatch
();
deleteBatch(request, options, callback)
deleteBatch
(
request
:
protos
.
google
.
cloud
.
dataproc
.
v1
.
IDeleteBatchRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IDeleteBatchRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.protobuf.IEmpty
, protos.google.cloud.dataproc.v1.IDeleteBatchRequest
| null | undefined, {} | null | undefined>
void
deleteBatch(request, callback)
deleteBatch
(
request
:
protos
.
google
.
cloud
.
dataproc
.
v1
.
IDeleteBatchRequest
,
callback
:
Callback<protos
.
google
.
protobuf
.
IEmpty
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IDeleteBatchRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.protobuf.IEmpty
, protos.google.cloud.dataproc.v1.IDeleteBatchRequest
| null | undefined, {} | null | undefined>
void
deleteOperation(request, optionsOrCallback, callback)
deleteOperation
(
request
:
protos
.
google
.
longrunning
.
DeleteOperationRequest
,
optionsOrCallback
?:
gax
.
CallOptions
|
Callback<protos
.
google
.
protobuf
.
Empty
,
protos
.
google
.
longrunning
.
DeleteOperationRequest
,
{}
|
null
|
undefined
> ,
callback
?:
Callback<protos
.
google
.
protobuf
.
Empty
,
protos
.
google
.
longrunning
.
DeleteOperationRequest
,
{}
|
null
|
undefined
> )
:
Promise<protos
.
google
.
protobuf
.
Empty
> ;
Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED
.
request
optionsOrCallback
CallOptions
| Callback
< protos.google.protobuf.Empty
, protos.google.longrunning.DeleteOperationRequest
, {} | null | undefined>
callback
Callback
< protos.google.protobuf.Empty
, protos.google.longrunning.DeleteOperationRequest
, {} | null | undefined>
The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.
const
client
=
longrunning
.
operationsClient
();
await
client
.
deleteOperation
({
name
:
''
});
getBatch(request, options)
getBatch
(
request
?:
protos
.
google
.
cloud
.
dataproc
.
v1
.
IGetBatchRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
cloud
.
dataproc
.
v1
.
IBatch
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IGetBatchRequest
|
undefined
,
{}
|
undefined
]>;
Gets the batch workload resource representation.
request
options
Promise
<[ protos.google.cloud.dataproc.v1.IBatch
, protos.google.cloud.dataproc.v1.IGetBatchRequest
| undefined,
{} | undefined
]>
{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.
/**
* 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 fully qualified name of the batch to retrieve
* in the format
* "projects/PROJECT_ID/locations/DATAPROC_REGION/batches/BATCH_ID"
*/
// const name = 'abc123'
// Imports the Dataproc library
const
{
BatchControllerClient
}
=
require
(
' @google-cloud/dataproc
'
).
v1
;
// Instantiates a client
const
dataprocClient
=
new
BatchControllerClient
();
async
function
callGetBatch
()
{
// Construct request
const
request
=
{
name
,
};
// Run request
const
response
=
await
dataprocClient
.
getBatch
(
request
);
console
.
log
(
response
);
}
callGetBatch
();
getBatch(request, options, callback)
getBatch
(
request
:
protos
.
google
.
cloud
.
dataproc
.
v1
.
IGetBatchRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
cloud
.
dataproc
.
v1
.
IBatch
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IGetBatchRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.cloud.dataproc.v1.IBatch
, protos.google.cloud.dataproc.v1.IGetBatchRequest
| null | undefined, {} | null | undefined>
void
getBatch(request, callback)
getBatch
(
request
:
protos
.
google
.
cloud
.
dataproc
.
v1
.
IGetBatchRequest
,
callback
:
Callback<protos
.
google
.
cloud
.
dataproc
.
v1
.
IBatch
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IGetBatchRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.cloud.dataproc.v1.IBatch
, protos.google.cloud.dataproc.v1.IGetBatchRequest
| null | undefined, {} | null | undefined>
void
getIamPolicy(request, options, callback)
getIamPolicy
(
request
:
IamProtos
.
google
.
iam
.
v1
.
GetIamPolicyRequest
,
options
?:
gax
.
CallOptions
|
Callback<IamProtos
.
google
.
iam
.
v1
.
Policy
,
IamProtos
.
google
.
iam
.
v1
.
GetIamPolicyRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> ,
callback
?:
Callback<IamProtos
.
google
.
iam
.
v1
.
Policy
,
IamProtos
.
google
.
iam
.
v1
.
GetIamPolicyRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
Promise
< [
IamProtos
.
google
.
iam
.
v1
.
Policy
]>;
Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
request
IamProtos.google.iam.v1.GetIamPolicyRequest
The request object that will be sent.
options
CallOptions
| Callback
< google.iam.v1.Policy
, google.iam.v1.GetIamPolicyRequest
| null | undefined, {} | null | undefined>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.
callback
Callback
< google.iam.v1.Policy
, google.iam.v1.GetIamPolicyRequest
| null | undefined, {} | null | undefined>
The function which will be called with the result of the API call.
The second parameter to the callback is an object representing .
Promise
<[ google.iam.v1.Policy
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.
getOperation(request, optionsOrCallback, callback)
getOperation
(
request
:
protos
.
google
.
longrunning
.
GetOperationRequest
,
optionsOrCallback
?:
gax
.
CallOptions
|
Callback<protos
.
google
.
longrunning
.
Operation
,
protos
.
google
.
longrunning
.
GetOperationRequest
,
{}
|
null
|
undefined
> ,
callback
?:
Callback<protos
.
google
.
longrunning
.
Operation
,
protos
.
google
.
longrunning
.
GetOperationRequest
,
{}
|
null
|
undefined
> )
:
Promise
< [
protos
.
google
.
longrunning
.
Operation
]>;
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.
request
optionsOrCallback
CallOptions
| Callback
< protos.google.longrunning.Operation
, protos.google.longrunning.GetOperationRequest
, {} | null | undefined>
callback
Callback
< protos.google.longrunning.Operation
, protos.google.longrunning.GetOperationRequest
, {} | null | undefined>
The function which will be called with the result of the API call.
The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.
const
client
=
longrunning
.
operationsClient
();
const
name
=
''
;
const
[
response
]
=
await
client
.
getOperation
({
name
});
// doThingsWith(response)
getProjectId()
getProjectId
()
:
Promise<string>
;
Promise
<string>
getProjectId(callback)
getProjectId
(
callback
:
Callback<string
,
undefined
,
undefined
> )
:
void
;
callback
Callback
<string, undefined, 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.
listBatches(request, options)
listBatches
(
request
?:
protos
.
google
.
cloud
.
dataproc
.
v1
.
IListBatchesRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
cloud
.
dataproc
.
v1
.
IBatch
[],
protos
.
google
.
cloud
.
dataproc
.
v1
.
IListBatchesRequest
|
null
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IListBatchesResponse
]>;
Lists batch workloads.
request
options
Promise
<[ protos.google.cloud.dataproc.v1.IBatch
[], protos.google.cloud.dataproc.v1.IListBatchesRequest
| null, protos.google.cloud.dataproc.v1.IListBatchesResponse
]>
{Promise} - The promise which resolves to an array. The first element of the array is Array of . 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 listBatchesAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
listBatches(request, options, callback)
listBatches
(
request
:
protos
.
google
.
cloud
.
dataproc
.
v1
.
IListBatchesRequest
,
options
:
CallOptions
,
callback
:
PaginationCallback<protos
.
google
.
cloud
.
dataproc
.
v1
.
IListBatchesRequest
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IListBatchesResponse
|
null
|
undefined
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IBatch
> )
:
void
;
request
options
CallOptions
callback
PaginationCallback
< protos.google.cloud.dataproc.v1.IListBatchesRequest
, protos.google.cloud.dataproc.v1.IListBatchesResponse
| null | undefined, protos.google.cloud.dataproc.v1.IBatch
>
void
listBatches(request, callback)
listBatches
(
request
:
protos
.
google
.
cloud
.
dataproc
.
v1
.
IListBatchesRequest
,
callback
:
PaginationCallback<protos
.
google
.
cloud
.
dataproc
.
v1
.
IListBatchesRequest
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IListBatchesResponse
|
null
|
undefined
,
protos
.
google
.
cloud
.
dataproc
.
v1
.
IBatch
> )
:
void
;
request
callback
PaginationCallback
< protos.google.cloud.dataproc.v1.IListBatchesRequest
, protos.google.cloud.dataproc.v1.IListBatchesResponse
| null | undefined, protos.google.cloud.dataproc.v1.IBatch
>
void
listBatchesAsync(request, options)
listBatchesAsync
(
request
?:
protos
.
google
.
cloud
.
dataproc
.
v1
.
IListBatchesRequest
,
options
?:
CallOptions
)
:
AsyncIterable<protos
.
google
.
cloud
.
dataproc
.
v1
.
IBatch
> ;
Equivalent to listBatches
, 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.dataproc.v1.IBatch
>
{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.
/**
* 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 parent, which owns this collection of batches.
*/
// const parent = 'abc123'
/**
* Optional. The maximum number of batches to return in each response.
* The service may return fewer than this value.
* The default page size is 20; the maximum page size is 1000.
*/
// const pageSize = 1234
/**
* Optional. A page token received from a previous `ListBatches` call.
* Provide this token to retrieve the subsequent page.
*/
// const pageToken = 'abc123'
/**
* Optional. A filter for the batches to return in the response.
* A filter is a logical expression constraining the values of various fields
* in each batch resource. Filters are case sensitive, and may contain
* multiple clauses combined with logical operators (AND/OR).
* Supported fields are `batch_id`, `batch_uuid`, `state`, and `create_time`.
* e.g. `state = RUNNING and create_time < "2023-01-01t00:00:00z"`="" *="" filters="" for="" batches="" in="" state="" running="" that="" were="" created="" before="" 2023-01-01="" *="" see="" https://google.aip.dev/assets/misc/ebnf-filtering.txt="" for="" a="" detailed="" *="" description="" of="" the="" filter="" syntax="" and="" a="" list="" of="" supported="" comparisons.="" */
=
""
const
=
""
filter
=
'abc123'
*=
""
*=
""
optional
.
=
""
field
(
s
)
=
""
on
=
""
which
=
""
to
=
""
sort
=
""
the
=
""
list
=
""
of
=
""
batches
.
=
""
*=
""
currently
=
""
the
=
""
only
=
""
supported
=
""
sort
=
""
orders
=
""
are
=
""
unspecified
=
""
(
empty
)
=
""
and
=
""
*=
""
`create_time="" desc`
=
""
to
=
""
sort
=
""
by
=
""
most
=
""
recently
=
""
created
=
""
batches
=
""
first
.
=
""
*=
""
see
=
""
https
:
//google.aip.dev/132#ordering="" for="" more="" details.="" */="" const="" orderby='abc123' imports="" the="" dataproc="" library="" const="" {batchcontrollerclient}="require('@google-cloud/dataproc').v1;" instantiates="" a="" client="" const="" dataprocclient="new" batchcontrollerclient();="" async="" function="" calllistbatches()="" {="" construct="" request="" const="" request="{" parent,="" };="" run="" request="" const="" iterable="dataprocClient.listBatchesAsync(request);" for="" await="" (const="" response="" of="" iterable)="" {="" console.log(response);="" }="" }="" calllistbatches();=""
>
listBatchesStream(request, options)
listBatchesStream
(
request
?:
protos
.
google
.
cloud
.
dataproc
.
v1
.
IListBatchesRequest
,
options
?:
CallOptions
)
:
Transform
;
Equivalent to listBatches
, but returns a NodeJS Stream object.
request
options
Transform
{Stream} An object stream which emits an object representing 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 listBatchesAsync()
method described below for async iteration which you can stop as needed. Please see the documentation
for more details and examples.
listOperationsAsync(request, options)
listOperationsAsync
(
request
:
protos
.
google
.
longrunning
.
ListOperationsRequest
,
options
?:
gax
.
CallOptions
)
:
AsyncIterable<protos
.
google
.
longrunning
.
ListOperationsResponse
> ;
Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED
. Returns an iterable object.
For-await-of syntax is used with the iterable to recursively get response element on-demand.
request
options
CallOptions
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.
AsyncIterable
< protos.google.longrunning.ListOperationsResponse
>
{Object} An iterable Object that conforms to iteration protocols .
const
client
=
longrunning
.
operationsClient
();
for
await
(
const
response
of
client
.
listOperationsAsync
(
request
));
// doThingsWith(response)
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.
matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName)
matchAutoscalingPolicyFromProjectLocationAutoscalingPolicyName
(
projectLocationAutoscalingPolicyName
:
string
)
:
string
|
number
;
Parse the autoscaling_policy from ProjectLocationAutoscalingPolicy resource.
projectLocationAutoscalingPolicyName
string
A fully-qualified path representing project_location_autoscaling_policy resource.
string | number
{string} A string representing the autoscaling_policy.
matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName)
matchAutoscalingPolicyFromProjectRegionAutoscalingPolicyName
(
projectRegionAutoscalingPolicyName
:
string
)
:
string
|
number
;
Parse the autoscaling_policy from ProjectRegionAutoscalingPolicy resource.
projectRegionAutoscalingPolicyName
string
A fully-qualified path representing project_region_autoscaling_policy resource.
string | number
{string} A string representing the autoscaling_policy.
matchBatchFromBatchName(batchName)
matchBatchFromBatchName
(
batchName
:
string
)
:
string
|
number
;
Parse the batch from Batch resource.
batchName
string
A fully-qualified path representing Batch resource.
string | number
{string} A string representing the batch.
matchClusterFromNodeGroupName(nodeGroupName)
matchClusterFromNodeGroupName
(
nodeGroupName
:
string
)
:
string
|
number
;
Parse the cluster from NodeGroup resource.
nodeGroupName
string
A fully-qualified path representing NodeGroup resource.
string | number
{string} A string representing the cluster.
matchLocationFromBatchName(batchName)
matchLocationFromBatchName
(
batchName
:
string
)
:
string
|
number
;
Parse the location from Batch resource.
batchName
string
A fully-qualified path representing Batch 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.
matchLocationFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName)
matchLocationFromProjectLocationAutoscalingPolicyName
(
projectLocationAutoscalingPolicyName
:
string
)
:
string
|
number
;
Parse the location from ProjectLocationAutoscalingPolicy resource.
projectLocationAutoscalingPolicyName
string
A fully-qualified path representing project_location_autoscaling_policy resource.
string | number
{string} A string representing the location.
matchLocationFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName)
matchLocationFromProjectLocationWorkflowTemplateName
(
projectLocationWorkflowTemplateName
:
string
)
:
string
|
number
;
Parse the location from ProjectLocationWorkflowTemplate resource.
projectLocationWorkflowTemplateName
string
A fully-qualified path representing project_location_workflow_template resource.
string | number
{string} A string representing the location.
matchLocationFromSessionName(sessionName)
matchLocationFromSessionName
(
sessionName
:
string
)
:
string
|
number
;
Parse the location from Session resource.
sessionName
string
A fully-qualified path representing Session resource.
string | number
{string} A string representing the location.
matchLocationFromSessionTemplateName(sessionTemplateName)
matchLocationFromSessionTemplateName
(
sessionTemplateName
:
string
)
:
string
|
number
;
Parse the location from SessionTemplate resource.
sessionTemplateName
string
A fully-qualified path representing SessionTemplate resource.
string | number
{string} A string representing the location.
matchNodeGroupFromNodeGroupName(nodeGroupName)
matchNodeGroupFromNodeGroupName
(
nodeGroupName
:
string
)
:
string
|
number
;
Parse the node_group from NodeGroup resource.
nodeGroupName
string
A fully-qualified path representing NodeGroup resource.
string | number
{string} A string representing the node_group.
matchProjectFromBatchName(batchName)
matchProjectFromBatchName
(
batchName
:
string
)
:
string
|
number
;
Parse the project from Batch resource.
batchName
string
A fully-qualified path representing Batch 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.
matchProjectFromNodeGroupName(nodeGroupName)
matchProjectFromNodeGroupName
(
nodeGroupName
:
string
)
:
string
|
number
;
Parse the project from NodeGroup resource.
nodeGroupName
string
A fully-qualified path representing NodeGroup resource.
string | number
{string} A string representing the project.
matchProjectFromProjectLocationAutoscalingPolicyName(projectLocationAutoscalingPolicyName)
matchProjectFromProjectLocationAutoscalingPolicyName
(
projectLocationAutoscalingPolicyName
:
string
)
:
string
|
number
;
Parse the project from ProjectLocationAutoscalingPolicy resource.
projectLocationAutoscalingPolicyName
string
A fully-qualified path representing project_location_autoscaling_policy resource.
string | number
{string} A string representing the project.
matchProjectFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName)
matchProjectFromProjectLocationWorkflowTemplateName
(
projectLocationWorkflowTemplateName
:
string
)
:
string
|
number
;
Parse the project from ProjectLocationWorkflowTemplate resource.
projectLocationWorkflowTemplateName
string
A fully-qualified path representing project_location_workflow_template 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.
matchProjectFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName)
matchProjectFromProjectRegionAutoscalingPolicyName
(
projectRegionAutoscalingPolicyName
:
string
)
:
string
|
number
;
Parse the project from ProjectRegionAutoscalingPolicy resource.
projectRegionAutoscalingPolicyName
string
A fully-qualified path representing project_region_autoscaling_policy resource.
string | number
{string} A string representing the project.
matchProjectFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName)
matchProjectFromProjectRegionWorkflowTemplateName
(
projectRegionWorkflowTemplateName
:
string
)
:
string
|
number
;
Parse the project from ProjectRegionWorkflowTemplate resource.
projectRegionWorkflowTemplateName
string
A fully-qualified path representing project_region_workflow_template resource.
string | number
{string} A string representing the project.
matchProjectFromSessionName(sessionName)
matchProjectFromSessionName
(
sessionName
:
string
)
:
string
|
number
;
Parse the project from Session resource.
sessionName
string
A fully-qualified path representing Session resource.
string | number
{string} A string representing the project.
matchProjectFromSessionTemplateName(sessionTemplateName)
matchProjectFromSessionTemplateName
(
sessionTemplateName
:
string
)
:
string
|
number
;
Parse the project from SessionTemplate resource.
sessionTemplateName
string
A fully-qualified path representing SessionTemplate resource.
string | number
{string} A string representing the project.
matchRegionFromNodeGroupName(nodeGroupName)
matchRegionFromNodeGroupName
(
nodeGroupName
:
string
)
:
string
|
number
;
Parse the region from NodeGroup resource.
nodeGroupName
string
A fully-qualified path representing NodeGroup resource.
string | number
{string} A string representing the region.
matchRegionFromProjectRegionAutoscalingPolicyName(projectRegionAutoscalingPolicyName)
matchRegionFromProjectRegionAutoscalingPolicyName
(
projectRegionAutoscalingPolicyName
:
string
)
:
string
|
number
;
Parse the region from ProjectRegionAutoscalingPolicy resource.
projectRegionAutoscalingPolicyName
string
A fully-qualified path representing project_region_autoscaling_policy resource.
string | number
{string} A string representing the region.
matchRegionFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName)
matchRegionFromProjectRegionWorkflowTemplateName
(
projectRegionWorkflowTemplateName
:
string
)
:
string
|
number
;
Parse the region from ProjectRegionWorkflowTemplate resource.
projectRegionWorkflowTemplateName
string
A fully-qualified path representing project_region_workflow_template resource.
string | number
{string} A string representing the region.
matchSessionFromSessionName(sessionName)
matchSessionFromSessionName
(
sessionName
:
string
)
:
string
|
number
;
Parse the session from Session resource.
sessionName
string
A fully-qualified path representing Session resource.
string | number
{string} A string representing the session.
matchTemplateFromSessionTemplateName(sessionTemplateName)
matchTemplateFromSessionTemplateName
(
sessionTemplateName
:
string
)
:
string
|
number
;
Parse the template from SessionTemplate resource.
sessionTemplateName
string
A fully-qualified path representing SessionTemplate resource.
string | number
{string} A string representing the template.
matchWorkflowTemplateFromProjectLocationWorkflowTemplateName(projectLocationWorkflowTemplateName)
matchWorkflowTemplateFromProjectLocationWorkflowTemplateName
(
projectLocationWorkflowTemplateName
:
string
)
:
string
|
number
;
Parse the workflow_template from ProjectLocationWorkflowTemplate resource.
projectLocationWorkflowTemplateName
string
A fully-qualified path representing project_location_workflow_template resource.
string | number
{string} A string representing the workflow_template.
matchWorkflowTemplateFromProjectRegionWorkflowTemplateName(projectRegionWorkflowTemplateName)
matchWorkflowTemplateFromProjectRegionWorkflowTemplateName
(
projectRegionWorkflowTemplateName
:
string
)
:
string
|
number
;
Parse the workflow_template from ProjectRegionWorkflowTemplate resource.
projectRegionWorkflowTemplateName
string
A fully-qualified path representing project_region_workflow_template resource.
string | number
{string} A string representing the workflow_template.
nodeGroupPath(project, region, cluster, nodeGroup)
nodeGroupPath
(
project
:
string
,
region
:
string
,
cluster
:
string
,
nodeGroup
:
string
)
:
string
;
Return a fully-qualified nodeGroup resource name string.
project
string
region
string
cluster
string
nodeGroup
string
string
{string} Resource name string.
projectLocationAutoscalingPolicyPath(project, location, autoscalingPolicy)
projectLocationAutoscalingPolicyPath
(
project
:
string
,
location
:
string
,
autoscalingPolicy
:
string
)
:
string
;
Return a fully-qualified projectLocationAutoscalingPolicy resource name string.
project
string
location
string
autoscalingPolicy
string
string
{string} Resource name string.
projectLocationWorkflowTemplatePath(project, location, workflowTemplate)
projectLocationWorkflowTemplatePath
(
project
:
string
,
location
:
string
,
workflowTemplate
:
string
)
:
string
;
Return a fully-qualified projectLocationWorkflowTemplate resource name string.
project
string
location
string
workflowTemplate
string
string
{string} Resource name string.
projectPath(project)
projectPath
(
project
:
string
)
:
string
;
Return a fully-qualified project resource name string.
project
string
string
{string} Resource name string.
projectRegionAutoscalingPolicyPath(project, region, autoscalingPolicy)
projectRegionAutoscalingPolicyPath
(
project
:
string
,
region
:
string
,
autoscalingPolicy
:
string
)
:
string
;
Return a fully-qualified projectRegionAutoscalingPolicy resource name string.
project
string
region
string
autoscalingPolicy
string
string
{string} Resource name string.
projectRegionWorkflowTemplatePath(project, region, workflowTemplate)
projectRegionWorkflowTemplatePath
(
project
:
string
,
region
:
string
,
workflowTemplate
:
string
)
:
string
;
Return a fully-qualified projectRegionWorkflowTemplate resource name string.
project
string
region
string
workflowTemplate
string
string
{string} Resource name string.
sessionPath(project, location, session)
sessionPath
(
project
:
string
,
location
:
string
,
session
:
string
)
:
string
;
Return a fully-qualified session resource name string.
project
string
location
string
session
string
string
{string} Resource name string.
sessionTemplatePath(project, location, template)
sessionTemplatePath
(
project
:
string
,
location
:
string
,
template
:
string
)
:
string
;
Return a fully-qualified sessionTemplate resource name string.
project
string
location
string
template
string
string
{string} Resource name string.
setIamPolicy(request, options, callback)
setIamPolicy
(
request
:
IamProtos
.
google
.
iam
.
v1
.
SetIamPolicyRequest
,
options
?:
gax
.
CallOptions
|
Callback<IamProtos
.
google
.
iam
.
v1
.
Policy
,
IamProtos
.
google
.
iam
.
v1
.
SetIamPolicyRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> ,
callback
?:
Callback<IamProtos
.
google
.
iam
.
v1
.
Policy
,
IamProtos
.
google
.
iam
.
v1
.
SetIamPolicyRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
Promise
< [
IamProtos
.
google
.
iam
.
v1
.
Policy
]>;
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
request
IamProtos.google.iam.v1.SetIamPolicyRequest
The request object that will be sent.
options
CallOptions
| Callback
< google.iam.v1.Policy
, google.iam.v1.SetIamPolicyRequest
| null | undefined, {} | null | undefined>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.
callback
Callback
< google.iam.v1.Policy
, google.iam.v1.SetIamPolicyRequest
| null | undefined, {} | null | undefined>
The function which will be called with the result of the API call.
The second parameter to the callback is an object representing .
Promise
<[ google.iam.v1.Policy
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.
testIamPermissions(request, options, callback)
testIamPermissions
(
request
:
IamProtos
.
google
.
iam
.
v1
.
TestIamPermissionsRequest
,
options
?:
gax
.
CallOptions
|
Callback<IamProtos
.
google
.
iam
.
v1
.
TestIamPermissionsResponse
,
IamProtos
.
google
.
iam
.
v1
.
TestIamPermissionsRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> ,
callback
?:
Callback<IamProtos
.
google
.
iam
.
v1
.
TestIamPermissionsResponse
,
IamProtos
.
google
.
iam
.
v1
.
TestIamPermissionsRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
Promise
< [
IamProtos
.
google
.
iam
.
v1
.
TestIamPermissionsResponse
]>;
Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.
request
IamProtos.google.iam.v1.TestIamPermissionsRequest
The request object that will be sent.
options
CallOptions
| Callback
< google.iam.v1.TestIamPermissionsResponse
, google.iam.v1.TestIamPermissionsRequest
| null | undefined, {} | null | undefined>
Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.
callback
Callback
< google.iam.v1.TestIamPermissionsResponse
, google.iam.v1.TestIamPermissionsRequest
| null | undefined, {} | null | undefined>
The function which will be called with the result of the API call.
The second parameter to the callback is an object representing .
Promise
<[ google.iam.v1.TestIamPermissionsResponse
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.