software.amazon.awssdk.services.pinpoint.model.ExportJobResponse 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.Collection;
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.Consumer;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Provides information about the status and settings of a job that exports endpoint definitions to a file. The file can
* be added directly to an Amazon Simple Storage Service (Amazon S3) bucket by using the Amazon Pinpoint API or
* downloaded directly to a computer by using the Amazon Pinpoint console.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ExportJobResponse implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField APPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ApplicationId").getter(getter(ExportJobResponse::applicationId)).setter(setter(Builder::applicationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplicationId").build()).build();
private static final SdkField COMPLETED_PIECES_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("CompletedPieces").getter(getter(ExportJobResponse::completedPieces))
.setter(setter(Builder::completedPieces))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompletedPieces").build()).build();
private static final SdkField COMPLETION_DATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CompletionDate").getter(getter(ExportJobResponse::completionDate))
.setter(setter(Builder::completionDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompletionDate").build()).build();
private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CreationDate").getter(getter(ExportJobResponse::creationDate)).setter(setter(Builder::creationDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationDate").build()).build();
private static final SdkField DEFINITION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Definition")
.getter(getter(ExportJobResponse::definition)).setter(setter(Builder::definition))
.constructor(ExportJobResource::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Definition").build()).build();
private static final SdkField FAILED_PIECES_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("FailedPieces").getter(getter(ExportJobResponse::failedPieces)).setter(setter(Builder::failedPieces))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailedPieces").build()).build();
private static final SdkField> FAILURES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Failures")
.getter(getter(ExportJobResponse::failures))
.setter(setter(Builder::failures))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Failures").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(ExportJobResponse::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField JOB_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("JobStatus").getter(getter(ExportJobResponse::jobStatusAsString)).setter(setter(Builder::jobStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("JobStatus").build()).build();
private static final SdkField TOTAL_FAILURES_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TotalFailures").getter(getter(ExportJobResponse::totalFailures)).setter(setter(Builder::totalFailures))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalFailures").build()).build();
private static final SdkField TOTAL_PIECES_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TotalPieces").getter(getter(ExportJobResponse::totalPieces)).setter(setter(Builder::totalPieces))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalPieces").build()).build();
private static final SdkField TOTAL_PROCESSED_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TotalProcessed").getter(getter(ExportJobResponse::totalProcessed))
.setter(setter(Builder::totalProcessed))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalProcessed").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type")
.getter(getter(ExportJobResponse::type)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(APPLICATION_ID_FIELD,
COMPLETED_PIECES_FIELD, COMPLETION_DATE_FIELD, CREATION_DATE_FIELD, DEFINITION_FIELD, FAILED_PIECES_FIELD,
FAILURES_FIELD, ID_FIELD, JOB_STATUS_FIELD, TOTAL_FAILURES_FIELD, TOTAL_PIECES_FIELD, TOTAL_PROCESSED_FIELD,
TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final String applicationId;
private final Integer completedPieces;
private final String completionDate;
private final String creationDate;
private final ExportJobResource definition;
private final Integer failedPieces;
private final List failures;
private final String id;
private final String jobStatus;
private final Integer totalFailures;
private final Integer totalPieces;
private final Integer totalProcessed;
private final String type;
private ExportJobResponse(BuilderImpl builder) {
this.applicationId = builder.applicationId;
this.completedPieces = builder.completedPieces;
this.completionDate = builder.completionDate;
this.creationDate = builder.creationDate;
this.definition = builder.definition;
this.failedPieces = builder.failedPieces;
this.failures = builder.failures;
this.id = builder.id;
this.jobStatus = builder.jobStatus;
this.totalFailures = builder.totalFailures;
this.totalPieces = builder.totalPieces;
this.totalProcessed = builder.totalProcessed;
this.type = builder.type;
}
/**
*
* The unique identifier for the application that's associated with the export job.
*
*
* @return The unique identifier for the application that's associated with the export job.
*/
public final String applicationId() {
return applicationId;
}
/**
*
* The number of pieces that were processed successfully (completed) by the export job, as of the time of the
* request.
*
*
* @return The number of pieces that were processed successfully (completed) by the export job, as of the time of
* the request.
*/
public final Integer completedPieces() {
return completedPieces;
}
/**
*
* The date, in ISO 8601 format, when the export job was completed.
*
*
* @return The date, in ISO 8601 format, when the export job was completed.
*/
public final String completionDate() {
return completionDate;
}
/**
*
* The date, in ISO 8601 format, when the export job was created.
*
*
* @return The date, in ISO 8601 format, when the export job was created.
*/
public final String creationDate() {
return creationDate;
}
/**
*
* The resource settings that apply to the export job.
*
*
* @return The resource settings that apply to the export job.
*/
public final ExportJobResource definition() {
return definition;
}
/**
*
* The number of pieces that weren't processed successfully (failed) by the export job, as of the time of the
* request.
*
*
* @return The number of pieces that weren't processed successfully (failed) by the export job, as of the time of
* the request.
*/
public final Integer failedPieces() {
return failedPieces;
}
/**
* For responses, this returns true if the service returned a value for the Failures property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasFailures() {
return failures != null && !(failures instanceof SdkAutoConstructList);
}
/**
*
* An array of entries, one for each of the first 100 entries that weren't processed successfully (failed) by the
* export job, if any.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasFailures} method.
*
*
* @return An array of entries, one for each of the first 100 entries that weren't processed successfully (failed)
* by the export job, if any.
*/
public final List failures() {
return failures;
}
/**
*
* The unique identifier for the export job.
*
*
* @return The unique identifier for the export job.
*/
public final String id() {
return id;
}
/**
*
* The status of the export job. The job status is FAILED if Amazon Pinpoint wasn't able to process one or more
* pieces in the job.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #jobStatus} will
* return {@link JobStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #jobStatusAsString}.
*
*
* @return The status of the export job. The job status is FAILED if Amazon Pinpoint wasn't able to process one or
* more pieces in the job.
* @see JobStatus
*/
public final JobStatus jobStatus() {
return JobStatus.fromValue(jobStatus);
}
/**
*
* The status of the export job. The job status is FAILED if Amazon Pinpoint wasn't able to process one or more
* pieces in the job.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #jobStatus} will
* return {@link JobStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #jobStatusAsString}.
*
*
* @return The status of the export job. The job status is FAILED if Amazon Pinpoint wasn't able to process one or
* more pieces in the job.
* @see JobStatus
*/
public final String jobStatusAsString() {
return jobStatus;
}
/**
*
* The total number of endpoint definitions that weren't processed successfully (failed) by the export job,
* typically because an error, such as a syntax error, occurred.
*
*
* @return The total number of endpoint definitions that weren't processed successfully (failed) by the export job,
* typically because an error, such as a syntax error, occurred.
*/
public final Integer totalFailures() {
return totalFailures;
}
/**
*
* The total number of pieces that must be processed to complete the export job. Each piece consists of an
* approximately equal portion of the endpoint definitions that are part of the export job.
*
*
* @return The total number of pieces that must be processed to complete the export job. Each piece consists of an
* approximately equal portion of the endpoint definitions that are part of the export job.
*/
public final Integer totalPieces() {
return totalPieces;
}
/**
*
* The total number of endpoint definitions that were processed by the export job.
*
*
* @return The total number of endpoint definitions that were processed by the export job.
*/
public final Integer totalProcessed() {
return totalProcessed;
}
/**
*
* The job type. This value is EXPORT for export jobs.
*
*
* @return The job type. This value is EXPORT for export jobs.
*/
public final String type() {
return type;
}
@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(completedPieces());
hashCode = 31 * hashCode + Objects.hashCode(completionDate());
hashCode = 31 * hashCode + Objects.hashCode(creationDate());
hashCode = 31 * hashCode + Objects.hashCode(definition());
hashCode = 31 * hashCode + Objects.hashCode(failedPieces());
hashCode = 31 * hashCode + Objects.hashCode(hasFailures() ? failures() : null);
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(jobStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(totalFailures());
hashCode = 31 * hashCode + Objects.hashCode(totalPieces());
hashCode = 31 * hashCode + Objects.hashCode(totalProcessed());
hashCode = 31 * hashCode + Objects.hashCode(type());
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 ExportJobResponse)) {
return false;
}
ExportJobResponse other = (ExportJobResponse) obj;
return Objects.equals(applicationId(), other.applicationId())
&& Objects.equals(completedPieces(), other.completedPieces())
&& Objects.equals(completionDate(), other.completionDate())
&& Objects.equals(creationDate(), other.creationDate()) && Objects.equals(definition(), other.definition())
&& Objects.equals(failedPieces(), other.failedPieces()) && hasFailures() == other.hasFailures()
&& Objects.equals(failures(), other.failures()) && Objects.equals(id(), other.id())
&& Objects.equals(jobStatusAsString(), other.jobStatusAsString())
&& Objects.equals(totalFailures(), other.totalFailures()) && Objects.equals(totalPieces(), other.totalPieces())
&& Objects.equals(totalProcessed(), other.totalProcessed()) && Objects.equals(type(), other.type());
}
/**
* 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("ExportJobResponse").add("ApplicationId", applicationId())
.add("CompletedPieces", completedPieces()).add("CompletionDate", completionDate())
.add("CreationDate", creationDate()).add("Definition", definition()).add("FailedPieces", failedPieces())
.add("Failures", hasFailures() ? failures() : null).add("Id", id()).add("JobStatus", jobStatusAsString())
.add("TotalFailures", totalFailures()).add("TotalPieces", totalPieces()).add("TotalProcessed", totalProcessed())
.add("Type", type()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ApplicationId":
return Optional.ofNullable(clazz.cast(applicationId()));
case "CompletedPieces":
return Optional.ofNullable(clazz.cast(completedPieces()));
case "CompletionDate":
return Optional.ofNullable(clazz.cast(completionDate()));
case "CreationDate":
return Optional.ofNullable(clazz.cast(creationDate()));
case "Definition":
return Optional.ofNullable(clazz.cast(definition()));
case "FailedPieces":
return Optional.ofNullable(clazz.cast(failedPieces()));
case "Failures":
return Optional.ofNullable(clazz.cast(failures()));
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "JobStatus":
return Optional.ofNullable(clazz.cast(jobStatusAsString()));
case "TotalFailures":
return Optional.ofNullable(clazz.cast(totalFailures()));
case "TotalPieces":
return Optional.ofNullable(clazz.cast(totalPieces()));
case "TotalProcessed":
return Optional.ofNullable(clazz.cast(totalProcessed()));
case "Type":
return Optional.ofNullable(clazz.cast(type()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function