Class CfnMetricStream

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

@Generated(value="jsii-pacmak/1.99.0 (build 8f757e4)", date="2024-06-13T18:49:15.827Z") @Stability(Stable) public class CfnMetricStream extends CfnResource implements IInspectable, ITaggable
Creates or updates a metric stream.

Metrics streams can automatically stream CloudWatch metrics to AWS destinations including Amazon S3 and to many third-party solutions. For more information, see Metric streams .

To create a metric stream, you must be logged on to an account that has the iam:PassRole permission and either the CloudWatchFullAccess policy or the cloudwatch:PutMetricStream permission.

When you create or update a metric stream, you choose one of the following:

  • Stream metrics from all metric namespaces in the account.
  • Stream metrics from all metric namespaces in the account, except for the namespaces that you list in ExcludeFilters .
  • Stream metrics from only the metric namespaces that you list in IncludeFilters .

When you create a metric stream, the stream is created in the running state. If you update an existing metric stream, the state does not change.

If you create a metric stream in an account that has been set up as a monitoring account in CloudWatch cross-account observability, you can choose whether to include metrics from linked source accounts in the metric stream.

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.cloudwatch.*;
 CfnMetricStream cfnMetricStream = CfnMetricStream.Builder.create(this, "MyCfnMetricStream")
         .firehoseArn("firehoseArn")
         .outputFormat("outputFormat")
         .roleArn("roleArn")
         // the properties below are optional
         .excludeFilters(List.of(MetricStreamFilterProperty.builder()
                 .namespace("namespace")
                 // the properties below are optional
                 .metricNames(List.of("metricNames"))
                 .build()))
         .includeFilters(List.of(MetricStreamFilterProperty.builder()
                 .namespace("namespace")
                 // the properties below are optional
                 .metricNames(List.of("metricNames"))
                 .build()))
         .includeLinkedAccountsMetrics(false)
         .name("name")
         .statisticsConfigurations(List.of(MetricStreamStatisticsConfigurationProperty.builder()
                 .additionalStatistics(List.of("additionalStatistics"))
                 .includeMetrics(List.of(MetricStreamStatisticsMetricProperty.builder()
                         .metricName("metricName")
                         .namespace("namespace")
                         .build()))
                 .build()))
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .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

    • CfnMetricStream

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

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

      @Stability(Stable) public CfnMetricStream(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnMetricStreamProps props)
      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

    • 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.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      The ARN of the metric stream.
    • getAttrCreationDate

      @Stability(Stable) @NotNull public String getAttrCreationDate()
      The date that the metric stream was originally created.
    • getAttrLastUpdateDate

      @Stability(Stable) @NotNull public String getAttrLastUpdateDate()
      The date that the metric stream was most recently updated.
    • getAttrState

      @Stability(Stable) @NotNull public String getAttrState()
      The state of the metric stream, either running or stopped .
    • getCfnProperties

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

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

      @Stability(Stable) @NotNull public String getFirehoseArn()
      The ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
    • setFirehoseArn

      @Stability(Stable) public void setFirehoseArn(@NotNull String value)
      The ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
    • getOutputFormat

      @Stability(Stable) @NotNull public String getOutputFormat()
      The output format for the stream.
    • setOutputFormat

      @Stability(Stable) public void setOutputFormat(@NotNull String value)
      The output format for the stream.
    • getRoleArn

      @Stability(Stable) @NotNull public String getRoleArn()
      The ARN of an IAM role that this metric stream will use to access Amazon Kinesis Firehose resources.
    • setRoleArn

      @Stability(Stable) public void setRoleArn(@NotNull String value)
      The ARN of an IAM role that this metric stream will use to access Amazon Kinesis Firehose resources.
    • getExcludeFilters

      @Stability(Stable) @Nullable public Object getExcludeFilters()
      If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.
    • setExcludeFilters

      @Stability(Stable) public void setExcludeFilters(@Nullable IResolvable value)
      If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.
    • setExcludeFilters

      @Stability(Stable) public void setExcludeFilters(@Nullable List<Object> value)
      If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.
    • getIncludeFilters

      @Stability(Stable) @Nullable public Object getIncludeFilters()
      If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.
    • setIncludeFilters

      @Stability(Stable) public void setIncludeFilters(@Nullable IResolvable value)
      If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.
    • setIncludeFilters

      @Stability(Stable) public void setIncludeFilters(@Nullable List<Object> value)
      If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.
    • getIncludeLinkedAccountsMetrics

      @Stability(Stable) @Nullable public Object getIncludeLinkedAccountsMetrics()
      If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream.
    • setIncludeLinkedAccountsMetrics

      @Stability(Stable) public void setIncludeLinkedAccountsMetrics(@Nullable Boolean value)
      If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream.
    • setIncludeLinkedAccountsMetrics

      @Stability(Stable) public void setIncludeLinkedAccountsMetrics(@Nullable IResolvable value)
      If you are creating a metric stream in a monitoring account, specify true to include metrics from source accounts that are linked to this monitoring account, in the metric stream.
    • getName

      @Stability(Stable) @Nullable public String getName()
      If you are creating a new metric stream, this is the name for the new stream.
    • setName

      @Stability(Stable) public void setName(@Nullable String value)
      If you are creating a new metric stream, this is the name for the new stream.
    • getStatisticsConfigurations

      @Stability(Stable) @Nullable public Object getStatisticsConfigurations()
      By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.
    • setStatisticsConfigurations

      @Stability(Stable) public void setStatisticsConfigurations(@Nullable IResolvable value)
      By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.
    • setStatisticsConfigurations

      @Stability(Stable) public void setStatisticsConfigurations(@Nullable List<Object> value)
      By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.
    • getTagsRaw

      @Stability(Stable) @Nullable public List<CfnTag> getTagsRaw()
      An array of key-value pairs to apply to the metric stream.
    • setTagsRaw

      @Stability(Stable) public void setTagsRaw(@Nullable List<CfnTag> value)
      An array of key-value pairs to apply to the metric stream.