Class CfnMetric

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, IMetricRef, IEnvironmentAware, ITaggableV2, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.139.0 (build 26a6b54)", date="2026-09-02T11:03:06.934Z") @Stability(Stable) public class CfnMetric extends CfnResource implements IInspectable, IMetricRef, ITaggableV2
Resource Type definition for AWS::Connect::Metric, a custom metric configured for an Amazon Connect instance.

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.connect.*;
 CfnMetric cfnMetric = CfnMetric.Builder.create(this, "MyCfnMetric")
         .instanceArn("instanceArn")
         // the properties below are optional
         .description("description")
         .metricCalculation(MetricCalculationProperty.builder()
                 .calculation("calculation")
                 .calculationComponents(List.of(CalculationComponentProperty.builder()
                         .alias("alias")
                         // the properties below are optional
                         .metricFilters(List.of(MetricFilterProperty.builder()
                                 .metricFilterKey("metricFilterKey")
                                 // the properties below are optional
                                 .booleanCondition(MetricFilterBooleanConditionProperty.builder()
                                         .comparison("comparison")
                                         .build())
                                 .negate(false)
                                 .numberCondition(MetricFilterNumberConditionProperty.builder()
                                         .comparison("comparison")
                                         .values(List.of(123))
                                         .build())
                                 .stringCondition(MetricFilterStringConditionProperty.builder()
                                         .comparison("comparison")
                                         .values(List.of("values"))
                                         .build())
                                 .build()))
                         .metricId("metricId")
                         .metricName("metricName")
                         .build()))
                 .build())
         .name("name")
         .positiveTrendIndicator("positiveTrendIndicator")
         .status("status")
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .unit("unit")
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnMetric

      protected CfnMetric(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnMetric

      protected CfnMetric(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnMetric

      @Stability(Stable) public CfnMetric(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnMetricProps props)
      Create a new AWS::Connect::Metric.

      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • arnForMetric

      @Stability(Stable) @NotNull public static String arnForMetric(@NotNull IMetricRef resource)
      Parameters:
      resource - This parameter is required.
    • isCfnMetric

      @Stability(Stable) @NotNull public static Boolean isCfnMetric(@NotNull Object x)
      Checks whether the given object is a CfnMetric.

      Parameters:
      x - This parameter is required.
    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrCategory

      @Stability(Stable) @NotNull public String getAttrCategory()
      The category of the custom metric.
    • getAttrCreatedTime

      @Stability(Stable) @NotNull public IResolvable getAttrCreatedTime()
      The timestamp where the metric was created.
    • getAttrCreatedUser

      @Stability(Stable) @NotNull public IResolvable getAttrCreatedUser()
    • getAttrCreationMethod

      @Stability(Stable) @NotNull public String getAttrCreationMethod()
      Whether the metric was built with the guided Service Level (SL) experience, or with the free-form metric builder.
    • getAttrEffectiveTime

      @Stability(Stable) @NotNull public IResolvable getAttrEffectiveTime()
      Earliest time that can be queried for this metric.
    • getAttrFilters

      @Stability(Stable) @NotNull public IResolvable getAttrFilters()
      List of filter types that may be used with this metric.
    • getAttrGroupings

      @Stability(Stable) @NotNull public List<String> getAttrGroupings()
      List of groupings that may be used with this metric.
    • getAttrLastModifiedRegion

      @Stability(Stable) @NotNull public String getAttrLastModifiedRegion()
      The AWS region where the metric was last modified.
    • getAttrLastModifiedTime

      @Stability(Stable) @NotNull public IResolvable getAttrLastModifiedTime()
      The timestamp where the metric was last modified.
    • getAttrLastModifiedUser

      @Stability(Stable) @NotNull public IResolvable getAttrLastModifiedUser()
    • getAttrMetricArn

      @Stability(Stable) @NotNull public String getAttrMetricArn()
      The Amazon Resource Name (ARN) for the custom metric.
    • getAttrPrimaryEventSource

      @Stability(Stable) @NotNull public String getAttrPrimaryEventSource()
      Main provider of the document/row-level data for the metric;

      should match Data Lake table names

    • getAttrPrimaryEventSourceEffectiveTimestampType

      @Stability(Stable) @NotNull public String getAttrPrimaryEventSourceEffectiveTimestampType()
      Identifies the timestamp used to place the metrics on a time-series;

      should match public attribute name

    • getAttrRefreshRate

      @Stability(Stable) @NotNull public Number getAttrRefreshRate()
      Recommended time to wait between each refresh of data for the metric.
    • getAttrSupportedStats

      @Stability(Stable) @NotNull public List<String> getAttrSupportedStats()
      List of stat aggregations available for the metric.
    • getAttrSupportsCustomCalculation

      @Stability(Stable) @NotNull public IResolvable getAttrSupportsCustomCalculation()
      The metric may be used to compose other (custom) metrics.
    • getAttrSupportsPreaggregateCalculation

      @Stability(Stable) @NotNull public IResolvable getAttrSupportsPreaggregateCalculation()
      The metric may be used to compose other (custom) metrics, meaning it can be used inside of aggregate stat functions.
    • getAttrType

      @Stability(Stable) @NotNull public String getAttrType()
      Whether the metric is provided out-of-the-box or created by each customer.
    • getCdkTagManager

      @Stability(Stable) @NotNull public TagManager getCdkTagManager()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getCdkTagManager in interface ITaggableV2
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getCfnPropertyNames

      @Stability(Stable) @NotNull protected Map<String,String> getCfnPropertyNames()
      Overrides:
      getCfnPropertyNames in class CfnResource
    • getMetricRef

      @Stability(Stable) @NotNull public MetricReference getMetricRef()
      A reference to a Metric resource.
      Specified by:
      getMetricRef in interface IMetricRef
    • getInstanceArn

      @Stability(Stable) @NotNull public String getInstanceArn()
      The identifier of the Amazon Connect instance.
    • setInstanceArn

      @Stability(Stable) public void setInstanceArn(@NotNull String value)
      The identifier of the Amazon Connect instance.
    • getDescription

      @Stability(Stable) @Nullable public String getDescription()
      The description of the custom metric.
    • setDescription

      @Stability(Stable) public void setDescription(@Nullable String value)
      The description of the custom metric.
    • getMetricCalculation

      @Stability(Stable) @Nullable public Object getMetricCalculation()
      The calculation configuration for the metric.

      Returns union: either IResolvable or CfnMetric.MetricCalculationProperty

    • setMetricCalculation

      @Stability(Stable) public void setMetricCalculation(@Nullable IResolvable value)
      The calculation configuration for the metric.
    • setMetricCalculation

      @Stability(Stable) public void setMetricCalculation(@Nullable CfnMetric.MetricCalculationProperty value)
      The calculation configuration for the metric.
    • getName

      @Stability(Stable) @Nullable public String getName()
      The name of the custom metric.
    • setName

      @Stability(Stable) public void setName(@Nullable String value)
      The name of the custom metric.
    • getPositiveTrendIndicator

      @Stability(Stable) @Nullable public String getPositiveTrendIndicator()
      Indicates how to classify a positive trend in metric data on the UI.
    • setPositiveTrendIndicator

      @Stability(Stable) public void setPositiveTrendIndicator(@Nullable String value)
      Indicates how to classify a positive trend in metric data on the UI.
    • getStatus

      @Stability(Stable) @Nullable public String getStatus()
      The status of the custom metric.
    • setStatus

      @Stability(Stable) public void setStatus(@Nullable String value)
      The status of the custom metric.
    • getTags

      @Stability(Stable) @Nullable public List<CfnTag> getTags()
      One or more tags.
    • setTags

      @Stability(Stable) public void setTags(@Nullable List<CfnTag> value)
      One or more tags.
    • getUnit

      @Stability(Stable) @Nullable public String getUnit()
      Display unit for the metric data.
    • setUnit

      @Stability(Stable) public void setUnit(@Nullable String value)
      Display unit for the metric data.