software.amazon.awscdk.services.iot.actions.alpha.S3PutObjectAction Maven / Gradle / Ivy
Show all versions of iot-actions-alpha Show documentation
package software.amazon.awscdk.services.iot.actions.alpha;
/**
* (experimental) The action to write the data from an MQTT message to an Amazon S3 bucket.
*
* Example:
*
*
* Bucket bucket = new Bucket(this, "MyBucket");
* TopicRule.Builder.create(this, "TopicRule")
* .sql(IotSql.fromStringAsVer20160323("SELECT topic(2) as device_id, year, month, day FROM 'device/+/data'"))
* .actions(List.of(
* S3PutObjectAction.Builder.create(bucket)
* .key("${year}/${month}/${day}/${topic(2)}")
* .build()))
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-24T10:56:42.459Z")
@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.S3PutObjectAction")
public class S3PutObjectAction extends software.amazon.jsii.JsiiObject implements software.amazon.awscdk.services.iot.alpha.IAction {
protected S3PutObjectAction(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected S3PutObjectAction(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param bucket The Amazon S3 bucket to which to write data. This parameter is required.
* @param props Optional properties to not use default.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public S3PutObjectAction(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.s3.IBucket bucket, final @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.iot.actions.alpha.S3PutObjectActionProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(bucket, "bucket is required"), props });
}
/**
* @param bucket The Amazon S3 bucket to which to write data. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public S3PutObjectAction(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.s3.IBucket bucket) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(bucket, "bucket is required") });
}
/**
* (experimental) A fluent builder for {@link software.amazon.awscdk.services.iot.actions.alpha.S3PutObjectAction}.
*/
@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 bucket The Amazon S3 bucket to which to write data. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final software.amazon.awscdk.services.s3.IBucket bucket) {
return new Builder(bucket);
}
private final software.amazon.awscdk.services.s3.IBucket bucket;
private software.amazon.awscdk.services.iot.actions.alpha.S3PutObjectActionProps.Builder props;
private Builder(final software.amazon.awscdk.services.s3.IBucket bucket) {
this.bucket = bucket;
}
/**
* (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 Amazon S3 canned ACL that controls access to the object identified by the object key.
*
* Default: None
*
* @return {@code this}
* @see https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html#canned-acl
* @param accessControl The Amazon S3 canned ACL that controls access to the object identified by the object key. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder accessControl(final software.amazon.awscdk.services.s3.BucketAccessControl accessControl) {
this.props().accessControl(accessControl);
return this;
}
/**
* (experimental) The path to the file where the data is written.
*
* Supports substitution templates.
*
* Default: '${topic()}/${timestamp()}'
*
* @return {@code this}
* @see https://docs.aws.amazon.com/iot/latest/developerguide/iot-substitution-templates.html
* @param key The path to the file where the data is written. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder key(final java.lang.String key) {
this.props().key(key);
return this;
}
/**
* @return a newly built instance of {@link software.amazon.awscdk.services.iot.actions.alpha.S3PutObjectAction}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public software.amazon.awscdk.services.iot.actions.alpha.S3PutObjectAction build() {
return new software.amazon.awscdk.services.iot.actions.alpha.S3PutObjectAction(
this.bucket,
this.props != null ? this.props.build() : null
);
}
private software.amazon.awscdk.services.iot.actions.alpha.S3PutObjectActionProps.Builder props() {
if (this.props == null) {
this.props = new software.amazon.awscdk.services.iot.actions.alpha.S3PutObjectActionProps.Builder();
}
return this.props;
}
}
}