com.amazonaws.services.dynamodbv2.model.Record Maven / Gradle / Ivy
/*
* Copyright 2016-2021 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.dynamodbv2.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* A description of a unique event within a stream.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class Record implements Serializable, Cloneable, StructuredPojo {
/**
*
* A globally unique identifier for the event that was recorded in this stream record.
*
*/
private String eventID;
/**
*
* The type of data modification that was performed on the DynamoDB table:
*
*
* -
*
* INSERT
- a new item was added to the table.
*
*
* -
*
* MODIFY
- one or more of an existing item's attributes were modified.
*
*
* -
*
* REMOVE
- the item was deleted from the table
*
*
*
*/
private String eventName;
/**
*
* The version number of the stream record format. This number is updated whenever the structure of
* Record
is modified.
*
*
* Client applications must not assume that eventVersion
will remain at a particular value, as this
* number is subject to change at any time. In general, eventVersion
will only increase as the
* low-level DynamoDB Streams API evolves.
*
*/
private String eventVersion;
/**
*
* The AWS service from which the stream record originated. For DynamoDB Streams, this is aws:dynamodb
.
*
*/
private String eventSource;
/**
*
* The region in which the GetRecords
request was received.
*
*/
private String awsRegion;
/**
*
* The main body of the stream record, containing all of the DynamoDB-specific fields.
*
*/
private StreamRecord dynamodb;
/**
*
* Items that are deleted by the Time to Live process after expiration have the following fields:
*
*
* -
*
* Records[].userIdentity.type
*
*
* "Service"
*
*
* -
*
* Records[].userIdentity.principalId
*
*
* "dynamodb.amazonaws.com"
*
*
*
*/
private Identity userIdentity;
/**
*
* A globally unique identifier for the event that was recorded in this stream record.
*
*
* @param eventID
* A globally unique identifier for the event that was recorded in this stream record.
*/
public void setEventID(String eventID) {
this.eventID = eventID;
}
/**
*
* A globally unique identifier for the event that was recorded in this stream record.
*
*
* @return A globally unique identifier for the event that was recorded in this stream record.
*/
public String getEventID() {
return this.eventID;
}
/**
*
* A globally unique identifier for the event that was recorded in this stream record.
*
*
* @param eventID
* A globally unique identifier for the event that was recorded in this stream record.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Record withEventID(String eventID) {
setEventID(eventID);
return this;
}
/**
*
* The type of data modification that was performed on the DynamoDB table:
*
*
* -
*
* INSERT
- a new item was added to the table.
*
*
* -
*
* MODIFY
- one or more of an existing item's attributes were modified.
*
*
* -
*
* REMOVE
- the item was deleted from the table
*
*
*
*
* @param eventName
* The type of data modification that was performed on the DynamoDB table:
*
* -
*
* INSERT
- a new item was added to the table.
*
*
* -
*
* MODIFY
- one or more of an existing item's attributes were modified.
*
*
* -
*
* REMOVE
- the item was deleted from the table
*
*
* @see OperationType
*/
public void setEventName(String eventName) {
this.eventName = eventName;
}
/**
*
* The type of data modification that was performed on the DynamoDB table:
*
*
* -
*
* INSERT
- a new item was added to the table.
*
*
* -
*
* MODIFY
- one or more of an existing item's attributes were modified.
*
*
* -
*
* REMOVE
- the item was deleted from the table
*
*
*
*
* @return The type of data modification that was performed on the DynamoDB table:
*
* -
*
* INSERT
- a new item was added to the table.
*
*
* -
*
* MODIFY
- one or more of an existing item's attributes were modified.
*
*
* -
*
* REMOVE
- the item was deleted from the table
*
*
* @see OperationType
*/
public String getEventName() {
return this.eventName;
}
/**
*
* The type of data modification that was performed on the DynamoDB table:
*
*
* -
*
* INSERT
- a new item was added to the table.
*
*
* -
*
* MODIFY
- one or more of an existing item's attributes were modified.
*
*
* -
*
* REMOVE
- the item was deleted from the table
*
*
*
*
* @param eventName
* The type of data modification that was performed on the DynamoDB table:
*
* -
*
* INSERT
- a new item was added to the table.
*
*
* -
*
* MODIFY
- one or more of an existing item's attributes were modified.
*
*
* -
*
* REMOVE
- the item was deleted from the table
*
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see OperationType
*/
public Record withEventName(String eventName) {
setEventName(eventName);
return this;
}
/**
*
* The type of data modification that was performed on the DynamoDB table:
*
*
* -
*
* INSERT
- a new item was added to the table.
*
*
* -
*
* MODIFY
- one or more of an existing item's attributes were modified.
*
*
* -
*
* REMOVE
- the item was deleted from the table
*
*
*
*
* @param eventName
* The type of data modification that was performed on the DynamoDB table:
*
* -
*
* INSERT
- a new item was added to the table.
*
*
* -
*
* MODIFY
- one or more of an existing item's attributes were modified.
*
*
* -
*
* REMOVE
- the item was deleted from the table
*
*
* @see OperationType
*/
public void setEventName(OperationType eventName) {
withEventName(eventName);
}
/**
*
* The type of data modification that was performed on the DynamoDB table:
*
*
* -
*
* INSERT
- a new item was added to the table.
*
*
* -
*
* MODIFY
- one or more of an existing item's attributes were modified.
*
*
* -
*
* REMOVE
- the item was deleted from the table
*
*
*
*
* @param eventName
* The type of data modification that was performed on the DynamoDB table:
*
* -
*
* INSERT
- a new item was added to the table.
*
*
* -
*
* MODIFY
- one or more of an existing item's attributes were modified.
*
*
* -
*
* REMOVE
- the item was deleted from the table
*
*
* @return Returns a reference to this object so that method calls can be chained together.
* @see OperationType
*/
public Record withEventName(OperationType eventName) {
this.eventName = eventName.toString();
return this;
}
/**
*
* The version number of the stream record format. This number is updated whenever the structure of
* Record
is modified.
*
*
* Client applications must not assume that eventVersion
will remain at a particular value, as this
* number is subject to change at any time. In general, eventVersion
will only increase as the
* low-level DynamoDB Streams API evolves.
*
*
* @param eventVersion
* The version number of the stream record format. This number is updated whenever the structure of
* Record
is modified.
*
* Client applications must not assume that eventVersion
will remain at a particular value, as
* this number is subject to change at any time. In general, eventVersion
will only increase as
* the low-level DynamoDB Streams API evolves.
*/
public void setEventVersion(String eventVersion) {
this.eventVersion = eventVersion;
}
/**
*
* The version number of the stream record format. This number is updated whenever the structure of
* Record
is modified.
*
*
* Client applications must not assume that eventVersion
will remain at a particular value, as this
* number is subject to change at any time. In general, eventVersion
will only increase as the
* low-level DynamoDB Streams API evolves.
*
*
* @return The version number of the stream record format. This number is updated whenever the structure of
* Record
is modified.
*
* Client applications must not assume that eventVersion
will remain at a particular value, as
* this number is subject to change at any time. In general, eventVersion
will only increase as
* the low-level DynamoDB Streams API evolves.
*/
public String getEventVersion() {
return this.eventVersion;
}
/**
*
* The version number of the stream record format. This number is updated whenever the structure of
* Record
is modified.
*
*
* Client applications must not assume that eventVersion
will remain at a particular value, as this
* number is subject to change at any time. In general, eventVersion
will only increase as the
* low-level DynamoDB Streams API evolves.
*
*
* @param eventVersion
* The version number of the stream record format. This number is updated whenever the structure of
* Record
is modified.
*
* Client applications must not assume that eventVersion
will remain at a particular value, as
* this number is subject to change at any time. In general, eventVersion
will only increase as
* the low-level DynamoDB Streams API evolves.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Record withEventVersion(String eventVersion) {
setEventVersion(eventVersion);
return this;
}
/**
*
* The AWS service from which the stream record originated. For DynamoDB Streams, this is aws:dynamodb
.
*
*
* @param eventSource
* The AWS service from which the stream record originated. For DynamoDB Streams, this is
* aws:dynamodb
.
*/
public void setEventSource(String eventSource) {
this.eventSource = eventSource;
}
/**
*
* The AWS service from which the stream record originated. For DynamoDB Streams, this is aws:dynamodb
.
*
*
* @return The AWS service from which the stream record originated. For DynamoDB Streams, this is
* aws:dynamodb
.
*/
public String getEventSource() {
return this.eventSource;
}
/**
*
* The AWS service from which the stream record originated. For DynamoDB Streams, this is aws:dynamodb
.
*
*
* @param eventSource
* The AWS service from which the stream record originated. For DynamoDB Streams, this is
* aws:dynamodb
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Record withEventSource(String eventSource) {
setEventSource(eventSource);
return this;
}
/**
*
* The region in which the GetRecords
request was received.
*
*
* @param awsRegion
* The region in which the GetRecords
request was received.
*/
public void setAwsRegion(String awsRegion) {
this.awsRegion = awsRegion;
}
/**
*
* The region in which the GetRecords
request was received.
*
*
* @return The region in which the GetRecords
request was received.
*/
public String getAwsRegion() {
return this.awsRegion;
}
/**
*
* The region in which the GetRecords
request was received.
*
*
* @param awsRegion
* The region in which the GetRecords
request was received.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Record withAwsRegion(String awsRegion) {
setAwsRegion(awsRegion);
return this;
}
/**
*
* The main body of the stream record, containing all of the DynamoDB-specific fields.
*
*
* @param dynamodb
* The main body of the stream record, containing all of the DynamoDB-specific fields.
*/
public void setDynamodb(StreamRecord dynamodb) {
this.dynamodb = dynamodb;
}
/**
*
* The main body of the stream record, containing all of the DynamoDB-specific fields.
*
*
* @return The main body of the stream record, containing all of the DynamoDB-specific fields.
*/
public StreamRecord getDynamodb() {
return this.dynamodb;
}
/**
*
* The main body of the stream record, containing all of the DynamoDB-specific fields.
*
*
* @param dynamodb
* The main body of the stream record, containing all of the DynamoDB-specific fields.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Record withDynamodb(StreamRecord dynamodb) {
setDynamodb(dynamodb);
return this;
}
/**
*
* Items that are deleted by the Time to Live process after expiration have the following fields:
*
*
* -
*
* Records[].userIdentity.type
*
*
* "Service"
*
*
* -
*
* Records[].userIdentity.principalId
*
*
* "dynamodb.amazonaws.com"
*
*
*
*
* @param userIdentity
* Items that are deleted by the Time to Live process after expiration have the following fields:
*
* -
*
* Records[].userIdentity.type
*
*
* "Service"
*
*
* -
*
* Records[].userIdentity.principalId
*
*
* "dynamodb.amazonaws.com"
*
*
*/
public void setUserIdentity(Identity userIdentity) {
this.userIdentity = userIdentity;
}
/**
*
* Items that are deleted by the Time to Live process after expiration have the following fields:
*
*
* -
*
* Records[].userIdentity.type
*
*
* "Service"
*
*
* -
*
* Records[].userIdentity.principalId
*
*
* "dynamodb.amazonaws.com"
*
*
*
*
* @return Items that are deleted by the Time to Live process after expiration have the following fields:
*
* -
*
* Records[].userIdentity.type
*
*
* "Service"
*
*
* -
*
* Records[].userIdentity.principalId
*
*
* "dynamodb.amazonaws.com"
*
*
*/
public Identity getUserIdentity() {
return this.userIdentity;
}
/**
*
* Items that are deleted by the Time to Live process after expiration have the following fields:
*
*
* -
*
* Records[].userIdentity.type
*
*
* "Service"
*
*
* -
*
* Records[].userIdentity.principalId
*
*
* "dynamodb.amazonaws.com"
*
*
*
*
* @param userIdentity
* Items that are deleted by the Time to Live process after expiration have the following fields:
*
* -
*
* Records[].userIdentity.type
*
*
* "Service"
*
*
* -
*
* Records[].userIdentity.principalId
*
*
* "dynamodb.amazonaws.com"
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public Record withUserIdentity(Identity userIdentity) {
setUserIdentity(userIdentity);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getEventID() != null)
sb.append("EventID: ").append(getEventID()).append(",");
if (getEventName() != null)
sb.append("EventName: ").append(getEventName()).append(",");
if (getEventVersion() != null)
sb.append("EventVersion: ").append(getEventVersion()).append(",");
if (getEventSource() != null)
sb.append("EventSource: ").append(getEventSource()).append(",");
if (getAwsRegion() != null)
sb.append("AwsRegion: ").append(getAwsRegion()).append(",");
if (getDynamodb() != null)
sb.append("Dynamodb: ").append(getDynamodb()).append(",");
if (getUserIdentity() != null)
sb.append("UserIdentity: ").append(getUserIdentity());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Record == false)
return false;
Record other = (Record) obj;
if (other.getEventID() == null ^ this.getEventID() == null)
return false;
if (other.getEventID() != null && other.getEventID().equals(this.getEventID()) == false)
return false;
if (other.getEventName() == null ^ this.getEventName() == null)
return false;
if (other.getEventName() != null && other.getEventName().equals(this.getEventName()) == false)
return false;
if (other.getEventVersion() == null ^ this.getEventVersion() == null)
return false;
if (other.getEventVersion() != null && other.getEventVersion().equals(this.getEventVersion()) == false)
return false;
if (other.getEventSource() == null ^ this.getEventSource() == null)
return false;
if (other.getEventSource() != null && other.getEventSource().equals(this.getEventSource()) == false)
return false;
if (other.getAwsRegion() == null ^ this.getAwsRegion() == null)
return false;
if (other.getAwsRegion() != null && other.getAwsRegion().equals(this.getAwsRegion()) == false)
return false;
if (other.getDynamodb() == null ^ this.getDynamodb() == null)
return false;
if (other.getDynamodb() != null && other.getDynamodb().equals(this.getDynamodb()) == false)
return false;
if (other.getUserIdentity() == null ^ this.getUserIdentity() == null)
return false;
if (other.getUserIdentity() != null && other.getUserIdentity().equals(this.getUserIdentity()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getEventID() == null) ? 0 : getEventID().hashCode());
hashCode = prime * hashCode + ((getEventName() == null) ? 0 : getEventName().hashCode());
hashCode = prime * hashCode + ((getEventVersion() == null) ? 0 : getEventVersion().hashCode());
hashCode = prime * hashCode + ((getEventSource() == null) ? 0 : getEventSource().hashCode());
hashCode = prime * hashCode + ((getAwsRegion() == null) ? 0 : getAwsRegion().hashCode());
hashCode = prime * hashCode + ((getDynamodb() == null) ? 0 : getDynamodb().hashCode());
hashCode = prime * hashCode + ((getUserIdentity() == null) ? 0 : getUserIdentity().hashCode());
return hashCode;
}
@Override
public Record clone() {
try {
return (Record) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.dynamodbv2.model.transform.RecordMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}