startSession method
Creates and starts a new Spark Connect session on the specified cluster.
The cluster must be in the RUNNING or WAITING
state and have sessions enabled. This operation is supported in Amazon EMR
Spark 8.0.0 and later.
May throw InternalServerException.
May throw InvalidRequestException.
Parameter clusterId :
The ID of the cluster on which to start the session.
Parameter clientRequestToken :
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 request token, the service returns the
original response without performing the operation again.
Parameter engineConfigurations :
The configuration overrides for the session. Only runtime configuration
overrides are supported.
Parameter executionRoleArn :
The execution role ARN for the session. Amazon EMR uses this role to
access Amazon Web Services resources on your behalf during session
execution.
Parameter monitoringConfiguration :
The monitoring configuration that controls where session logs are
published, such as Amazon S3, CloudWatch, or managed logging.
Parameter name :
An optional name for the session.
Parameter sessionIdleTimeoutInMinutes :
The idle timeout, in minutes. If the session is idle for this duration,
Amazon EMR EC2 automatically terminates it.
Parameter tags :
The tags to assign to the session.
Implementation
Future<StartSessionOutput> startSession({
required String clusterId,
String? clientRequestToken,
List<Configuration>? engineConfigurations,
String? executionRoleArn,
SessionMonitoringConfiguration? monitoringConfiguration,
String? name,
int? sessionIdleTimeoutInMinutes,
List<Tag>? tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'ElasticMapReduce.StartSession'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ClusterId': clusterId,
if (clientRequestToken != null)
'ClientRequestToken': clientRequestToken,
if (engineConfigurations != null)
'EngineConfigurations': engineConfigurations,
if (executionRoleArn != null) 'ExecutionRoleArn': executionRoleArn,
if (monitoringConfiguration != null)
'MonitoringConfiguration': monitoringConfiguration,
if (name != null) 'Name': name,
if (sessionIdleTimeoutInMinutes != null)
'SessionIdleTimeoutInMinutes': sessionIdleTimeoutInMinutes,
if (tags != null) 'Tags': tags,
},
);
return StartSessionOutput.fromJson(jsonResponse.body);
}