create method
Creates a node group in a cluster.
The returned Operation.metadata is NodeGroupOperationMetadata (https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#nodegroupoperationmetadata).
request
- The metadata request object.
Request parameters:
parent
- Required. The parent resource where this node group will be
created. Format: projects/{project}/regions/{region}/clusters/{cluster}
Value must have pattern
^projects/\[^/\]+/regions/\[^/\]+/clusters/\[^/\]+$
.
nodeGroupId
- Optional. An optional node group ID. Generated if not
specified.The ID must contain only letters (a-z, A-Z), numbers (0-9),
underscores (_), and hyphens (-). Cannot begin or end with underscore or
hyphen. Must consist of from 3 to 33 characters.
parentOperationId
- Optional. operation id of the parent operation
sending the create request
requestId
- Optional. A unique ID used to identify the request. If the
server receives two CreateNodeGroupRequest
(https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateNodeGroupRequest)
with the same ID, the second request is ignored and the first
google.longrunning.Operation created and stored in the backend is
returned.Recommendation: Set this value to a UUID
(https://en.wikipedia.org/wiki/Universally_unique_identifier).The ID must
contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and
hyphens (-). The maximum length is 40 characters.
$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(
NodeGroup request,
core.String parent, {
core.String? nodeGroupId,
core.String? parentOperationId,
core.String? requestId,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (nodeGroupId != null) 'nodeGroupId': [nodeGroupId],
if (parentOperationId != null) 'parentOperationId': [parentOperationId],
if (requestId != null) 'requestId': [requestId],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/nodeGroups';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}