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

software.amazon.awssdk.services.redshift.model.OrderableClusterOption Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Redshift module holds the client classes that are used for communicating with Amazon Redshift Service

There is a newer version: 2.30.1
Show newest version
/*
 * Copyright 2014-2019 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.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Describes an orderable cluster option. *

*/ @Generated("software.amazon.awssdk:codegen") public final class OrderableClusterOption implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField CLUSTER_VERSION_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(OrderableClusterOption::clusterVersion)).setter(setter(Builder::clusterVersion)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClusterVersion").build()).build(); private static final SdkField CLUSTER_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(OrderableClusterOption::clusterType)).setter(setter(Builder::clusterType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ClusterType").build()).build(); private static final SdkField NODE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(OrderableClusterOption::nodeType)).setter(setter(Builder::nodeType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NodeType").build()).build(); private static final SdkField> AVAILABILITY_ZONES_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(OrderableClusterOption::availabilityZones)) .setter(setter(Builder::availabilityZones)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AvailabilityZones").build(), ListTrait .builder() .memberLocationName("AvailabilityZone") .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(AvailabilityZone::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("AvailabilityZone").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(CLUSTER_VERSION_FIELD, CLUSTER_TYPE_FIELD, NODE_TYPE_FIELD, AVAILABILITY_ZONES_FIELD)); private static final long serialVersionUID = 1L; private final String clusterVersion; private final String clusterType; private final String nodeType; private final List availabilityZones; private OrderableClusterOption(BuilderImpl builder) { this.clusterVersion = builder.clusterVersion; this.clusterType = builder.clusterType; this.nodeType = builder.nodeType; this.availabilityZones = builder.availabilityZones; } /** *

* The version of the orderable cluster. *

* * @return The version of the orderable cluster. */ public String clusterVersion() { return clusterVersion; } /** *

* The cluster type, for example multi-node. *

* * @return The cluster type, for example multi-node. */ public String clusterType() { return clusterType; } /** *

* The node type for the orderable cluster. *

* * @return The node type for the orderable cluster. */ public String nodeType() { return nodeType; } /** *

* A list of availability zones for the orderable cluster. *

*

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

* * @return A list of availability zones for the orderable cluster. */ public List availabilityZones() { return availabilityZones; } @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(clusterVersion()); hashCode = 31 * hashCode + Objects.hashCode(clusterType()); hashCode = 31 * hashCode + Objects.hashCode(nodeType()); hashCode = 31 * hashCode + Objects.hashCode(availabilityZones()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof OrderableClusterOption)) { return false; } OrderableClusterOption other = (OrderableClusterOption) obj; return Objects.equals(clusterVersion(), other.clusterVersion()) && Objects.equals(clusterType(), other.clusterType()) && Objects.equals(nodeType(), other.nodeType()) && Objects.equals(availabilityZones(), other.availabilityZones()); } /** * 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("OrderableClusterOption").add("ClusterVersion", clusterVersion()) .add("ClusterType", clusterType()).add("NodeType", nodeType()).add("AvailabilityZones", availabilityZones()) .build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ClusterVersion": return Optional.ofNullable(clazz.cast(clusterVersion())); case "ClusterType": return Optional.ofNullable(clazz.cast(clusterType())); case "NodeType": return Optional.ofNullable(clazz.cast(nodeType())); case "AvailabilityZones": return Optional.ofNullable(clazz.cast(availabilityZones())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((OrderableClusterOption) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The version of the orderable cluster. *

* * @param clusterVersion * The version of the orderable cluster. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clusterVersion(String clusterVersion); /** *

* The cluster type, for example multi-node. *

* * @param clusterType * The cluster type, for example multi-node. * @return Returns a reference to this object so that method calls can be chained together. */ Builder clusterType(String clusterType); /** *

* The node type for the orderable cluster. *

* * @param nodeType * The node type for the orderable cluster. * @return Returns a reference to this object so that method calls can be chained together. */ Builder nodeType(String nodeType); /** *

* A list of availability zones for the orderable cluster. *

* * @param availabilityZones * A list of availability zones for the orderable cluster. * @return Returns a reference to this object so that method calls can be chained together. */ Builder availabilityZones(Collection availabilityZones); /** *

* A list of availability zones for the orderable cluster. *

* * @param availabilityZones * A list of availability zones for the orderable cluster. * @return Returns a reference to this object so that method calls can be chained together. */ Builder availabilityZones(AvailabilityZone... availabilityZones); /** *

* A list of availability zones for the orderable cluster. *

* 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 #availabilityZones(List)}. * * @param availabilityZones * 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 #availabilityZones(List) */ Builder availabilityZones(Consumer... availabilityZones); } static final class BuilderImpl implements Builder { private String clusterVersion; private String clusterType; private String nodeType; private List availabilityZones = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(OrderableClusterOption model) { clusterVersion(model.clusterVersion); clusterType(model.clusterType); nodeType(model.nodeType); availabilityZones(model.availabilityZones); } public final String getClusterVersion() { return clusterVersion; } @Override public final Builder clusterVersion(String clusterVersion) { this.clusterVersion = clusterVersion; return this; } public final void setClusterVersion(String clusterVersion) { this.clusterVersion = clusterVersion; } public final String getClusterType() { return clusterType; } @Override public final Builder clusterType(String clusterType) { this.clusterType = clusterType; return this; } public final void setClusterType(String clusterType) { this.clusterType = clusterType; } public final String getNodeType() { return nodeType; } @Override public final Builder nodeType(String nodeType) { this.nodeType = nodeType; return this; } public final void setNodeType(String nodeType) { this.nodeType = nodeType; } public final Collection getAvailabilityZones() { return availabilityZones != null ? availabilityZones.stream().map(AvailabilityZone::toBuilder) .collect(Collectors.toList()) : null; } @Override public final Builder availabilityZones(Collection availabilityZones) { this.availabilityZones = AvailabilityZoneListCopier.copy(availabilityZones); return this; } @Override @SafeVarargs public final Builder availabilityZones(AvailabilityZone... availabilityZones) { availabilityZones(Arrays.asList(availabilityZones)); return this; } @Override @SafeVarargs public final Builder availabilityZones(Consumer... availabilityZones) { availabilityZones(Stream.of(availabilityZones).map(c -> AvailabilityZone.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setAvailabilityZones(Collection availabilityZones) { this.availabilityZones = AvailabilityZoneListCopier.copyFromBuilder(availabilityZones); } @Override public OrderableClusterOption build() { return new OrderableClusterOption(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy