create method
Create an interactive session asynchronously.
request
- The metadata request object.
Request parameters:
parent
- Required. The parent resource where this session will be
created.
Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+$
.
requestId
- Optional. A unique ID used to identify the request. If the
service receives two CreateSessionRequests
(https://cloud.google.com/dataproc/docs/reference/rpc/google.cloud.dataproc.v1#google.cloud.dataproc.v1.CreateSessionRequest)s
with the same ID, the second request is ignored, and the first Session is
created and stored in the backend.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.
sessionId
- Required. The ID to use for the session, which becomes the
final component of the session's resource name.This value must be 4-63
characters. Valid characters are /a-z-/.
$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(
Session request,
core.String parent, {
core.String? requestId,
core.String? sessionId,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (requestId != null) 'requestId': [requestId],
if (sessionId != null) 'sessionId': [sessionId],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/sessions';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Operation.fromJson(response_ as core.Map<core.String, core.dynamic>);
}