software.amazon.awssdk.services.redshift.model.ClusterParameterGroupStatus Maven / Gradle / Ivy
Show all versions of redshift 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.redshift.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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.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 the status of a parameter group.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class ClusterParameterGroupStatus implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField PARAMETER_GROUP_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ParameterGroupName").getter(getter(ClusterParameterGroupStatus::parameterGroupName))
.setter(setter(Builder::parameterGroupName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParameterGroupName").build())
.build();
private static final SdkField PARAMETER_APPLY_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ParameterApplyStatus").getter(getter(ClusterParameterGroupStatus::parameterApplyStatus))
.setter(setter(Builder::parameterApplyStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ParameterApplyStatus").build())
.build();
private static final SdkField> CLUSTER_PARAMETER_STATUS_LIST_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("ClusterParameterStatusList")
.getter(getter(ClusterParameterGroupStatus::clusterParameterStatusList))
.setter(setter(Builder::clusterParameterStatusList))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClusterParameterStatusList").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ClusterParameterStatus::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(PARAMETER_GROUP_NAME_FIELD,
PARAMETER_APPLY_STATUS_FIELD, CLUSTER_PARAMETER_STATUS_LIST_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("ParameterGroupName", PARAMETER_GROUP_NAME_FIELD);
put("ParameterApplyStatus", PARAMETER_APPLY_STATUS_FIELD);
put("ClusterParameterStatusList", CLUSTER_PARAMETER_STATUS_LIST_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String parameterGroupName;
private final String parameterApplyStatus;
private final List clusterParameterStatusList;
private ClusterParameterGroupStatus(BuilderImpl builder) {
this.parameterGroupName = builder.parameterGroupName;
this.parameterApplyStatus = builder.parameterApplyStatus;
this.clusterParameterStatusList = builder.clusterParameterStatusList;
}
/**
*
* The name of the cluster parameter group.
*
*
* @return The name of the cluster parameter group.
*/
public final String parameterGroupName() {
return parameterGroupName;
}
/**
*
* The status of parameter updates.
*
*
* @return The status of parameter updates.
*/
public final String parameterApplyStatus() {
return parameterApplyStatus;
}
/**
* For responses, this returns true if the service returned a value for the ClusterParameterStatusList 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 hasClusterParameterStatusList() {
return clusterParameterStatusList != null && !(clusterParameterStatusList instanceof SdkAutoConstructList);
}
/**
*
* The list of parameter statuses.
*
*
* For more information about parameters and parameter groups, go to Amazon Redshift
* Parameter Groups in the Amazon Redshift Cluster Management Guide.
*
*
* 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 #hasClusterParameterStatusList} method.
*
*
* @return The list of parameter statuses.
*
* For more information about parameters and parameter groups, go to Amazon
* Redshift Parameter Groups in the Amazon Redshift Cluster Management Guide.
*/
public final List clusterParameterStatusList() {
return clusterParameterStatusList;
}
@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(parameterGroupName());
hashCode = 31 * hashCode + Objects.hashCode(parameterApplyStatus());
hashCode = 31 * hashCode + Objects.hashCode(hasClusterParameterStatusList() ? clusterParameterStatusList() : null);
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 ClusterParameterGroupStatus)) {
return false;
}
ClusterParameterGroupStatus other = (ClusterParameterGroupStatus) obj;
return Objects.equals(parameterGroupName(), other.parameterGroupName())
&& Objects.equals(parameterApplyStatus(), other.parameterApplyStatus())
&& hasClusterParameterStatusList() == other.hasClusterParameterStatusList()
&& Objects.equals(clusterParameterStatusList(), other.clusterParameterStatusList());
}
/**
* 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("ClusterParameterGroupStatus").add("ParameterGroupName", parameterGroupName())
.add("ParameterApplyStatus", parameterApplyStatus())
.add("ClusterParameterStatusList", hasClusterParameterStatusList() ? clusterParameterStatusList() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ParameterGroupName":
return Optional.ofNullable(clazz.cast(parameterGroupName()));
case "ParameterApplyStatus":
return Optional.ofNullable(clazz.cast(parameterApplyStatus()));
case "ClusterParameterStatusList":
return Optional.ofNullable(clazz.cast(clusterParameterStatusList()));
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
*
* For more information about parameters and parameter groups, go to Amazon
* Redshift Parameter Groups in the Amazon Redshift Cluster Management Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder clusterParameterStatusList(Collection clusterParameterStatusList);
/**
*
* The list of parameter statuses.
*
*
* For more information about parameters and parameter groups, go to Amazon Redshift
* Parameter Groups in the Amazon Redshift Cluster Management Guide.
*
*
* @param clusterParameterStatusList
* The list of parameter statuses.
*
* For more information about parameters and parameter groups, go to Amazon
* Redshift Parameter Groups in the Amazon Redshift Cluster Management Guide.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder clusterParameterStatusList(ClusterParameterStatus... clusterParameterStatusList);
/**
*
* The list of parameter statuses.
*
*
* For more information about parameters and parameter groups, go to Amazon Redshift
* Parameter Groups in the Amazon Redshift Cluster Management Guide.
*
* This is a convenience method that creates an instance of the
* {@link software.amazon.awssdk.services.redshift.model.ClusterParameterStatus.Builder} avoiding the need to
* create one manually via
* {@link software.amazon.awssdk.services.redshift.model.ClusterParameterStatus#builder()}.
*
*
* When the {@link Consumer} completes,
* {@link software.amazon.awssdk.services.redshift.model.ClusterParameterStatus.Builder#build()} is called
* immediately and its result is passed to {@link #clusterParameterStatusList(List)}.
*
* @param clusterParameterStatusList
* a consumer that will call methods on
* {@link software.amazon.awssdk.services.redshift.model.ClusterParameterStatus.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #clusterParameterStatusList(java.util.Collection)
*/
Builder clusterParameterStatusList(Consumer... clusterParameterStatusList);
}
static final class BuilderImpl implements Builder {
private String parameterGroupName;
private String parameterApplyStatus;
private List clusterParameterStatusList = DefaultSdkAutoConstructList.getInstance();
private BuilderImpl() {
}
private BuilderImpl(ClusterParameterGroupStatus model) {
parameterGroupName(model.parameterGroupName);
parameterApplyStatus(model.parameterApplyStatus);
clusterParameterStatusList(model.clusterParameterStatusList);
}
public final String getParameterGroupName() {
return parameterGroupName;
}
public final void setParameterGroupName(String parameterGroupName) {
this.parameterGroupName = parameterGroupName;
}
@Override
public final Builder parameterGroupName(String parameterGroupName) {
this.parameterGroupName = parameterGroupName;
return this;
}
public final String getParameterApplyStatus() {
return parameterApplyStatus;
}
public final void setParameterApplyStatus(String parameterApplyStatus) {
this.parameterApplyStatus = parameterApplyStatus;
}
@Override
public final Builder parameterApplyStatus(String parameterApplyStatus) {
this.parameterApplyStatus = parameterApplyStatus;
return this;
}
public final List getClusterParameterStatusList() {
List result = ClusterParameterStatusListCopier
.copyToBuilder(this.clusterParameterStatusList);
if (result instanceof SdkAutoConstructList) {
return null;
}
return result;
}
public final void setClusterParameterStatusList(Collection clusterParameterStatusList) {
this.clusterParameterStatusList = ClusterParameterStatusListCopier.copyFromBuilder(clusterParameterStatusList);
}
@Override
public final Builder clusterParameterStatusList(Collection clusterParameterStatusList) {
this.clusterParameterStatusList = ClusterParameterStatusListCopier.copy(clusterParameterStatusList);
return this;
}
@Override
@SafeVarargs
public final Builder clusterParameterStatusList(ClusterParameterStatus... clusterParameterStatusList) {
clusterParameterStatusList(Arrays.asList(clusterParameterStatusList));
return this;
}
@Override
@SafeVarargs
public final Builder clusterParameterStatusList(Consumer... clusterParameterStatusList) {
clusterParameterStatusList(Stream.of(clusterParameterStatusList)
.map(c -> ClusterParameterStatus.builder().applyMutation(c).build()).collect(Collectors.toList()));
return this;
}
@Override
public ClusterParameterGroupStatus build() {
return new ClusterParameterGroupStatus(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}