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

software.amazon.awssdk.services.appmesh.model.HealthCheckPolicy Maven / Gradle / Ivy

Go to download

The AWS Java SDK for App Mesh module holds the client classes that are used for communicating with App Mesh.

There is a newer version: 2.28.3
Show newest version
/*
 * 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.appmesh.model;

import java.io.Serializable;
import java.util.Arrays;
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.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;

/**
 * 

* An object that represents the health check policy for a virtual node's listener. *

*/ @Generated("software.amazon.awssdk:codegen") public final class HealthCheckPolicy implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField HEALTHY_THRESHOLD_FIELD = SdkField. builder(MarshallingType.INTEGER) .getter(getter(HealthCheckPolicy::healthyThreshold)).setter(setter(Builder::healthyThreshold)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("healthyThreshold").build()).build(); private static final SdkField INTERVAL_MILLIS_FIELD = SdkField. builder(MarshallingType.LONG) .getter(getter(HealthCheckPolicy::intervalMillis)).setter(setter(Builder::intervalMillis)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("intervalMillis").build()).build(); private static final SdkField PATH_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(HealthCheckPolicy::path)).setter(setter(Builder::path)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("path").build()).build(); private static final SdkField PORT_FIELD = SdkField. builder(MarshallingType.INTEGER) .getter(getter(HealthCheckPolicy::port)).setter(setter(Builder::port)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("port").build()).build(); private static final SdkField PROTOCOL_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(HealthCheckPolicy::protocolAsString)).setter(setter(Builder::protocol)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("protocol").build()).build(); private static final SdkField TIMEOUT_MILLIS_FIELD = SdkField. builder(MarshallingType.LONG) .getter(getter(HealthCheckPolicy::timeoutMillis)).setter(setter(Builder::timeoutMillis)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("timeoutMillis").build()).build(); private static final SdkField UNHEALTHY_THRESHOLD_FIELD = SdkField. builder(MarshallingType.INTEGER) .getter(getter(HealthCheckPolicy::unhealthyThreshold)).setter(setter(Builder::unhealthyThreshold)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("unhealthyThreshold").build()) .build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(HEALTHY_THRESHOLD_FIELD, INTERVAL_MILLIS_FIELD, PATH_FIELD, PORT_FIELD, PROTOCOL_FIELD, TIMEOUT_MILLIS_FIELD, UNHEALTHY_THRESHOLD_FIELD)); private static final long serialVersionUID = 1L; private final Integer healthyThreshold; private final Long intervalMillis; private final String path; private final Integer port; private final String protocol; private final Long timeoutMillis; private final Integer unhealthyThreshold; private HealthCheckPolicy(BuilderImpl builder) { this.healthyThreshold = builder.healthyThreshold; this.intervalMillis = builder.intervalMillis; this.path = builder.path; this.port = builder.port; this.protocol = builder.protocol; this.timeoutMillis = builder.timeoutMillis; this.unhealthyThreshold = builder.unhealthyThreshold; } /** *

* The number of consecutive successful health checks that must occur before declaring listener healthy. *

* * @return The number of consecutive successful health checks that must occur before declaring listener healthy. */ public Integer healthyThreshold() { return healthyThreshold; } /** *

* The time period in milliseconds between each health check execution. *

* * @return The time period in milliseconds between each health check execution. */ public Long intervalMillis() { return intervalMillis; } /** *

* The destination path for the health check request. This value is only used if the specified protocol is HTTP or * HTTP/2. For any other protocol, this value is ignored. *

* * @return The destination path for the health check request. This value is only used if the specified protocol is * HTTP or HTTP/2. For any other protocol, this value is ignored. */ public String path() { return path; } /** *

* The destination port for the health check request. This port must match the port defined in the * PortMapping for the listener. *

* * @return The destination port for the health check request. This port must match the port defined in the * PortMapping for the listener. */ public Integer port() { return port; } /** *

* The protocol for the health check request. If you specify grpc, then your service must conform to * the GRPC Health Checking Protocol. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #protocol} will * return {@link PortProtocol#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #protocolAsString}. *

* * @return The protocol for the health check request. If you specify grpc, then your service must * conform to the GRPC Health * Checking Protocol. * @see PortProtocol */ public PortProtocol protocol() { return PortProtocol.fromValue(protocol); } /** *

* The protocol for the health check request. If you specify grpc, then your service must conform to * the GRPC Health Checking Protocol. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #protocol} will * return {@link PortProtocol#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #protocolAsString}. *

* * @return The protocol for the health check request. If you specify grpc, then your service must * conform to the GRPC Health * Checking Protocol. * @see PortProtocol */ public String protocolAsString() { return protocol; } /** *

* The amount of time to wait when receiving a response from the health check, in milliseconds. *

* * @return The amount of time to wait when receiving a response from the health check, in milliseconds. */ public Long timeoutMillis() { return timeoutMillis; } /** *

* The number of consecutive failed health checks that must occur before declaring a virtual node unhealthy. *

* * @return The number of consecutive failed health checks that must occur before declaring a virtual node unhealthy. */ public Integer unhealthyThreshold() { return unhealthyThreshold; } @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(healthyThreshold()); hashCode = 31 * hashCode + Objects.hashCode(intervalMillis()); hashCode = 31 * hashCode + Objects.hashCode(path()); hashCode = 31 * hashCode + Objects.hashCode(port()); hashCode = 31 * hashCode + Objects.hashCode(protocolAsString()); hashCode = 31 * hashCode + Objects.hashCode(timeoutMillis()); hashCode = 31 * hashCode + Objects.hashCode(unhealthyThreshold()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof HealthCheckPolicy)) { return false; } HealthCheckPolicy other = (HealthCheckPolicy) obj; return Objects.equals(healthyThreshold(), other.healthyThreshold()) && Objects.equals(intervalMillis(), other.intervalMillis()) && Objects.equals(path(), other.path()) && Objects.equals(port(), other.port()) && Objects.equals(protocolAsString(), other.protocolAsString()) && Objects.equals(timeoutMillis(), other.timeoutMillis()) && Objects.equals(unhealthyThreshold(), other.unhealthyThreshold()); } /** * 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("HealthCheckPolicy").add("HealthyThreshold", healthyThreshold()) .add("IntervalMillis", intervalMillis()).add("Path", path()).add("Port", port()) .add("Protocol", protocolAsString()).add("TimeoutMillis", timeoutMillis()) .add("UnhealthyThreshold", unhealthyThreshold()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "healthyThreshold": return Optional.ofNullable(clazz.cast(healthyThreshold())); case "intervalMillis": return Optional.ofNullable(clazz.cast(intervalMillis())); case "path": return Optional.ofNullable(clazz.cast(path())); case "port": return Optional.ofNullable(clazz.cast(port())); case "protocol": return Optional.ofNullable(clazz.cast(protocolAsString())); case "timeoutMillis": return Optional.ofNullable(clazz.cast(timeoutMillis())); case "unhealthyThreshold": return Optional.ofNullable(clazz.cast(unhealthyThreshold())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((HealthCheckPolicy) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The number of consecutive successful health checks that must occur before declaring listener healthy. *

* * @param healthyThreshold * The number of consecutive successful health checks that must occur before declaring listener healthy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder healthyThreshold(Integer healthyThreshold); /** *

* The time period in milliseconds between each health check execution. *

* * @param intervalMillis * The time period in milliseconds between each health check execution. * @return Returns a reference to this object so that method calls can be chained together. */ Builder intervalMillis(Long intervalMillis); /** *

* The destination path for the health check request. This value is only used if the specified protocol is HTTP * or HTTP/2. For any other protocol, this value is ignored. *

* * @param path * The destination path for the health check request. This value is only used if the specified protocol * is HTTP or HTTP/2. For any other protocol, this value is ignored. * @return Returns a reference to this object so that method calls can be chained together. */ Builder path(String path); /** *

* The destination port for the health check request. This port must match the port defined in the * PortMapping for the listener. *

* * @param port * The destination port for the health check request. This port must match the port defined in the * PortMapping for the listener. * @return Returns a reference to this object so that method calls can be chained together. */ Builder port(Integer port); /** *

* The protocol for the health check request. If you specify grpc, then your service must conform * to the GRPC Health Checking * Protocol. *

* * @param protocol * The protocol for the health check request. If you specify grpc, then your service must * conform to the GRPC Health * Checking Protocol. * @see PortProtocol * @return Returns a reference to this object so that method calls can be chained together. * @see PortProtocol */ Builder protocol(String protocol); /** *

* The protocol for the health check request. If you specify grpc, then your service must conform * to the GRPC Health Checking * Protocol. *

* * @param protocol * The protocol for the health check request. If you specify grpc, then your service must * conform to the GRPC Health * Checking Protocol. * @see PortProtocol * @return Returns a reference to this object so that method calls can be chained together. * @see PortProtocol */ Builder protocol(PortProtocol protocol); /** *

* The amount of time to wait when receiving a response from the health check, in milliseconds. *

* * @param timeoutMillis * The amount of time to wait when receiving a response from the health check, in milliseconds. * @return Returns a reference to this object so that method calls can be chained together. */ Builder timeoutMillis(Long timeoutMillis); /** *

* The number of consecutive failed health checks that must occur before declaring a virtual node unhealthy. *

* * @param unhealthyThreshold * The number of consecutive failed health checks that must occur before declaring a virtual node * unhealthy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder unhealthyThreshold(Integer unhealthyThreshold); } static final class BuilderImpl implements Builder { private Integer healthyThreshold; private Long intervalMillis; private String path; private Integer port; private String protocol; private Long timeoutMillis; private Integer unhealthyThreshold; private BuilderImpl() { } private BuilderImpl(HealthCheckPolicy model) { healthyThreshold(model.healthyThreshold); intervalMillis(model.intervalMillis); path(model.path); port(model.port); protocol(model.protocol); timeoutMillis(model.timeoutMillis); unhealthyThreshold(model.unhealthyThreshold); } public final Integer getHealthyThreshold() { return healthyThreshold; } @Override public final Builder healthyThreshold(Integer healthyThreshold) { this.healthyThreshold = healthyThreshold; return this; } public final void setHealthyThreshold(Integer healthyThreshold) { this.healthyThreshold = healthyThreshold; } public final Long getIntervalMillis() { return intervalMillis; } @Override public final Builder intervalMillis(Long intervalMillis) { this.intervalMillis = intervalMillis; return this; } public final void setIntervalMillis(Long intervalMillis) { this.intervalMillis = intervalMillis; } public final String getPath() { return path; } @Override public final Builder path(String path) { this.path = path; return this; } public final void setPath(String path) { this.path = path; } public final Integer getPort() { return port; } @Override public final Builder port(Integer port) { this.port = port; return this; } public final void setPort(Integer port) { this.port = port; } public final String getProtocol() { return protocol; } @Override public final Builder protocol(String protocol) { this.protocol = protocol; return this; } @Override public final Builder protocol(PortProtocol protocol) { this.protocol(protocol == null ? null : protocol.toString()); return this; } public final void setProtocol(String protocol) { this.protocol = protocol; } public final Long getTimeoutMillis() { return timeoutMillis; } @Override public final Builder timeoutMillis(Long timeoutMillis) { this.timeoutMillis = timeoutMillis; return this; } public final void setTimeoutMillis(Long timeoutMillis) { this.timeoutMillis = timeoutMillis; } public final Integer getUnhealthyThreshold() { return unhealthyThreshold; } @Override public final Builder unhealthyThreshold(Integer unhealthyThreshold) { this.unhealthyThreshold = unhealthyThreshold; return this; } public final void setUnhealthyThreshold(Integer unhealthyThreshold) { this.unhealthyThreshold = unhealthyThreshold; } @Override public HealthCheckPolicy build() { return new HealthCheckPolicy(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy