startSession method
Creates and starts a new session on the specified application. The
application must be in the STARTED state or have
AutoStart enabled, and have interactive sessions enabled.
This operation is supported for EMR release 7.13.0 and later.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ValidationException.
Parameter applicationId :
The ID of the application on which to start the session.
Parameter executionRoleArn :
The execution role ARN for the session. Amazon EMR Serverless uses this
role to access Amazon Web Services resources on your behalf during session
execution.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request. If you retry a request that completed
successfully using the same client token, the server returns the
successful response without performing the operation again.
Parameter configurationOverrides :
The configuration overrides for the session. Only runtime configuration
overrides are supported.
Parameter idleTimeoutMinutes :
The idle timeout in minutes for the session. After the session remains
idle for this duration, Amazon EMR Serverless automatically terminates it.
Parameter name :
The optional name for the session.
Parameter tags :
The tags to assign to the session.
Implementation
Future<StartSessionResponse> startSession({
required String applicationId,
required String executionRoleArn,
String? clientToken,
SessionConfigurationOverrides? configurationOverrides,
int? idleTimeoutMinutes,
String? name,
Map<String, String>? tags,
}) async {
_s.validateNumRange(
'idleTimeoutMinutes',
idleTimeoutMinutes,
0,
1000000,
);
final $payload = <String, dynamic>{
'executionRoleArn': executionRoleArn,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (configurationOverrides != null)
'configurationOverrides': configurationOverrides,
if (idleTimeoutMinutes != null) 'idleTimeoutMinutes': idleTimeoutMinutes,
if (name != null) 'name': name,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri:
'/applications/${Uri.encodeComponent(applicationId)}/sessions',
exceptionFnMap: _exceptionFns,
);
return StartSessionResponse.fromJson(response);
}