software.amazon.awssdk.services.pinpoint.model.ActivityResponse Maven / Gradle / Ivy
Show all versions of pinpoint Show documentation
/*
* Copyright 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;
/**
*
* Provides information about an activity that was performed by a campaign.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ActivityResponse implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField APPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ApplicationId").getter(getter(ActivityResponse::applicationId)).setter(setter(Builder::applicationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplicationId").build()).build();
private static final SdkField CAMPAIGN_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CampaignId").getter(getter(ActivityResponse::campaignId)).setter(setter(Builder::campaignId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CampaignId").build()).build();
private static final SdkField END_FIELD = SdkField. builder(MarshallingType.STRING).memberName("End")
.getter(getter(ActivityResponse::end)).setter(setter(Builder::end))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("End").build()).build();
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(ActivityResponse::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField RESULT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Result")
.getter(getter(ActivityResponse::result)).setter(setter(Builder::result))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Result").build()).build();
private static final SdkField SCHEDULED_START_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ScheduledStart").getter(getter(ActivityResponse::scheduledStart))
.setter(setter(Builder::scheduledStart))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScheduledStart").build()).build();
private static final SdkField START_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Start")
.getter(getter(ActivityResponse::start)).setter(setter(Builder::start))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Start").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(ActivityResponse::state)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField SUCCESSFUL_ENDPOINT_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("SuccessfulEndpointCount").getter(getter(ActivityResponse::successfulEndpointCount))
.setter(setter(Builder::successfulEndpointCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SuccessfulEndpointCount").build())
.build();
private static final SdkField TIMEZONES_COMPLETED_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TimezonesCompletedCount").getter(getter(ActivityResponse::timezonesCompletedCount))
.setter(setter(Builder::timezonesCompletedCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TimezonesCompletedCount").build())
.build();
private static final SdkField TIMEZONES_TOTAL_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TimezonesTotalCount").getter(getter(ActivityResponse::timezonesTotalCount))
.setter(setter(Builder::timezonesTotalCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TimezonesTotalCount").build())
.build();
private static final SdkField TOTAL_ENDPOINT_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TotalEndpointCount").getter(getter(ActivityResponse::totalEndpointCount))
.setter(setter(Builder::totalEndpointCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalEndpointCount").build())
.build();
private static final SdkField TREATMENT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TreatmentId").getter(getter(ActivityResponse::treatmentId)).setter(setter(Builder::treatmentId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TreatmentId").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APPLICATION_ID_FIELD,
CAMPAIGN_ID_FIELD, END_FIELD, ID_FIELD, RESULT_FIELD, SCHEDULED_START_FIELD, START_FIELD, STATE_FIELD,
SUCCESSFUL_ENDPOINT_COUNT_FIELD, TIMEZONES_COMPLETED_COUNT_FIELD, TIMEZONES_TOTAL_COUNT_FIELD,
TOTAL_ENDPOINT_COUNT_FIELD, TREATMENT_ID_FIELD));
private static final long serialVersionUID = 1L;
private final String applicationId;
private final String campaignId;
private final String end;
private final String id;
private final String result;
private final String scheduledStart;
private final String start;
private final String state;
private final Integer successfulEndpointCount;
private final Integer timezonesCompletedCount;
private final Integer timezonesTotalCount;
private final Integer totalEndpointCount;
private final String treatmentId;
private ActivityResponse(BuilderImpl builder) {
this.applicationId = builder.applicationId;
this.campaignId = builder.campaignId;
this.end = builder.end;
this.id = builder.id;
this.result = builder.result;
this.scheduledStart = builder.scheduledStart;
this.start = builder.start;
this.state = builder.state;
this.successfulEndpointCount = builder.successfulEndpointCount;
this.timezonesCompletedCount = builder.timezonesCompletedCount;
this.timezonesTotalCount = builder.timezonesTotalCount;
this.totalEndpointCount = builder.totalEndpointCount;
this.treatmentId = builder.treatmentId;
}
/**
*
* The unique identifier for the application that the campaign applies to.
*
*
* @return The unique identifier for the application that the campaign applies to.
*/
public final String applicationId() {
return applicationId;
}
/**
*
* The unique identifier for the campaign that the activity applies to.
*
*
* @return The unique identifier for the campaign that the activity applies to.
*/
public final String campaignId() {
return campaignId;
}
/**
*
* The actual time, in ISO 8601 format, when the activity was marked CANCELLED or COMPLETED.
*
*
* @return The actual time, in ISO 8601 format, when the activity was marked CANCELLED or COMPLETED.
*/
public final String end() {
return end;
}
/**
*
* The unique identifier for the activity.
*
*
* @return The unique identifier for the activity.
*/
public final String id() {
return id;
}
/**
*
* Specifies whether the activity succeeded. Possible values are SUCCESS and FAIL.
*
*
* @return Specifies whether the activity succeeded. Possible values are SUCCESS and FAIL.
*/
public final String result() {
return result;
}
/**
*
* The scheduled start time, in ISO 8601 format, for the activity.
*
*
* @return The scheduled start time, in ISO 8601 format, for the activity.
*/
public final String scheduledStart() {
return scheduledStart;
}
/**
*
* The actual start time, in ISO 8601 format, of the activity.
*
*
* @return The actual start time, in ISO 8601 format, of the activity.
*/
public final String start() {
return start;
}
/**
*
* The current status of the activity. Possible values are: PENDING, INITIALIZING, RUNNING, PAUSED, CANCELLED, and
* COMPLETED.
*
*
* @return The current status of the activity. Possible values are: PENDING, INITIALIZING, RUNNING, PAUSED,
* CANCELLED, and COMPLETED.
*/
public final String state() {
return state;
}
/**
*
* The total number of endpoints that the campaign successfully delivered messages to.
*
*
* @return The total number of endpoints that the campaign successfully delivered messages to.
*/
public final Integer successfulEndpointCount() {
return successfulEndpointCount;
}
/**
*
* The total number of time zones that were completed.
*
*
* @return The total number of time zones that were completed.
*/
public final Integer timezonesCompletedCount() {
return timezonesCompletedCount;
}
/**
*
* The total number of unique time zones that are in the segment for the campaign.
*
*
* @return The total number of unique time zones that are in the segment for the campaign.
*/
public final Integer timezonesTotalCount() {
return timezonesTotalCount;
}
/**
*
* The total number of endpoints that the campaign attempted to deliver messages to.
*
*
* @return The total number of endpoints that the campaign attempted to deliver messages to.
*/
public final Integer totalEndpointCount() {
return totalEndpointCount;
}
/**
*
* The unique identifier for the campaign treatment that the activity applies to. A treatment is a variation of a
* campaign that's used for A/B testing of a campaign.
*
*
* @return The unique identifier for the campaign treatment that the activity applies to. A treatment is a variation
* of a campaign that's used for A/B testing of a campaign.
*/
public final String treatmentId() {
return treatmentId;
}
@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 final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(applicationId());
hashCode = 31 * hashCode + Objects.hashCode(campaignId());
hashCode = 31 * hashCode + Objects.hashCode(end());
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(result());
hashCode = 31 * hashCode + Objects.hashCode(scheduledStart());
hashCode = 31 * hashCode + Objects.hashCode(start());
hashCode = 31 * hashCode + Objects.hashCode(state());
hashCode = 31 * hashCode + Objects.hashCode(successfulEndpointCount());
hashCode = 31 * hashCode + Objects.hashCode(timezonesCompletedCount());
hashCode = 31 * hashCode + Objects.hashCode(timezonesTotalCount());
hashCode = 31 * hashCode + Objects.hashCode(totalEndpointCount());
hashCode = 31 * hashCode + Objects.hashCode(treatmentId());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof ActivityResponse)) {
return false;
}
ActivityResponse other = (ActivityResponse) obj;
return Objects.equals(applicationId(), other.applicationId()) && Objects.equals(campaignId(), other.campaignId())
&& Objects.equals(end(), other.end()) && Objects.equals(id(), other.id())
&& Objects.equals(result(), other.result()) && Objects.equals(scheduledStart(), other.scheduledStart())
&& Objects.equals(start(), other.start()) && Objects.equals(state(), other.state())
&& Objects.equals(successfulEndpointCount(), other.successfulEndpointCount())
&& Objects.equals(timezonesCompletedCount(), other.timezonesCompletedCount())
&& Objects.equals(timezonesTotalCount(), other.timezonesTotalCount())
&& Objects.equals(totalEndpointCount(), other.totalEndpointCount())
&& Objects.equals(treatmentId(), other.treatmentId());
}
/**
* 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 final String toString() {
return ToString.builder("ActivityResponse").add("ApplicationId", applicationId()).add("CampaignId", campaignId())
.add("End", end()).add("Id", id()).add("Result", result()).add("ScheduledStart", scheduledStart())
.add("Start", start()).add("State", state()).add("SuccessfulEndpointCount", successfulEndpointCount())
.add("TimezonesCompletedCount", timezonesCompletedCount()).add("TimezonesTotalCount", timezonesTotalCount())
.add("TotalEndpointCount", totalEndpointCount()).add("TreatmentId", treatmentId()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ApplicationId":
return Optional.ofNullable(clazz.cast(applicationId()));
case "CampaignId":
return Optional.ofNullable(clazz.cast(campaignId()));
case "End":
return Optional.ofNullable(clazz.cast(end()));
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "Result":
return Optional.ofNullable(clazz.cast(result()));
case "ScheduledStart":
return Optional.ofNullable(clazz.cast(scheduledStart()));
case "Start":
return Optional.ofNullable(clazz.cast(start()));
case "State":
return Optional.ofNullable(clazz.cast(state()));
case "SuccessfulEndpointCount":
return Optional.ofNullable(clazz.cast(successfulEndpointCount()));
case "TimezonesCompletedCount":
return Optional.ofNullable(clazz.cast(timezonesCompletedCount()));
case "TimezonesTotalCount":
return Optional.ofNullable(clazz.cast(timezonesTotalCount()));
case "TotalEndpointCount":
return Optional.ofNullable(clazz.cast(totalEndpointCount()));
case "TreatmentId":
return Optional.ofNullable(clazz.cast(treatmentId()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function