Skip to content

create_monitor async

create_monitor(
    monitor_name: Name,
    resource_arn: Arn,
    *,
    config_overrides: Optional[AsyncforecastClientConfig] = None,
    tags: Optional[Tags] = None,
) -> CreateMonitorResponse

Creates a predictor monitor resource for an existing auto predictor. Predictor monitoring allows you to see how your predictor's performance changes over time. For more information, see Predictor Monitoring.

Parameters:

  • monitor_name (Name) –

    The name of the monitor resource.

  • resource_arn (Arn) –

    The Amazon Resource Name (ARN) of the predictor to monitor.

  • tags (Optional[Tags], default: None ) –

    A list of tags to apply to the monitor resource.

Raises:

Source code in docs_src/capo_forecast/_services/async_forecast.py
async def create_monitor(
    self,
    monitor_name: "capo_forecast.types.name.Name",
    resource_arn: "capo_forecast.types.arn.Arn",
    *,
    config_overrides: Optional[AsyncforecastClientConfig] = None,
    tags: Optional["capo_forecast.types.tags.Tags"] = None,
) -> "capo_forecast.types.create_monitor_response.CreateMonitorResponse":
    """<p>Creates a predictor monitor resource for an existing auto predictor. Predictor monitoring allows you to see how your predictor's performance changes over time. For more information, see <a href="https://docs.aws.amazon.com/forecast/latest/dg/predictor-monitoring.html">Predictor Monitoring</a>. </p>

    Args:
        monitor_name: <p>The name of the monitor resource.</p>
        resource_arn: <p>The Amazon Resource Name (ARN) of the predictor to monitor.</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 monitor resource.</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_monitor_request.CreateMonitorRequest]",
    ) -> AsyncOperationResponse[
        "capo_forecast.types.create_monitor_response.CreateMonitorResponse"
    ]:
        import capo_forecast._operations.amazon_forecast.create_monitor

        (
            output,
            http_response,
        ) = await capo_forecast._operations.amazon_forecast.create_monitor.async_create_monitor(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_forecast.types.create_monitor_request.CreateMonitorRequest",
    ) -> dict[str, Any]:
        import capo_forecast.types.create_monitor_request

        return capo_forecast.types.create_monitor_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateMonitor", redact_input=_redact_input),
    )
    input_: capo_forecast.types.create_monitor_request.CreateMonitorRequest = {
        "monitor_name": monitor_name,
        "resource_arn": resource_arn,
    }
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output