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

software.amazon.awssdk.services.elasticbeanstalk.model.LoadBalancerDescription Maven / Gradle / Ivy

/*
 * 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.elasticbeanstalk.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 the details of a LoadBalancer. *

*/ @Generated("software.amazon.awssdk:codegen") public final class LoadBalancerDescription implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField LOAD_BALANCER_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("LoadBalancerName").getter(getter(LoadBalancerDescription::loadBalancerName)) .setter(setter(Builder::loadBalancerName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LoadBalancerName").build()).build(); private static final SdkField DOMAIN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Domain") .getter(getter(LoadBalancerDescription::domain)).setter(setter(Builder::domain)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Domain").build()).build(); private static final SdkField> LISTENERS_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("Listeners") .getter(getter(LoadBalancerDescription::listeners)) .setter(setter(Builder::listeners)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Listeners").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(Listener::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(LOAD_BALANCER_NAME_FIELD, DOMAIN_FIELD, LISTENERS_FIELD)); private static final long serialVersionUID = 1L; private final String loadBalancerName; private final String domain; private final List listeners; private LoadBalancerDescription(BuilderImpl builder) { this.loadBalancerName = builder.loadBalancerName; this.domain = builder.domain; this.listeners = builder.listeners; } /** *

* The name of the LoadBalancer. *

* * @return The name of the LoadBalancer. */ public final String loadBalancerName() { return loadBalancerName; } /** *

* The domain name of the LoadBalancer. *

* * @return The domain name of the LoadBalancer. */ public final String domain() { return domain; } /** * For responses, this returns true if the service returned a value for the Listeners 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 hasListeners() { return listeners != null && !(listeners instanceof SdkAutoConstructList); } /** *

* A list of Listeners used by the LoadBalancer. *

*

* 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 #hasListeners} method. *

* * @return A list of Listeners used by the LoadBalancer. */ public final List listeners() { return listeners; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(loadBalancerName()); hashCode = 31 * hashCode + Objects.hashCode(domain()); hashCode = 31 * hashCode + Objects.hashCode(hasListeners() ? listeners() : 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 LoadBalancerDescription)) { return false; } LoadBalancerDescription other = (LoadBalancerDescription) obj; return Objects.equals(loadBalancerName(), other.loadBalancerName()) && Objects.equals(domain(), other.domain()) && hasListeners() == other.hasListeners() && Objects.equals(listeners(), other.listeners()); } /** * 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("LoadBalancerDescription").add("LoadBalancerName", loadBalancerName()).add("Domain", domain()) .add("Listeners", hasListeners() ? listeners() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "LoadBalancerName": return Optional.ofNullable(clazz.cast(loadBalancerName())); case "Domain": return Optional.ofNullable(clazz.cast(domain())); case "Listeners": return Optional.ofNullable(clazz.cast(listeners())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((LoadBalancerDescription) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The name of the LoadBalancer. *

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

* The domain name of the LoadBalancer. *

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

* A list of Listeners used by the LoadBalancer. *

* * @param listeners * A list of Listeners used by the LoadBalancer. * @return Returns a reference to this object so that method calls can be chained together. */ Builder listeners(Collection listeners); /** *

* A list of Listeners used by the LoadBalancer. *

* * @param listeners * A list of Listeners used by the LoadBalancer. * @return Returns a reference to this object so that method calls can be chained together. */ Builder listeners(Listener... listeners); /** *

* A list of Listeners used by the LoadBalancer. *

* This is a convenience method 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 #listeners(List)}. * * @param listeners * 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 #listeners(List) */ Builder listeners(Consumer... listeners); } static final class BuilderImpl implements Builder { private String loadBalancerName; private String domain; private List listeners = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(LoadBalancerDescription model) { loadBalancerName(model.loadBalancerName); domain(model.domain); listeners(model.listeners); } public final String getLoadBalancerName() { return loadBalancerName; } public final void setLoadBalancerName(String loadBalancerName) { this.loadBalancerName = loadBalancerName; } @Override public final Builder loadBalancerName(String loadBalancerName) { this.loadBalancerName = loadBalancerName; return this; } public final String getDomain() { return domain; } public final void setDomain(String domain) { this.domain = domain; } @Override public final Builder domain(String domain) { this.domain = domain; return this; } public final List getListeners() { List result = LoadBalancerListenersDescriptionCopier.copyToBuilder(this.listeners); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setListeners(Collection listeners) { this.listeners = LoadBalancerListenersDescriptionCopier.copyFromBuilder(listeners); } @Override public final Builder listeners(Collection listeners) { this.listeners = LoadBalancerListenersDescriptionCopier.copy(listeners); return this; } @Override @SafeVarargs public final Builder listeners(Listener... listeners) { listeners(Arrays.asList(listeners)); return this; } @Override @SafeVarargs public final Builder listeners(Consumer... listeners) { listeners(Stream.of(listeners).map(c -> Listener.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } @Override public LoadBalancerDescription build() { return new LoadBalancerDescription(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy