/* * Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.iot.model; import java.io.Serializable; /** *
* The Timestream rule action writes attributes (measures) from an MQTT message * into an Amazon Timestream table. For more information, see the Timestream topic rule action documentation. *
*/ public class TimestreamAction implements Serializable { /** ** The ARN of the role that grants permission to write to the Amazon * Timestream database table. *
*/ private String roleArn; /** ** The name of an Amazon Timestream database. *
*/ private String databaseName; /** ** The name of the database table into which to write the measure records. *
*/ private String tableName; /** ** Metadata attributes of the time series that are written in each measure * record. *
*/ private java.util.List
* Specifies an application-defined value to replace the default value
* assigned to the Timestream record's timestamp in the time
* column.
*
* You can use this property to specify the value and the precision of the * Timestream record's timestamp. You can specify a value from the message * payload or a value computed by a substitution template. *
** If omitted, the topic rule action assigns the timestamp, in milliseconds, * at the time it processed the rule. *
*/ private TimestreamTimestamp timestamp; /** ** The ARN of the role that grants permission to write to the Amazon * Timestream database table. *
* * @return* The ARN of the role that grants permission to write to the Amazon * Timestream database table. *
*/ public String getRoleArn() { return roleArn; } /** ** The ARN of the role that grants permission to write to the Amazon * Timestream database table. *
* * @param roleArn* The ARN of the role that grants permission to write to the * Amazon Timestream database table. *
*/ public void setRoleArn(String roleArn) { this.roleArn = roleArn; } /** ** The ARN of the role that grants permission to write to the Amazon * Timestream database table. *
** Returns a reference to this object so that method calls can be chained * together. * * @param roleArn
* The ARN of the role that grants permission to write to the * Amazon Timestream database table. *
* @return A reference to this updated object so that method calls can be * chained together. */ public TimestreamAction withRoleArn(String roleArn) { this.roleArn = roleArn; return this; } /** ** The name of an Amazon Timestream database. *
* * @return* The name of an Amazon Timestream database. *
*/ public String getDatabaseName() { return databaseName; } /** ** The name of an Amazon Timestream database. *
* * @param databaseName* The name of an Amazon Timestream database. *
*/ public void setDatabaseName(String databaseName) { this.databaseName = databaseName; } /** ** The name of an Amazon Timestream database. *
** Returns a reference to this object so that method calls can be chained * together. * * @param databaseName
* The name of an Amazon Timestream database. *
* @return A reference to this updated object so that method calls can be * chained together. */ public TimestreamAction withDatabaseName(String databaseName) { this.databaseName = databaseName; return this; } /** ** The name of the database table into which to write the measure records. *
* * @return* The name of the database table into which to write the measure * records. *
*/ public String getTableName() { return tableName; } /** ** The name of the database table into which to write the measure records. *
* * @param tableName* The name of the database table into which to write the measure * records. *
*/ public void setTableName(String tableName) { this.tableName = tableName; } /** ** The name of the database table into which to write the measure records. *
** Returns a reference to this object so that method calls can be chained * together. * * @param tableName
* The name of the database table into which to write the measure * records. *
* @return A reference to this updated object so that method calls can be * chained together. */ public TimestreamAction withTableName(String tableName) { this.tableName = tableName; return this; } /** ** Metadata attributes of the time series that are written in each measure * record. *
* * @return* Metadata attributes of the time series that are written in each * measure record. *
*/ public java.util.List* Metadata attributes of the time series that are written in each measure * record. *
* * @param dimensions* Metadata attributes of the time series that are written in * each measure record. *
*/ public void setDimensions(java.util.Collection* Metadata attributes of the time series that are written in each measure * record. *
** Returns a reference to this object so that method calls can be chained * together. * * @param dimensions
* Metadata attributes of the time series that are written in * each measure record. *
* @return A reference to this updated object so that method calls can be * chained together. */ public TimestreamAction withDimensions(TimestreamDimension... dimensions) { if (getDimensions() == null) { this.dimensions = new java.util.ArrayList* Metadata attributes of the time series that are written in each measure * record. *
** Returns a reference to this object so that method calls can be chained * together. * * @param dimensions
* Metadata attributes of the time series that are written in * each measure record. *
* @return A reference to this updated object so that method calls can be * chained together. */ public TimestreamAction withDimensions(java.util.Collection
* Specifies an application-defined value to replace the default value
* assigned to the Timestream record's timestamp in the time
* column.
*
* You can use this property to specify the value and the precision of the * Timestream record's timestamp. You can specify a value from the message * payload or a value computed by a substitution template. *
** If omitted, the topic rule action assigns the timestamp, in milliseconds, * at the time it processed the rule. *
* * @return
* Specifies an application-defined value to replace the default
* value assigned to the Timestream record's timestamp in the
* time
column.
*
* You can use this property to specify the value and the precision * of the Timestream record's timestamp. You can specify a value * from the message payload or a value computed by a substitution * template. *
** If omitted, the topic rule action assigns the timestamp, in * milliseconds, at the time it processed the rule. *
*/ public TimestreamTimestamp getTimestamp() { return timestamp; } /** *
* Specifies an application-defined value to replace the default value
* assigned to the Timestream record's timestamp in the time
* column.
*
* You can use this property to specify the value and the precision of the * Timestream record's timestamp. You can specify a value from the message * payload or a value computed by a substitution template. *
** If omitted, the topic rule action assigns the timestamp, in milliseconds, * at the time it processed the rule. *
* * @param timestamp
* Specifies an application-defined value to replace the default
* value assigned to the Timestream record's timestamp in the
* time
column.
*
* You can use this property to specify the value and the * precision of the Timestream record's timestamp. You can * specify a value from the message payload or a value computed * by a substitution template. *
** If omitted, the topic rule action assigns the timestamp, in * milliseconds, at the time it processed the rule. *
*/ public void setTimestamp(TimestreamTimestamp timestamp) { this.timestamp = timestamp; } /** *
* Specifies an application-defined value to replace the default value
* assigned to the Timestream record's timestamp in the time
* column.
*
* You can use this property to specify the value and the precision of the * Timestream record's timestamp. You can specify a value from the message * payload or a value computed by a substitution template. *
** If omitted, the topic rule action assigns the timestamp, in milliseconds, * at the time it processed the rule. *
** Returns a reference to this object so that method calls can be chained * together. * * @param timestamp
* Specifies an application-defined value to replace the default
* value assigned to the Timestream record's timestamp in the
* time
column.
*
* You can use this property to specify the value and the * precision of the Timestream record's timestamp. You can * specify a value from the message payload or a value computed * by a substitution template. *
** If omitted, the topic rule action assigns the timestamp, in * milliseconds, at the time it processed the rule. *
* @return A reference to this updated object so that method calls can be * chained together. */ public TimestreamAction withTimestamp(TimestreamTimestamp timestamp) { this.timestamp = timestamp; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getRoleArn() != null) sb.append("roleArn: " + getRoleArn() + ","); if (getDatabaseName() != null) sb.append("databaseName: " + getDatabaseName() + ","); if (getTableName() != null) sb.append("tableName: " + getTableName() + ","); if (getDimensions() != null) sb.append("dimensions: " + getDimensions() + ","); if (getTimestamp() != null) sb.append("timestamp: " + getTimestamp()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getRoleArn() == null) ? 0 : getRoleArn().hashCode()); hashCode = prime * hashCode + ((getDatabaseName() == null) ? 0 : getDatabaseName().hashCode()); hashCode = prime * hashCode + ((getTableName() == null) ? 0 : getTableName().hashCode()); hashCode = prime * hashCode + ((getDimensions() == null) ? 0 : getDimensions().hashCode()); hashCode = prime * hashCode + ((getTimestamp() == null) ? 0 : getTimestamp().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof TimestreamAction == false) return false; TimestreamAction other = (TimestreamAction) obj; if (other.getRoleArn() == null ^ this.getRoleArn() == null) return false; if (other.getRoleArn() != null && other.getRoleArn().equals(this.getRoleArn()) == false) return false; if (other.getDatabaseName() == null ^ this.getDatabaseName() == null) return false; if (other.getDatabaseName() != null && other.getDatabaseName().equals(this.getDatabaseName()) == false) return false; if (other.getTableName() == null ^ this.getTableName() == null) return false; if (other.getTableName() != null && other.getTableName().equals(this.getTableName()) == false) return false; if (other.getDimensions() == null ^ this.getDimensions() == null) return false; if (other.getDimensions() != null && other.getDimensions().equals(this.getDimensions()) == false) return false; if (other.getTimestamp() == null ^ this.getTimestamp() == null) return false; if (other.getTimestamp() != null && other.getTimestamp().equals(this.getTimestamp()) == false) return false; return true; } }