create method
Creates a new workflow.
If a workflow with the specified name already exists in the specified project and location, the long running operation returns a ALREADY_EXISTS error.
request
- The metadata request object.
Request parameters:
parent
- Required. Project and location in which the workflow should be
created. Format: projects/{project}/locations/{location}
Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$
.
workflowId
- Required. The ID of the workflow to be created. It has to
fulfill the following requirements: * Must contain only letters, numbers,
underscores and hyphens. * Must start with a letter. * Must be between
1-64 characters. * Must end with a number or a letter. * Must be unique
within the customer project and location.
$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(
Workflow request,
core.String parent, {
core.String? workflowId,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (workflowId != null) 'workflowId': [workflowId],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/workflows';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}