software.amazon.awssdk.services.outposts.model.StartCapacityTaskResponse Maven / Gradle / Ivy
Show all versions of outposts 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.outposts.model;
import java.time.Instant;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class StartCapacityTaskResponse extends OutpostsResponse implements
ToCopyableBuilder {
private static final SdkField CAPACITY_TASK_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CapacityTaskId").getter(getter(StartCapacityTaskResponse::capacityTaskId))
.setter(setter(Builder::capacityTaskId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CapacityTaskId").build()).build();
private static final SdkField OUTPOST_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OutpostId").getter(getter(StartCapacityTaskResponse::outpostId)).setter(setter(Builder::outpostId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutpostId").build()).build();
private static final SdkField ORDER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OrderId").getter(getter(StartCapacityTaskResponse::orderId)).setter(setter(Builder::orderId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OrderId").build()).build();
private static final SdkField> REQUESTED_INSTANCE_POOLS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("RequestedInstancePools")
.getter(getter(StartCapacityTaskResponse::requestedInstancePools))
.setter(setter(Builder::requestedInstancePools))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RequestedInstancePools").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(InstanceTypeCapacity::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField DRY_RUN_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("DryRun").getter(getter(StartCapacityTaskResponse::dryRun)).setter(setter(Builder::dryRun))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DryRun").build()).build();
private static final SdkField CAPACITY_TASK_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CapacityTaskStatus").getter(getter(StartCapacityTaskResponse::capacityTaskStatusAsString))
.setter(setter(Builder::capacityTaskStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CapacityTaskStatus").build())
.build();
private static final SdkField FAILED_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Failed")
.getter(getter(StartCapacityTaskResponse::failed)).setter(setter(Builder::failed))
.constructor(CapacityTaskFailure::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Failed").build()).build();
private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationDate").getter(getter(StartCapacityTaskResponse::creationDate))
.setter(setter(Builder::creationDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationDate").build()).build();
private static final SdkField COMPLETION_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CompletionDate").getter(getter(StartCapacityTaskResponse::completionDate))
.setter(setter(Builder::completionDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompletionDate").build()).build();
private static final SdkField LAST_MODIFIED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("LastModifiedDate").getter(getter(StartCapacityTaskResponse::lastModifiedDate))
.setter(setter(Builder::lastModifiedDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedDate").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CAPACITY_TASK_ID_FIELD,
OUTPOST_ID_FIELD, ORDER_ID_FIELD, REQUESTED_INSTANCE_POOLS_FIELD, DRY_RUN_FIELD, CAPACITY_TASK_STATUS_FIELD,
FAILED_FIELD, CREATION_DATE_FIELD, COMPLETION_DATE_FIELD, LAST_MODIFIED_DATE_FIELD));
private final String capacityTaskId;
private final String outpostId;
private final String orderId;
private final List requestedInstancePools;
private final Boolean dryRun;
private final String capacityTaskStatus;
private final CapacityTaskFailure failed;
private final Instant creationDate;
private final Instant completionDate;
private final Instant lastModifiedDate;
private StartCapacityTaskResponse(BuilderImpl builder) {
super(builder);
this.capacityTaskId = builder.capacityTaskId;
this.outpostId = builder.outpostId;
this.orderId = builder.orderId;
this.requestedInstancePools = builder.requestedInstancePools;
this.dryRun = builder.dryRun;
this.capacityTaskStatus = builder.capacityTaskStatus;
this.failed = builder.failed;
this.creationDate = builder.creationDate;
this.completionDate = builder.completionDate;
this.lastModifiedDate = builder.lastModifiedDate;
}
/**
*
* ID of the capacity task that you want to start.
*
*
* @return ID of the capacity task that you want to start.
*/
public final String capacityTaskId() {
return capacityTaskId;
}
/**
*
* ID of the Outpost associated with the capacity task.
*
*
* @return ID of the Outpost associated with the capacity task.
*/
public final String outpostId() {
return outpostId;
}
/**
*
* ID of the Amazon Web Services Outposts order of the host associated with the capacity task.
*
*
* @return ID of the Amazon Web Services Outposts order of the host associated with the capacity task.
*/
public final String orderId() {
return orderId;
}
/**
* For responses, this returns true if the service returned a value for the RequestedInstancePools 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 hasRequestedInstancePools() {
return requestedInstancePools != null && !(requestedInstancePools instanceof SdkAutoConstructList);
}
/**
*
* List of the instance pools requested in the specified capacity task.
*
*
* 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 #hasRequestedInstancePools} method.
*
*
* @return List of the instance pools requested in the specified capacity task.
*/
public final List requestedInstancePools() {
return requestedInstancePools;
}
/**
*
* Results of the dry run showing if the specified capacity task is above or below the available instance capacity.
*
*
* @return Results of the dry run showing if the specified capacity task is above or below the available instance
* capacity.
*/
public final Boolean dryRun() {
return dryRun;
}
/**
*
* Status of the specified capacity task.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #capacityTaskStatus} will return {@link CapacityTaskStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #capacityTaskStatusAsString}.
*
*
* @return Status of the specified capacity task.
* @see CapacityTaskStatus
*/
public final CapacityTaskStatus capacityTaskStatus() {
return CapacityTaskStatus.fromValue(capacityTaskStatus);
}
/**
*
* Status of the specified capacity task.
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #capacityTaskStatus} will return {@link CapacityTaskStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned
* by the service is available from {@link #capacityTaskStatusAsString}.
*
*
* @return Status of the specified capacity task.
* @see CapacityTaskStatus
*/
public final String capacityTaskStatusAsString() {
return capacityTaskStatus;
}
/**
*
* Reason that the specified capacity task failed.
*
*
* @return Reason that the specified capacity task failed.
*/
public final CapacityTaskFailure failed() {
return failed;
}
/**
*
* Date that the specified capacity task was created.
*
*
* @return Date that the specified capacity task was created.
*/
public final Instant creationDate() {
return creationDate;
}
/**
*
* Date that the specified capacity task ran successfully.
*
*
* @return Date that the specified capacity task ran successfully.
*/
public final Instant completionDate() {
return completionDate;
}
/**
*
* Date that the specified capacity task was last modified.
*
*
* @return Date that the specified capacity task was last modified.
*/
public final Instant lastModifiedDate() {
return lastModifiedDate;
}
@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(capacityTaskId());
hashCode = 31 * hashCode + Objects.hashCode(outpostId());
hashCode = 31 * hashCode + Objects.hashCode(orderId());
hashCode = 31 * hashCode + Objects.hashCode(hasRequestedInstancePools() ? requestedInstancePools() : null);
hashCode = 31 * hashCode + Objects.hashCode(dryRun());
hashCode = 31 * hashCode + Objects.hashCode(capacityTaskStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(failed());
hashCode = 31 * hashCode + Objects.hashCode(creationDate());
hashCode = 31 * hashCode + Objects.hashCode(completionDate());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedDate());
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 StartCapacityTaskResponse)) {
return false;
}
StartCapacityTaskResponse other = (StartCapacityTaskResponse) obj;
return Objects.equals(capacityTaskId(), other.capacityTaskId()) && Objects.equals(outpostId(), other.outpostId())
&& Objects.equals(orderId(), other.orderId()) && hasRequestedInstancePools() == other.hasRequestedInstancePools()
&& Objects.equals(requestedInstancePools(), other.requestedInstancePools())
&& Objects.equals(dryRun(), other.dryRun())
&& Objects.equals(capacityTaskStatusAsString(), other.capacityTaskStatusAsString())
&& Objects.equals(failed(), other.failed()) && Objects.equals(creationDate(), other.creationDate())
&& Objects.equals(completionDate(), other.completionDate())
&& Objects.equals(lastModifiedDate(), other.lastModifiedDate());
}
/**
* 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("StartCapacityTaskResponse").add("CapacityTaskId", capacityTaskId())
.add("OutpostId", outpostId()).add("OrderId", orderId())
.add("RequestedInstancePools", hasRequestedInstancePools() ? requestedInstancePools() : null)
.add("DryRun", dryRun()).add("CapacityTaskStatus", capacityTaskStatusAsString()).add("Failed", failed())
.add("CreationDate", creationDate()).add("CompletionDate", completionDate())
.add("LastModifiedDate", lastModifiedDate()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "CapacityTaskId":
return Optional.ofNullable(clazz.cast(capacityTaskId()));
case "OutpostId":
return Optional.ofNullable(clazz.cast(outpostId()));
case "OrderId":
return Optional.ofNullable(clazz.cast(orderId()));
case "RequestedInstancePools":
return Optional.ofNullable(clazz.cast(requestedInstancePools()));
case "DryRun":
return Optional.ofNullable(clazz.cast(dryRun()));
case "CapacityTaskStatus":
return Optional.ofNullable(clazz.cast(capacityTaskStatusAsString()));
case "Failed":
return Optional.ofNullable(clazz.cast(failed()));
case "CreationDate":
return Optional.ofNullable(clazz.cast(creationDate()));
case "CompletionDate":
return Optional.ofNullable(clazz.cast(completionDate()));
case "LastModifiedDate":
return Optional.ofNullable(clazz.cast(lastModifiedDate()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function