createNotebook method

Future<CreateNotebookOutput> createNotebook({
  1. required String name,
  2. required String workGroup,
  3. String? clientRequestToken,
})

Creates an empty ipynb file in the specified Apache Spark enabled workgroup. Throws an error if a file in the workgroup with the same name already exists.

May throw InternalServerException. May throw InvalidRequestException. May throw TooManyRequestsException.

Parameter name : The name of the ipynb file to be created in the Spark workgroup, without the .ipynb extension.

Parameter workGroup : The name of the Spark enabled workgroup in which the notebook will be created.

Parameter clientRequestToken : A unique case-sensitive string used to ensure the request to create the notebook is idempotent (executes only once).

Implementation

Future<CreateNotebookOutput> createNotebook({
  required String name,
  required String workGroup,
  String? clientRequestToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonAthena.CreateNotebook'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      'WorkGroup': workGroup,
      if (clientRequestToken != null)
        'ClientRequestToken': clientRequestToken,
    },
  );

  return CreateNotebookOutput.fromJson(jsonResponse.body);
}