
software.amazon.awssdk.services.sesv2.model.GetImportJobResponse Maven / Gradle / Ivy
/*
* 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.sesv2.model;
import java.time.Instant;
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.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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* An HTTP 200 response if the request succeeds, or an error message if the request fails.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetImportJobResponse extends SesV2Response implements
ToCopyableBuilder {
private static final SdkField JOB_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("JobId")
.getter(getter(GetImportJobResponse::jobId)).setter(setter(Builder::jobId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("JobId").build()).build();
private static final SdkField IMPORT_DESTINATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ImportDestination")
.getter(getter(GetImportJobResponse::importDestination)).setter(setter(Builder::importDestination))
.constructor(ImportDestination::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ImportDestination").build()).build();
private static final SdkField IMPORT_DATA_SOURCE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ImportDataSource")
.getter(getter(GetImportJobResponse::importDataSource)).setter(setter(Builder::importDataSource))
.constructor(ImportDataSource::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ImportDataSource").build()).build();
private static final SdkField FAILURE_INFO_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("FailureInfo").getter(getter(GetImportJobResponse::failureInfo)).setter(setter(Builder::failureInfo))
.constructor(FailureInfo::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureInfo").build()).build();
private static final SdkField JOB_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("JobStatus").getter(getter(GetImportJobResponse::jobStatusAsString)).setter(setter(Builder::jobStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("JobStatus").build()).build();
private static final SdkField CREATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedTimestamp").getter(getter(GetImportJobResponse::createdTimestamp))
.setter(setter(Builder::createdTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTimestamp").build()).build();
private static final SdkField COMPLETED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CompletedTimestamp").getter(getter(GetImportJobResponse::completedTimestamp))
.setter(setter(Builder::completedTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompletedTimestamp").build())
.build();
private static final SdkField PROCESSED_RECORDS_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("ProcessedRecordsCount").getter(getter(GetImportJobResponse::processedRecordsCount))
.setter(setter(Builder::processedRecordsCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProcessedRecordsCount").build())
.build();
private static final SdkField FAILED_RECORDS_COUNT_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("FailedRecordsCount").getter(getter(GetImportJobResponse::failedRecordsCount))
.setter(setter(Builder::failedRecordsCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailedRecordsCount").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(JOB_ID_FIELD,
IMPORT_DESTINATION_FIELD, IMPORT_DATA_SOURCE_FIELD, FAILURE_INFO_FIELD, JOB_STATUS_FIELD, CREATED_TIMESTAMP_FIELD,
COMPLETED_TIMESTAMP_FIELD, PROCESSED_RECORDS_COUNT_FIELD, FAILED_RECORDS_COUNT_FIELD));
private final String jobId;
private final ImportDestination importDestination;
private final ImportDataSource importDataSource;
private final FailureInfo failureInfo;
private final String jobStatus;
private final Instant createdTimestamp;
private final Instant completedTimestamp;
private final Integer processedRecordsCount;
private final Integer failedRecordsCount;
private GetImportJobResponse(BuilderImpl builder) {
super(builder);
this.jobId = builder.jobId;
this.importDestination = builder.importDestination;
this.importDataSource = builder.importDataSource;
this.failureInfo = builder.failureInfo;
this.jobStatus = builder.jobStatus;
this.createdTimestamp = builder.createdTimestamp;
this.completedTimestamp = builder.completedTimestamp;
this.processedRecordsCount = builder.processedRecordsCount;
this.failedRecordsCount = builder.failedRecordsCount;
}
/**
*
* A string that represents the import job ID.
*
*
* @return A string that represents the import job ID.
*/
public final String jobId() {
return jobId;
}
/**
*
* The destination of the import job.
*
*
* @return The destination of the import job.
*/
public final ImportDestination importDestination() {
return importDestination;
}
/**
*
* The data source of the import job.
*
*
* @return The data source of the import job.
*/
public final ImportDataSource importDataSource() {
return importDataSource;
}
/**
*
* The failure details about an import job.
*
*
* @return The failure details about an import job.
*/
public final FailureInfo failureInfo() {
return failureInfo;
}
/**
*
* The status of the import 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 import job.
* @see JobStatus
*/
public final JobStatus jobStatus() {
return JobStatus.fromValue(jobStatus);
}
/**
*
* The status of the import 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 import job.
* @see JobStatus
*/
public final String jobStatusAsString() {
return jobStatus;
}
/**
*
* The time stamp of when the import job was created.
*
*
* @return The time stamp of when the import job was created.
*/
public final Instant createdTimestamp() {
return createdTimestamp;
}
/**
*
* The time stamp of when the import job was completed.
*
*
* @return The time stamp of when the import job was completed.
*/
public final Instant completedTimestamp() {
return completedTimestamp;
}
/**
*
* The current number of records processed.
*
*
* @return The current number of records processed.
*/
public final Integer processedRecordsCount() {
return processedRecordsCount;
}
/**
*
* The number of records that failed processing because of invalid input or other reasons.
*
*
* @return The number of records that failed processing because of invalid input or other reasons.
*/
public final Integer failedRecordsCount() {
return failedRecordsCount;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(jobId());
hashCode = 31 * hashCode + Objects.hashCode(importDestination());
hashCode = 31 * hashCode + Objects.hashCode(importDataSource());
hashCode = 31 * hashCode + Objects.hashCode(failureInfo());
hashCode = 31 * hashCode + Objects.hashCode(jobStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(createdTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(completedTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(processedRecordsCount());
hashCode = 31 * hashCode + Objects.hashCode(failedRecordsCount());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetImportJobResponse)) {
return false;
}
GetImportJobResponse other = (GetImportJobResponse) obj;
return Objects.equals(jobId(), other.jobId()) && Objects.equals(importDestination(), other.importDestination())
&& Objects.equals(importDataSource(), other.importDataSource())
&& Objects.equals(failureInfo(), other.failureInfo())
&& Objects.equals(jobStatusAsString(), other.jobStatusAsString())
&& Objects.equals(createdTimestamp(), other.createdTimestamp())
&& Objects.equals(completedTimestamp(), other.completedTimestamp())
&& Objects.equals(processedRecordsCount(), other.processedRecordsCount())
&& Objects.equals(failedRecordsCount(), other.failedRecordsCount());
}
/**
* 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("GetImportJobResponse").add("JobId", jobId()).add("ImportDestination", importDestination())
.add("ImportDataSource", importDataSource()).add("FailureInfo", failureInfo())
.add("JobStatus", jobStatusAsString()).add("CreatedTimestamp", createdTimestamp())
.add("CompletedTimestamp", completedTimestamp()).add("ProcessedRecordsCount", processedRecordsCount())
.add("FailedRecordsCount", failedRecordsCount()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "JobId":
return Optional.ofNullable(clazz.cast(jobId()));
case "ImportDestination":
return Optional.ofNullable(clazz.cast(importDestination()));
case "ImportDataSource":
return Optional.ofNullable(clazz.cast(importDataSource()));
case "FailureInfo":
return Optional.ofNullable(clazz.cast(failureInfo()));
case "JobStatus":
return Optional.ofNullable(clazz.cast(jobStatusAsString()));
case "CreatedTimestamp":
return Optional.ofNullable(clazz.cast(createdTimestamp()));
case "CompletedTimestamp":
return Optional.ofNullable(clazz.cast(completedTimestamp()));
case "ProcessedRecordsCount":
return Optional.ofNullable(clazz.cast(processedRecordsCount()));
case "FailedRecordsCount":
return Optional.ofNullable(clazz.cast(failedRecordsCount()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function