startSession method

Future<StartSessionResponse> startSession({
  1. required EngineConfiguration engineConfiguration,
  2. required String workGroup,
  3. String? clientRequestToken,
  4. bool? copyWorkGroupTags,
  5. String? description,
  6. String? executionRole,
  7. MonitoringConfiguration? monitoringConfiguration,
  8. String? notebookVersion,
  9. int? sessionIdleTimeoutInMinutes,
  10. List<Tag>? tags,
})

Creates a session for running calculations within a workgroup. The session is ready when it reaches an IDLE state.

May throw InternalServerException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw SessionAlreadyExistsException. May throw TooManyRequestsException.

Parameter engineConfiguration : Contains engine data processing unit (DPU) configuration settings and parameter mappings.

Parameter workGroup : The workgroup to which the session belongs.

Parameter clientRequestToken : A unique case-sensitive string used to ensure the request to create the session is idempotent (executes only once). If another StartSessionRequest is received, the same response is returned and another session is not created. If a parameter has changed, an error is returned.

Parameter copyWorkGroupTags : Copies the tags from the Workgroup to the Session when.

Parameter description : The session description.

Parameter executionRole : The ARN of the execution role used to access user resources for Spark sessions and Identity Center enabled workgroups. This property applies only to Spark enabled workgroups and Identity Center enabled workgroups.

Parameter monitoringConfiguration : Contains the configuration settings for managed log persistence, delivering logs to Amazon S3 buckets, Amazon CloudWatch log groups etc.

Parameter notebookVersion : The notebook version. This value is supplied automatically for notebook sessions in the Athena console and is not required for programmatic session access. The only valid notebook version is Athena notebook version 1. If you specify a value for NotebookVersion, you must also specify a value for NotebookId. See EngineConfiguration$AdditionalConfigs.

Parameter sessionIdleTimeoutInMinutes : The idle timeout in minutes for the session.

Parameter tags : A list of comma separated tags to add to the session that is created.

Implementation

Future<StartSessionResponse> startSession({
  required EngineConfiguration engineConfiguration,
  required String workGroup,
  String? clientRequestToken,
  bool? copyWorkGroupTags,
  String? description,
  String? executionRole,
  MonitoringConfiguration? monitoringConfiguration,
  String? notebookVersion,
  int? sessionIdleTimeoutInMinutes,
  List<Tag>? tags,
}) async {
  _s.validateNumRange(
    'sessionIdleTimeoutInMinutes',
    sessionIdleTimeoutInMinutes,
    1,
    480,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonAthena.StartSession'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'EngineConfiguration': engineConfiguration,
      'WorkGroup': workGroup,
      if (clientRequestToken != null)
        'ClientRequestToken': clientRequestToken,
      if (copyWorkGroupTags != null) 'CopyWorkGroupTags': copyWorkGroupTags,
      if (description != null) 'Description': description,
      if (executionRole != null) 'ExecutionRole': executionRole,
      if (monitoringConfiguration != null)
        'MonitoringConfiguration': monitoringConfiguration,
      if (notebookVersion != null) 'NotebookVersion': notebookVersion,
      if (sessionIdleTimeoutInMinutes != null)
        'SessionIdleTimeoutInMinutes': sessionIdleTimeoutInMinutes,
      if (tags != null) 'Tags': tags,
    },
  );

  return StartSessionResponse.fromJson(jsonResponse.body);
}