software.amazon.awssdk.services.forecast.model.DescribeWhatIfAnalysisResponse Maven / Gradle / Ivy
Show all versions of forecast 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.forecast.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class DescribeWhatIfAnalysisResponse extends ForecastResponse implements
ToCopyableBuilder {
private static final SdkField WHAT_IF_ANALYSIS_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("WhatIfAnalysisName").getter(getter(DescribeWhatIfAnalysisResponse::whatIfAnalysisName))
.setter(setter(Builder::whatIfAnalysisName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WhatIfAnalysisName").build())
.build();
private static final SdkField WHAT_IF_ANALYSIS_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("WhatIfAnalysisArn").getter(getter(DescribeWhatIfAnalysisResponse::whatIfAnalysisArn))
.setter(setter(Builder::whatIfAnalysisArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WhatIfAnalysisArn").build()).build();
private static final SdkField FORECAST_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ForecastArn").getter(getter(DescribeWhatIfAnalysisResponse::forecastArn))
.setter(setter(Builder::forecastArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ForecastArn").build()).build();
private static final SdkField ESTIMATED_TIME_REMAINING_IN_MINUTES_FIELD = SdkField
. builder(MarshallingType.LONG)
.memberName("EstimatedTimeRemainingInMinutes")
.getter(getter(DescribeWhatIfAnalysisResponse::estimatedTimeRemainingInMinutes))
.setter(setter(Builder::estimatedTimeRemainingInMinutes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EstimatedTimeRemainingInMinutes")
.build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(DescribeWhatIfAnalysisResponse::status)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Message")
.getter(getter(DescribeWhatIfAnalysisResponse::message)).setter(setter(Builder::message))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Message").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(DescribeWhatIfAnalysisResponse::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField LAST_MODIFICATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastModificationTime").getter(getter(DescribeWhatIfAnalysisResponse::lastModificationTime))
.setter(setter(Builder::lastModificationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModificationTime").build())
.build();
private static final SdkField TIME_SERIES_SELECTOR_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("TimeSeriesSelector")
.getter(getter(DescribeWhatIfAnalysisResponse::timeSeriesSelector)).setter(setter(Builder::timeSeriesSelector))
.constructor(TimeSeriesSelector::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TimeSeriesSelector").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(WHAT_IF_ANALYSIS_NAME_FIELD,
WHAT_IF_ANALYSIS_ARN_FIELD, FORECAST_ARN_FIELD, ESTIMATED_TIME_REMAINING_IN_MINUTES_FIELD, STATUS_FIELD,
MESSAGE_FIELD, CREATION_TIME_FIELD, LAST_MODIFICATION_TIME_FIELD, TIME_SERIES_SELECTOR_FIELD));
private final String whatIfAnalysisName;
private final String whatIfAnalysisArn;
private final String forecastArn;
private final Long estimatedTimeRemainingInMinutes;
private final String status;
private final String message;
private final Instant creationTime;
private final Instant lastModificationTime;
private final TimeSeriesSelector timeSeriesSelector;
private DescribeWhatIfAnalysisResponse(BuilderImpl builder) {
super(builder);
this.whatIfAnalysisName = builder.whatIfAnalysisName;
this.whatIfAnalysisArn = builder.whatIfAnalysisArn;
this.forecastArn = builder.forecastArn;
this.estimatedTimeRemainingInMinutes = builder.estimatedTimeRemainingInMinutes;
this.status = builder.status;
this.message = builder.message;
this.creationTime = builder.creationTime;
this.lastModificationTime = builder.lastModificationTime;
this.timeSeriesSelector = builder.timeSeriesSelector;
}
/**
*
* The name of the what-if analysis.
*
*
* @return The name of the what-if analysis.
*/
public final String whatIfAnalysisName() {
return whatIfAnalysisName;
}
/**
*
* The Amazon Resource Name (ARN) of the what-if analysis.
*
*
* @return The Amazon Resource Name (ARN) of the what-if analysis.
*/
public final String whatIfAnalysisArn() {
return whatIfAnalysisArn;
}
/**
*
* The Amazon Resource Name (ARN) of the what-if forecast.
*
*
* @return The Amazon Resource Name (ARN) of the what-if forecast.
*/
public final String forecastArn() {
return forecastArn;
}
/**
*
* The approximate time remaining to complete the what-if analysis, in minutes.
*
*
* @return The approximate time remaining to complete the what-if analysis, in minutes.
*/
public final Long estimatedTimeRemainingInMinutes() {
return estimatedTimeRemainingInMinutes;
}
/**
*
* The status of the what-if analysis. States include:
*
*
* -
*
* ACTIVE
*
*
* -
*
* CREATE_PENDING
, CREATE_IN_PROGRESS
, CREATE_FAILED
*
*
* -
*
* CREATE_STOPPING
, CREATE_STOPPED
*
*
* -
*
* DELETE_PENDING
, DELETE_IN_PROGRESS
, DELETE_FAILED
*
*
*
*
*
* The Status
of the what-if analysis must be ACTIVE
before you can access the analysis.
*
*
*
* @return The status of the what-if analysis. States include:
*
* -
*
* ACTIVE
*
*
* -
*
* CREATE_PENDING
, CREATE_IN_PROGRESS
, CREATE_FAILED
*
*
* -
*
* CREATE_STOPPING
, CREATE_STOPPED
*
*
* -
*
* DELETE_PENDING
, DELETE_IN_PROGRESS
, DELETE_FAILED
*
*
*
*
*
* The Status
of the what-if analysis must be ACTIVE
before you can access the
* analysis.
*
*/
public final String status() {
return status;
}
/**
*
* If an error occurred, an informational message about the error.
*
*
* @return If an error occurred, an informational message about the error.
*/
public final String message() {
return message;
}
/**
*
* When the what-if analysis was created.
*
*
* @return When the what-if analysis was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The last time the resource was modified. The timestamp depends on the status of the job:
*
*
* -
*
* CREATE_PENDING
- The CreationTime
.
*
*
* -
*
* CREATE_IN_PROGRESS
- The current timestamp.
*
*
* -
*
* CREATE_STOPPING
- The current timestamp.
*
*
* -
*
* CREATE_STOPPED
- When the job stopped.
*
*
* -
*
* ACTIVE
or CREATE_FAILED
- When the job finished or failed.
*
*
*
*
* @return The last time the resource was modified. The timestamp depends on the status of the job:
*
* -
*
* CREATE_PENDING
- The CreationTime
.
*
*
* -
*
* CREATE_IN_PROGRESS
- The current timestamp.
*
*
* -
*
* CREATE_STOPPING
- The current timestamp.
*
*
* -
*
* CREATE_STOPPED
- When the job stopped.
*
*
* -
*
* ACTIVE
or CREATE_FAILED
- When the job finished or failed.
*
*
*/
public final Instant lastModificationTime() {
return lastModificationTime;
}
/**
* Returns the value of the TimeSeriesSelector property for this object.
*
* @return The value of the TimeSeriesSelector property for this object.
*/
public final TimeSeriesSelector timeSeriesSelector() {
return timeSeriesSelector;
}
@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(whatIfAnalysisName());
hashCode = 31 * hashCode + Objects.hashCode(whatIfAnalysisArn());
hashCode = 31 * hashCode + Objects.hashCode(forecastArn());
hashCode = 31 * hashCode + Objects.hashCode(estimatedTimeRemainingInMinutes());
hashCode = 31 * hashCode + Objects.hashCode(status());
hashCode = 31 * hashCode + Objects.hashCode(message());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(lastModificationTime());
hashCode = 31 * hashCode + Objects.hashCode(timeSeriesSelector());
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 DescribeWhatIfAnalysisResponse)) {
return false;
}
DescribeWhatIfAnalysisResponse other = (DescribeWhatIfAnalysisResponse) obj;
return Objects.equals(whatIfAnalysisName(), other.whatIfAnalysisName())
&& Objects.equals(whatIfAnalysisArn(), other.whatIfAnalysisArn())
&& Objects.equals(forecastArn(), other.forecastArn())
&& Objects.equals(estimatedTimeRemainingInMinutes(), other.estimatedTimeRemainingInMinutes())
&& Objects.equals(status(), other.status()) && Objects.equals(message(), other.message())
&& Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(lastModificationTime(), other.lastModificationTime())
&& Objects.equals(timeSeriesSelector(), other.timeSeriesSelector());
}
/**
* 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("DescribeWhatIfAnalysisResponse").add("WhatIfAnalysisName", whatIfAnalysisName())
.add("WhatIfAnalysisArn", whatIfAnalysisArn()).add("ForecastArn", forecastArn())
.add("EstimatedTimeRemainingInMinutes", estimatedTimeRemainingInMinutes()).add("Status", status())
.add("Message", message()).add("CreationTime", creationTime())
.add("LastModificationTime", lastModificationTime()).add("TimeSeriesSelector", timeSeriesSelector()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "WhatIfAnalysisName":
return Optional.ofNullable(clazz.cast(whatIfAnalysisName()));
case "WhatIfAnalysisArn":
return Optional.ofNullable(clazz.cast(whatIfAnalysisArn()));
case "ForecastArn":
return Optional.ofNullable(clazz.cast(forecastArn()));
case "EstimatedTimeRemainingInMinutes":
return Optional.ofNullable(clazz.cast(estimatedTimeRemainingInMinutes()));
case "Status":
return Optional.ofNullable(clazz.cast(status()));
case "Message":
return Optional.ofNullable(clazz.cast(message()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "LastModificationTime":
return Optional.ofNullable(clazz.cast(lastModificationTime()));
case "TimeSeriesSelector":
return Optional.ofNullable(clazz.cast(timeSeriesSelector()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function