Connect / Client / update_metric_content

update_metric_content

Connect.Client.update_metric_content(**kwargs)

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

See also: AWS API Documentation

Request Syntax

response = client.update_metric_content(
    InstanceId='string',
    MetricId='string',
    MetricCalculation={
        'CalculationComponents': [
            {
                'Alias': 'string',
                'MetricName': 'string',
                'MetricId': 'string',
                'MetricFilters': [
                    {
                        'MetricFilterKey': 'string',
                        'Negate': True|False,
                        'NumberCondition': {
                            'Comparison': 'LESSER'|'LESSER_OR_EQUAL'|'GREATER'|'GREATER_OR_EQUAL',
                            'Values': [
                                123.0,
                            ]
                        },
                        'StringCondition': {
                            'Comparison': 'MATCHES_ANY'|'MATCHES_NONE',
                            'Values': [
                                'string',
                            ]
                        },
                        'BooleanCondition': {
                            'Comparison': 'IS_TRUE'|'IS_FALSE'
                        }
                    },
                ]
            },
        ],
        'Calculation': 'string'
    },
    Unit='INTEGER'|'DOUBLE'|'PERCENT'|'SECONDS',
    PositiveTrendIndicator='POSITIVE'|'NEGATIVE'|'NEUTRAL'
)
Parameters:
  • InstanceId (string) –

    [REQUIRED]

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

  • MetricId (string) –

    [REQUIRED]

    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.

  • MetricCalculation (dict) –

    The updated calculation definition for the metric.

    • CalculationComponents (list) – [REQUIRED]

      The list of component metrics referenced in the calculation formula. Each component has an alias used in the formula expression.

      • (dict) –

        Represents a component metric referenced in a custom metric calculation formula.

        • Alias (string) – [REQUIRED]

          The alias used to reference this component in the calculation expression.

        • MetricName (string) –

          The name of an AWS-managed metric used in this calculation component (for example, CONTACTS_HANDLED). Mutually exclusive with MetricId.

        • MetricId (string) –

          The ARN of an AWS-managed metric used in this calculation component. Mutually exclusive with MetricName.

        • MetricFilters (list) –

          The filters applied to the calculation component.

          • (dict) –

            A filter condition applied to a metric component in a calculation. Filters restrict the data included in the metric computation.

            • MetricFilterKey (string) – [REQUIRED]

              The key identifying the field to filter on.

            • Negate (boolean) –

              Specifies whether the filter condition is negated. When set to true, the filter excludes matching data instead of including it.

            • NumberCondition (dict) –

              A numeric comparison condition.

              • Comparison (string) – [REQUIRED]

                The comparison operator. Valid values: LESSER (less than) | LESSER_OR_EQUAL (less than or equal to) | GREATER (greater than) | GREATER_OR_EQUAL (greater than or equal to).

              • Values (list) – [REQUIRED]

                The numeric values to compare against.

                • (float) –

            • StringCondition (dict) –

              A string comparison condition.

              • Comparison (string) – [REQUIRED]

                The comparison operator. Valid values: MATCHES_ANY (matches any of the specified values) | MATCHES_NONE (matches none of the specified values).

              • Values (list) – [REQUIRED]

                The string values to compare against.

                • (string) –

            • BooleanCondition (dict) –

              A boolean comparison condition.

              • Comparison (string) – [REQUIRED]

                The comparison operator. Valid values: IS_TRUE (matches when the field is true) | IS_FALSE (matches when the field is false).

    • Calculation (string) – [REQUIRED]

      The formula expression that defines how the metric is calculated. Uses component aliases (for example, 100 * SUM(M1) / SUM(M2)).

  • Unit (string) – The updated display unit for the metric.

  • PositiveTrendIndicator (string) – How an increase in the metric value should be interpreted. Valid values: POSITIVE, NEUTRAL, NEGATIVE.

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

Exceptions

  • Connect.Client.exceptions.InvalidRequestException

  • Connect.Client.exceptions.InvalidParameterException

  • Connect.Client.exceptions.ResourceNotFoundException

  • Connect.Client.exceptions.AccessDeniedException

  • Connect.Client.exceptions.ThrottlingException

  • Connect.Client.exceptions.InternalServiceException