software.amazon.awssdk.services.elasticache.model.Parameter Maven / Gradle / Ivy
Show all versions of elasticache 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.elasticache.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;
/**
*
* Describes an individual setting that controls some aspect of ElastiCache behavior.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Parameter implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField PARAMETER_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ParameterName").getter(getter(Parameter::parameterName)).setter(setter(Builder::parameterName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParameterName").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 DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(Parameter::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField SOURCE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Source")
.getter(getter(Parameter::source)).setter(setter(Builder::source))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Source").build()).build();
private static final SdkField DATA_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DataType").getter(getter(Parameter::dataType)).setter(setter(Builder::dataType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DataType").build()).build();
private static final SdkField ALLOWED_VALUES_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AllowedValues").getter(getter(Parameter::allowedValues)).setter(setter(Builder::allowedValues))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AllowedValues").build()).build();
private static final SdkField IS_MODIFIABLE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("IsModifiable").getter(getter(Parameter::isModifiable)).setter(setter(Builder::isModifiable))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsModifiable").build()).build();
private static final SdkField MINIMUM_ENGINE_VERSION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("MinimumEngineVersion").getter(getter(Parameter::minimumEngineVersion))
.setter(setter(Builder::minimumEngineVersion))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MinimumEngineVersion").build())
.build();
private static final SdkField CHANGE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ChangeType").getter(getter(Parameter::changeTypeAsString)).setter(setter(Builder::changeType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ChangeType").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PARAMETER_NAME_FIELD,
PARAMETER_VALUE_FIELD, DESCRIPTION_FIELD, SOURCE_FIELD, DATA_TYPE_FIELD, ALLOWED_VALUES_FIELD, IS_MODIFIABLE_FIELD,
MINIMUM_ENGINE_VERSION_FIELD, CHANGE_TYPE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final String parameterName;
private final String parameterValue;
private final String description;
private final String source;
private final String dataType;
private final String allowedValues;
private final Boolean isModifiable;
private final String minimumEngineVersion;
private final String changeType;
private Parameter(BuilderImpl builder) {
this.parameterName = builder.parameterName;
this.parameterValue = builder.parameterValue;
this.description = builder.description;
this.source = builder.source;
this.dataType = builder.dataType;
this.allowedValues = builder.allowedValues;
this.isModifiable = builder.isModifiable;
this.minimumEngineVersion = builder.minimumEngineVersion;
this.changeType = builder.changeType;
}
/**
*
* The name of the parameter.
*
*
* @return The name of the parameter.
*/
public final String parameterName() {
return parameterName;
}
/**
*
* The value of the parameter.
*
*
* @return The value of the parameter.
*/
public final String parameterValue() {
return parameterValue;
}
/**
*
* A description of the parameter.
*
*
* @return A description of the parameter.
*/
public final String description() {
return description;
}
/**
*
* The source of the parameter.
*
*
* @return The source of the parameter.
*/
public final String source() {
return source;
}
/**
*
* The valid data type for the parameter.
*
*
* @return The valid data type for the parameter.
*/
public final String dataType() {
return dataType;
}
/**
*
* The valid range of values for the parameter.
*
*
* @return The valid range of values for the parameter.
*/
public final String allowedValues() {
return allowedValues;
}
/**
*
* Indicates whether (true
) or not (false
) the parameter can be modified. Some parameters
* have security or operational implications that prevent them from being changed.
*
*
* @return Indicates whether (true
) or not (false
) the parameter can be modified. Some
* parameters have security or operational implications that prevent them from being changed.
*/
public final Boolean isModifiable() {
return isModifiable;
}
/**
*
* The earliest cache engine version to which the parameter can apply.
*
*
* @return The earliest cache engine version to which the parameter can apply.
*/
public final String minimumEngineVersion() {
return minimumEngineVersion;
}
/**
*
* Indicates whether a change to the parameter is applied immediately or requires a reboot for the change to be
* applied. You can force a reboot or wait until the next maintenance window's reboot. For more information, see Rebooting a Cluster.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #changeType} will
* return {@link ChangeType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #changeTypeAsString}.
*
*
* @return Indicates whether a change to the parameter is applied immediately or requires a reboot for the change to
* be applied. You can force a reboot or wait until the next maintenance window's reboot. For more
* information, see Rebooting a
* Cluster.
* @see ChangeType
*/
public final ChangeType changeType() {
return ChangeType.fromValue(changeType);
}
/**
*
* Indicates whether a change to the parameter is applied immediately or requires a reboot for the change to be
* applied. You can force a reboot or wait until the next maintenance window's reboot. For more information, see Rebooting a Cluster.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #changeType} will
* return {@link ChangeType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #changeTypeAsString}.
*
*
* @return Indicates whether a change to the parameter is applied immediately or requires a reboot for the change to
* be applied. You can force a reboot or wait until the next maintenance window's reboot. For more
* information, see Rebooting a
* Cluster.
* @see ChangeType
*/
public final String changeTypeAsString() {
return changeType;
}
@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(parameterName());
hashCode = 31 * hashCode + Objects.hashCode(parameterValue());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(source());
hashCode = 31 * hashCode + Objects.hashCode(dataType());
hashCode = 31 * hashCode + Objects.hashCode(allowedValues());
hashCode = 31 * hashCode + Objects.hashCode(isModifiable());
hashCode = 31 * hashCode + Objects.hashCode(minimumEngineVersion());
hashCode = 31 * hashCode + Objects.hashCode(changeTypeAsString());
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(parameterName(), other.parameterName()) && Objects.equals(parameterValue(), other.parameterValue())
&& Objects.equals(description(), other.description()) && Objects.equals(source(), other.source())
&& Objects.equals(dataType(), other.dataType()) && Objects.equals(allowedValues(), other.allowedValues())
&& Objects.equals(isModifiable(), other.isModifiable())
&& Objects.equals(minimumEngineVersion(), other.minimumEngineVersion())
&& Objects.equals(changeTypeAsString(), other.changeTypeAsString());
}
/**
* 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("ParameterName", parameterName()).add("ParameterValue", parameterValue())
.add("Description", description()).add("Source", source()).add("DataType", dataType())
.add("AllowedValues", allowedValues()).add("IsModifiable", isModifiable())
.add("MinimumEngineVersion", minimumEngineVersion()).add("ChangeType", changeTypeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ParameterName":
return Optional.ofNullable(clazz.cast(parameterName()));
case "ParameterValue":
return Optional.ofNullable(clazz.cast(parameterValue()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "Source":
return Optional.ofNullable(clazz.cast(source()));
case "DataType":
return Optional.ofNullable(clazz.cast(dataType()));
case "AllowedValues":
return Optional.ofNullable(clazz.cast(allowedValues()));
case "IsModifiable":
return Optional.ofNullable(clazz.cast(isModifiable()));
case "MinimumEngineVersion":
return Optional.ofNullable(clazz.cast(minimumEngineVersion()));
case "ChangeType":
return Optional.ofNullable(clazz.cast(changeTypeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("ParameterName", PARAMETER_NAME_FIELD);
map.put("ParameterValue", PARAMETER_VALUE_FIELD);
map.put("Description", DESCRIPTION_FIELD);
map.put("Source", SOURCE_FIELD);
map.put("DataType", DATA_TYPE_FIELD);
map.put("AllowedValues", ALLOWED_VALUES_FIELD);
map.put("IsModifiable", IS_MODIFIABLE_FIELD);
map.put("MinimumEngineVersion", MINIMUM_ENGINE_VERSION_FIELD);
map.put("ChangeType", CHANGE_TYPE_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function