software.amazon.awssdk.services.cloudformation.model.Parameter Maven / Gradle / Ivy
Show all versions of cloudformation 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.cloudformation.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The Parameter data type.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Parameter implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField PARAMETER_KEY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ParameterKey").getter(getter(Parameter::parameterKey)).setter(setter(Builder::parameterKey))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParameterKey").build()).build();
private static final SdkField PARAMETER_VALUE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ParameterValue").getter(getter(Parameter::parameterValue)).setter(setter(Builder::parameterValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParameterValue").build()).build();
private static final SdkField USE_PREVIOUS_VALUE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("UsePreviousValue").getter(getter(Parameter::usePreviousValue)).setter(setter(Builder::usePreviousValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UsePreviousValue").build()).build();
private static final SdkField RESOLVED_VALUE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ResolvedValue").getter(getter(Parameter::resolvedValue)).setter(setter(Builder::resolvedValue))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResolvedValue").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PARAMETER_KEY_FIELD,
PARAMETER_VALUE_FIELD, USE_PREVIOUS_VALUE_FIELD, RESOLVED_VALUE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("ParameterKey", PARAMETER_KEY_FIELD);
put("ParameterValue", PARAMETER_VALUE_FIELD);
put("UsePreviousValue", USE_PREVIOUS_VALUE_FIELD);
put("ResolvedValue", RESOLVED_VALUE_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String parameterKey;
private final String parameterValue;
private final Boolean usePreviousValue;
private final String resolvedValue;
private Parameter(BuilderImpl builder) {
this.parameterKey = builder.parameterKey;
this.parameterValue = builder.parameterValue;
this.usePreviousValue = builder.usePreviousValue;
this.resolvedValue = builder.resolvedValue;
}
/**
*
* The key associated with the parameter. If you don't specify a key and value for a particular parameter,
* CloudFormation uses the default value that's specified in your template.
*
*
* @return The key associated with the parameter. If you don't specify a key and value for a particular parameter,
* CloudFormation uses the default value that's specified in your template.
*/
public final String parameterKey() {
return parameterKey;
}
/**
*
* The input value associated with the parameter.
*
*
* @return The input value associated with the parameter.
*/
public final String parameterValue() {
return parameterValue;
}
/**
*
* During a stack update, use the existing parameter value that the stack is using for a given parameter key. If you
* specify true
, do not specify a parameter value.
*
*
* @return During a stack update, use the existing parameter value that the stack is using for a given parameter
* key. If you specify true
, do not specify a parameter value.
*/
public final Boolean usePreviousValue() {
return usePreviousValue;
}
/**
*
* Read-only. The value that corresponds to a Systems Manager parameter key. This field is returned only for Systems
* Manager parameter types in the template. For more information, see Use
* CloudFormation-supplied parameter types in the CloudFormation User Guide.
*
*
* @return Read-only. The value that corresponds to a Systems Manager parameter key. This field is returned only for
* Systems Manager parameter types in the template. For more information, see Use CloudFormation-supplied parameter types in the CloudFormation User Guide.
*/
public final String resolvedValue() {
return resolvedValue;
}
@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 + Objects.hashCode(parameterKey());
hashCode = 31 * hashCode + Objects.hashCode(parameterValue());
hashCode = 31 * hashCode + Objects.hashCode(usePreviousValue());
hashCode = 31 * hashCode + Objects.hashCode(resolvedValue());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof Parameter)) {
return false;
}
Parameter other = (Parameter) obj;
return Objects.equals(parameterKey(), other.parameterKey()) && Objects.equals(parameterValue(), other.parameterValue())
&& Objects.equals(usePreviousValue(), other.usePreviousValue())
&& Objects.equals(resolvedValue(), other.resolvedValue());
}
/**
* 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("Parameter").add("ParameterKey", parameterKey()).add("ParameterValue", parameterValue())
.add("UsePreviousValue", usePreviousValue()).add("ResolvedValue", resolvedValue()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ParameterKey":
return Optional.ofNullable(clazz.cast(parameterKey()));
case "ParameterValue":
return Optional.ofNullable(clazz.cast(parameterValue()));
case "UsePreviousValue":
return Optional.ofNullable(clazz.cast(usePreviousValue()));
case "ResolvedValue":
return Optional.ofNullable(clazz.cast(resolvedValue()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function