/* * 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; /** *

* Describes an action to write to a DynamoDB table. *

*

* This DynamoDB action writes each attribute in the message payload into it's * own column in the DynamoDB table. *

*/ public class DynamoDBv2Action implements Serializable { /** *

* The ARN of the IAM role that grants access to the DynamoDB table. *

*/ private String roleArn; /** *

* Specifies the DynamoDB table to which the message data will be written. * For example: *

*

* { "dynamoDBv2": { "roleArn": "aws:iam:12341251:my-role" "putItem": { "tableName": "my-table" } } } *

*

* Each attribute in the message payload will be written to a separate * column in the DynamoDB database. *

*/ private PutItemInput putItem; /** *

* The ARN of the IAM role that grants access to the DynamoDB table. *

* * @return

* The ARN of the IAM role that grants access to the DynamoDB table. *

*/ public String getRoleArn() { return roleArn; } /** *

* The ARN of the IAM role that grants access to the DynamoDB table. *

* * @param roleArn

* The ARN of the IAM role that grants access to the DynamoDB * table. *

*/ public void setRoleArn(String roleArn) { this.roleArn = roleArn; } /** *

* The ARN of the IAM role that grants access to the DynamoDB table. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param roleArn

* The ARN of the IAM role that grants access to the DynamoDB * table. *

* @return A reference to this updated object so that method calls can be * chained together. */ public DynamoDBv2Action withRoleArn(String roleArn) { this.roleArn = roleArn; return this; } /** *

* Specifies the DynamoDB table to which the message data will be written. * For example: *

*

* { "dynamoDBv2": { "roleArn": "aws:iam:12341251:my-role" "putItem": { "tableName": "my-table" } } } *

*

* Each attribute in the message payload will be written to a separate * column in the DynamoDB database. *

* * @return

* Specifies the DynamoDB table to which the message data will be * written. For example: *

*

* { "dynamoDBv2": { "roleArn": "aws:iam:12341251:my-role" "putItem": { "tableName": "my-table" } } } *

*

* Each attribute in the message payload will be written to a * separate column in the DynamoDB database. *

*/ public PutItemInput getPutItem() { return putItem; } /** *

* Specifies the DynamoDB table to which the message data will be written. * For example: *

*

* { "dynamoDBv2": { "roleArn": "aws:iam:12341251:my-role" "putItem": { "tableName": "my-table" } } } *

*

* Each attribute in the message payload will be written to a separate * column in the DynamoDB database. *

* * @param putItem

* Specifies the DynamoDB table to which the message data will be * written. For example: *

*

* { "dynamoDBv2": { "roleArn": "aws:iam:12341251:my-role" "putItem": { "tableName": "my-table" } } } *

*

* Each attribute in the message payload will be written to a * separate column in the DynamoDB database. *

*/ public void setPutItem(PutItemInput putItem) { this.putItem = putItem; } /** *

* Specifies the DynamoDB table to which the message data will be written. * For example: *

*

* { "dynamoDBv2": { "roleArn": "aws:iam:12341251:my-role" "putItem": { "tableName": "my-table" } } } *

*

* Each attribute in the message payload will be written to a separate * column in the DynamoDB database. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param putItem

* Specifies the DynamoDB table to which the message data will be * written. For example: *

*

* { "dynamoDBv2": { "roleArn": "aws:iam:12341251:my-role" "putItem": { "tableName": "my-table" } } } *

*

* Each attribute in the message payload will be written to a * separate column in the DynamoDB database. *

* @return A reference to this updated object so that method calls can be * chained together. */ public DynamoDBv2Action withPutItem(PutItemInput putItem) { this.putItem = putItem; 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 (getPutItem() != null) sb.append("putItem: " + getPutItem()); 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 + ((getPutItem() == null) ? 0 : getPutItem().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof DynamoDBv2Action == false) return false; DynamoDBv2Action other = (DynamoDBv2Action) obj; if (other.getRoleArn() == null ^ this.getRoleArn() == null) return false; if (other.getRoleArn() != null && other.getRoleArn().equals(this.getRoleArn()) == false) return false; if (other.getPutItem() == null ^ this.getPutItem() == null) return false; if (other.getPutItem() != null && other.getPutItem().equals(this.getPutItem()) == false) return false; return true; } }