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

software.amazon.awssdk.services.ssm.model.ParameterMetadata 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.ssm.model;

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

/**
 * 

* Metadata includes information like the ARN of the last user and the date/time the parameter was last used. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ParameterMetadata implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name") .getter(getter(ParameterMetadata::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type") .getter(getter(ParameterMetadata::typeAsString)).setter(setter(Builder::type)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build(); private static final SdkField KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("KeyId") .getter(getter(ParameterMetadata::keyId)).setter(setter(Builder::keyId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyId").build()).build(); private static final SdkField LAST_MODIFIED_DATE_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("LastModifiedDate").getter(getter(ParameterMetadata::lastModifiedDate)) .setter(setter(Builder::lastModifiedDate)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedDate").build()).build(); private static final SdkField LAST_MODIFIED_USER_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("LastModifiedUser").getter(getter(ParameterMetadata::lastModifiedUser)) .setter(setter(Builder::lastModifiedUser)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedUser").build()).build(); private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Description").getter(getter(ParameterMetadata::description)).setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build(); private static final SdkField ALLOWED_PATTERN_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("AllowedPattern").getter(getter(ParameterMetadata::allowedPattern)) .setter(setter(Builder::allowedPattern)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AllowedPattern").build()).build(); private static final SdkField VERSION_FIELD = SdkField. builder(MarshallingType.LONG).memberName("Version") .getter(getter(ParameterMetadata::version)).setter(setter(Builder::version)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Version").build()).build(); private static final SdkField TIER_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Tier") .getter(getter(ParameterMetadata::tierAsString)).setter(setter(Builder::tier)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Tier").build()).build(); private static final SdkField> POLICIES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Policies") .getter(getter(ParameterMetadata::policies)) .setter(setter(Builder::policies)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Policies").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(ParameterInlinePolicy::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField DATA_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("DataType").getter(getter(ParameterMetadata::dataType)).setter(setter(Builder::dataType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DataType").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, TYPE_FIELD, KEY_ID_FIELD, LAST_MODIFIED_DATE_FIELD, LAST_MODIFIED_USER_FIELD, DESCRIPTION_FIELD, ALLOWED_PATTERN_FIELD, VERSION_FIELD, TIER_FIELD, POLICIES_FIELD, DATA_TYPE_FIELD)); private static final long serialVersionUID = 1L; private final String name; private final String type; private final String keyId; private final Instant lastModifiedDate; private final String lastModifiedUser; private final String description; private final String allowedPattern; private final Long version; private final String tier; private final List policies; private final String dataType; private ParameterMetadata(BuilderImpl builder) { this.name = builder.name; this.type = builder.type; this.keyId = builder.keyId; this.lastModifiedDate = builder.lastModifiedDate; this.lastModifiedUser = builder.lastModifiedUser; this.description = builder.description; this.allowedPattern = builder.allowedPattern; this.version = builder.version; this.tier = builder.tier; this.policies = builder.policies; this.dataType = builder.dataType; } /** *

* The parameter name. *

* * @return The parameter name. */ public String name() { return name; } /** *

* The type of parameter. Valid parameter types include the following: String, StringList, * and SecureString. *

*

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

* * @return The type of parameter. Valid parameter types include the following: String, * StringList, and SecureString. * @see ParameterType */ public ParameterType type() { return ParameterType.fromValue(type); } /** *

* The type of parameter. Valid parameter types include the following: String, StringList, * and SecureString. *

*

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

* * @return The type of parameter. Valid parameter types include the following: String, * StringList, and SecureString. * @see ParameterType */ public String typeAsString() { return type; } /** *

* The ID of the query key used for this parameter. *

* * @return The ID of the query key used for this parameter. */ public String keyId() { return keyId; } /** *

* Date the parameter was last changed or updated. *

* * @return Date the parameter was last changed or updated. */ public Instant lastModifiedDate() { return lastModifiedDate; } /** *

* Amazon Resource Name (ARN) of the AWS user who last changed the parameter. *

* * @return Amazon Resource Name (ARN) of the AWS user who last changed the parameter. */ public String lastModifiedUser() { return lastModifiedUser; } /** *

* Description of the parameter actions. *

* * @return Description of the parameter actions. */ public String description() { return description; } /** *

* A parameter name can include only the following letters and symbols. *

*

* a-zA-Z0-9_.- *

* * @return A parameter name can include only the following letters and symbols.

*

* a-zA-Z0-9_.- */ public String allowedPattern() { return allowedPattern; } /** *

* The parameter version. *

* * @return The parameter version. */ public Long version() { return version; } /** *

* The parameter tier. *

*

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

* * @return The parameter tier. * @see ParameterTier */ public ParameterTier tier() { return ParameterTier.fromValue(tier); } /** *

* The parameter tier. *

*

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

* * @return The parameter tier. * @see ParameterTier */ public String tierAsString() { return tier; } /** * Returns true if the Policies 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 hasPolicies() { return policies != null && !(policies instanceof SdkAutoConstructList); } /** *

* A list of policies associated with a parameter. *

*

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

*

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

* * @return A list of policies associated with a parameter. */ public List policies() { return policies; } /** *

* The data type of the parameter, such as text or aws:ec2:image. The default is * text. *

* * @return The data type of the parameter, such as text or aws:ec2:image. The default is * text. */ public String dataType() { return dataType; } @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(name()); hashCode = 31 * hashCode + Objects.hashCode(typeAsString()); hashCode = 31 * hashCode + Objects.hashCode(keyId()); hashCode = 31 * hashCode + Objects.hashCode(lastModifiedDate()); hashCode = 31 * hashCode + Objects.hashCode(lastModifiedUser()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(allowedPattern()); hashCode = 31 * hashCode + Objects.hashCode(version()); hashCode = 31 * hashCode + Objects.hashCode(tierAsString()); hashCode = 31 * hashCode + Objects.hashCode(policies()); hashCode = 31 * hashCode + Objects.hashCode(dataType()); 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 ParameterMetadata)) { return false; } ParameterMetadata other = (ParameterMetadata) obj; return Objects.equals(name(), other.name()) && Objects.equals(typeAsString(), other.typeAsString()) && Objects.equals(keyId(), other.keyId()) && Objects.equals(lastModifiedDate(), other.lastModifiedDate()) && Objects.equals(lastModifiedUser(), other.lastModifiedUser()) && Objects.equals(description(), other.description()) && Objects.equals(allowedPattern(), other.allowedPattern()) && Objects.equals(version(), other.version()) && Objects.equals(tierAsString(), other.tierAsString()) && Objects.equals(policies(), other.policies()) && Objects.equals(dataType(), other.dataType()); } /** * 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("ParameterMetadata").add("Name", name()).add("Type", typeAsString()).add("KeyId", keyId()) .add("LastModifiedDate", lastModifiedDate()).add("LastModifiedUser", lastModifiedUser()) .add("Description", description()).add("AllowedPattern", allowedPattern()).add("Version", version()) .add("Tier", tierAsString()).add("Policies", policies()).add("DataType", dataType()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Name": return Optional.ofNullable(clazz.cast(name())); case "Type": return Optional.ofNullable(clazz.cast(typeAsString())); case "KeyId": return Optional.ofNullable(clazz.cast(keyId())); case "LastModifiedDate": return Optional.ofNullable(clazz.cast(lastModifiedDate())); case "LastModifiedUser": return Optional.ofNullable(clazz.cast(lastModifiedUser())); case "Description": return Optional.ofNullable(clazz.cast(description())); case "AllowedPattern": return Optional.ofNullable(clazz.cast(allowedPattern())); case "Version": return Optional.ofNullable(clazz.cast(version())); case "Tier": return Optional.ofNullable(clazz.cast(tierAsString())); case "Policies": return Optional.ofNullable(clazz.cast(policies())); case "DataType": return Optional.ofNullable(clazz.cast(dataType())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ParameterMetadata) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The parameter name. *

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

* The type of parameter. Valid parameter types include the following: String, * StringList, and SecureString. *

* * @param type * The type of parameter. Valid parameter types include the following: String, * StringList, and SecureString. * @see ParameterType * @return Returns a reference to this object so that method calls can be chained together. * @see ParameterType */ Builder type(String type); /** *

* The type of parameter. Valid parameter types include the following: String, * StringList, and SecureString. *

* * @param type * The type of parameter. Valid parameter types include the following: String, * StringList, and SecureString. * @see ParameterType * @return Returns a reference to this object so that method calls can be chained together. * @see ParameterType */ Builder type(ParameterType type); /** *

* The ID of the query key used for this parameter. *

* * @param keyId * The ID of the query key used for this parameter. * @return Returns a reference to this object so that method calls can be chained together. */ Builder keyId(String keyId); /** *

* Date the parameter was last changed or updated. *

* * @param lastModifiedDate * Date the parameter was last changed or updated. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastModifiedDate(Instant lastModifiedDate); /** *

* Amazon Resource Name (ARN) of the AWS user who last changed the parameter. *

* * @param lastModifiedUser * Amazon Resource Name (ARN) of the AWS user who last changed the parameter. * @return Returns a reference to this object so that method calls can be chained together. */ Builder lastModifiedUser(String lastModifiedUser); /** *

* Description of the parameter actions. *

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

* A parameter name can include only the following letters and symbols. *

*

* a-zA-Z0-9_.- *

* * @param allowedPattern * A parameter name can include only the following letters and symbols.

*

* a-zA-Z0-9_.- * @return Returns a reference to this object so that method calls can be chained together. */ Builder allowedPattern(String allowedPattern); /** *

* The parameter version. *

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

* The parameter tier. *

* * @param tier * The parameter tier. * @see ParameterTier * @return Returns a reference to this object so that method calls can be chained together. * @see ParameterTier */ Builder tier(String tier); /** *

* The parameter tier. *

* * @param tier * The parameter tier. * @see ParameterTier * @return Returns a reference to this object so that method calls can be chained together. * @see ParameterTier */ Builder tier(ParameterTier tier); /** *

* A list of policies associated with a parameter. *

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

* A list of policies associated with a parameter. *

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

* A list of policies associated with a parameter. *

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

* The data type of the parameter, such as text or aws:ec2:image. The default is * text. *

* * @param dataType * The data type of the parameter, such as text or aws:ec2:image. The default * is text. * @return Returns a reference to this object so that method calls can be chained together. */ Builder dataType(String dataType); } static final class BuilderImpl implements Builder { private String name; private String type; private String keyId; private Instant lastModifiedDate; private String lastModifiedUser; private String description; private String allowedPattern; private Long version; private String tier; private List policies = DefaultSdkAutoConstructList.getInstance(); private String dataType; private BuilderImpl() { } private BuilderImpl(ParameterMetadata model) { name(model.name); type(model.type); keyId(model.keyId); lastModifiedDate(model.lastModifiedDate); lastModifiedUser(model.lastModifiedUser); description(model.description); allowedPattern(model.allowedPattern); version(model.version); tier(model.tier); policies(model.policies); dataType(model.dataType); } 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 getType() { return type; } @Override public final Builder type(String type) { this.type = type; return this; } @Override public final Builder type(ParameterType type) { this.type(type == null ? null : type.toString()); return this; } public final void setType(String type) { this.type = type; } public final String getKeyId() { return keyId; } @Override public final Builder keyId(String keyId) { this.keyId = keyId; return this; } public final void setKeyId(String keyId) { this.keyId = keyId; } public final Instant getLastModifiedDate() { return lastModifiedDate; } @Override public final Builder lastModifiedDate(Instant lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; return this; } public final void setLastModifiedDate(Instant lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } public final String getLastModifiedUser() { return lastModifiedUser; } @Override public final Builder lastModifiedUser(String lastModifiedUser) { this.lastModifiedUser = lastModifiedUser; return this; } public final void setLastModifiedUser(String lastModifiedUser) { this.lastModifiedUser = lastModifiedUser; } 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 getAllowedPattern() { return allowedPattern; } @Override public final Builder allowedPattern(String allowedPattern) { this.allowedPattern = allowedPattern; return this; } public final void setAllowedPattern(String allowedPattern) { this.allowedPattern = allowedPattern; } public final Long getVersion() { return version; } @Override public final Builder version(Long version) { this.version = version; return this; } public final void setVersion(Long version) { this.version = version; } public final String getTier() { return tier; } @Override public final Builder tier(String tier) { this.tier = tier; return this; } @Override public final Builder tier(ParameterTier tier) { this.tier(tier == null ? null : tier.toString()); return this; } public final void setTier(String tier) { this.tier = tier; } public final Collection getPolicies() { return policies != null ? policies.stream().map(ParameterInlinePolicy::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder policies(Collection policies) { this.policies = ParameterPolicyListCopier.copy(policies); return this; } @Override @SafeVarargs public final Builder policies(ParameterInlinePolicy... policies) { policies(Arrays.asList(policies)); return this; } @Override @SafeVarargs public final Builder policies(Consumer... policies) { policies(Stream.of(policies).map(c -> ParameterInlinePolicy.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setPolicies(Collection policies) { this.policies = ParameterPolicyListCopier.copyFromBuilder(policies); } public final String getDataType() { return dataType; } @Override public final Builder dataType(String dataType) { this.dataType = dataType; return this; } public final void setDataType(String dataType) { this.dataType = dataType; } @Override public ParameterMetadata build() { return new ParameterMetadata(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy