Skip to content

stop_resource

stop_resource(
    resource_arn: Arn, *, config_overrides: Optional[forecastClientConfig] = None
) -> None

Stops a resource.

The resource undergoes the following states: CREATE_STOPPING and CREATE_STOPPED. You cannot resume a resource once it has been stopped.

This operation can be applied to the following resources (and their corresponding child resources):

  • Dataset Import Job

  • Predictor Job

  • Forecast Job

  • Forecast Export Job

  • Predictor Backtest Export Job

  • Explainability Job

  • Explainability Export Job

Parameters:

  • resource_arn (Arn) –

    The Amazon Resource Name (ARN) that identifies the resource to stop. The supported ARNs are DatasetImportJobArn, PredictorArn, PredictorBacktestExportJobArn, ForecastArn, ForecastExportJobArn, ExplainabilityArn, and ExplainabilityExportArn.

Raises:

  • InvalidInputException –

    We can't process the request because it includes an invalid value or a value that exceeds the valid range.

  • LimitExceededException –

    The limit on the number of resources per account has been exceeded.

  • ResourceNotFoundException –

    We can't find a resource with that Amazon Resource Name (ARN). Check the ARN and try again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_forecast/_services/forecast.py
def stop_resource(
    self,
    resource_arn: "capo_forecast.types.arn.Arn",
    *,
    config_overrides: Optional[forecastClientConfig] = None,
) -> None:
    """<p>Stops a resource.</p> <p>The resource undergoes the following states: <code>CREATE_STOPPING</code> and <code>CREATE_STOPPED</code>. You cannot resume a resource once it has been stopped.</p> <p>This operation can be applied to the following resources (and their corresponding child resources):</p> <ul> <li> <p>Dataset Import Job</p> </li> <li> <p>Predictor Job</p> </li> <li> <p>Forecast Job</p> </li> <li> <p>Forecast Export Job</p> </li> <li> <p>Predictor Backtest Export Job</p> </li> <li> <p>Explainability Job</p> </li> <li> <p>Explainability Export Job</p> </li> </ul>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) that identifies the resource to stop. The supported ARNs are <code>DatasetImportJobArn</code>, <code>PredictorArn</code>, <code>PredictorBacktestExportJobArn</code>, <code>ForecastArn</code>, <code>ForecastExportJobArn</code>, <code>ExplainabilityArn</code>, and <code>ExplainabilityExportArn</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.limit_exceeded_exception.LimitExceededException: <p>The limit on the number of resources per account has been exceeded.</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.
    """

    def _handler(
        req: "OperationRequest[capo_forecast.types.stop_resource_request.StopResourceRequest]",
    ) -> OperationResponse[None]:
        import capo_forecast._operations.amazon_forecast.stop_resource

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StopResource")
    )
    input_: capo_forecast.types.stop_resource_request.StopResourceRequest = {
        "resource_arn": resource_arn
    }

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