Skip to content

list_what_if_forecasts

list_what_if_forecasts(
    *,
    config_overrides: Optional[forecastClientConfig] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
    filters: Optional[Filters] = None,
) -> ListWhatIfForecastsResponse

Returns a list of what-if forecasts created using the CreateWhatIfForecast operation. For each what-if forecast, this operation returns a summary of its properties, including its Amazon Resource Name (ARN). You can retrieve the complete set of properties by using the what-if forecast ARN with the DescribeWhatIfForecast operation.

Parameters:

  • next_token (Optional[NextToken], default: None ) –

    If the result of the previous request was truncated, the response includes a NextToken. To retrieve the next set of results, use the token in the next request. Tokens expire after 24 hours.

  • max_results (Optional[MaxResults], default: None ) –

    The number of items to return in the response.

  • filters (Optional[Filters], default: None ) –

    An array of filters. For each filter, you provide a condition and a match statement. The condition is either IS or IS_NOT, which specifies whether to include or exclude the what-if forecast export jobs that match the statement from the list, respectively. The match statement consists of a key and a value.

    Filter properties

    • Condition - The condition to apply. Valid values are IS and IS_NOT. To include the forecast export jobs that match the statement, specify IS. To exclude matching forecast export jobs, specify IS_NOT.

    • Key - The name of the parameter to filter on. Valid values are WhatIfForecastArn and Status.

    • Value - The value to match.

    For example, to list all jobs that export a forecast named electricityWhatIfForecast, specify the following filter:

    "Filters": [ { "Condition": "IS", "Key": "WhatIfForecastArn", "Value": "arn:aws:forecast:us-west-2::forecast/electricityWhatIfForecast" } ]

Raises:

Source code in docs_src/capo_forecast/_services/forecast.py
def list_what_if_forecasts(
    self,
    *,
    config_overrides: Optional[forecastClientConfig] = None,
    next_token: Optional["capo_forecast.types.next_token.NextToken"] = None,
    max_results: Optional["capo_forecast.types.max_results.MaxResults"] = None,
    filters: Optional["capo_forecast.types.filters.Filters"] = None,
) -> "capo_forecast.types.list_what_if_forecasts_response.ListWhatIfForecastsResponse":
    """<p>Returns a list of what-if forecasts created using the <a>CreateWhatIfForecast</a> operation. For each what-if forecast, this operation returns a summary of its properties, including its Amazon Resource Name (ARN). You can retrieve the complete set of properties by using the what-if forecast ARN with the <a>DescribeWhatIfForecast</a> operation.</p>

    Args:
        next_token: <p>If the result of the previous request was truncated, the response includes a <code>NextToken</code>. To retrieve the next set of results, use the token in the next request. Tokens expire after 24 hours.</p>
        max_results: <p>The number of items to return in the response.</p>
        filters: <p>An array of filters. For each filter, you provide a condition and a match statement. The condition is either <code>IS</code> or <code>IS_NOT</code>, which specifies whether to include or exclude the what-if forecast export jobs that match the statement from the list, respectively. The match statement consists of a key and a value.</p> <p> <b>Filter properties</b> </p> <ul> <li> <p> <code>Condition</code> - The condition to apply. Valid values are <code>IS</code> and <code>IS_NOT</code>. To include the forecast export jobs that match the statement, specify <code>IS</code>. To exclude matching forecast export jobs, specify <code>IS_NOT</code>.</p> </li> <li> <p> <code>Key</code> - The name of the parameter to filter on. Valid values are <code>WhatIfForecastArn</code> and <code>Status</code>.</p> </li> <li> <p> <code>Value</code> - The value to match.</p> </li> </ul> <p>For example, to list all jobs that export a forecast named <i>electricityWhatIfForecast</i>, specify the following filter:</p> <p> <code>"Filters": [ { "Condition": "IS", "Key": "WhatIfForecastArn", "Value": "arn:aws:forecast:us-west-2:<acct-id>:forecast/electricityWhatIfForecast" } ]</code> </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.invalid_next_token_exception.InvalidNextTokenException: <p>The token is not valid. Tokens expire after 24 hours.</p>
        capo_forecast.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_forecast.types.list_what_if_forecasts_request.ListWhatIfForecastsRequest]",
    ) -> OperationResponse[
        "capo_forecast.types.list_what_if_forecasts_response.ListWhatIfForecastsResponse"
    ]:
        import capo_forecast._operations.amazon_forecast.list_what_if_forecasts

        output, http_response = (
            capo_forecast._operations.amazon_forecast.list_what_if_forecasts.list_what_if_forecasts(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListWhatIfForecasts")
    )
    input_: capo_forecast.types.list_what_if_forecasts_request.ListWhatIfForecastsRequest = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if filters is not None:
        input_["filters"] = filters

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output