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

software.amazon.awssdk.services.imagebuilder.model.Component 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.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* A detailed view of a component. *

*/ @Generated("software.amazon.awssdk:codegen") public final class Component implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ARN_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Component::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(Component::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(Component::version)).setter(setter(Builder::version)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("version").build()).build(); private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Component::description)).setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build(); private static final SdkField CHANGE_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Component::changeDescription)).setter(setter(Builder::changeDescription)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("changeDescription").build()).build(); private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Component::typeAsString)).setter(setter(Builder::type)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("type").build()).build(); private static final SdkField PLATFORM_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Component::platformAsString)).setter(setter(Builder::platform)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("platform").build()).build(); private static final SdkField> SUPPORTED_OS_VERSIONS_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(Component::supportedOsVersions)) .setter(setter(Builder::supportedOsVersions)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("supportedOsVersions").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField OWNER_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Component::owner)).setter(setter(Builder::owner)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("owner").build()).build(); private static final SdkField DATA_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Component::data)).setter(setter(Builder::data)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("data").build()).build(); private static final SdkField KMS_KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Component::kmsKeyId)).setter(setter(Builder::kmsKeyId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("kmsKeyId").build()).build(); private static final SdkField ENCRYPTED_FIELD = SdkField. builder(MarshallingType.BOOLEAN) .getter(getter(Component::encrypted)).setter(setter(Builder::encrypted)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("encrypted").build()).build(); private static final SdkField DATE_CREATED_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(Component::dateCreated)).setter(setter(Builder::dateCreated)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("dateCreated").build()).build(); private static final SdkField> TAGS_FIELD = SdkField .> builder(MarshallingType.MAP) .getter(getter(Component::tags)) .setter(setter(Builder::tags)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ARN_FIELD, NAME_FIELD, VERSION_FIELD, DESCRIPTION_FIELD, CHANGE_DESCRIPTION_FIELD, TYPE_FIELD, PLATFORM_FIELD, SUPPORTED_OS_VERSIONS_FIELD, OWNER_FIELD, DATA_FIELD, KMS_KEY_ID_FIELD, ENCRYPTED_FIELD, DATE_CREATED_FIELD, TAGS_FIELD)); private static final long serialVersionUID = 1L; private final String arn; private final String name; private final String version; private final String description; private final String changeDescription; private final String type; private final String platform; private final List supportedOsVersions; private final String owner; private final String data; private final String kmsKeyId; private final Boolean encrypted; private final String dateCreated; private final Map tags; private Component(BuilderImpl builder) { this.arn = builder.arn; this.name = builder.name; this.version = builder.version; this.description = builder.description; this.changeDescription = builder.changeDescription; this.type = builder.type; this.platform = builder.platform; this.supportedOsVersions = builder.supportedOsVersions; this.owner = builder.owner; this.data = builder.data; this.kmsKeyId = builder.kmsKeyId; this.encrypted = builder.encrypted; this.dateCreated = builder.dateCreated; this.tags = builder.tags; } /** *

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

* * @return The Amazon Resource Name (ARN) of the component. */ public String arn() { return arn; } /** *

* The name of the component. *

* * @return The name of the component. */ public String name() { return name; } /** *

* The version of the component. *

* * @return The version of the component. */ public String version() { return version; } /** *

* The description of the component. *

* * @return The description of the component. */ public String description() { return description; } /** *

* The change description of the component. *

* * @return The change description of the component. */ public String changeDescription() { return changeDescription; } /** *

* The type of the component denotes whether the component is used to build the image or only to test it. *

*

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

* * @return The type of the component denotes whether the component is used to build the image or only to test it. * @see ComponentType */ public ComponentType type() { return ComponentType.fromValue(type); } /** *

* The type of the component denotes whether the component is used to build the image or only to test it. *

*

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

* * @return The type of the component denotes whether the component is used to build the image or only to test it. * @see ComponentType */ public String typeAsString() { return type; } /** *

* The platform of the component. *

*

* 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 component. * @see Platform */ public Platform platform() { return Platform.fromValue(platform); } /** *

* The platform of the component. *

*

* 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 component. * @see Platform */ public String platformAsString() { return platform; } /** * Returns true if the SupportedOsVersions 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 hasSupportedOsVersions() { return supportedOsVersions != null && !(supportedOsVersions instanceof SdkAutoConstructList); } /** *

* The operating system (OS) version supported by the component. If the OS information is available, a prefix match * is performed against the parent image OS version during image recipe creation. *

*

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

*

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

* * @return The operating system (OS) version supported by the component. If the OS information is available, a * prefix match is performed against the parent image OS version during image recipe creation. */ public List supportedOsVersions() { return supportedOsVersions; } /** *

* The owner of the component. *

* * @return The owner of the component. */ public String owner() { return owner; } /** *

* The data of the component. *

* * @return The data of the component. */ public String data() { return data; } /** *

* The KMS key identifier used to encrypt the component. *

* * @return The KMS key identifier used to encrypt the component. */ public String kmsKeyId() { return kmsKeyId; } /** *

* The encryption status of the component. *

* * @return The encryption status of the component. */ public Boolean encrypted() { return encrypted; } /** *

* The date that the component was created. *

* * @return The date that the component was created. */ public String dateCreated() { return dateCreated; } /** * 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 SdkAutoConstructMap); } /** *

* The tags associated with the component. *

*

* 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 associated with the component. */ public Map 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(arn()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(version()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(changeDescription()); hashCode = 31 * hashCode + Objects.hashCode(typeAsString()); hashCode = 31 * hashCode + Objects.hashCode(platformAsString()); hashCode = 31 * hashCode + Objects.hashCode(supportedOsVersions()); hashCode = 31 * hashCode + Objects.hashCode(owner()); hashCode = 31 * hashCode + Objects.hashCode(data()); hashCode = 31 * hashCode + Objects.hashCode(kmsKeyId()); hashCode = 31 * hashCode + Objects.hashCode(encrypted()); hashCode = 31 * hashCode + Objects.hashCode(dateCreated()); 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 Component)) { return false; } Component other = (Component) obj; return Objects.equals(arn(), other.arn()) && Objects.equals(name(), other.name()) && Objects.equals(version(), other.version()) && Objects.equals(description(), other.description()) && Objects.equals(changeDescription(), other.changeDescription()) && Objects.equals(typeAsString(), other.typeAsString()) && Objects.equals(platformAsString(), other.platformAsString()) && Objects.equals(supportedOsVersions(), other.supportedOsVersions()) && Objects.equals(owner(), other.owner()) && Objects.equals(data(), other.data()) && Objects.equals(kmsKeyId(), other.kmsKeyId()) && Objects.equals(encrypted(), other.encrypted()) && Objects.equals(dateCreated(), other.dateCreated()) && 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("Component").add("Arn", arn()).add("Name", name()).add("Version", version()) .add("Description", description()).add("ChangeDescription", changeDescription()).add("Type", typeAsString()) .add("Platform", platformAsString()).add("SupportedOsVersions", supportedOsVersions()).add("Owner", owner()) .add("Data", data()).add("KmsKeyId", kmsKeyId()).add("Encrypted", encrypted()).add("DateCreated", dateCreated()) .add("Tags", tags()).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 "description": return Optional.ofNullable(clazz.cast(description())); case "changeDescription": return Optional.ofNullable(clazz.cast(changeDescription())); case "type": return Optional.ofNullable(clazz.cast(typeAsString())); case "platform": return Optional.ofNullable(clazz.cast(platformAsString())); case "supportedOsVersions": return Optional.ofNullable(clazz.cast(supportedOsVersions())); case "owner": return Optional.ofNullable(clazz.cast(owner())); case "data": return Optional.ofNullable(clazz.cast(data())); case "kmsKeyId": return Optional.ofNullable(clazz.cast(kmsKeyId())); case "encrypted": return Optional.ofNullable(clazz.cast(encrypted())); case "dateCreated": return Optional.ofNullable(clazz.cast(dateCreated())); 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((Component) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

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

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

* The name of the component. *

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

* The version of the component. *

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

* The description of the component. *

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

* The change description of the component. *

* * @param changeDescription * The change description of the component. * @return Returns a reference to this object so that method calls can be chained together. */ Builder changeDescription(String changeDescription); /** *

* The type of the component denotes whether the component is used to build the image or only to test it. *

* * @param type * The type of the component denotes whether the component is used to build the image or only to test it. * @see ComponentType * @return Returns a reference to this object so that method calls can be chained together. * @see ComponentType */ Builder type(String type); /** *

* The type of the component denotes whether the component is used to build the image or only to test it. *

* * @param type * The type of the component denotes whether the component is used to build the image or only to test it. * @see ComponentType * @return Returns a reference to this object so that method calls can be chained together. * @see ComponentType */ Builder type(ComponentType type); /** *

* The platform of the component. *

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

* The platform of the component. *

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

* The operating system (OS) version supported by the component. If the OS information is available, a prefix * match is performed against the parent image OS version during image recipe creation. *

* * @param supportedOsVersions * The operating system (OS) version supported by the component. If the OS information is available, a * prefix match is performed against the parent image OS version during image recipe creation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder supportedOsVersions(Collection supportedOsVersions); /** *

* The operating system (OS) version supported by the component. If the OS information is available, a prefix * match is performed against the parent image OS version during image recipe creation. *

* * @param supportedOsVersions * The operating system (OS) version supported by the component. If the OS information is available, a * prefix match is performed against the parent image OS version during image recipe creation. * @return Returns a reference to this object so that method calls can be chained together. */ Builder supportedOsVersions(String... supportedOsVersions); /** *

* The owner of the component. *

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

* The data of the component. *

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

* The KMS key identifier used to encrypt the component. *

* * @param kmsKeyId * The KMS key identifier used to encrypt the component. * @return Returns a reference to this object so that method calls can be chained together. */ Builder kmsKeyId(String kmsKeyId); /** *

* The encryption status of the component. *

* * @param encrypted * The encryption status of the component. * @return Returns a reference to this object so that method calls can be chained together. */ Builder encrypted(Boolean encrypted); /** *

* The date that the component was created. *

* * @param dateCreated * The date that the component was created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dateCreated(String dateCreated); /** *

* The tags associated with the component. *

* * @param tags * The tags associated with the component. * @return Returns a reference to this object so that method calls can be chained together. */ Builder tags(Map tags); } static final class BuilderImpl implements Builder { private String arn; private String name; private String version; private String description; private String changeDescription; private String type; private String platform; private List supportedOsVersions = DefaultSdkAutoConstructList.getInstance(); private String owner; private String data; private String kmsKeyId; private Boolean encrypted; private String dateCreated; private Map tags = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(Component model) { arn(model.arn); name(model.name); version(model.version); description(model.description); changeDescription(model.changeDescription); type(model.type); platform(model.platform); supportedOsVersions(model.supportedOsVersions); owner(model.owner); data(model.data); kmsKeyId(model.kmsKeyId); encrypted(model.encrypted); dateCreated(model.dateCreated); tags(model.tags); } public final String getArn() { return arn; } @Override public final Builder arn(String arn) { this.arn = arn; return this; } public final void setArn(String arn) { this.arn = arn; } public final String getName() { return name; } @Override public final Builder name(String name) { this.name = name; return this; } public final void setName(String name) { this.name = name; } public final String getVersion() { return version; } @Override public final Builder version(String version) { this.version = version; return this; } public final void setVersion(String version) { this.version = version; } 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 getChangeDescription() { return changeDescription; } @Override public final Builder changeDescription(String changeDescription) { this.changeDescription = changeDescription; return this; } public final void setChangeDescription(String changeDescription) { this.changeDescription = changeDescription; } public final String getType() { return type; } @Override public final Builder type(String type) { this.type = type; return this; } @Override public final Builder type(ComponentType type) { this.type(type == null ? null : type.toString()); return this; } public final void setType(String type) { this.type = type; } public final String getPlatform() { return platform; } @Override public final Builder platform(String platform) { this.platform = platform; return this; } @Override public final Builder platform(Platform platform) { this.platform(platform == null ? null : platform.toString()); return this; } public final void setPlatform(String platform) { this.platform = platform; } public final Collection getSupportedOsVersions() { return supportedOsVersions; } @Override public final Builder supportedOsVersions(Collection supportedOsVersions) { this.supportedOsVersions = OsVersionListCopier.copy(supportedOsVersions); return this; } @Override @SafeVarargs public final Builder supportedOsVersions(String... supportedOsVersions) { supportedOsVersions(Arrays.asList(supportedOsVersions)); return this; } public final void setSupportedOsVersions(Collection supportedOsVersions) { this.supportedOsVersions = OsVersionListCopier.copy(supportedOsVersions); } public final String getOwner() { return owner; } @Override public final Builder owner(String owner) { this.owner = owner; return this; } public final void setOwner(String owner) { this.owner = owner; } public final String getData() { return data; } @Override public final Builder data(String data) { this.data = data; return this; } public final void setData(String data) { this.data = data; } public final String getKmsKeyId() { return kmsKeyId; } @Override public final Builder kmsKeyId(String kmsKeyId) { this.kmsKeyId = kmsKeyId; return this; } public final void setKmsKeyId(String kmsKeyId) { this.kmsKeyId = kmsKeyId; } public final Boolean getEncrypted() { return encrypted; } @Override public final Builder encrypted(Boolean encrypted) { this.encrypted = encrypted; return this; } public final void setEncrypted(Boolean encrypted) { this.encrypted = encrypted; } public final String getDateCreated() { return dateCreated; } @Override public final Builder dateCreated(String dateCreated) { this.dateCreated = dateCreated; return this; } public final void setDateCreated(String dateCreated) { this.dateCreated = dateCreated; } public final Map getTags() { return tags; } @Override public final Builder tags(Map tags) { this.tags = TagMapCopier.copy(tags); return this; } public final void setTags(Map tags) { this.tags = TagMapCopier.copy(tags); } @Override public Component build() { return new Component(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy