
software.amazon.awssdk.services.sqs.model.SendMessageResponse Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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 software.amazon.awssdk.services.sqs.model;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The MD5OfMessageBody
and MessageId
elements.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class SendMessageResponse extends SqsResponse implements
ToCopyableBuilder {
private static final SdkField MD5_OF_MESSAGE_BODY_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(SendMessageResponse::md5OfMessageBody)).setter(setter(Builder::md5OfMessageBody))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MD5OfMessageBody").build()).build();
private static final SdkField MD5_OF_MESSAGE_ATTRIBUTES_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(SendMessageResponse::md5OfMessageAttributes)).setter(setter(Builder::md5OfMessageAttributes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MD5OfMessageAttributes").build())
.build();
private static final SdkField MD5_OF_MESSAGE_SYSTEM_ATTRIBUTES_FIELD = SdkField
. builder(MarshallingType.STRING)
.getter(getter(SendMessageResponse::md5OfMessageSystemAttributes))
.setter(setter(Builder::md5OfMessageSystemAttributes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MD5OfMessageSystemAttributes")
.build()).build();
private static final SdkField MESSAGE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(SendMessageResponse::messageId)).setter(setter(Builder::messageId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MessageId").build()).build();
private static final SdkField SEQUENCE_NUMBER_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(SendMessageResponse::sequenceNumber)).setter(setter(Builder::sequenceNumber))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SequenceNumber").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MD5_OF_MESSAGE_BODY_FIELD,
MD5_OF_MESSAGE_ATTRIBUTES_FIELD, MD5_OF_MESSAGE_SYSTEM_ATTRIBUTES_FIELD, MESSAGE_ID_FIELD, SEQUENCE_NUMBER_FIELD));
private final String md5OfMessageBody;
private final String md5OfMessageAttributes;
private final String md5OfMessageSystemAttributes;
private final String messageId;
private final String sequenceNumber;
private SendMessageResponse(BuilderImpl builder) {
super(builder);
this.md5OfMessageBody = builder.md5OfMessageBody;
this.md5OfMessageAttributes = builder.md5OfMessageAttributes;
this.md5OfMessageSystemAttributes = builder.md5OfMessageSystemAttributes;
this.messageId = builder.messageId;
this.sequenceNumber = builder.sequenceNumber;
}
/**
*
* An MD5 digest of the non-URL-encoded message attribute string. You can use this attribute to verify that Amazon
* SQS received the message correctly. Amazon SQS URL-decodes the message before creating the MD5 digest. For
* information about MD5, see RFC1321.
*
*
* @return An MD5 digest of the non-URL-encoded message attribute string. You can use this attribute to verify that
* Amazon SQS received the message correctly. Amazon SQS URL-decodes the message before creating the MD5
* digest. For information about MD5, see RFC1321.
*/
public String md5OfMessageBody() {
return md5OfMessageBody;
}
/**
*
* An MD5 digest of the non-URL-encoded message attribute string. You can use this attribute to verify that Amazon
* SQS received the message correctly. Amazon SQS URL-decodes the message before creating the MD5 digest. For
* information about MD5, see RFC1321.
*
*
* @return An MD5 digest of the non-URL-encoded message attribute string. You can use this attribute to verify that
* Amazon SQS received the message correctly. Amazon SQS URL-decodes the message before creating the MD5
* digest. For information about MD5, see RFC1321.
*/
public String md5OfMessageAttributes() {
return md5OfMessageAttributes;
}
/**
*
* An MD5 digest of the non-URL-encoded message system attribute string. You can use this attribute to verify that
* Amazon SQS received the message correctly. Amazon SQS URL-decodes the message before creating the MD5 digest.
*
*
* @return An MD5 digest of the non-URL-encoded message system attribute string. You can use this attribute to
* verify that Amazon SQS received the message correctly. Amazon SQS URL-decodes the message before creating
* the MD5 digest.
*/
public String md5OfMessageSystemAttributes() {
return md5OfMessageSystemAttributes;
}
/**
*
* An attribute containing the MessageId
of the message sent to the queue. For more information, see Queue and Message Identifiers in the Amazon Simple Queue Service Developer Guide.
*
*
* @return An attribute containing the MessageId
of the message sent to the queue. For more
* information, see Queue and Message Identifiers in the Amazon Simple Queue Service Developer Guide.
*/
public String messageId() {
return messageId;
}
/**
*
* This parameter applies only to FIFO (first-in-first-out) queues.
*
*
* The large, non-consecutive number that Amazon SQS assigns to each message.
*
*
* The length of SequenceNumber
is 128 bits. SequenceNumber
continues to increase for a
* particular MessageGroupId
.
*
*
* @return This parameter applies only to FIFO (first-in-first-out) queues.
*
* The large, non-consecutive number that Amazon SQS assigns to each message.
*
*
* The length of SequenceNumber
is 128 bits. SequenceNumber
continues to increase
* for a particular MessageGroupId
.
*/
public String sequenceNumber() {
return sequenceNumber;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(md5OfMessageBody());
hashCode = 31 * hashCode + Objects.hashCode(md5OfMessageAttributes());
hashCode = 31 * hashCode + Objects.hashCode(md5OfMessageSystemAttributes());
hashCode = 31 * hashCode + Objects.hashCode(messageId());
hashCode = 31 * hashCode + Objects.hashCode(sequenceNumber());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof SendMessageResponse)) {
return false;
}
SendMessageResponse other = (SendMessageResponse) obj;
return Objects.equals(md5OfMessageBody(), other.md5OfMessageBody())
&& Objects.equals(md5OfMessageAttributes(), other.md5OfMessageAttributes())
&& Objects.equals(md5OfMessageSystemAttributes(), other.md5OfMessageSystemAttributes())
&& Objects.equals(messageId(), other.messageId()) && Objects.equals(sequenceNumber(), other.sequenceNumber());
}
/**
* 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.
*/
@Override
public String toString() {
return ToString.builder("SendMessageResponse").add("MD5OfMessageBody", md5OfMessageBody())
.add("MD5OfMessageAttributes", md5OfMessageAttributes())
.add("MD5OfMessageSystemAttributes", md5OfMessageSystemAttributes()).add("MessageId", messageId())
.add("SequenceNumber", sequenceNumber()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "MD5OfMessageBody":
return Optional.ofNullable(clazz.cast(md5OfMessageBody()));
case "MD5OfMessageAttributes":
return Optional.ofNullable(clazz.cast(md5OfMessageAttributes()));
case "MD5OfMessageSystemAttributes":
return Optional.ofNullable(clazz.cast(md5OfMessageSystemAttributes()));
case "MessageId":
return Optional.ofNullable(clazz.cast(messageId()));
case "SequenceNumber":
return Optional.ofNullable(clazz.cast(sequenceNumber()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* The large, non-consecutive number that Amazon SQS assigns to each message.
*
*
* The length of SequenceNumber
is 128 bits. SequenceNumber
continues to
* increase for a particular MessageGroupId
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder sequenceNumber(String sequenceNumber);
}
static final class BuilderImpl extends SqsResponse.BuilderImpl implements Builder {
private String md5OfMessageBody;
private String md5OfMessageAttributes;
private String md5OfMessageSystemAttributes;
private String messageId;
private String sequenceNumber;
private BuilderImpl() {
}
private BuilderImpl(SendMessageResponse model) {
super(model);
md5OfMessageBody(model.md5OfMessageBody);
md5OfMessageAttributes(model.md5OfMessageAttributes);
md5OfMessageSystemAttributes(model.md5OfMessageSystemAttributes);
messageId(model.messageId);
sequenceNumber(model.sequenceNumber);
}
public final String getMd5OfMessageBody() {
return md5OfMessageBody;
}
@Override
public final Builder md5OfMessageBody(String md5OfMessageBody) {
this.md5OfMessageBody = md5OfMessageBody;
return this;
}
public final void setMd5OfMessageBody(String md5OfMessageBody) {
this.md5OfMessageBody = md5OfMessageBody;
}
public final String getMd5OfMessageAttributes() {
return md5OfMessageAttributes;
}
@Override
public final Builder md5OfMessageAttributes(String md5OfMessageAttributes) {
this.md5OfMessageAttributes = md5OfMessageAttributes;
return this;
}
public final void setMd5OfMessageAttributes(String md5OfMessageAttributes) {
this.md5OfMessageAttributes = md5OfMessageAttributes;
}
public final String getMd5OfMessageSystemAttributes() {
return md5OfMessageSystemAttributes;
}
@Override
public final Builder md5OfMessageSystemAttributes(String md5OfMessageSystemAttributes) {
this.md5OfMessageSystemAttributes = md5OfMessageSystemAttributes;
return this;
}
public final void setMd5OfMessageSystemAttributes(String md5OfMessageSystemAttributes) {
this.md5OfMessageSystemAttributes = md5OfMessageSystemAttributes;
}
public final String getMessageId() {
return messageId;
}
@Override
public final Builder messageId(String messageId) {
this.messageId = messageId;
return this;
}
public final void setMessageId(String messageId) {
this.messageId = messageId;
}
public final String getSequenceNumber() {
return sequenceNumber;
}
@Override
public final Builder sequenceNumber(String sequenceNumber) {
this.sequenceNumber = sequenceNumber;
return this;
}
public final void setSequenceNumber(String sequenceNumber) {
this.sequenceNumber = sequenceNumber;
}
@Override
public SendMessageResponse build() {
return new SendMessageResponse(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}