software.amazon.awssdk.services.ebs.model.StartSnapshotResponse Maven / Gradle / Ivy
Show all versions of ebs 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.ebs.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 StartSnapshotResponse extends EbsResponse implements
ToCopyableBuilder {
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(StartSnapshotResponse::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField SNAPSHOT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SnapshotId").getter(getter(StartSnapshotResponse::snapshotId)).setter(setter(Builder::snapshotId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SnapshotId").build()).build();
private static final SdkField OWNER_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("OwnerId").getter(getter(StartSnapshotResponse::ownerId)).setter(setter(Builder::ownerId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OwnerId").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status")
.getter(getter(StartSnapshotResponse::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField START_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("StartTime").getter(getter(StartSnapshotResponse::startTime)).setter(setter(Builder::startTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartTime").build()).build();
private static final SdkField VOLUME_SIZE_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("VolumeSize").getter(getter(StartSnapshotResponse::volumeSize)).setter(setter(Builder::volumeSize))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VolumeSize").build()).build();
private static final SdkField BLOCK_SIZE_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("BlockSize").getter(getter(StartSnapshotResponse::blockSize)).setter(setter(Builder::blockSize))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BlockSize").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Tags")
.getter(getter(StartSnapshotResponse::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tags").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Tag::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField PARENT_SNAPSHOT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ParentSnapshotId").getter(getter(StartSnapshotResponse::parentSnapshotId))
.setter(setter(Builder::parentSnapshotId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParentSnapshotId").build()).build();
private static final SdkField KMS_KEY_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KmsKeyArn").getter(getter(StartSnapshotResponse::kmsKeyArn)).setter(setter(Builder::kmsKeyArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KmsKeyArn").build()).build();
private static final SdkField SSE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SseType").getter(getter(StartSnapshotResponse::sseTypeAsString)).setter(setter(Builder::sseType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SseType").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DESCRIPTION_FIELD,
SNAPSHOT_ID_FIELD, OWNER_ID_FIELD, STATUS_FIELD, START_TIME_FIELD, VOLUME_SIZE_FIELD, BLOCK_SIZE_FIELD, TAGS_FIELD,
PARENT_SNAPSHOT_ID_FIELD, KMS_KEY_ARN_FIELD, SSE_TYPE_FIELD));
private final String description;
private final String snapshotId;
private final String ownerId;
private final String status;
private final Instant startTime;
private final Long volumeSize;
private final Integer blockSize;
private final List tags;
private final String parentSnapshotId;
private final String kmsKeyArn;
private final String sseType;
private StartSnapshotResponse(BuilderImpl builder) {
super(builder);
this.description = builder.description;
this.snapshotId = builder.snapshotId;
this.ownerId = builder.ownerId;
this.status = builder.status;
this.startTime = builder.startTime;
this.volumeSize = builder.volumeSize;
this.blockSize = builder.blockSize;
this.tags = builder.tags;
this.parentSnapshotId = builder.parentSnapshotId;
this.kmsKeyArn = builder.kmsKeyArn;
this.sseType = builder.sseType;
}
/**
*
* The description of the snapshot.
*
*
* @return The description of the snapshot.
*/
public final String description() {
return description;
}
/**
*
* The ID of the snapshot.
*
*
* @return The ID of the snapshot.
*/
public final String snapshotId() {
return snapshotId;
}
/**
*
* The Amazon Web Services account ID of the snapshot owner.
*
*
* @return The Amazon Web Services account ID of the snapshot owner.
*/
public final String ownerId() {
return ownerId;
}
/**
*
* The status of the snapshot.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link Status#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the snapshot.
* @see Status
*/
public final Status status() {
return Status.fromValue(status);
}
/**
*
* The status of the snapshot.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link Status#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the snapshot.
* @see Status
*/
public final String statusAsString() {
return status;
}
/**
*
* The timestamp when the snapshot was created.
*
*
* @return The timestamp when the snapshot was created.
*/
public final Instant startTime() {
return startTime;
}
/**
*
* The size of the volume, in GiB.
*
*
* @return The size of the volume, in GiB.
*/
public final Long volumeSize() {
return volumeSize;
}
/**
*
* The size of the blocks in the snapshot, in bytes.
*
*
* @return The size of the blocks in the snapshot, in bytes.
*/
public final Integer blockSize() {
return blockSize;
}
/**
* For responses, this returns true if the service returned a value for the Tags 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 hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructList);
}
/**
*
* The tags applied to the snapshot. You can specify up to 50 tags per snapshot. For more information, see Tagging your Amazon EC2 resources
* in the Amazon Elastic Compute Cloud User Guide.
*
*
* 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 #hasTags} method.
*
*
* @return The tags applied to the snapshot. You can specify up to 50 tags per snapshot. For more information, see
* Tagging your Amazon EC2
* resources in the Amazon Elastic Compute Cloud User Guide.
*/
public final List tags() {
return tags;
}
/**
*
* The ID of the parent snapshot.
*
*
* @return The ID of the parent snapshot.
*/
public final String parentSnapshotId() {
return parentSnapshotId;
}
/**
*
* The Amazon Resource Name (ARN) of the Key Management Service (KMS) key used to encrypt the snapshot.
*
*
* @return The Amazon Resource Name (ARN) of the Key Management Service (KMS) key used to encrypt the snapshot.
*/
public final String kmsKeyArn() {
return kmsKeyArn;
}
/**
*
* Reserved for future use.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #sseType} will
* return {@link SSEType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #sseTypeAsString}.
*
*
* @return Reserved for future use.
* @see SSEType
*/
public final SSEType sseType() {
return SSEType.fromValue(sseType);
}
/**
*
* Reserved for future use.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #sseType} will
* return {@link SSEType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #sseTypeAsString}.
*
*
* @return Reserved for future use.
* @see SSEType
*/
public final String sseTypeAsString() {
return sseType;
}
@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(description());
hashCode = 31 * hashCode + Objects.hashCode(snapshotId());
hashCode = 31 * hashCode + Objects.hashCode(ownerId());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(startTime());
hashCode = 31 * hashCode + Objects.hashCode(volumeSize());
hashCode = 31 * hashCode + Objects.hashCode(blockSize());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(parentSnapshotId());
hashCode = 31 * hashCode + Objects.hashCode(kmsKeyArn());
hashCode = 31 * hashCode + Objects.hashCode(sseTypeAsString());
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 StartSnapshotResponse)) {
return false;
}
StartSnapshotResponse other = (StartSnapshotResponse) obj;
return Objects.equals(description(), other.description()) && Objects.equals(snapshotId(), other.snapshotId())
&& Objects.equals(ownerId(), other.ownerId()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(startTime(), other.startTime()) && Objects.equals(volumeSize(), other.volumeSize())
&& Objects.equals(blockSize(), other.blockSize()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags()) && Objects.equals(parentSnapshotId(), other.parentSnapshotId())
&& Objects.equals(kmsKeyArn(), other.kmsKeyArn()) && Objects.equals(sseTypeAsString(), other.sseTypeAsString());
}
/**
* 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("StartSnapshotResponse").add("Description", description()).add("SnapshotId", snapshotId())
.add("OwnerId", ownerId()).add("Status", statusAsString()).add("StartTime", startTime())
.add("VolumeSize", volumeSize()).add("BlockSize", blockSize()).add("Tags", hasTags() ? tags() : null)
.add("ParentSnapshotId", parentSnapshotId())
.add("KmsKeyArn", kmsKeyArn() == null ? null : "*** Sensitive Data Redacted ***")
.add("SseType", sseTypeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "SnapshotId":
return Optional.ofNullable(clazz.cast(snapshotId()));
case "OwnerId":
return Optional.ofNullable(clazz.cast(ownerId()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "StartTime":
return Optional.ofNullable(clazz.cast(startTime()));
case "VolumeSize":
return Optional.ofNullable(clazz.cast(volumeSize()));
case "BlockSize":
return Optional.ofNullable(clazz.cast(blockSize()));
case "Tags":
return Optional.ofNullable(clazz.cast(tags()));
case "ParentSnapshotId":
return Optional.ofNullable(clazz.cast(parentSnapshotId()));
case "KmsKeyArn":
return Optional.ofNullable(clazz.cast(kmsKeyArn()));
case "SseType":
return Optional.ofNullable(clazz.cast(sseTypeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function