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

software.amazon.awssdk.services.ec2.model.VolumeStatusItem 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 the volume status. *

*/ @Generated("software.amazon.awssdk:codegen") public final class VolumeStatusItem implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField> ACTIONS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Actions") .getter(getter(VolumeStatusItem::actions)) .setter(setter(Builder::actions)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActionsSet") .unmarshallLocationName("actionsSet").build(), ListTrait .builder() .memberLocationName("item") .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(VolumeStatusAction::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("Item").unmarshallLocationName("item").build()).build()) .build()).build(); private static final SdkField AVAILABILITY_ZONE_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("AvailabilityZone") .getter(getter(VolumeStatusItem::availabilityZone)) .setter(setter(Builder::availabilityZone)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZone") .unmarshallLocationName("availabilityZone").build()).build(); private static final SdkField OUTPOST_ARN_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("OutpostArn") .getter(getter(VolumeStatusItem::outpostArn)) .setter(setter(Builder::outpostArn)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutpostArn") .unmarshallLocationName("outpostArn").build()).build(); private static final SdkField> EVENTS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Events") .getter(getter(VolumeStatusItem::events)) .setter(setter(Builder::events)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventsSet") .unmarshallLocationName("eventsSet").build(), ListTrait .builder() .memberLocationName("item") .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(VolumeStatusEvent::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("Item").unmarshallLocationName("item").build()).build()) .build()).build(); private static final SdkField VOLUME_ID_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("VolumeId") .getter(getter(VolumeStatusItem::volumeId)) .setter(setter(Builder::volumeId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeId") .unmarshallLocationName("volumeId").build()).build(); private static final SdkField VOLUME_STATUS_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("VolumeStatus") .getter(getter(VolumeStatusItem::volumeStatus)) .setter(setter(Builder::volumeStatus)) .constructor(VolumeStatusInfo::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeStatus") .unmarshallLocationName("volumeStatus").build()).build(); private static final SdkField> ATTACHMENT_STATUSES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("AttachmentStatuses") .getter(getter(VolumeStatusItem::attachmentStatuses)) .setter(setter(Builder::attachmentStatuses)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AttachmentStatuses") .unmarshallLocationName("attachmentStatuses").build(), ListTrait .builder() .memberLocationName("item") .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(VolumeStatusAttachmentStatus::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(ACTIONS_FIELD, AVAILABILITY_ZONE_FIELD, OUTPOST_ARN_FIELD, EVENTS_FIELD, VOLUME_ID_FIELD, VOLUME_STATUS_FIELD, ATTACHMENT_STATUSES_FIELD)); private static final long serialVersionUID = 1L; private final List actions; private final String availabilityZone; private final String outpostArn; private final List events; private final String volumeId; private final VolumeStatusInfo volumeStatus; private final List attachmentStatuses; private VolumeStatusItem(BuilderImpl builder) { this.actions = builder.actions; this.availabilityZone = builder.availabilityZone; this.outpostArn = builder.outpostArn; this.events = builder.events; this.volumeId = builder.volumeId; this.volumeStatus = builder.volumeStatus; this.attachmentStatuses = builder.attachmentStatuses; } /** * Returns true if the Actions 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 hasActions() { return actions != null && !(actions instanceof SdkAutoConstructList); } /** *

* The details of the operation. *

*

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

*

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

* * @return The details of the operation. */ public List actions() { return actions; } /** *

* The Availability Zone of the volume. *

* * @return The Availability Zone of the volume. */ public String availabilityZone() { return availabilityZone; } /** *

* The Amazon Resource Name (ARN) of the Outpost. *

* * @return The Amazon Resource Name (ARN) of the Outpost. */ public String outpostArn() { return outpostArn; } /** * Returns true if the Events 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 hasEvents() { return events != null && !(events instanceof SdkAutoConstructList); } /** *

* A list of events associated with the volume. *

*

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

*

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

* * @return A list of events associated with the volume. */ public List events() { return events; } /** *

* The volume ID. *

* * @return The volume ID. */ public String volumeId() { return volumeId; } /** *

* The volume status. *

* * @return The volume status. */ public VolumeStatusInfo volumeStatus() { return volumeStatus; } /** * Returns true if the AttachmentStatuses 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 hasAttachmentStatuses() { return attachmentStatuses != null && !(attachmentStatuses instanceof SdkAutoConstructList); } /** *

* Information about the instances to which the volume is attached. *

*

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

*

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

* * @return Information about the instances to which the volume is attached. */ public List attachmentStatuses() { return attachmentStatuses; } @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(actions()); hashCode = 31 * hashCode + Objects.hashCode(availabilityZone()); hashCode = 31 * hashCode + Objects.hashCode(outpostArn()); hashCode = 31 * hashCode + Objects.hashCode(events()); hashCode = 31 * hashCode + Objects.hashCode(volumeId()); hashCode = 31 * hashCode + Objects.hashCode(volumeStatus()); hashCode = 31 * hashCode + Objects.hashCode(attachmentStatuses()); 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 VolumeStatusItem)) { return false; } VolumeStatusItem other = (VolumeStatusItem) obj; return Objects.equals(actions(), other.actions()) && Objects.equals(availabilityZone(), other.availabilityZone()) && Objects.equals(outpostArn(), other.outpostArn()) && Objects.equals(events(), other.events()) && Objects.equals(volumeId(), other.volumeId()) && Objects.equals(volumeStatus(), other.volumeStatus()) && Objects.equals(attachmentStatuses(), other.attachmentStatuses()); } /** * 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("VolumeStatusItem").add("Actions", actions()).add("AvailabilityZone", availabilityZone()) .add("OutpostArn", outpostArn()).add("Events", events()).add("VolumeId", volumeId()) .add("VolumeStatus", volumeStatus()).add("AttachmentStatuses", attachmentStatuses()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Actions": return Optional.ofNullable(clazz.cast(actions())); case "AvailabilityZone": return Optional.ofNullable(clazz.cast(availabilityZone())); case "OutpostArn": return Optional.ofNullable(clazz.cast(outpostArn())); case "Events": return Optional.ofNullable(clazz.cast(events())); case "VolumeId": return Optional.ofNullable(clazz.cast(volumeId())); case "VolumeStatus": return Optional.ofNullable(clazz.cast(volumeStatus())); case "AttachmentStatuses": return Optional.ofNullable(clazz.cast(attachmentStatuses())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((VolumeStatusItem) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The details of the operation. *

* * @param actions * The details of the operation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder actions(Collection actions); /** *

* The details of the operation. *

* * @param actions * The details of the operation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder actions(VolumeStatusAction... actions); /** *

* The details of the operation. *

* 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 #actions(List)}. * * @param actions * 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 #actions(List) */ Builder actions(Consumer... actions); /** *

* The Availability Zone of the volume. *

* * @param availabilityZone * The Availability Zone of the volume. * @return Returns a reference to this object so that method calls can be chained together. */ Builder availabilityZone(String availabilityZone); /** *

* The Amazon Resource Name (ARN) of the Outpost. *

* * @param outpostArn * The Amazon Resource Name (ARN) of the Outpost. * @return Returns a reference to this object so that method calls can be chained together. */ Builder outpostArn(String outpostArn); /** *

* A list of events associated with the volume. *

* * @param events * A list of events associated with the volume. * @return Returns a reference to this object so that method calls can be chained together. */ Builder events(Collection events); /** *

* A list of events associated with the volume. *

* * @param events * A list of events associated with the volume. * @return Returns a reference to this object so that method calls can be chained together. */ Builder events(VolumeStatusEvent... events); /** *

* A list of events associated with the volume. *

* 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 #events(List)}. * * @param events * 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 #events(List) */ Builder events(Consumer... events); /** *

* The volume ID. *

* * @param volumeId * The volume ID. * @return Returns a reference to this object so that method calls can be chained together. */ Builder volumeId(String volumeId); /** *

* The volume status. *

* * @param volumeStatus * The volume status. * @return Returns a reference to this object so that method calls can be chained together. */ Builder volumeStatus(VolumeStatusInfo volumeStatus); /** *

* The volume status. *

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

* Information about the instances to which the volume is attached. *

* * @param attachmentStatuses * Information about the instances to which the volume is attached. * @return Returns a reference to this object so that method calls can be chained together. */ Builder attachmentStatuses(Collection attachmentStatuses); /** *

* Information about the instances to which the volume is attached. *

* * @param attachmentStatuses * Information about the instances to which the volume is attached. * @return Returns a reference to this object so that method calls can be chained together. */ Builder attachmentStatuses(VolumeStatusAttachmentStatus... attachmentStatuses); /** *

* Information about the instances to which the volume is attached. *

* 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 #attachmentStatuses(List)}. * * @param attachmentStatuses * 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 #attachmentStatuses(List) */ Builder attachmentStatuses(Consumer... attachmentStatuses); } static final class BuilderImpl implements Builder { private List actions = DefaultSdkAutoConstructList.getInstance(); private String availabilityZone; private String outpostArn; private List events = DefaultSdkAutoConstructList.getInstance(); private String volumeId; private VolumeStatusInfo volumeStatus; private List attachmentStatuses = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(VolumeStatusItem model) { actions(model.actions); availabilityZone(model.availabilityZone); outpostArn(model.outpostArn); events(model.events); volumeId(model.volumeId); volumeStatus(model.volumeStatus); attachmentStatuses(model.attachmentStatuses); } public final Collection getActions() { return actions != null ? actions.stream().map(VolumeStatusAction::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder actions(Collection actions) { this.actions = VolumeStatusActionsListCopier.copy(actions); return this; } @Override @SafeVarargs public final Builder actions(VolumeStatusAction... actions) { actions(Arrays.asList(actions)); return this; } @Override @SafeVarargs public final Builder actions(Consumer... actions) { actions(Stream.of(actions).map(c -> VolumeStatusAction.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setActions(Collection actions) { this.actions = VolumeStatusActionsListCopier.copyFromBuilder(actions); } public final String getAvailabilityZone() { return availabilityZone; } @Override public final Builder availabilityZone(String availabilityZone) { this.availabilityZone = availabilityZone; return this; } public final void setAvailabilityZone(String availabilityZone) { this.availabilityZone = availabilityZone; } public final String getOutpostArn() { return outpostArn; } @Override public final Builder outpostArn(String outpostArn) { this.outpostArn = outpostArn; return this; } public final void setOutpostArn(String outpostArn) { this.outpostArn = outpostArn; } public final Collection getEvents() { return events != null ? events.stream().map(VolumeStatusEvent::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder events(Collection events) { this.events = VolumeStatusEventsListCopier.copy(events); return this; } @Override @SafeVarargs public final Builder events(VolumeStatusEvent... events) { events(Arrays.asList(events)); return this; } @Override @SafeVarargs public final Builder events(Consumer... events) { events(Stream.of(events).map(c -> VolumeStatusEvent.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setEvents(Collection events) { this.events = VolumeStatusEventsListCopier.copyFromBuilder(events); } public final String getVolumeId() { return volumeId; } @Override public final Builder volumeId(String volumeId) { this.volumeId = volumeId; return this; } public final void setVolumeId(String volumeId) { this.volumeId = volumeId; } public final VolumeStatusInfo.Builder getVolumeStatus() { return volumeStatus != null ? volumeStatus.toBuilder() : null; } @Override public final Builder volumeStatus(VolumeStatusInfo volumeStatus) { this.volumeStatus = volumeStatus; return this; } public final void setVolumeStatus(VolumeStatusInfo.BuilderImpl volumeStatus) { this.volumeStatus = volumeStatus != null ? volumeStatus.build() : null; } public final Collection getAttachmentStatuses() { return attachmentStatuses != null ? attachmentStatuses.stream().map(VolumeStatusAttachmentStatus::toBuilder) .collect(Collectors.toList()) : null; } @Override public final Builder attachmentStatuses(Collection attachmentStatuses) { this.attachmentStatuses = VolumeStatusAttachmentStatusListCopier.copy(attachmentStatuses); return this; } @Override @SafeVarargs public final Builder attachmentStatuses(VolumeStatusAttachmentStatus... attachmentStatuses) { attachmentStatuses(Arrays.asList(attachmentStatuses)); return this; } @Override @SafeVarargs public final Builder attachmentStatuses(Consumer... attachmentStatuses) { attachmentStatuses(Stream.of(attachmentStatuses) .map(c -> VolumeStatusAttachmentStatus.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final void setAttachmentStatuses(Collection attachmentStatuses) { this.attachmentStatuses = VolumeStatusAttachmentStatusListCopier.copyFromBuilder(attachmentStatuses); } @Override public VolumeStatusItem build() { return new VolumeStatusItem(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy