software.amazon.awssdk.services.dax.model.Parameter Maven / Gradle / Ivy
Show all versions of dax 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.dax.model;
import java.io.Serializable;
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;
/**
*
* Describes an individual setting that controls some aspect of DAX 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_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ParameterType").getter(getter(Parameter::parameterTypeAsString)).setter(setter(Builder::parameterType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParameterType").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> NODE_TYPE_SPECIFIC_VALUES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("NodeTypeSpecificValues")
.getter(getter(Parameter::nodeTypeSpecificValues))
.setter(setter(Builder::nodeTypeSpecificValues))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NodeTypeSpecificValues").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(NodeTypeSpecificValue::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).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.STRING)
.memberName("IsModifiable").getter(getter(Parameter::isModifiableAsString)).setter(setter(Builder::isModifiable))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsModifiable").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_TYPE_FIELD, PARAMETER_VALUE_FIELD, NODE_TYPE_SPECIFIC_VALUES_FIELD, DESCRIPTION_FIELD, SOURCE_FIELD,
DATA_TYPE_FIELD, ALLOWED_VALUES_FIELD, IS_MODIFIABLE_FIELD, CHANGE_TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final String parameterName;
private final String parameterType;
private final String parameterValue;
private final List nodeTypeSpecificValues;
private final String description;
private final String source;
private final String dataType;
private final String allowedValues;
private final String isModifiable;
private final String changeType;
private Parameter(BuilderImpl builder) {
this.parameterName = builder.parameterName;
this.parameterType = builder.parameterType;
this.parameterValue = builder.parameterValue;
this.nodeTypeSpecificValues = builder.nodeTypeSpecificValues;
this.description = builder.description;
this.source = builder.source;
this.dataType = builder.dataType;
this.allowedValues = builder.allowedValues;
this.isModifiable = builder.isModifiable;
this.changeType = builder.changeType;
}
/**
*
* The name of the parameter.
*
*
* @return The name of the parameter.
*/
public final String parameterName() {
return parameterName;
}
/**
*
* Determines whether the parameter can be applied to any nodes, or only nodes of a particular type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #parameterType}
* will return {@link ParameterType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #parameterTypeAsString}.
*
*
* @return Determines whether the parameter can be applied to any nodes, or only nodes of a particular type.
* @see ParameterType
*/
public final ParameterType parameterType() {
return ParameterType.fromValue(parameterType);
}
/**
*
* Determines whether the parameter can be applied to any nodes, or only nodes of a particular type.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #parameterType}
* will return {@link ParameterType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #parameterTypeAsString}.
*
*
* @return Determines whether the parameter can be applied to any nodes, or only nodes of a particular type.
* @see ParameterType
*/
public final String parameterTypeAsString() {
return parameterType;
}
/**
*
* The value for the parameter.
*
*
* @return The value for the parameter.
*/
public final String parameterValue() {
return parameterValue;
}
/**
* For responses, this returns true if the service returned a value for the NodeTypeSpecificValues property. This
* DOES NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the
* property). This is useful because the SDK will never return a null collection or map, but you may need to
* differentiate between the service returning nothing (or null) and the service returning an empty collection or
* map. For requests, this returns true if a value for the property was specified in the request builder, and false
* if a value was not specified.
*/
public final boolean hasNodeTypeSpecificValues() {
return nodeTypeSpecificValues != null && !(nodeTypeSpecificValues instanceof SdkAutoConstructList);
}
/**
*
* A list of node types, and specific parameter values for each node.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasNodeTypeSpecificValues} method.
*
*
* @return A list of node types, and specific parameter values for each node.
*/
public final List nodeTypeSpecificValues() {
return nodeTypeSpecificValues;
}
/**
*
* A description of the parameter
*
*
* @return A description of the parameter
*/
public final String description() {
return description;
}
/**
*
* How the parameter is defined. For example, system
denotes a system-defined parameter.
*
*
* @return How the parameter is defined. For example, system
denotes a system-defined parameter.
*/
public final String source() {
return source;
}
/**
*
* The data type of the parameter. For example, integer
:
*
*
* @return The data type of the parameter. For example, integer
:
*/
public final String dataType() {
return dataType;
}
/**
*
* A range of values within which the parameter can be set.
*
*
* @return A range of values within which the parameter can be set.
*/
public final String allowedValues() {
return allowedValues;
}
/**
*
* Whether the customer is allowed to modify the parameter.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #isModifiable} will
* return {@link IsModifiable#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #isModifiableAsString}.
*
*
* @return Whether the customer is allowed to modify the parameter.
* @see IsModifiable
*/
public final IsModifiable isModifiable() {
return IsModifiable.fromValue(isModifiable);
}
/**
*
* Whether the customer is allowed to modify the parameter.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #isModifiable} will
* return {@link IsModifiable#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #isModifiableAsString}.
*
*
* @return Whether the customer is allowed to modify the parameter.
* @see IsModifiable
*/
public final String isModifiableAsString() {
return isModifiable;
}
/**
*
* The conditions under which changes to this parameter can be applied. For example, requires-reboot
* indicates that a new value for this parameter will only take effect if a node is rebooted.
*
*
* 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 The conditions under which changes to this parameter can be applied. For example,
* requires-reboot
indicates that a new value for this parameter will only take effect if a
* node is rebooted.
* @see ChangeType
*/
public final ChangeType changeType() {
return ChangeType.fromValue(changeType);
}
/**
*
* The conditions under which changes to this parameter can be applied. For example, requires-reboot
* indicates that a new value for this parameter will only take effect if a node is rebooted.
*
*
* 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 The conditions under which changes to this parameter can be applied. For example,
* requires-reboot
indicates that a new value for this parameter will only take effect if a
* node is rebooted.
* @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(parameterTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(parameterValue());
hashCode = 31 * hashCode + Objects.hashCode(hasNodeTypeSpecificValues() ? nodeTypeSpecificValues() : null);
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(isModifiableAsString());
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(parameterTypeAsString(), other.parameterTypeAsString())
&& Objects.equals(parameterValue(), other.parameterValue())
&& hasNodeTypeSpecificValues() == other.hasNodeTypeSpecificValues()
&& Objects.equals(nodeTypeSpecificValues(), other.nodeTypeSpecificValues())
&& Objects.equals(description(), other.description()) && Objects.equals(source(), other.source())
&& Objects.equals(dataType(), other.dataType()) && Objects.equals(allowedValues(), other.allowedValues())
&& Objects.equals(isModifiableAsString(), other.isModifiableAsString())
&& 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("ParameterType", parameterTypeAsString())
.add("ParameterValue", parameterValue())
.add("NodeTypeSpecificValues", hasNodeTypeSpecificValues() ? nodeTypeSpecificValues() : null)
.add("Description", description()).add("Source", source()).add("DataType", dataType())
.add("AllowedValues", allowedValues()).add("IsModifiable", isModifiableAsString())
.add("ChangeType", changeTypeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ParameterName":
return Optional.ofNullable(clazz.cast(parameterName()));
case "ParameterType":
return Optional.ofNullable(clazz.cast(parameterTypeAsString()));
case "ParameterValue":
return Optional.ofNullable(clazz.cast(parameterValue()));
case "NodeTypeSpecificValues":
return Optional.ofNullable(clazz.cast(nodeTypeSpecificValues()));
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(isModifiableAsString()));
case "ChangeType":
return Optional.ofNullable(clazz.cast(changeTypeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function