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

software.amazon.awssdk.services.ec2.model.ExportTask 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.ec2.model;

import java.io.Serializable;
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;

/**
 * 

* Describes an instance export task. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ExportTask implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField DESCRIPTION_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("Description") .getter(getter(ExportTask::description)) .setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description") .unmarshallLocationName("description").build()).build(); private static final SdkField EXPORT_TASK_ID_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("ExportTaskId") .getter(getter(ExportTask::exportTaskId)) .setter(setter(Builder::exportTaskId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExportTaskId") .unmarshallLocationName("exportTaskId").build()).build(); private static final SdkField EXPORT_TO_S3_TASK_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("ExportToS3Task") .getter(getter(ExportTask::exportToS3Task)) .setter(setter(Builder::exportToS3Task)) .constructor(ExportToS3Task::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExportToS3") .unmarshallLocationName("exportToS3").build()).build(); private static final SdkField INSTANCE_EXPORT_DETAILS_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("InstanceExportDetails") .getter(getter(ExportTask::instanceExportDetails)) .setter(setter(Builder::instanceExportDetails)) .constructor(InstanceExportDetails::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceExport") .unmarshallLocationName("instanceExport").build()).build(); private static final SdkField STATE_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("State") .getter(getter(ExportTask::stateAsString)) .setter(setter(Builder::state)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State") .unmarshallLocationName("state").build()).build(); private static final SdkField STATUS_MESSAGE_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("StatusMessage") .getter(getter(ExportTask::statusMessage)) .setter(setter(Builder::statusMessage)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StatusMessage") .unmarshallLocationName("statusMessage").build()).build(); private static final SdkField> TAGS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Tags") .getter(getter(ExportTask::tags)) .setter(setter(Builder::tags)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TagSet") .unmarshallLocationName("tagSet").build(), ListTrait .builder() .memberLocationName("item") .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Tag::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("Item").unmarshallLocationName("item").build()).build()) .build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DESCRIPTION_FIELD, EXPORT_TASK_ID_FIELD, EXPORT_TO_S3_TASK_FIELD, INSTANCE_EXPORT_DETAILS_FIELD, STATE_FIELD, STATUS_MESSAGE_FIELD, TAGS_FIELD)); private static final long serialVersionUID = 1L; private final String description; private final String exportTaskId; private final ExportToS3Task exportToS3Task; private final InstanceExportDetails instanceExportDetails; private final String state; private final String statusMessage; private final List tags; private ExportTask(BuilderImpl builder) { this.description = builder.description; this.exportTaskId = builder.exportTaskId; this.exportToS3Task = builder.exportToS3Task; this.instanceExportDetails = builder.instanceExportDetails; this.state = builder.state; this.statusMessage = builder.statusMessage; this.tags = builder.tags; } /** *

* A description of the resource being exported. *

* * @return A description of the resource being exported. */ public String description() { return description; } /** *

* The ID of the export task. *

* * @return The ID of the export task. */ public String exportTaskId() { return exportTaskId; } /** *

* Information about the export task. *

* * @return Information about the export task. */ public ExportToS3Task exportToS3Task() { return exportToS3Task; } /** *

* Information about the instance to export. *

* * @return Information about the instance to export. */ public InstanceExportDetails instanceExportDetails() { return instanceExportDetails; } /** *

* The state of the export task. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link ExportTaskState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The state of the export task. * @see ExportTaskState */ public ExportTaskState state() { return ExportTaskState.fromValue(state); } /** *

* The state of the export task. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return * {@link ExportTaskState#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #stateAsString}. *

* * @return The state of the export task. * @see ExportTaskState */ public String stateAsString() { return state; } /** *

* The status message related to the export task. *

* * @return The status message related to the export task. */ public String statusMessage() { return statusMessage; } /** * Returns true if the Tags property was specified by the sender (it may be empty), or false if the sender did not * specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public boolean hasTags() { return tags != null && !(tags instanceof SdkAutoConstructList); } /** *

* The tags for the export task. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasTags()} to see if a value was sent in this field. *

* * @return The tags for the export task. */ public List tags() { return tags; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(exportTaskId()); hashCode = 31 * hashCode + Objects.hashCode(exportToS3Task()); hashCode = 31 * hashCode + Objects.hashCode(instanceExportDetails()); hashCode = 31 * hashCode + Objects.hashCode(stateAsString()); hashCode = 31 * hashCode + Objects.hashCode(statusMessage()); hashCode = 31 * hashCode + Objects.hashCode(tags()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ExportTask)) { return false; } ExportTask other = (ExportTask) obj; return Objects.equals(description(), other.description()) && Objects.equals(exportTaskId(), other.exportTaskId()) && Objects.equals(exportToS3Task(), other.exportToS3Task()) && Objects.equals(instanceExportDetails(), other.instanceExportDetails()) && Objects.equals(stateAsString(), other.stateAsString()) && Objects.equals(statusMessage(), other.statusMessage()) && Objects.equals(tags(), other.tags()); } /** * 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 String toString() { return ToString.builder("ExportTask").add("Description", description()).add("ExportTaskId", exportTaskId()) .add("ExportToS3Task", exportToS3Task()).add("InstanceExportDetails", instanceExportDetails()) .add("State", stateAsString()).add("StatusMessage", statusMessage()).add("Tags", tags()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Description": return Optional.ofNullable(clazz.cast(description())); case "ExportTaskId": return Optional.ofNullable(clazz.cast(exportTaskId())); case "ExportToS3Task": return Optional.ofNullable(clazz.cast(exportToS3Task())); case "InstanceExportDetails": return Optional.ofNullable(clazz.cast(instanceExportDetails())); case "State": return Optional.ofNullable(clazz.cast(stateAsString())); case "StatusMessage": return Optional.ofNullable(clazz.cast(statusMessage())); case "Tags": return Optional.ofNullable(clazz.cast(tags())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ExportTask) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* A description of the resource being exported. *

* * @param description * A description of the resource being exported. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* The ID of the export task. *

* * @param exportTaskId * The ID of the export task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder exportTaskId(String exportTaskId); /** *

* Information about the export task. *

* * @param exportToS3Task * Information about the export task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder exportToS3Task(ExportToS3Task exportToS3Task); /** *

* Information about the export task. *

* This is a convenience that creates an instance of the {@link ExportToS3Task.Builder} avoiding the need to * create one manually via {@link ExportToS3Task#builder()}. * * When the {@link Consumer} completes, {@link ExportToS3Task.Builder#build()} is called immediately and its * result is passed to {@link #exportToS3Task(ExportToS3Task)}. * * @param exportToS3Task * a consumer that will call methods on {@link ExportToS3Task.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #exportToS3Task(ExportToS3Task) */ default Builder exportToS3Task(Consumer exportToS3Task) { return exportToS3Task(ExportToS3Task.builder().applyMutation(exportToS3Task).build()); } /** *

* Information about the instance to export. *

* * @param instanceExportDetails * Information about the instance to export. * @return Returns a reference to this object so that method calls can be chained together. */ Builder instanceExportDetails(InstanceExportDetails instanceExportDetails); /** *

* Information about the instance to export. *

* This is a convenience that creates an instance of the {@link InstanceExportDetails.Builder} avoiding the need * to create one manually via {@link InstanceExportDetails#builder()}. * * When the {@link Consumer} completes, {@link InstanceExportDetails.Builder#build()} is called immediately and * its result is passed to {@link #instanceExportDetails(InstanceExportDetails)}. * * @param instanceExportDetails * a consumer that will call methods on {@link InstanceExportDetails.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #instanceExportDetails(InstanceExportDetails) */ default Builder instanceExportDetails(Consumer instanceExportDetails) { return instanceExportDetails(InstanceExportDetails.builder().applyMutation(instanceExportDetails).build()); } /** *

* The state of the export task. *

* * @param state * The state of the export task. * @see ExportTaskState * @return Returns a reference to this object so that method calls can be chained together. * @see ExportTaskState */ Builder state(String state); /** *

* The state of the export task. *

* * @param state * The state of the export task. * @see ExportTaskState * @return Returns a reference to this object so that method calls can be chained together. * @see ExportTaskState */ Builder state(ExportTaskState state); /** *

* The status message related to the export task. *

* * @param statusMessage * The status message related to the export task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder statusMessage(String statusMessage); /** *

* The tags for the export task. *

* * @param tags * The tags for the export task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Collection tags); /** *

* The tags for the export task. *

* * @param tags * The tags for the export task. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Tag... tags); /** *

* The tags for the export task. *

* This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to create * one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its result * is passed to {@link #tags(List)}. * * @param tags * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #tags(List) */ Builder tags(Consumer... tags); } static final class BuilderImpl implements Builder { private String description; private String exportTaskId; private ExportToS3Task exportToS3Task; private InstanceExportDetails instanceExportDetails; private String state; private String statusMessage; private List tags = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(ExportTask model) { description(model.description); exportTaskId(model.exportTaskId); exportToS3Task(model.exportToS3Task); instanceExportDetails(model.instanceExportDetails); state(model.state); statusMessage(model.statusMessage); tags(model.tags); } public final String getDescription() { return description; } @Override public final Builder description(String description) { this.description = description; return this; } public final void setDescription(String description) { this.description = description; } public final String getExportTaskId() { return exportTaskId; } @Override public final Builder exportTaskId(String exportTaskId) { this.exportTaskId = exportTaskId; return this; } public final void setExportTaskId(String exportTaskId) { this.exportTaskId = exportTaskId; } public final ExportToS3Task.Builder getExportToS3Task() { return exportToS3Task != null ? exportToS3Task.toBuilder() : null; } @Override public final Builder exportToS3Task(ExportToS3Task exportToS3Task) { this.exportToS3Task = exportToS3Task; return this; } public final void setExportToS3Task(ExportToS3Task.BuilderImpl exportToS3Task) { this.exportToS3Task = exportToS3Task != null ? exportToS3Task.build() : null; } public final InstanceExportDetails.Builder getInstanceExportDetails() { return instanceExportDetails != null ? instanceExportDetails.toBuilder() : null; } @Override public final Builder instanceExportDetails(InstanceExportDetails instanceExportDetails) { this.instanceExportDetails = instanceExportDetails; return this; } public final void setInstanceExportDetails(InstanceExportDetails.BuilderImpl instanceExportDetails) { this.instanceExportDetails = instanceExportDetails != null ? instanceExportDetails.build() : null; } public final String getState() { return state; } @Override public final Builder state(String state) { this.state = state; return this; } @Override public final Builder state(ExportTaskState state) { this.state(state == null ? null : state.toString()); return this; } public final void setState(String state) { this.state = state; } public final String getStatusMessage() { return statusMessage; } @Override public final Builder statusMessage(String statusMessage) { this.statusMessage = statusMessage; return this; } public final void setStatusMessage(String statusMessage) { this.statusMessage = statusMessage; } public final Collection getTags() { return tags != null ? tags.stream().map(Tag::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder tags(Collection tags) { this.tags = TagListCopier.copy(tags); return this; } @Override @SafeVarargs public final Builder tags(Tag... tags) { tags(Arrays.asList(tags)); return this; } @Override @SafeVarargs public final Builder tags(Consumer... tags) { tags(Stream.of(tags).map(c -> Tag.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setTags(Collection tags) { this.tags = TagListCopier.copyFromBuilder(tags); } @Override public ExportTask build() { return new ExportTask(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy