software.amazon.awssdk.services.autoscaling.model.TrafficSourceState Maven / Gradle / Ivy
Show all versions of autoscaling 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.autoscaling.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 the state of a traffic source.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TrafficSourceState implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField TRAFFIC_SOURCE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("TrafficSource").getter(getter(TrafficSourceState::trafficSource)).setter(setter(Builder::trafficSource))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TrafficSource").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(TrafficSourceState::state)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField IDENTIFIER_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Identifier").getter(getter(TrafficSourceState::identifier)).setter(setter(Builder::identifier))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Identifier").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Type")
.getter(getter(TrafficSourceState::type)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Type").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TRAFFIC_SOURCE_FIELD,
STATE_FIELD, IDENTIFIER_FIELD, TYPE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("TrafficSource", TRAFFIC_SOURCE_FIELD);
put("State", STATE_FIELD);
put("Identifier", IDENTIFIER_FIELD);
put("Type", TYPE_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String trafficSource;
private final String state;
private final String identifier;
private final String type;
private TrafficSourceState(BuilderImpl builder) {
this.trafficSource = builder.trafficSource;
this.state = builder.state;
this.identifier = builder.identifier;
this.type = builder.type;
}
/**
*
* This is replaced by Identifier
.
*
*
* @return This is replaced by Identifier
.
* @deprecated TrafficSource has been replaced by Identifier
*/
@Deprecated
public final String trafficSource() {
return trafficSource;
}
/**
*
* Describes the current state of a traffic source.
*
*
* The state values are as follows:
*
*
* -
*
* Adding
- The Auto Scaling instances are being registered with the load balancer or target group.
*
*
* -
*
* Added
- All Auto Scaling instances are registered with the load balancer or target group.
*
*
* -
*
* InService
- For an Elastic Load Balancing load balancer or target group, at least one Auto Scaling
* instance passed an ELB
health check. For VPC Lattice, at least one Auto Scaling instance passed an
* VPC_LATTICE
health check.
*
*
* -
*
* Removing
- The Auto Scaling instances are being deregistered from the load balancer or target group.
* If connection draining (deregistration delay) is enabled, Elastic Load Balancing or VPC Lattice waits for
* in-flight requests to complete before deregistering the instances.
*
*
* -
*
* Removed
- All Auto Scaling instances are deregistered from the load balancer or target group.
*
*
*
*
* @return Describes the current state of a traffic source.
*
* The state values are as follows:
*
*
* -
*
* Adding
- The Auto Scaling instances are being registered with the load balancer or target
* group.
*
*
* -
*
* Added
- All Auto Scaling instances are registered with the load balancer or target group.
*
*
* -
*
* InService
- For an Elastic Load Balancing load balancer or target group, at least one Auto
* Scaling instance passed an ELB
health check. For VPC Lattice, at least one Auto Scaling
* instance passed an VPC_LATTICE
health check.
*
*
* -
*
* Removing
- The Auto Scaling instances are being deregistered from the load balancer or
* target group. If connection draining (deregistration delay) is enabled, Elastic Load Balancing or VPC
* Lattice waits for in-flight requests to complete before deregistering the instances.
*
*
* -
*
* Removed
- All Auto Scaling instances are deregistered from the load balancer or target
* group.
*
*
*/
public final String state() {
return state;
}
/**
*
* The unique identifier of the traffic source.
*
*
* @return The unique identifier of the traffic source.
*/
public final String identifier() {
return identifier;
}
/**
*
* Provides additional context for the value of Identifier
.
*
*
* The following lists the valid values:
*
*
* -
*
* elb
if Identifier
is the name of a Classic Load Balancer.
*
*
* -
*
* elbv2
if Identifier
is the ARN of an Application Load Balancer, Gateway Load Balancer,
* or Network Load Balancer target group.
*
*
* -
*
* vpc-lattice
if Identifier
is the ARN of a VPC Lattice target group.
*
*
*
*
* Required if the identifier is the name of a Classic Load Balancer.
*
*
* @return Provides additional context for the value of Identifier
.
*
* The following lists the valid values:
*
*
* -
*
* elb
if Identifier
is the name of a Classic Load Balancer.
*
*
* -
*
* elbv2
if Identifier
is the ARN of an Application Load Balancer, Gateway Load
* Balancer, or Network Load Balancer target group.
*
*
* -
*
* vpc-lattice
if Identifier
is the ARN of a VPC Lattice target group.
*
*
*
*
* Required if the identifier is the name of a Classic Load Balancer.
*/
public final String type() {
return type;
}
@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(trafficSource());
hashCode = 31 * hashCode + Objects.hashCode(state());
hashCode = 31 * hashCode + Objects.hashCode(identifier());
hashCode = 31 * hashCode + Objects.hashCode(type());
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 TrafficSourceState)) {
return false;
}
TrafficSourceState other = (TrafficSourceState) obj;
return Objects.equals(trafficSource(), other.trafficSource()) && Objects.equals(state(), other.state())
&& Objects.equals(identifier(), other.identifier()) && Objects.equals(type(), other.type());
}
/**
* 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("TrafficSourceState").add("TrafficSource", trafficSource()).add("State", state())
.add("Identifier", identifier()).add("Type", type()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "TrafficSource":
return Optional.ofNullable(clazz.cast(trafficSource()));
case "State":
return Optional.ofNullable(clazz.cast(state()));
case "Identifier":
return Optional.ofNullable(clazz.cast(identifier()));
case "Type":
return Optional.ofNullable(clazz.cast(type()));
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
*
* The state values are as follows:
*
*
* -
*
* Adding
- The Auto Scaling instances are being registered with the load balancer or target
* group.
*
*
* -
*
* Added
- All Auto Scaling instances are registered with the load balancer or target group.
*
*
* -
*
* InService
- For an Elastic Load Balancing load balancer or target group, at least one
* Auto Scaling instance passed an ELB
health check. For VPC Lattice, at least one Auto
* Scaling instance passed an VPC_LATTICE
health check.
*
*
* -
*
* Removing
- The Auto Scaling instances are being deregistered from the load balancer or
* target group. If connection draining (deregistration delay) is enabled, Elastic Load Balancing or VPC
* Lattice waits for in-flight requests to complete before deregistering the instances.
*
*
* -
*
* Removed
- All Auto Scaling instances are deregistered from the load balancer or target
* group.
*
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder state(String state);
/**
*
* The unique identifier of the traffic source.
*
*
* @param identifier
* The unique identifier of the traffic source.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder identifier(String identifier);
/**
*
* Provides additional context for the value of Identifier
.
*
*
* The following lists the valid values:
*
*
* -
*
* elb
if Identifier
is the name of a Classic Load Balancer.
*
*
* -
*
* elbv2
if Identifier
is the ARN of an Application Load Balancer, Gateway Load
* Balancer, or Network Load Balancer target group.
*
*
* -
*
* vpc-lattice
if Identifier
is the ARN of a VPC Lattice target group.
*
*
*
*
* Required if the identifier is the name of a Classic Load Balancer.
*
*
* @param type
* Provides additional context for the value of Identifier
.
*
* The following lists the valid values:
*
*
* -
*
* elb
if Identifier
is the name of a Classic Load Balancer.
*
*
* -
*
* elbv2
if Identifier
is the ARN of an Application Load Balancer, Gateway Load
* Balancer, or Network Load Balancer target group.
*
*
* -
*
* vpc-lattice
if Identifier
is the ARN of a VPC Lattice target group.
*
*
*
*
* Required if the identifier is the name of a Classic Load Balancer.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder type(String type);
}
static final class BuilderImpl implements Builder {
private String trafficSource;
private String state;
private String identifier;
private String type;
private BuilderImpl() {
}
private BuilderImpl(TrafficSourceState model) {
trafficSource(model.trafficSource);
state(model.state);
identifier(model.identifier);
type(model.type);
}
@Deprecated
public final String getTrafficSource() {
return trafficSource;
}
@Deprecated
public final void setTrafficSource(String trafficSource) {
this.trafficSource = trafficSource;
}
@Override
@Deprecated
public final Builder trafficSource(String trafficSource) {
this.trafficSource = trafficSource;
return this;
}
public final String getState() {
return state;
}
public final void setState(String state) {
this.state = state;
}
@Override
public final Builder state(String state) {
this.state = state;
return this;
}
public final String getIdentifier() {
return identifier;
}
public final void setIdentifier(String identifier) {
this.identifier = identifier;
}
@Override
public final Builder identifier(String identifier) {
this.identifier = identifier;
return this;
}
public final String getType() {
return type;
}
public final void setType(String type) {
this.type = type;
}
@Override
public final Builder type(String type) {
this.type = type;
return this;
}
@Override
public TrafficSourceState build() {
return new TrafficSourceState(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
@Override
public Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
}
}