importNotebook method

Future<ImportNotebookOutput> importNotebook({
  1. required String name,
  2. required NotebookType type,
  3. required String workGroup,
  4. String? clientRequestToken,
  5. String? notebookS3LocationUri,
  6. String? payload,
})

Imports a single ipynb file to a Spark enabled workgroup. To import the notebook, the request must specify a value for either Payload or NoteBookS3LocationUri. If neither is specified or both are specified, an InvalidRequestException occurs. The maximum file size that can be imported is 10 megabytes. If an ipynb file with the same name already exists in the workgroup, throws an error.

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

Parameter name : The name of the notebook to import.

Parameter type : The notebook content type. Currently, the only valid type is IPYNB.

Parameter workGroup : The name of the Spark enabled workgroup to import the notebook to.

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

Parameter notebookS3LocationUri : A URI that specifies the Amazon S3 location of a notebook file in ipynb format.

Parameter payload : The notebook content to be imported. The payload must be in ipynb format.

Implementation

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

  return ImportNotebookOutput.fromJson(jsonResponse.body);
}