All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.pinpoint.model.EndpointMessageResult Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Pinpoint module holds the client classes that are used for communicating with Amazon Pinpoint Service

There is a newer version: 2.28.4
Show newest version
/*
 * 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.pinpoint.model;

import java.io.Serializable;
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 result from sending a message to an endpoint.
 */
@Generated("software.amazon.awssdk:codegen")
public final class EndpointMessageResult implements SdkPojo, Serializable,
        ToCopyableBuilder {
    private static final SdkField ADDRESS_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(EndpointMessageResult::address)).setter(setter(Builder::address))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Address").build()).build();

    private static final SdkField DELIVERY_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(EndpointMessageResult::deliveryStatusAsString)).setter(setter(Builder::deliveryStatus))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeliveryStatus").build()).build();

    private static final SdkField MESSAGE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(EndpointMessageResult::messageId)).setter(setter(Builder::messageId))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MessageId").build()).build();

    private static final SdkField STATUS_CODE_FIELD = SdkField. builder(MarshallingType.INTEGER)
            .getter(getter(EndpointMessageResult::statusCode)).setter(setter(Builder::statusCode))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusCode").build()).build();

    private static final SdkField STATUS_MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(EndpointMessageResult::statusMessage)).setter(setter(Builder::statusMessage))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusMessage").build()).build();

    private static final SdkField UPDATED_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
            .getter(getter(EndpointMessageResult::updatedToken)).setter(setter(Builder::updatedToken))
            .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UpdatedToken").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ADDRESS_FIELD,
            DELIVERY_STATUS_FIELD, MESSAGE_ID_FIELD, STATUS_CODE_FIELD, STATUS_MESSAGE_FIELD, UPDATED_TOKEN_FIELD));

    private static final long serialVersionUID = 1L;

    private final String address;

    private final String deliveryStatus;

    private final String messageId;

    private final Integer statusCode;

    private final String statusMessage;

    private final String updatedToken;

    private EndpointMessageResult(BuilderImpl builder) {
        this.address = builder.address;
        this.deliveryStatus = builder.deliveryStatus;
        this.messageId = builder.messageId;
        this.statusCode = builder.statusCode;
        this.statusMessage = builder.statusMessage;
        this.updatedToken = builder.updatedToken;
    }

    /**
     * Address that endpoint message was delivered to.
     * 
     * @return Address that endpoint message was delivered to.
     */
    public String address() {
        return address;
    }

    /**
     * The delivery status of the message. Possible values:
     *
     * SUCCESS - The message was successfully delivered to the endpoint.
     *
     * TRANSIENT_FAILURE - A temporary error occurred. Amazon Pinpoint will attempt to deliver the message again later.
     *
     * FAILURE_PERMANENT - An error occurred when delivering the message to the endpoint. Amazon Pinpoint won't attempt
     * to send the message again.
     *
     * TIMEOUT - The message couldn't be sent within the timeout period.
     *
     * QUIET_TIME - The local time for the endpoint was within the QuietTime for the campaign or app.
     *
     * DAILY_CAP - The endpoint has received the maximum number of messages it can receive within a 24-hour period.
     *
     * HOLDOUT - The endpoint was in a hold out treatment for the campaign.
     *
     * THROTTLED - Amazon Pinpoint throttled sending to this endpoint.
     *
     * EXPIRED - The endpoint address is expired.
     *
     * CAMPAIGN_CAP - The endpoint received the maximum number of messages allowed by the campaign.
     *
     * SERVICE_FAILURE - A service-level failure prevented Amazon Pinpoint from delivering the message.
     *
     * UNKNOWN - An unknown error occurred.
     * 

* If the service returns an enum value that is not available in the current SDK version, {@link #deliveryStatus} * will return {@link DeliveryStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #deliveryStatusAsString}. *

* * @return The delivery status of the message. Possible values: * * SUCCESS - The message was successfully delivered to the endpoint. * * TRANSIENT_FAILURE - A temporary error occurred. Amazon Pinpoint will attempt to deliver the message again * later. * * FAILURE_PERMANENT - An error occurred when delivering the message to the endpoint. Amazon Pinpoint won't * attempt to send the message again. * * TIMEOUT - The message couldn't be sent within the timeout period. * * QUIET_TIME - The local time for the endpoint was within the QuietTime for the campaign or app. * * DAILY_CAP - The endpoint has received the maximum number of messages it can receive within a 24-hour * period. * * HOLDOUT - The endpoint was in a hold out treatment for the campaign. * * THROTTLED - Amazon Pinpoint throttled sending to this endpoint. * * EXPIRED - The endpoint address is expired. * * CAMPAIGN_CAP - The endpoint received the maximum number of messages allowed by the campaign. * * SERVICE_FAILURE - A service-level failure prevented Amazon Pinpoint from delivering the message. * * UNKNOWN - An unknown error occurred. * @see DeliveryStatus */ public DeliveryStatus deliveryStatus() { return DeliveryStatus.fromValue(deliveryStatus); } /** * The delivery status of the message. Possible values: * * SUCCESS - The message was successfully delivered to the endpoint. * * TRANSIENT_FAILURE - A temporary error occurred. Amazon Pinpoint will attempt to deliver the message again later. * * FAILURE_PERMANENT - An error occurred when delivering the message to the endpoint. Amazon Pinpoint won't attempt * to send the message again. * * TIMEOUT - The message couldn't be sent within the timeout period. * * QUIET_TIME - The local time for the endpoint was within the QuietTime for the campaign or app. * * DAILY_CAP - The endpoint has received the maximum number of messages it can receive within a 24-hour period. * * HOLDOUT - The endpoint was in a hold out treatment for the campaign. * * THROTTLED - Amazon Pinpoint throttled sending to this endpoint. * * EXPIRED - The endpoint address is expired. * * CAMPAIGN_CAP - The endpoint received the maximum number of messages allowed by the campaign. * * SERVICE_FAILURE - A service-level failure prevented Amazon Pinpoint from delivering the message. * * UNKNOWN - An unknown error occurred. *

* If the service returns an enum value that is not available in the current SDK version, {@link #deliveryStatus} * will return {@link DeliveryStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available * from {@link #deliveryStatusAsString}. *

* * @return The delivery status of the message. Possible values: * * SUCCESS - The message was successfully delivered to the endpoint. * * TRANSIENT_FAILURE - A temporary error occurred. Amazon Pinpoint will attempt to deliver the message again * later. * * FAILURE_PERMANENT - An error occurred when delivering the message to the endpoint. Amazon Pinpoint won't * attempt to send the message again. * * TIMEOUT - The message couldn't be sent within the timeout period. * * QUIET_TIME - The local time for the endpoint was within the QuietTime for the campaign or app. * * DAILY_CAP - The endpoint has received the maximum number of messages it can receive within a 24-hour * period. * * HOLDOUT - The endpoint was in a hold out treatment for the campaign. * * THROTTLED - Amazon Pinpoint throttled sending to this endpoint. * * EXPIRED - The endpoint address is expired. * * CAMPAIGN_CAP - The endpoint received the maximum number of messages allowed by the campaign. * * SERVICE_FAILURE - A service-level failure prevented Amazon Pinpoint from delivering the message. * * UNKNOWN - An unknown error occurred. * @see DeliveryStatus */ public String deliveryStatusAsString() { return deliveryStatus; } /** * Unique message identifier associated with the message that was sent. * * @return Unique message identifier associated with the message that was sent. */ public String messageId() { return messageId; } /** * Downstream service status code. * * @return Downstream service status code. */ public Integer statusCode() { return statusCode; } /** * Status message for message delivery. * * @return Status message for message delivery. */ public String statusMessage() { return statusMessage; } /** * If token was updated as part of delivery. (This is GCM Specific) * * @return If token was updated as part of delivery. (This is GCM Specific) */ public String updatedToken() { return updatedToken; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(address()); hashCode = 31 * hashCode + Objects.hashCode(deliveryStatusAsString()); hashCode = 31 * hashCode + Objects.hashCode(messageId()); hashCode = 31 * hashCode + Objects.hashCode(statusCode()); hashCode = 31 * hashCode + Objects.hashCode(statusMessage()); hashCode = 31 * hashCode + Objects.hashCode(updatedToken()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof EndpointMessageResult)) { return false; } EndpointMessageResult other = (EndpointMessageResult) obj; return Objects.equals(address(), other.address()) && Objects.equals(deliveryStatusAsString(), other.deliveryStatusAsString()) && Objects.equals(messageId(), other.messageId()) && Objects.equals(statusCode(), other.statusCode()) && Objects.equals(statusMessage(), other.statusMessage()) && Objects.equals(updatedToken(), other.updatedToken()); } /** * 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("EndpointMessageResult").add("Address", address()) .add("DeliveryStatus", deliveryStatusAsString()).add("MessageId", messageId()).add("StatusCode", statusCode()) .add("StatusMessage", statusMessage()).add("UpdatedToken", updatedToken()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Address": return Optional.ofNullable(clazz.cast(address())); case "DeliveryStatus": return Optional.ofNullable(clazz.cast(deliveryStatusAsString())); case "MessageId": return Optional.ofNullable(clazz.cast(messageId())); case "StatusCode": return Optional.ofNullable(clazz.cast(statusCode())); case "StatusMessage": return Optional.ofNullable(clazz.cast(statusMessage())); case "UpdatedToken": return Optional.ofNullable(clazz.cast(updatedToken())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((EndpointMessageResult) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** * Address that endpoint message was delivered to. * * @param address * Address that endpoint message was delivered to. * @return Returns a reference to this object so that method calls can be chained together. */ Builder address(String address); /** * The delivery status of the message. Possible values: * * SUCCESS - The message was successfully delivered to the endpoint. * * TRANSIENT_FAILURE - A temporary error occurred. Amazon Pinpoint will attempt to deliver the message again * later. * * FAILURE_PERMANENT - An error occurred when delivering the message to the endpoint. Amazon Pinpoint won't * attempt to send the message again. * * TIMEOUT - The message couldn't be sent within the timeout period. * * QUIET_TIME - The local time for the endpoint was within the QuietTime for the campaign or app. * * DAILY_CAP - The endpoint has received the maximum number of messages it can receive within a 24-hour period. * * HOLDOUT - The endpoint was in a hold out treatment for the campaign. * * THROTTLED - Amazon Pinpoint throttled sending to this endpoint. * * EXPIRED - The endpoint address is expired. * * CAMPAIGN_CAP - The endpoint received the maximum number of messages allowed by the campaign. * * SERVICE_FAILURE - A service-level failure prevented Amazon Pinpoint from delivering the message. * * UNKNOWN - An unknown error occurred. * * @param deliveryStatus * The delivery status of the message. Possible values: * * SUCCESS - The message was successfully delivered to the endpoint. * * TRANSIENT_FAILURE - A temporary error occurred. Amazon Pinpoint will attempt to deliver the message * again later. * * FAILURE_PERMANENT - An error occurred when delivering the message to the endpoint. Amazon Pinpoint * won't attempt to send the message again. * * TIMEOUT - The message couldn't be sent within the timeout period. * * QUIET_TIME - The local time for the endpoint was within the QuietTime for the campaign or app. * * DAILY_CAP - The endpoint has received the maximum number of messages it can receive within a 24-hour * period. * * HOLDOUT - The endpoint was in a hold out treatment for the campaign. * * THROTTLED - Amazon Pinpoint throttled sending to this endpoint. * * EXPIRED - The endpoint address is expired. * * CAMPAIGN_CAP - The endpoint received the maximum number of messages allowed by the campaign. * * SERVICE_FAILURE - A service-level failure prevented Amazon Pinpoint from delivering the message. * * UNKNOWN - An unknown error occurred. * @see DeliveryStatus * @return Returns a reference to this object so that method calls can be chained together. * @see DeliveryStatus */ Builder deliveryStatus(String deliveryStatus); /** * The delivery status of the message. Possible values: * * SUCCESS - The message was successfully delivered to the endpoint. * * TRANSIENT_FAILURE - A temporary error occurred. Amazon Pinpoint will attempt to deliver the message again * later. * * FAILURE_PERMANENT - An error occurred when delivering the message to the endpoint. Amazon Pinpoint won't * attempt to send the message again. * * TIMEOUT - The message couldn't be sent within the timeout period. * * QUIET_TIME - The local time for the endpoint was within the QuietTime for the campaign or app. * * DAILY_CAP - The endpoint has received the maximum number of messages it can receive within a 24-hour period. * * HOLDOUT - The endpoint was in a hold out treatment for the campaign. * * THROTTLED - Amazon Pinpoint throttled sending to this endpoint. * * EXPIRED - The endpoint address is expired. * * CAMPAIGN_CAP - The endpoint received the maximum number of messages allowed by the campaign. * * SERVICE_FAILURE - A service-level failure prevented Amazon Pinpoint from delivering the message. * * UNKNOWN - An unknown error occurred. * * @param deliveryStatus * The delivery status of the message. Possible values: * * SUCCESS - The message was successfully delivered to the endpoint. * * TRANSIENT_FAILURE - A temporary error occurred. Amazon Pinpoint will attempt to deliver the message * again later. * * FAILURE_PERMANENT - An error occurred when delivering the message to the endpoint. Amazon Pinpoint * won't attempt to send the message again. * * TIMEOUT - The message couldn't be sent within the timeout period. * * QUIET_TIME - The local time for the endpoint was within the QuietTime for the campaign or app. * * DAILY_CAP - The endpoint has received the maximum number of messages it can receive within a 24-hour * period. * * HOLDOUT - The endpoint was in a hold out treatment for the campaign. * * THROTTLED - Amazon Pinpoint throttled sending to this endpoint. * * EXPIRED - The endpoint address is expired. * * CAMPAIGN_CAP - The endpoint received the maximum number of messages allowed by the campaign. * * SERVICE_FAILURE - A service-level failure prevented Amazon Pinpoint from delivering the message. * * UNKNOWN - An unknown error occurred. * @see DeliveryStatus * @return Returns a reference to this object so that method calls can be chained together. * @see DeliveryStatus */ Builder deliveryStatus(DeliveryStatus deliveryStatus); /** * Unique message identifier associated with the message that was sent. * * @param messageId * Unique message identifier associated with the message that was sent. * @return Returns a reference to this object so that method calls can be chained together. */ Builder messageId(String messageId); /** * Downstream service status code. * * @param statusCode * Downstream service status code. * @return Returns a reference to this object so that method calls can be chained together. */ Builder statusCode(Integer statusCode); /** * Status message for message delivery. * * @param statusMessage * Status message for message delivery. * @return Returns a reference to this object so that method calls can be chained together. */ Builder statusMessage(String statusMessage); /** * If token was updated as part of delivery. (This is GCM Specific) * * @param updatedToken * If token was updated as part of delivery. (This is GCM Specific) * @return Returns a reference to this object so that method calls can be chained together. */ Builder updatedToken(String updatedToken); } static final class BuilderImpl implements Builder { private String address; private String deliveryStatus; private String messageId; private Integer statusCode; private String statusMessage; private String updatedToken; private BuilderImpl() { } private BuilderImpl(EndpointMessageResult model) { address(model.address); deliveryStatus(model.deliveryStatus); messageId(model.messageId); statusCode(model.statusCode); statusMessage(model.statusMessage); updatedToken(model.updatedToken); } public final String getAddress() { return address; } @Override public final Builder address(String address) { this.address = address; return this; } public final void setAddress(String address) { this.address = address; } public final String getDeliveryStatusAsString() { return deliveryStatus; } @Override public final Builder deliveryStatus(String deliveryStatus) { this.deliveryStatus = deliveryStatus; return this; } @Override public final Builder deliveryStatus(DeliveryStatus deliveryStatus) { this.deliveryStatus(deliveryStatus.toString()); return this; } public final void setDeliveryStatus(String deliveryStatus) { this.deliveryStatus = deliveryStatus; } 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 Integer getStatusCode() { return statusCode; } @Override public final Builder statusCode(Integer statusCode) { this.statusCode = statusCode; return this; } public final void setStatusCode(Integer statusCode) { this.statusCode = statusCode; } public final String getStatusMessage() { return statusMessage; } @Override public final Builder statusMessage(String statusMessage) { this.statusMessage = statusMessage; return this; } public final void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; } public final String getUpdatedToken() { return updatedToken; } @Override public final Builder updatedToken(String updatedToken) { this.updatedToken = updatedToken; return this; } public final void setUpdatedToken(String updatedToken) { this.updatedToken = updatedToken; } @Override public EndpointMessageResult build() { return new EndpointMessageResult(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy