com.amazonaws.services.appmesh.model.VirtualGatewayHealthCheckPolicy Maven / Gradle / Ivy
Show all versions of aws-java-sdk-appmesh Show documentation
/*
* Copyright 2019-2024 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 com.amazonaws.services.appmesh.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* An object that represents the health check policy for a virtual gateway's listener.
*
*
* @see AWS API Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class VirtualGatewayHealthCheckPolicy implements Serializable, Cloneable, StructuredPojo {
/**
*
* The number of consecutive successful health checks that must occur before declaring the listener healthy.
*
*/
private Integer healthyThreshold;
/**
*
* The time period in milliseconds between each health check execution.
*
*/
private 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.
*
*/
private String path;
/**
*
* The destination port for the health check request. This port must match the port defined in the
* PortMapping for the listener.
*
*/
private Integer port;
/**
*
* The protocol for the health check request. If you specify grpc
, then your service must conform to
* the GRPC Health Checking Protocol.
*
*/
private String protocol;
/**
*
* The amount of time to wait when receiving a response from the health check, in milliseconds.
*
*/
private Long timeoutMillis;
/**
*
* The number of consecutive failed health checks that must occur before declaring a virtual gateway unhealthy.
*
*/
private Integer unhealthyThreshold;
/**
*
* The number of consecutive successful health checks that must occur before declaring the listener healthy.
*
*
* @param healthyThreshold
* The number of consecutive successful health checks that must occur before declaring the listener healthy.
*/
public void setHealthyThreshold(Integer healthyThreshold) {
this.healthyThreshold = healthyThreshold;
}
/**
*
* The number of consecutive successful health checks that must occur before declaring the listener healthy.
*
*
* @return The number of consecutive successful health checks that must occur before declaring the listener healthy.
*/
public Integer getHealthyThreshold() {
return this.healthyThreshold;
}
/**
*
* The number of consecutive successful health checks that must occur before declaring the listener healthy.
*
*
* @param healthyThreshold
* The number of consecutive successful health checks that must occur before declaring the listener healthy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public VirtualGatewayHealthCheckPolicy withHealthyThreshold(Integer healthyThreshold) {
setHealthyThreshold(healthyThreshold);
return this;
}
/**
*
* The time period in milliseconds between each health check execution.
*
*
* @param intervalMillis
* The time period in milliseconds between each health check execution.
*/
public void setIntervalMillis(Long intervalMillis) {
this.intervalMillis = intervalMillis;
}
/**
*
* The time period in milliseconds between each health check execution.
*
*
* @return The time period in milliseconds between each health check execution.
*/
public Long getIntervalMillis() {
return this.intervalMillis;
}
/**
*
* 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.
*/
public VirtualGatewayHealthCheckPolicy withIntervalMillis(Long intervalMillis) {
setIntervalMillis(intervalMillis);
return this;
}
/**
*
* 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.
*/
public void setPath(String path) {
this.path = 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 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 getPath() {
return this.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.
*
*
* @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.
*/
public VirtualGatewayHealthCheckPolicy withPath(String path) {
setPath(path);
return this;
}
/**
*
* 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.
*/
public void setPort(Integer port) {
this.port = port;
}
/**
*
* 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 getPort() {
return this.port;
}
/**
*
* 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.
*/
public VirtualGatewayHealthCheckPolicy withPort(Integer port) {
setPort(port);
return this;
}
/**
*
* 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 VirtualGatewayPortProtocol
*/
public void setProtocol(String protocol) {
this.protocol = protocol;
}
/**
*
* The protocol for the health check request. If you specify grpc
, then your service must conform to
* the GRPC Health Checking Protocol.
*
*
* @return The protocol for the health check request. If you specify grpc
, then your service must
* conform to the GRPC Health
* Checking Protocol.
* @see VirtualGatewayPortProtocol
*/
public String getProtocol() {
return this.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.
* @return Returns a reference to this object so that method calls can be chained together.
* @see VirtualGatewayPortProtocol
*/
public VirtualGatewayHealthCheckPolicy withProtocol(String protocol) {
setProtocol(protocol);
return this;
}
/**
*
* 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.
* @return Returns a reference to this object so that method calls can be chained together.
* @see VirtualGatewayPortProtocol
*/
public VirtualGatewayHealthCheckPolicy withProtocol(VirtualGatewayPortProtocol protocol) {
this.protocol = protocol.toString();
return this;
}
/**
*
* 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.
*/
public void setTimeoutMillis(Long timeoutMillis) {
this.timeoutMillis = timeoutMillis;
}
/**
*
* 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 getTimeoutMillis() {
return this.timeoutMillis;
}
/**
*
* 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.
*/
public VirtualGatewayHealthCheckPolicy withTimeoutMillis(Long timeoutMillis) {
setTimeoutMillis(timeoutMillis);
return this;
}
/**
*
* The number of consecutive failed health checks that must occur before declaring a virtual gateway unhealthy.
*
*
* @param unhealthyThreshold
* The number of consecutive failed health checks that must occur before declaring a virtual gateway
* unhealthy.
*/
public void setUnhealthyThreshold(Integer unhealthyThreshold) {
this.unhealthyThreshold = unhealthyThreshold;
}
/**
*
* The number of consecutive failed health checks that must occur before declaring a virtual gateway unhealthy.
*
*
* @return The number of consecutive failed health checks that must occur before declaring a virtual gateway
* unhealthy.
*/
public Integer getUnhealthyThreshold() {
return this.unhealthyThreshold;
}
/**
*
* The number of consecutive failed health checks that must occur before declaring a virtual gateway unhealthy.
*
*
* @param unhealthyThreshold
* The number of consecutive failed health checks that must occur before declaring a virtual gateway
* unhealthy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public VirtualGatewayHealthCheckPolicy withUnhealthyThreshold(Integer unhealthyThreshold) {
setUnhealthyThreshold(unhealthyThreshold);
return this;
}
/**
* 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.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getHealthyThreshold() != null)
sb.append("HealthyThreshold: ").append(getHealthyThreshold()).append(",");
if (getIntervalMillis() != null)
sb.append("IntervalMillis: ").append(getIntervalMillis()).append(",");
if (getPath() != null)
sb.append("Path: ").append(getPath()).append(",");
if (getPort() != null)
sb.append("Port: ").append(getPort()).append(",");
if (getProtocol() != null)
sb.append("Protocol: ").append(getProtocol()).append(",");
if (getTimeoutMillis() != null)
sb.append("TimeoutMillis: ").append(getTimeoutMillis()).append(",");
if (getUnhealthyThreshold() != null)
sb.append("UnhealthyThreshold: ").append(getUnhealthyThreshold());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof VirtualGatewayHealthCheckPolicy == false)
return false;
VirtualGatewayHealthCheckPolicy other = (VirtualGatewayHealthCheckPolicy) obj;
if (other.getHealthyThreshold() == null ^ this.getHealthyThreshold() == null)
return false;
if (other.getHealthyThreshold() != null && other.getHealthyThreshold().equals(this.getHealthyThreshold()) == false)
return false;
if (other.getIntervalMillis() == null ^ this.getIntervalMillis() == null)
return false;
if (other.getIntervalMillis() != null && other.getIntervalMillis().equals(this.getIntervalMillis()) == false)
return false;
if (other.getPath() == null ^ this.getPath() == null)
return false;
if (other.getPath() != null && other.getPath().equals(this.getPath()) == false)
return false;
if (other.getPort() == null ^ this.getPort() == null)
return false;
if (other.getPort() != null && other.getPort().equals(this.getPort()) == false)
return false;
if (other.getProtocol() == null ^ this.getProtocol() == null)
return false;
if (other.getProtocol() != null && other.getProtocol().equals(this.getProtocol()) == false)
return false;
if (other.getTimeoutMillis() == null ^ this.getTimeoutMillis() == null)
return false;
if (other.getTimeoutMillis() != null && other.getTimeoutMillis().equals(this.getTimeoutMillis()) == false)
return false;
if (other.getUnhealthyThreshold() == null ^ this.getUnhealthyThreshold() == null)
return false;
if (other.getUnhealthyThreshold() != null && other.getUnhealthyThreshold().equals(this.getUnhealthyThreshold()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getHealthyThreshold() == null) ? 0 : getHealthyThreshold().hashCode());
hashCode = prime * hashCode + ((getIntervalMillis() == null) ? 0 : getIntervalMillis().hashCode());
hashCode = prime * hashCode + ((getPath() == null) ? 0 : getPath().hashCode());
hashCode = prime * hashCode + ((getPort() == null) ? 0 : getPort().hashCode());
hashCode = prime * hashCode + ((getProtocol() == null) ? 0 : getProtocol().hashCode());
hashCode = prime * hashCode + ((getTimeoutMillis() == null) ? 0 : getTimeoutMillis().hashCode());
hashCode = prime * hashCode + ((getUnhealthyThreshold() == null) ? 0 : getUnhealthyThreshold().hashCode());
return hashCode;
}
@Override
public VirtualGatewayHealthCheckPolicy clone() {
try {
return (VirtualGatewayHealthCheckPolicy) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.appmesh.model.transform.VirtualGatewayHealthCheckPolicyMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}