createWhatIfForecastExport method

Future<CreateWhatIfForecastExportResponse> createWhatIfForecastExport({
  1. required DataDestination destination,
  2. required List<String> whatIfForecastArns,
  3. required String whatIfForecastExportName,
  4. String? format,
  5. List<Tag>? tags,
})

Exports a forecast created by the CreateWhatIfForecast operation to your Amazon Simple Storage Service (Amazon S3) bucket. The forecast file name will match the following conventions:

The

You must specify a DataDestination object that includes an Identity and Access Management (IAM) role that Amazon Forecast can assume to access the Amazon S3 bucket. For more information, see aws-forecast-iam-roles.

For more information, see howitworks-forecast.

To get a list of all your what-if forecast export jobs, use the ListWhatIfForecastExports operation.

May throw InvalidInputException. May throw LimitExceededException. May throw ResourceAlreadyExistsException. May throw ResourceInUseException. May throw ResourceNotFoundException.

Parameter destination : The location where you want to save the forecast and an Identity and Access Management (IAM) role that Amazon Forecast can assume to access the location. The forecast must be exported to an Amazon S3 bucket.

If encryption is used, Destination must include an Key Management Service (KMS) key. The IAM role must allow Amazon Forecast permission to access the key.

Parameter whatIfForecastArns : The list of what-if forecast Amazon Resource Names (ARNs) to export.

Parameter whatIfForecastExportName : The name of the what-if forecast to export.

Parameter format : The format of the exported data, CSV or PARQUET.

Parameter tags : A list of tags to apply to the what if forecast.

Implementation

Future<CreateWhatIfForecastExportResponse> createWhatIfForecastExport({
  required DataDestination destination,
  required List<String> whatIfForecastArns,
  required String whatIfForecastExportName,
  String? format,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonForecast.CreateWhatIfForecastExport'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Destination': destination,
      'WhatIfForecastArns': whatIfForecastArns,
      'WhatIfForecastExportName': whatIfForecastExportName,
      if (format != null) 'Format': format,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateWhatIfForecastExportResponse.fromJson(jsonResponse.body);
}