software.amazon.awscdk.services.iot.actions.alpha.CloudWatchLogsAction Maven / Gradle / Ivy
Show all versions of iot-actions-alpha Show documentation
package software.amazon.awscdk.services.iot.actions.alpha;
/**
* (experimental) The action to send data to Amazon CloudWatch Logs.
*
* Example:
*
*
* import software.amazon.awscdk.services.logs.*;
* LogGroup logGroup = new LogGroup(this, "MyLogGroup");
* TopicRule.Builder.create(this, "TopicRule")
* .sql(IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id, timestamp() as timestamp FROM 'device/+/data'"))
* .errorAction(new CloudWatchLogsAction(logGroup))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-05T03:43:53.704Z")
@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.CloudWatchLogsAction")
public class CloudWatchLogsAction extends software.amazon.jsii.JsiiObject implements software.amazon.awscdk.services.iot.alpha.IAction {
protected CloudWatchLogsAction(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected CloudWatchLogsAction(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param logGroup The CloudWatch log group to which the action sends data. This parameter is required.
* @param props Optional properties to not use default.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public CloudWatchLogsAction(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.logs.ILogGroup logGroup, final @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.iot.actions.alpha.CloudWatchLogsActionProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(logGroup, "logGroup is required"), props });
}
/**
* @param logGroup The CloudWatch log group to which the action sends data. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public CloudWatchLogsAction(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.logs.ILogGroup logGroup) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(logGroup, "logGroup is required") });
}
/**
* (experimental) A fluent builder for {@link software.amazon.awscdk.services.iot.actions.alpha.CloudWatchLogsAction}.
*/
@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}.
* @param logGroup The CloudWatch log group to which the action sends data. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final software.amazon.awscdk.services.logs.ILogGroup logGroup) {
return new Builder(logGroup);
}
private final software.amazon.awscdk.services.logs.ILogGroup logGroup;
private software.amazon.awscdk.services.iot.actions.alpha.CloudWatchLogsActionProps.Builder props;
private Builder(final software.amazon.awscdk.services.logs.ILogGroup logGroup) {
this.logGroup = logGroup;
}
/**
* (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;
}
/**
* @return a newly built instance of {@link software.amazon.awscdk.services.iot.actions.alpha.CloudWatchLogsAction}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public software.amazon.awscdk.services.iot.actions.alpha.CloudWatchLogsAction build() {
return new software.amazon.awscdk.services.iot.actions.alpha.CloudWatchLogsAction(
this.logGroup,
this.props != null ? this.props.build() : null
);
}
private software.amazon.awscdk.services.iot.actions.alpha.CloudWatchLogsActionProps.Builder props() {
if (this.props == null) {
this.props = new software.amazon.awscdk.services.iot.actions.alpha.CloudWatchLogsActionProps.Builder();
}
return this.props;
}
}
}