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

com.amazonaws.services.appmesh.model.HttpRetryPolicy Maven / Gradle / Ivy

Go to download

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

There is a newer version: 1.12.780
Show newest version
/*
 * 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 a retry policy. Specify at least one value for at least one of the types of * RetryEvents, a value for maxRetries, and a value for perRetryTimeout. Both * server-error and gateway-error under httpRetryEvents include the Envoy * reset policy. For more information on the reset policy, see the Envoy documentation. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class HttpRetryPolicy implements Serializable, Cloneable, StructuredPojo { /** *

* Specify at least one of the following values. *

*
    *
  • *

    * server-error – HTTP status codes 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, and 511 *

    *
  • *
  • *

    * gateway-error – HTTP status codes 502, 503, and 504 *

    *
  • *
  • *

    * client-error – HTTP status code 409 *

    *
  • *
  • *

    * stream-error – Retry on refused stream *

    *
  • *
*/ private java.util.List httpRetryEvents; /** *

* The maximum number of retry attempts. *

*/ private Long maxRetries; /** *

* The timeout for each retry attempt. *

*/ private Duration perRetryTimeout; /** *

* Specify a valid value. The event occurs before any processing of a request has started and is encountered when * the upstream is temporarily or permanently unavailable. *

*/ private java.util.List tcpRetryEvents; /** *

* Specify at least one of the following values. *

*
    *
  • *

    * server-error – HTTP status codes 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, and 511 *

    *
  • *
  • *

    * gateway-error – HTTP status codes 502, 503, and 504 *

    *
  • *
  • *

    * client-error – HTTP status code 409 *

    *
  • *
  • *

    * stream-error – Retry on refused stream *

    *
  • *
* * @return Specify at least one of the following values.

*
    *
  • *

    * server-error – HTTP status codes 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, and 511 *

    *
  • *
  • *

    * gateway-error – HTTP status codes 502, 503, and 504 *

    *
  • *
  • *

    * client-error – HTTP status code 409 *

    *
  • *
  • *

    * stream-error – Retry on refused stream *

    *
  • */ public java.util.List getHttpRetryEvents() { return httpRetryEvents; } /** *

    * Specify at least one of the following values. *

    *
      *
    • *

      * server-error – HTTP status codes 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, and 511 *

      *
    • *
    • *

      * gateway-error – HTTP status codes 502, 503, and 504 *

      *
    • *
    • *

      * client-error – HTTP status code 409 *

      *
    • *
    • *

      * stream-error – Retry on refused stream *

      *
    • *
    * * @param httpRetryEvents * Specify at least one of the following values.

    *
      *
    • *

      * server-error – HTTP status codes 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, and 511 *

      *
    • *
    • *

      * gateway-error – HTTP status codes 502, 503, and 504 *

      *
    • *
    • *

      * client-error – HTTP status code 409 *

      *
    • *
    • *

      * stream-error – Retry on refused stream *

      *
    • */ public void setHttpRetryEvents(java.util.Collection httpRetryEvents) { if (httpRetryEvents == null) { this.httpRetryEvents = null; return; } this.httpRetryEvents = new java.util.ArrayList(httpRetryEvents); } /** *

      * Specify at least one of the following values. *

      *
        *
      • *

        * server-error – HTTP status codes 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, and 511 *

        *
      • *
      • *

        * gateway-error – HTTP status codes 502, 503, and 504 *

        *
      • *
      • *

        * client-error – HTTP status code 409 *

        *
      • *
      • *

        * stream-error – Retry on refused stream *

        *
      • *
      *

      * NOTE: This method appends the values to the existing list (if any). Use * {@link #setHttpRetryEvents(java.util.Collection)} or {@link #withHttpRetryEvents(java.util.Collection)} if you * want to override the existing values. *

      * * @param httpRetryEvents * Specify at least one of the following values.

      *
        *
      • *

        * server-error – HTTP status codes 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, and 511 *

        *
      • *
      • *

        * gateway-error – HTTP status codes 502, 503, and 504 *

        *
      • *
      • *

        * client-error – HTTP status code 409 *

        *
      • *
      • *

        * stream-error – Retry on refused stream *

        *
      • * @return Returns a reference to this object so that method calls can be chained together. */ public HttpRetryPolicy withHttpRetryEvents(String... httpRetryEvents) { if (this.httpRetryEvents == null) { setHttpRetryEvents(new java.util.ArrayList(httpRetryEvents.length)); } for (String ele : httpRetryEvents) { this.httpRetryEvents.add(ele); } return this; } /** *

        * Specify at least one of the following values. *

        *
          *
        • *

          * server-error – HTTP status codes 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, and 511 *

          *
        • *
        • *

          * gateway-error – HTTP status codes 502, 503, and 504 *

          *
        • *
        • *

          * client-error – HTTP status code 409 *

          *
        • *
        • *

          * stream-error – Retry on refused stream *

          *
        • *
        * * @param httpRetryEvents * Specify at least one of the following values.

        *
          *
        • *

          * server-error – HTTP status codes 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, and 511 *

          *
        • *
        • *

          * gateway-error – HTTP status codes 502, 503, and 504 *

          *
        • *
        • *

          * client-error – HTTP status code 409 *

          *
        • *
        • *

          * stream-error – Retry on refused stream *

          *
        • * @return Returns a reference to this object so that method calls can be chained together. */ public HttpRetryPolicy withHttpRetryEvents(java.util.Collection httpRetryEvents) { setHttpRetryEvents(httpRetryEvents); return this; } /** *

          * The maximum number of retry attempts. *

          * * @param maxRetries * The maximum number of retry attempts. */ public void setMaxRetries(Long maxRetries) { this.maxRetries = maxRetries; } /** *

          * The maximum number of retry attempts. *

          * * @return The maximum number of retry attempts. */ public Long getMaxRetries() { return this.maxRetries; } /** *

          * The maximum number of retry attempts. *

          * * @param maxRetries * The maximum number of retry attempts. * @return Returns a reference to this object so that method calls can be chained together. */ public HttpRetryPolicy withMaxRetries(Long maxRetries) { setMaxRetries(maxRetries); return this; } /** *

          * The timeout for each retry attempt. *

          * * @param perRetryTimeout * The timeout for each retry attempt. */ public void setPerRetryTimeout(Duration perRetryTimeout) { this.perRetryTimeout = perRetryTimeout; } /** *

          * The timeout for each retry attempt. *

          * * @return The timeout for each retry attempt. */ public Duration getPerRetryTimeout() { return this.perRetryTimeout; } /** *

          * The timeout for each retry attempt. *

          * * @param perRetryTimeout * The timeout for each retry attempt. * @return Returns a reference to this object so that method calls can be chained together. */ public HttpRetryPolicy withPerRetryTimeout(Duration perRetryTimeout) { setPerRetryTimeout(perRetryTimeout); return this; } /** *

          * Specify a valid value. The event occurs before any processing of a request has started and is encountered when * the upstream is temporarily or permanently unavailable. *

          * * @return Specify a valid value. The event occurs before any processing of a request has started and is encountered * when the upstream is temporarily or permanently unavailable. * @see TcpRetryPolicyEvent */ public java.util.List getTcpRetryEvents() { return tcpRetryEvents; } /** *

          * Specify a valid value. The event occurs before any processing of a request has started and is encountered when * the upstream is temporarily or permanently unavailable. *

          * * @param tcpRetryEvents * Specify a valid value. The event occurs before any processing of a request has started and is encountered * when the upstream is temporarily or permanently unavailable. * @see TcpRetryPolicyEvent */ public void setTcpRetryEvents(java.util.Collection tcpRetryEvents) { if (tcpRetryEvents == null) { this.tcpRetryEvents = null; return; } this.tcpRetryEvents = new java.util.ArrayList(tcpRetryEvents); } /** *

          * Specify a valid value. The event occurs before any processing of a request has started and is encountered when * the upstream is temporarily or permanently unavailable. *

          *

          * NOTE: This method appends the values to the existing list (if any). Use * {@link #setTcpRetryEvents(java.util.Collection)} or {@link #withTcpRetryEvents(java.util.Collection)} if you want * to override the existing values. *

          * * @param tcpRetryEvents * Specify a valid value. The event occurs before any processing of a request has started and is encountered * when the upstream is temporarily or permanently unavailable. * @return Returns a reference to this object so that method calls can be chained together. * @see TcpRetryPolicyEvent */ public HttpRetryPolicy withTcpRetryEvents(String... tcpRetryEvents) { if (this.tcpRetryEvents == null) { setTcpRetryEvents(new java.util.ArrayList(tcpRetryEvents.length)); } for (String ele : tcpRetryEvents) { this.tcpRetryEvents.add(ele); } return this; } /** *

          * Specify a valid value. The event occurs before any processing of a request has started and is encountered when * the upstream is temporarily or permanently unavailable. *

          * * @param tcpRetryEvents * Specify a valid value. The event occurs before any processing of a request has started and is encountered * when the upstream is temporarily or permanently unavailable. * @return Returns a reference to this object so that method calls can be chained together. * @see TcpRetryPolicyEvent */ public HttpRetryPolicy withTcpRetryEvents(java.util.Collection tcpRetryEvents) { setTcpRetryEvents(tcpRetryEvents); return this; } /** *

          * Specify a valid value. The event occurs before any processing of a request has started and is encountered when * the upstream is temporarily or permanently unavailable. *

          * * @param tcpRetryEvents * Specify a valid value. The event occurs before any processing of a request has started and is encountered * when the upstream is temporarily or permanently unavailable. * @return Returns a reference to this object so that method calls can be chained together. * @see TcpRetryPolicyEvent */ public HttpRetryPolicy withTcpRetryEvents(TcpRetryPolicyEvent... tcpRetryEvents) { java.util.ArrayList tcpRetryEventsCopy = new java.util.ArrayList(tcpRetryEvents.length); for (TcpRetryPolicyEvent value : tcpRetryEvents) { tcpRetryEventsCopy.add(value.toString()); } if (getTcpRetryEvents() == null) { setTcpRetryEvents(tcpRetryEventsCopy); } else { getTcpRetryEvents().addAll(tcpRetryEventsCopy); } 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 (getHttpRetryEvents() != null) sb.append("HttpRetryEvents: ").append(getHttpRetryEvents()).append(","); if (getMaxRetries() != null) sb.append("MaxRetries: ").append(getMaxRetries()).append(","); if (getPerRetryTimeout() != null) sb.append("PerRetryTimeout: ").append(getPerRetryTimeout()).append(","); if (getTcpRetryEvents() != null) sb.append("TcpRetryEvents: ").append(getTcpRetryEvents()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof HttpRetryPolicy == false) return false; HttpRetryPolicy other = (HttpRetryPolicy) obj; if (other.getHttpRetryEvents() == null ^ this.getHttpRetryEvents() == null) return false; if (other.getHttpRetryEvents() != null && other.getHttpRetryEvents().equals(this.getHttpRetryEvents()) == false) return false; if (other.getMaxRetries() == null ^ this.getMaxRetries() == null) return false; if (other.getMaxRetries() != null && other.getMaxRetries().equals(this.getMaxRetries()) == false) return false; if (other.getPerRetryTimeout() == null ^ this.getPerRetryTimeout() == null) return false; if (other.getPerRetryTimeout() != null && other.getPerRetryTimeout().equals(this.getPerRetryTimeout()) == false) return false; if (other.getTcpRetryEvents() == null ^ this.getTcpRetryEvents() == null) return false; if (other.getTcpRetryEvents() != null && other.getTcpRetryEvents().equals(this.getTcpRetryEvents()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getHttpRetryEvents() == null) ? 0 : getHttpRetryEvents().hashCode()); hashCode = prime * hashCode + ((getMaxRetries() == null) ? 0 : getMaxRetries().hashCode()); hashCode = prime * hashCode + ((getPerRetryTimeout() == null) ? 0 : getPerRetryTimeout().hashCode()); hashCode = prime * hashCode + ((getTcpRetryEvents() == null) ? 0 : getTcpRetryEvents().hashCode()); return hashCode; } @Override public HttpRetryPolicy clone() { try { return (HttpRetryPolicy) 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.HttpRetryPolicyMarshaller.getInstance().marshall(this, protocolMarshaller); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy