software.amazon.awscdk.services.iot.actions.alpha.CloudWatchPutMetricAction Maven / Gradle / Ivy
Show all versions of iot-actions-alpha Show documentation
package software.amazon.awscdk.services.iot.actions.alpha;
/**
* (experimental) The action to capture an Amazon CloudWatch metric.
*
* Example:
*
*
* TopicRule topicRule = TopicRule.Builder.create(this, "TopicRule")
* .sql(IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id, namespace, unit, value, timestamp FROM 'device/+/data'"))
* .actions(List.of(
* CloudWatchPutMetricAction.Builder.create()
* .metricName("${topic(2)}")
* .metricNamespace("${namespace}")
* .metricUnit("${unit}")
* .metricValue("${value}")
* .metricTimestamp("${timestamp}")
* .build()))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-19T18:12:10.291Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.iot.actions.alpha.$Module.class, fqn = "@aws-cdk/aws-iot-actions-alpha.CloudWatchPutMetricAction")
public class CloudWatchPutMetricAction extends software.amazon.jsii.JsiiObject implements software.amazon.awscdk.services.iot.alpha.IAction {
protected CloudWatchPutMetricAction(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected CloudWatchPutMetricAction(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public CloudWatchPutMetricAction(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iot.actions.alpha.CloudWatchPutMetricActionProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) A fluent builder for {@link software.amazon.awscdk.services.iot.actions.alpha.CloudWatchPutMetricAction}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create() {
return new Builder();
}
private final software.amazon.awscdk.services.iot.actions.alpha.CloudWatchPutMetricActionProps.Builder props;
private Builder() {
this.props = new software.amazon.awscdk.services.iot.actions.alpha.CloudWatchPutMetricActionProps.Builder();
}
/**
* (experimental) The IAM role that allows access to AWS service.
*
* Default: a new role will be created
*
* @return {@code this}
* @param role The IAM role that allows access to AWS service. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder role(final software.amazon.awscdk.services.iam.IRole role) {
this.props.role(role);
return this;
}
/**
* (experimental) The CloudWatch metric name.
*
* Supports substitution templates.
*
* @return {@code this}
* @see https://docs.aws.amazon.com/iot/latest/developerguide/iot-substitution-templates.html
* @param metricName The CloudWatch metric name. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder metricName(final java.lang.String metricName) {
this.props.metricName(metricName);
return this;
}
/**
* (experimental) The CloudWatch metric namespace name.
*
* Supports substitution templates.
*
* @return {@code this}
* @see https://docs.aws.amazon.com/iot/latest/developerguide/iot-substitution-templates.html
* @param metricNamespace The CloudWatch metric namespace name. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder metricNamespace(final java.lang.String metricNamespace) {
this.props.metricNamespace(metricNamespace);
return this;
}
/**
* (experimental) The metric unit supported by CloudWatch.
*
* Supports substitution templates.
*
* @return {@code this}
* @see https://docs.aws.amazon.com/iot/latest/developerguide/iot-substitution-templates.html
* @param metricUnit The metric unit supported by CloudWatch. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder metricUnit(final java.lang.String metricUnit) {
this.props.metricUnit(metricUnit);
return this;
}
/**
* (experimental) A string that contains the CloudWatch metric value.
*
* Supports substitution templates.
*
* @return {@code this}
* @see https://docs.aws.amazon.com/iot/latest/developerguide/iot-substitution-templates.html
* @param metricValue A string that contains the CloudWatch metric value. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder metricValue(final java.lang.String metricValue) {
this.props.metricValue(metricValue);
return this;
}
/**
* (experimental) A string that contains the timestamp, expressed in seconds in Unix epoch time.
*
* Supports substitution templates.
*
* Default: - none -- Defaults to the current Unix epoch time.
*
* @return {@code this}
* @see https://docs.aws.amazon.com/iot/latest/developerguide/iot-substitution-templates.html
* @param metricTimestamp A string that contains the timestamp, expressed in seconds in Unix epoch time. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder metricTimestamp(final java.lang.String metricTimestamp) {
this.props.metricTimestamp(metricTimestamp);
return this;
}
/**
* @return a newly built instance of {@link software.amazon.awscdk.services.iot.actions.alpha.CloudWatchPutMetricAction}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public software.amazon.awscdk.services.iot.actions.alpha.CloudWatchPutMetricAction build() {
return new software.amazon.awscdk.services.iot.actions.alpha.CloudWatchPutMetricAction(
this.props.build()
);
}
}
}