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 component is in Java SimpleDateFormat (yyyy-MM-ddTHH-mm-ssZ).
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.
The Status of the forecast export job must be ACTIVE before you can access the forecast in your Amazon S3 bucket. To get the status, use the DescribeWhatIfForecastExport operation.
Parameters:
-
what_if_forecast_export_name
(Name)
–
The name of the what-if forecast to export.
-
what_if_forecast_arns
(WhatIfForecastArnListForExport)
–
The list of what-if forecast Amazon Resource Names (ARNs) to export.
-
destination
(DataDestination)
–
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.
-
tags
(Optional[Tags], default:
None
)
–
A list of tags to apply to the what if forecast.
-
format
(Optional[Format], default:
None
)
–
The format of the exported data, CSV or PARQUET.
Raises:
Source code in docs_src/capo_forecast/_services/async_forecast.py
| async def create_what_if_forecast_export(
self,
what_if_forecast_export_name: "capo_forecast.types.name.Name",
what_if_forecast_arns: "capo_forecast.types.what_if_forecast_arn_list_for_export.WhatIfForecastArnListForExport",
destination: "capo_forecast.types.data_destination.DataDestination",
*,
config_overrides: Optional[AsyncforecastClientConfig] = None,
tags: Optional["capo_forecast.types.tags.Tags"] = None,
format: Optional["capo_forecast.types.format.Format"] = None,
) -> "capo_forecast.types.create_what_if_forecast_export_response.CreateWhatIfForecastExportResponse":
"""<p>Exports a forecast created by the <a>CreateWhatIfForecast</a> operation to your Amazon Simple Storage Service (Amazon S3) bucket. The forecast file name will match the following conventions:</p> <p> <code>≈<ForecastExportJobName>_<ExportTimestamp>_<PartNumber></code> </p> <p>The <ExportTimestamp> component is in Java SimpleDateFormat (yyyy-MM-ddTHH-mm-ssZ).</p> <p>You must specify a <a>DataDestination</a> 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 <a>aws-forecast-iam-roles</a>.</p> <p>For more information, see <a>howitworks-forecast</a>.</p> <p>To get a list of all your what-if forecast export jobs, use the <a>ListWhatIfForecastExports</a> operation.</p> <note> <p>The <code>Status</code> of the forecast export job must be <code>ACTIVE</code> before you can access the forecast in your Amazon S3 bucket. To get the status, use the <a>DescribeWhatIfForecastExport</a> operation.</p> </note>
Args:
what_if_forecast_export_name: <p>The name of the what-if forecast to export.</p>
what_if_forecast_arns: <p>The list of what-if forecast Amazon Resource Names (ARNs) to export.</p>
destination: <p>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.</p> <p>If encryption is used, <code>Destination</code> must include an Key Management Service (KMS) key. The IAM role must allow Amazon Forecast permission to access the key.</p>
tags: <p>A list of <a href="https://docs.aws.amazon.com/forecast/latest/dg/tagging-forecast-resources.html">tags</a> to apply to the what if forecast.</p>
format: <p>The format of the exported data, CSV or PARQUET.</p>
Raises:
capo_forecast.errors.invalid_input_exception.InvalidInputException: <p>We can't process the request because it includes an invalid value or a value that exceeds the valid range.</p>
capo_forecast.errors.limit_exceeded_exception.LimitExceededException: <p>The limit on the number of resources per account has been exceeded.</p>
capo_forecast.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>There is already a resource with this name. Try again with a different name.</p>
capo_forecast.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource is in use.</p>
capo_forecast.errors.resource_not_found_exception.ResourceNotFoundException: <p>We can't find a resource with that Amazon Resource Name (ARN). Check the ARN and try again.</p>
capo_forecast.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_forecast.types.create_what_if_forecast_export_request.CreateWhatIfForecastExportRequest]",
) -> AsyncOperationResponse[
"capo_forecast.types.create_what_if_forecast_export_response.CreateWhatIfForecastExportResponse"
]:
import capo_forecast._operations.amazon_forecast.create_what_if_forecast_export
(
output,
http_response,
) = await capo_forecast._operations.amazon_forecast.create_what_if_forecast_export.async_create_what_if_forecast_export(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_forecast.types.create_what_if_forecast_export_request.CreateWhatIfForecastExportRequest",
) -> dict[str, Any]:
import capo_forecast.types.create_what_if_forecast_export_request
return capo_forecast.types.create_what_if_forecast_export_request.redact_sensitive(
input_
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("CreateWhatIfForecastExport", redact_input=_redact_input),
)
input_: capo_forecast.types.create_what_if_forecast_export_request.CreateWhatIfForecastExportRequest = {
"what_if_forecast_export_name": what_if_forecast_export_name,
"what_if_forecast_arns": what_if_forecast_arns,
"destination": destination,
}
if tags is not None:
input_["tags"] = tags
if format is not None:
input_["format"] = format
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|