All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.outposts.model.StartCapacityTaskResponse Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Outposts module holds the client classes that are used for communicating with Outposts.

There is a newer version: 2.30.1
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((StartCapacityTaskResponse) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends OutpostsResponse.Builder, SdkPojo, CopyableBuilder { /** *

* ID of the capacity task that you want to start. *

* * @param capacityTaskId * ID of the capacity task that you want to start. * @return Returns a reference to this object so that method calls can be chained together. */ Builder capacityTaskId(String capacityTaskId); /** *

* ID of the Outpost associated with the capacity task. *

* * @param outpostId * ID of the Outpost associated with the capacity task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder outpostId(String outpostId); /** *

* ID of the Amazon Web Services Outposts order of the host associated with the capacity task. *

* * @param orderId * ID of the Amazon Web Services Outposts order of the host associated with the capacity task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder orderId(String orderId); /** *

* List of the instance pools requested in the specified capacity task. *

* * @param requestedInstancePools * List of the instance pools requested in the specified capacity task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder requestedInstancePools(Collection requestedInstancePools); /** *

* List of the instance pools requested in the specified capacity task. *

* * @param requestedInstancePools * List of the instance pools requested in the specified capacity task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder requestedInstancePools(InstanceTypeCapacity... requestedInstancePools); /** *

* List of the instance pools requested in the specified capacity task. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.outposts.model.InstanceTypeCapacity.Builder} avoiding the need to * create one manually via {@link software.amazon.awssdk.services.outposts.model.InstanceTypeCapacity#builder()} * . * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.outposts.model.InstanceTypeCapacity.Builder#build()} is called * immediately and its result is passed to {@link #requestedInstancePools(List)}. * * @param requestedInstancePools * a consumer that will call methods on * {@link software.amazon.awssdk.services.outposts.model.InstanceTypeCapacity.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #requestedInstancePools(java.util.Collection) */ Builder requestedInstancePools(Consumer... requestedInstancePools); /** *

* Results of the dry run showing if the specified capacity task is above or below the available instance * capacity. *

* * @param dryRun * Results of the dry run showing if the specified capacity task is above or below the available instance * capacity. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dryRun(Boolean dryRun); /** *

* Status of the specified capacity task. *

* * @param capacityTaskStatus * Status of the specified capacity task. * @see CapacityTaskStatus * @return Returns a reference to this object so that method calls can be chained together. * @see CapacityTaskStatus */ Builder capacityTaskStatus(String capacityTaskStatus); /** *

* Status of the specified capacity task. *

* * @param capacityTaskStatus * Status of the specified capacity task. * @see CapacityTaskStatus * @return Returns a reference to this object so that method calls can be chained together. * @see CapacityTaskStatus */ Builder capacityTaskStatus(CapacityTaskStatus capacityTaskStatus); /** *

* Reason that the specified capacity task failed. *

* * @param failed * Reason that the specified capacity task failed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder failed(CapacityTaskFailure failed); /** *

* Reason that the specified capacity task failed. *

* This is a convenience method that creates an instance of the {@link CapacityTaskFailure.Builder} avoiding the * need to create one manually via {@link CapacityTaskFailure#builder()}. * *

* When the {@link Consumer} completes, {@link CapacityTaskFailure.Builder#build()} is called immediately and * its result is passed to {@link #failed(CapacityTaskFailure)}. * * @param failed * a consumer that will call methods on {@link CapacityTaskFailure.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #failed(CapacityTaskFailure) */ default Builder failed(Consumer failed) { return failed(CapacityTaskFailure.builder().applyMutation(failed).build()); } /** *

* Date that the specified capacity task was created. *

* * @param creationDate * Date that the specified capacity task was created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder creationDate(Instant creationDate); /** *

* Date that the specified capacity task ran successfully. *

* * @param completionDate * Date that the specified capacity task ran successfully. * @return Returns a reference to this object so that method calls can be chained together. */ Builder completionDate(Instant completionDate); /** *

* Date that the specified capacity task was last modified. *

* * @param lastModifiedDate * Date that the specified capacity task was last modified. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastModifiedDate(Instant lastModifiedDate); } static final class BuilderImpl extends OutpostsResponse.BuilderImpl implements Builder { private String capacityTaskId; private String outpostId; private String orderId; private List requestedInstancePools = DefaultSdkAutoConstructList.getInstance(); private Boolean dryRun; private String capacityTaskStatus; private CapacityTaskFailure failed; private Instant creationDate; private Instant completionDate; private Instant lastModifiedDate; private BuilderImpl() { } private BuilderImpl(StartCapacityTaskResponse model) { super(model); capacityTaskId(model.capacityTaskId); outpostId(model.outpostId); orderId(model.orderId); requestedInstancePools(model.requestedInstancePools); dryRun(model.dryRun); capacityTaskStatus(model.capacityTaskStatus); failed(model.failed); creationDate(model.creationDate); completionDate(model.completionDate); lastModifiedDate(model.lastModifiedDate); } public final String getCapacityTaskId() { return capacityTaskId; } public final void setCapacityTaskId(String capacityTaskId) { this.capacityTaskId = capacityTaskId; } @Override public final Builder capacityTaskId(String capacityTaskId) { this.capacityTaskId = capacityTaskId; return this; } public final String getOutpostId() { return outpostId; } public final void setOutpostId(String outpostId) { this.outpostId = outpostId; } @Override public final Builder outpostId(String outpostId) { this.outpostId = outpostId; return this; } public final String getOrderId() { return orderId; } public final void setOrderId(String orderId) { this.orderId = orderId; } @Override public final Builder orderId(String orderId) { this.orderId = orderId; return this; } public final List getRequestedInstancePools() { List result = RequestedInstancePoolsCopier.copyToBuilder(this.requestedInstancePools); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setRequestedInstancePools(Collection requestedInstancePools) { this.requestedInstancePools = RequestedInstancePoolsCopier.copyFromBuilder(requestedInstancePools); } @Override public final Builder requestedInstancePools(Collection requestedInstancePools) { this.requestedInstancePools = RequestedInstancePoolsCopier.copy(requestedInstancePools); return this; } @Override @SafeVarargs public final Builder requestedInstancePools(InstanceTypeCapacity... requestedInstancePools) { requestedInstancePools(Arrays.asList(requestedInstancePools)); return this; } @Override @SafeVarargs public final Builder requestedInstancePools(Consumer... requestedInstancePools) { requestedInstancePools(Stream.of(requestedInstancePools) .map(c -> InstanceTypeCapacity.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final Boolean getDryRun() { return dryRun; } public final void setDryRun(Boolean dryRun) { this.dryRun = dryRun; } @Override public final Builder dryRun(Boolean dryRun) { this.dryRun = dryRun; return this; } public final String getCapacityTaskStatus() { return capacityTaskStatus; } public final void setCapacityTaskStatus(String capacityTaskStatus) { this.capacityTaskStatus = capacityTaskStatus; } @Override public final Builder capacityTaskStatus(String capacityTaskStatus) { this.capacityTaskStatus = capacityTaskStatus; return this; } @Override public final Builder capacityTaskStatus(CapacityTaskStatus capacityTaskStatus) { this.capacityTaskStatus(capacityTaskStatus == null ? null : capacityTaskStatus.toString()); return this; } public final CapacityTaskFailure.Builder getFailed() { return failed != null ? failed.toBuilder() : null; } public final void setFailed(CapacityTaskFailure.BuilderImpl failed) { this.failed = failed != null ? failed.build() : null; } @Override public final Builder failed(CapacityTaskFailure failed) { this.failed = failed; return this; } public final Instant getCreationDate() { return creationDate; } public final void setCreationDate(Instant creationDate) { this.creationDate = creationDate; } @Override public final Builder creationDate(Instant creationDate) { this.creationDate = creationDate; return this; } public final Instant getCompletionDate() { return completionDate; } public final void setCompletionDate(Instant completionDate) { this.completionDate = completionDate; } @Override public final Builder completionDate(Instant completionDate) { this.completionDate = completionDate; return this; } public final Instant getLastModifiedDate() { return lastModifiedDate; } public final void setLastModifiedDate(Instant lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } @Override public final Builder lastModifiedDate(Instant lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; return this; } @Override public StartCapacityTaskResponse build() { return new StartCapacityTaskResponse(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy