create method
Creates a batch job.
request
- The metadata request object.
Request parameters:
parent
- Required. Value for parent.
Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$
.
jobId
- Required. The optional job_id
for this Job . If not specified,
an id is generated. job_id
should be no more than 128 characters and
must include only characters available in DNS names, as defined by
RFC-1123.
requestId
- Optional. An optional request ID to identify requests.
Specify a unique request ID in case you need to retry your request.
Requests with same request_id
will be ignored for at least 60 minutes
since the first request. The request ID must be a valid UUID with the
exception that zero UUID is not supported
(00000000-0000-0000-0000-000000000000).
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Operation.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<Operation> create(
Job request,
core.String parent, {
core.String? jobId,
core.String? requestId,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (jobId != null) 'jobId': [jobId],
if (requestId != null) 'requestId': [requestId],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/jobs';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}