
software.amazon.awssdk.services.imagebuilder.model.ImageVersion 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.imagebuilder.model;
import java.io.Serializable;
import java.util.Arrays;
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.Function;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* An image semantic version.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ImageVersion implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ImageVersion::arn)).setter(setter(Builder::arn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("arn").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ImageVersion::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("name").build()).build();
private static final SdkField VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ImageVersion::version)).setter(setter(Builder::version))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("version").build()).build();
private static final SdkField PLATFORM_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ImageVersion::platformAsString)).setter(setter(Builder::platform))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("platform").build()).build();
private static final SdkField OS_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ImageVersion::osVersion)).setter(setter(Builder::osVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("osVersion").build()).build();
private static final SdkField OWNER_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ImageVersion::owner)).setter(setter(Builder::owner))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("owner").build()).build();
private static final SdkField DATE_CREATED_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(ImageVersion::dateCreated)).setter(setter(Builder::dateCreated))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dateCreated").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, NAME_FIELD,
VERSION_FIELD, PLATFORM_FIELD, OS_VERSION_FIELD, OWNER_FIELD, DATE_CREATED_FIELD));
private static final long serialVersionUID = 1L;
private final String arn;
private final String name;
private final String version;
private final String platform;
private final String osVersion;
private final String owner;
private final String dateCreated;
private ImageVersion(BuilderImpl builder) {
this.arn = builder.arn;
this.name = builder.name;
this.version = builder.version;
this.platform = builder.platform;
this.osVersion = builder.osVersion;
this.owner = builder.owner;
this.dateCreated = builder.dateCreated;
}
/**
*
* The Amazon Resource Name (ARN) of the image semantic version.
*
*
* @return The Amazon Resource Name (ARN) of the image semantic version.
*/
public String arn() {
return arn;
}
/**
*
* The name of the image semantic version.
*
*
* @return The name of the image semantic version.
*/
public String name() {
return name;
}
/**
*
* The semantic version of the image semantic version.
*
*
* @return The semantic version of the image semantic version.
*/
public String version() {
return version;
}
/**
*
* The platform of the image semantic version.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #platform} will
* return {@link Platform#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #platformAsString}.
*
*
* @return The platform of the image semantic version.
* @see Platform
*/
public Platform platform() {
return Platform.fromValue(platform);
}
/**
*
* The platform of the image semantic version.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #platform} will
* return {@link Platform#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #platformAsString}.
*
*
* @return The platform of the image semantic version.
* @see Platform
*/
public String platformAsString() {
return platform;
}
/**
*
* The operating system version of the instance. For example, Amazon Linux 2, Ubuntu 18, or Microsoft Windows Server
* 2019.
*
*
* @return The operating system version of the instance. For example, Amazon Linux 2, Ubuntu 18, or Microsoft
* Windows Server 2019.
*/
public String osVersion() {
return osVersion;
}
/**
*
* The owner of the image semantic version.
*
*
* @return The owner of the image semantic version.
*/
public String owner() {
return owner;
}
/**
*
* The date at which this image semantic version was created.
*
*
* @return The date at which this image semantic version was created.
*/
public String dateCreated() {
return dateCreated;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(arn());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(version());
hashCode = 31 * hashCode + Objects.hashCode(platformAsString());
hashCode = 31 * hashCode + Objects.hashCode(osVersion());
hashCode = 31 * hashCode + Objects.hashCode(owner());
hashCode = 31 * hashCode + Objects.hashCode(dateCreated());
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 ImageVersion)) {
return false;
}
ImageVersion other = (ImageVersion) obj;
return Objects.equals(arn(), other.arn()) && Objects.equals(name(), other.name())
&& Objects.equals(version(), other.version()) && Objects.equals(platformAsString(), other.platformAsString())
&& Objects.equals(osVersion(), other.osVersion()) && Objects.equals(owner(), other.owner())
&& Objects.equals(dateCreated(), other.dateCreated());
}
/**
* 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("ImageVersion").add("Arn", arn()).add("Name", name()).add("Version", version())
.add("Platform", platformAsString()).add("OsVersion", osVersion()).add("Owner", owner())
.add("DateCreated", dateCreated()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "arn":
return Optional.ofNullable(clazz.cast(arn()));
case "name":
return Optional.ofNullable(clazz.cast(name()));
case "version":
return Optional.ofNullable(clazz.cast(version()));
case "platform":
return Optional.ofNullable(clazz.cast(platformAsString()));
case "osVersion":
return Optional.ofNullable(clazz.cast(osVersion()));
case "owner":
return Optional.ofNullable(clazz.cast(owner()));
case "dateCreated":
return Optional.ofNullable(clazz.cast(dateCreated()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function