software.amazon.awssdk.services.computeoptimizer.model.RecommendationExportJob Maven / Gradle / Ivy
Show all versions of computeoptimizer 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.computeoptimizer.model;
import java.io.Serializable;
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;
/**
*
* Describes a recommendation export job.
*
*
* Use the DescribeRecommendationExportJobs action to view your recommendation export jobs.
*
*
* Use the ExportAutoScalingGroupRecommendations or ExportEC2InstanceRecommendations actions to request an
* export of your recommendations.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class RecommendationExportJob implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField JOB_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("jobId")
.getter(getter(RecommendationExportJob::jobId)).setter(setter(Builder::jobId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jobId").build()).build();
private static final SdkField DESTINATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("destination")
.getter(getter(RecommendationExportJob::destination)).setter(setter(Builder::destination))
.constructor(ExportDestination::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("destination").build()).build();
private static final SdkField RESOURCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("resourceType").getter(getter(RecommendationExportJob::resourceTypeAsString))
.setter(setter(Builder::resourceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("resourceType").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(RecommendationExportJob::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField CREATION_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("creationTimestamp").getter(getter(RecommendationExportJob::creationTimestamp))
.setter(setter(Builder::creationTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("creationTimestamp").build()).build();
private static final SdkField LAST_UPDATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("lastUpdatedTimestamp").getter(getter(RecommendationExportJob::lastUpdatedTimestamp))
.setter(setter(Builder::lastUpdatedTimestamp))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastUpdatedTimestamp").build())
.build();
private static final SdkField FAILURE_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("failureReason").getter(getter(RecommendationExportJob::failureReason))
.setter(setter(Builder::failureReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("failureReason").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(JOB_ID_FIELD,
DESTINATION_FIELD, RESOURCE_TYPE_FIELD, STATUS_FIELD, CREATION_TIMESTAMP_FIELD, LAST_UPDATED_TIMESTAMP_FIELD,
FAILURE_REASON_FIELD));
private static final long serialVersionUID = 1L;
private final String jobId;
private final ExportDestination destination;
private final String resourceType;
private final String status;
private final Instant creationTimestamp;
private final Instant lastUpdatedTimestamp;
private final String failureReason;
private RecommendationExportJob(BuilderImpl builder) {
this.jobId = builder.jobId;
this.destination = builder.destination;
this.resourceType = builder.resourceType;
this.status = builder.status;
this.creationTimestamp = builder.creationTimestamp;
this.lastUpdatedTimestamp = builder.lastUpdatedTimestamp;
this.failureReason = builder.failureReason;
}
/**
*
* The identification number of the export job.
*
*
* @return The identification number of the export job.
*/
public final String jobId() {
return jobId;
}
/**
*
* An object that describes the destination of the export file.
*
*
* @return An object that describes the destination of the export file.
*/
public final ExportDestination destination() {
return destination;
}
/**
*
* The resource type of the exported recommendations.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #resourceType} will
* return {@link ResourceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #resourceTypeAsString}.
*
*
* @return The resource type of the exported recommendations.
* @see ResourceType
*/
public final ResourceType resourceType() {
return ResourceType.fromValue(resourceType);
}
/**
*
* The resource type of the exported recommendations.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #resourceType} will
* return {@link ResourceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #resourceTypeAsString}.
*
*
* @return The resource type of the exported recommendations.
* @see ResourceType
*/
public final String resourceTypeAsString() {
return resourceType;
}
/**
*
* The status of the export job.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link JobStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the export job.
* @see JobStatus
*/
public final JobStatus status() {
return JobStatus.fromValue(status);
}
/**
*
* The status of the export job.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link JobStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the export job.
* @see JobStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* The timestamp of when the export job was created.
*
*
* @return The timestamp of when the export job was created.
*/
public final Instant creationTimestamp() {
return creationTimestamp;
}
/**
*
* The timestamp of when the export job was last updated.
*
*
* @return The timestamp of when the export job was last updated.
*/
public final Instant lastUpdatedTimestamp() {
return lastUpdatedTimestamp;
}
/**
*
* The reason for an export job failure.
*
*
* @return The reason for an export job failure.
*/
public final String failureReason() {
return failureReason;
}
@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(jobId());
hashCode = 31 * hashCode + Objects.hashCode(destination());
hashCode = 31 * hashCode + Objects.hashCode(resourceTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(creationTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedTimestamp());
hashCode = 31 * hashCode + Objects.hashCode(failureReason());
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 RecommendationExportJob)) {
return false;
}
RecommendationExportJob other = (RecommendationExportJob) obj;
return Objects.equals(jobId(), other.jobId()) && Objects.equals(destination(), other.destination())
&& Objects.equals(resourceTypeAsString(), other.resourceTypeAsString())
&& Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(creationTimestamp(), other.creationTimestamp())
&& Objects.equals(lastUpdatedTimestamp(), other.lastUpdatedTimestamp())
&& Objects.equals(failureReason(), other.failureReason());
}
/**
* 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("RecommendationExportJob").add("JobId", jobId()).add("Destination", destination())
.add("ResourceType", resourceTypeAsString()).add("Status", statusAsString())
.add("CreationTimestamp", creationTimestamp()).add("LastUpdatedTimestamp", lastUpdatedTimestamp())
.add("FailureReason", failureReason()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "jobId":
return Optional.ofNullable(clazz.cast(jobId()));
case "destination":
return Optional.ofNullable(clazz.cast(destination()));
case "resourceType":
return Optional.ofNullable(clazz.cast(resourceTypeAsString()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "creationTimestamp":
return Optional.ofNullable(clazz.cast(creationTimestamp()));
case "lastUpdatedTimestamp":
return Optional.ofNullable(clazz.cast(lastUpdatedTimestamp()));
case "failureReason":
return Optional.ofNullable(clazz.cast(failureReason()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function