@Generated(value="jsii-pacmak/1.73.0 (build 6faeda3)", date="2023-01-31T18:36:51.255Z") @Stability(value=Stable) public class CfnMetricStream extends CfnResource implements IInspectable
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:
ExcludeFilters .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")
.build()))
.includeFilters(List.of(MetricStreamFilterProperty.builder()
.namespace("namespace")
.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();
| Modifier and Type | Class and Description |
|---|---|
static class |
CfnMetricStream.Builder
A fluent builder for
CfnMetricStream. |
static interface |
CfnMetricStream.MetricStreamFilterProperty
This structure contains the name of one of the metric namespaces that is listed in a filter of a metric stream.
|
static interface |
CfnMetricStream.MetricStreamStatisticsConfigurationProperty
This structure specifies a list of additional statistics to stream, and the metrics to stream those additional statistics for.
|
static interface |
CfnMetricStream.MetricStreamStatisticsMetricProperty
A structure that specifies the metric name and namespace for one metric that is going to have additional statistics included in the stream.
|
software.amazon.jsii.JsiiObject.InitializationModeIInspectable.Jsii$Default, IInspectable.Jsii$ProxyIConstruct.Jsii$Default| Modifier and Type | Field and Description |
|---|---|
static String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
| Modifier | Constructor and Description |
|---|---|
|
CfnMetricStream(Construct scope,
String id,
CfnMetricStreamProps props)
Create a new `AWS::CloudWatch::MetricStream`.
|
protected |
CfnMetricStream(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnMetricStream(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
String |
getAttrArn()
The ARN of the metric stream.
|
String |
getAttrCreationDate()
The date that the metric stream was originally created.
|
String |
getAttrLastUpdateDate()
The date that the metric stream was most recently updated.
|
String |
getAttrState()
The state of the metric stream, either `running` or `stopped` .
|
protected Map<String,Object> |
getCfnProperties() |
Object |
getExcludeFilters()
If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.
|
String |
getFirehoseArn()
The ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
|
Object |
getIncludeFilters()
If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.
|
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.
|
String |
getName()
If you are creating a new metric stream, this is the name for the new stream.
|
String |
getOutputFormat()
The output format for the stream.
|
String |
getRoleArn()
The ARN of an IAM role that this metric stream will use to access Amazon Kinesis Firehose resources.
|
Object |
getStatisticsConfigurations()
By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.
|
TagManager |
getTags()
An array of key-value pairs to apply to the metric stream.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected Map<String,Object> |
renderProperties(Map<String,Object> props) |
void |
setExcludeFilters(IResolvable value)
If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.
|
void |
setExcludeFilters(List<Object> value)
If you specify this parameter, the stream sends metrics from all metric namespaces except for the namespaces that you specify here.
|
void |
setFirehoseArn(String value)
The ARN of the Amazon Kinesis Firehose delivery stream to use for this metric stream.
|
void |
setIncludeFilters(IResolvable value)
If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.
|
void |
setIncludeFilters(List<Object> value)
If you specify this parameter, the stream sends only the metrics from the metric namespaces that you specify here.
|
void |
setIncludeLinkedAccountsMetrics(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.
|
void |
setIncludeLinkedAccountsMetrics(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.
|
void |
setName(String value)
If you are creating a new metric stream, this is the name for the new stream.
|
void |
setOutputFormat(String value)
The output format for the stream.
|
void |
setRoleArn(String value)
The ARN of an IAM role that this metric stream will use to access Amazon Kinesis Firehose resources.
|
void |
setStatisticsConfigurations(IResolvable value)
By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.
|
void |
setStatisticsConfigurations(List<Object> value)
By default, a metric stream always sends the MAX, MIN, SUM, and SAMPLECOUNT statistics for each metric that is streamed.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validatePropertiesgetRefgetCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdgetNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validatejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet@Stability(value=Stable) public static final String CFN_RESOURCE_TYPE_NAME
protected CfnMetricStream(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnMetricStream(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CfnMetricStream(@NotNull
Construct scope,
@NotNull
String id,
@NotNull
CfnMetricStreamProps props)
scope - - scope in which this resource is defined. This parameter is required.id - - scoped id of the resource. This parameter is required.props - - resource properties. This parameter is required.@Stability(value=Stable)
public void inspect(@NotNull
TreeInspector inspector)
inspect in interface IInspectableinspector - - tree inspector to collect and process attributes. This parameter is required.@Stability(value=Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
renderProperties in class CfnResourceprops - This parameter is required.@Stability(value=Stable) @NotNull public String getAttrArn()
@Stability(value=Stable) @NotNull public String getAttrCreationDate()
@Stability(value=Stable) @NotNull public String getAttrLastUpdateDate()
@Stability(value=Stable) @NotNull public String getAttrState()
@Stability(value=Stable) @NotNull protected Map<String,Object> getCfnProperties()
getCfnProperties in class CfnResource@Stability(value=Stable) @NotNull public TagManager getTags()
For more information, see Tag .
@Stability(value=Stable) @NotNull public String getFirehoseArn()
This Amazon Kinesis Firehose delivery stream must already exist and must be in the same account as the metric stream.
@Stability(value=Stable)
public void setFirehoseArn(@NotNull
String value)
This Amazon Kinesis Firehose delivery stream must already exist and must be in the same account as the metric stream.
@Stability(value=Stable) @NotNull public String getOutputFormat()
Valid values are json and opentelemetry0.7 For more information about metric stream output formats, see Metric streams output formats .
This parameter is required.
@Stability(value=Stable)
public void setOutputFormat(@NotNull
String value)
Valid values are json and opentelemetry0.7 For more information about metric stream output formats, see Metric streams output formats .
This parameter is required.
@Stability(value=Stable) @NotNull public String getRoleArn()
This IAM role must already exist and must be in the same account as the metric stream. This IAM role must include the firehose:PutRecord and firehose:PutRecordBatch permissions.
@Stability(value=Stable)
public void setRoleArn(@NotNull
String value)
This IAM role must already exist and must be in the same account as the metric stream. This IAM role must include the firehose:PutRecord and firehose:PutRecordBatch permissions.
@Stability(value=Stable) @Nullable public Object getExcludeFilters()
You cannot specify both IncludeFilters and ExcludeFilters in the same metric stream.
When you modify the IncludeFilters or ExcludeFilters of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update.
@Stability(value=Stable)
public void setExcludeFilters(@Nullable
IResolvable value)
You cannot specify both IncludeFilters and ExcludeFilters in the same metric stream.
When you modify the IncludeFilters or ExcludeFilters of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update.
@Stability(value=Stable)
public void setExcludeFilters(@Nullable
List<Object> value)
You cannot specify both IncludeFilters and ExcludeFilters in the same metric stream.
When you modify the IncludeFilters or ExcludeFilters of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update.
@Stability(value=Stable) @Nullable public Object getIncludeFilters()
You cannot specify both IncludeFilters and ExcludeFilters in the same metric stream.
When you modify the IncludeFilters or ExcludeFilters of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update.
@Stability(value=Stable)
public void setIncludeFilters(@Nullable
IResolvable value)
You cannot specify both IncludeFilters and ExcludeFilters in the same metric stream.
When you modify the IncludeFilters or ExcludeFilters of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update.
@Stability(value=Stable)
public void setIncludeFilters(@Nullable
List<Object> value)
You cannot specify both IncludeFilters and ExcludeFilters in the same metric stream.
When you modify the IncludeFilters or ExcludeFilters of an existing metric stream in any way, the metric stream is effectively restarted, so after such a change you will get only the datapoints that have a timestamp after the time of the update.
@Stability(value=Stable) @Nullable public Object getIncludeLinkedAccountsMetrics()
The default is false .
For more information about linking accounts, see CloudWatch cross-account observability
@Stability(value=Stable)
public void setIncludeLinkedAccountsMetrics(@Nullable
Boolean value)
The default is false .
For more information about linking accounts, see CloudWatch cross-account observability
@Stability(value=Stable)
public void setIncludeLinkedAccountsMetrics(@Nullable
IResolvable value)
The default is false .
For more information about linking accounts, see CloudWatch cross-account observability
@Stability(value=Stable) @Nullable public String getName()
The name must be different than the names of other metric streams in this account and Region.
If you are updating a metric stream, specify the name of that stream here.
@Stability(value=Stable)
public void setName(@Nullable
String value)
The name must be different than the names of other metric streams in this account and Region.
If you are updating a metric stream, specify the name of that stream here.
@Stability(value=Stable) @Nullable public Object getStatisticsConfigurations()
You can use this parameter to have the metric stream also send additional statistics in the stream. This array can have up to 100 members.
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's OutputFormat . If the OutputFormat is json , you can stream any additional statistic that is supported by CloudWatch , listed in CloudWatch statistics definitions . If the OutputFormat is opentelemetry0 .7, you can stream percentile statistics (p??) .
@Stability(value=Stable)
public void setStatisticsConfigurations(@Nullable
IResolvable value)
You can use this parameter to have the metric stream also send additional statistics in the stream. This array can have up to 100 members.
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's OutputFormat . If the OutputFormat is json , you can stream any additional statistic that is supported by CloudWatch , listed in CloudWatch statistics definitions . If the OutputFormat is opentelemetry0 .7, you can stream percentile statistics (p??) .
@Stability(value=Stable)
public void setStatisticsConfigurations(@Nullable
List<Object> value)
You can use this parameter to have the metric stream also send additional statistics in the stream. This array can have up to 100 members.
For each entry in this array, you specify one or more metrics and the list of additional statistics to stream for those metrics. The additional statistics that you can stream depend on the stream's OutputFormat . If the OutputFormat is json , you can stream any additional statistic that is supported by CloudWatch , listed in CloudWatch statistics definitions . If the OutputFormat is opentelemetry0 .7, you can stream percentile statistics (p??) .
Copyright © 2023. All rights reserved.