Skip to content

update_metric_content

update_metric_content(
    instance_id: InstanceId,
    metric_id: MetricId,
    *,
    config_overrides: Optional[ConnectClientConfig] = None,
    metric_calculation: Optional[MetricCalculation] = None,
    unit: Optional[MetricUnit] = None,
    positive_trend_indicator: Optional[TrendIndicator] = None,
) -> UpdateMetricContentResponse

Updates the calculation, unit, and/or trend indicator of an existing metric in the specified Connect Customer instance.

Parameters:

  • instance_id (InstanceId) –

    The identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

  • metric_id (MetricId) –

    The identifier of the metric to update. Adding the $SAVED qualifier will update the saved version of the metric. Adding $LATEST or omitting a qualifier will update the published version.

  • metric_calculation (Optional[MetricCalculation], default: None ) –

    The updated calculation definition for the metric.

  • unit (Optional[MetricUnit], default: None ) –

    The updated display unit for the metric.

  • positive_trend_indicator (Optional[TrendIndicator], default: None ) –

    How an increase in the metric value should be interpreted. Valid values: POSITIVE, NEUTRAL, NEGATIVE.

Raises:

Source code in docs_src/capo_connect/_services/connect.py
def update_metric_content(
    self,
    instance_id: "capo_connect.types.instance_id.InstanceId",
    metric_id: "capo_connect.types.metric_id.MetricId",
    *,
    config_overrides: Optional[ConnectClientConfig] = None,
    metric_calculation: Optional[
        "capo_connect.types.metric_calculation.MetricCalculation"
    ] = None,
    unit: Optional["capo_connect.types.metric_unit.MetricUnit"] = None,
    positive_trend_indicator: Optional[
        "capo_connect.types.trend_indicator.TrendIndicator"
    ] = None,
) -> (
    "capo_connect.types.update_metric_content_response.UpdateMetricContentResponse"
):
    """<p>Updates the calculation, unit, and/or trend indicator of an existing metric in the specified Connect Customer instance.</p>

    Args:
        instance_id: <p>The identifier of the Connect Customer instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
        metric_id: <p>The identifier of the metric to update. Adding the <code>$SAVED</code> qualifier will update the saved version of the metric. Adding <code>$LATEST</code> or omitting a qualifier will update the published version.</p>
        metric_calculation: <p>The updated calculation definition for the metric.</p>
        unit: <p>The updated display unit for the metric.</p>
        positive_trend_indicator: <p>How an increase in the metric value should be interpreted. Valid values: <code>POSITIVE</code>, <code>NEUTRAL</code>, <code>NEGATIVE</code>.</p>

    Raises:
        capo_connect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_connect.errors.internal_service_exception.InternalServiceException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_connect.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the specified parameters are not valid.</p>
        capo_connect.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_connect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_connect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</p>
        capo_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_connect.types.update_metric_content_request.UpdateMetricContentRequest]",
    ) -> OperationResponse[
        "capo_connect.types.update_metric_content_response.UpdateMetricContentResponse"
    ]:
        import capo_connect._operations.amazon_connect_service.update_metric_content

        output, http_response = (
            capo_connect._operations.amazon_connect_service.update_metric_content.update_metric_content(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateMetricContent")
    )
    input_: capo_connect.types.update_metric_content_request.UpdateMetricContentRequest = {
        "instance_id": instance_id,
        "metric_id": metric_id,
    }
    if metric_calculation is not None:
        input_["metric_calculation"] = metric_calculation
    if unit is not None:
        input_["unit"] = unit
    if positive_trend_indicator is not None:
        input_["positive_trend_indicator"] = positive_trend_indicator

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