// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.gcp.networkservices.outputs;

import com.pulumi.core.annotations.CustomType;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class EdgeCacheOriginTimeout {
    /**
     * @return The maximum duration to wait for a single origin connection to be established, including DNS lookup, TLS handshake and TCP/QUIC connection establishment.
     * Defaults to 5 seconds. The timeout must be a value between 1s and 15s.
     * The connectTimeout capped by the deadline set by the request&#39;s maxAttemptsTimeout.  The last connection attempt may have a smaller connectTimeout in order to adhere to the overall maxAttemptsTimeout.
     * 
     */
    private @Nullable String connectTimeout;
    /**
     * @return The maximum time across all connection attempts to the origin, including failover origins, before returning an error to the client. A HTTP 504 will be returned if the timeout is reached before a response is returned.
     * Defaults to 15 seconds. The timeout must be a value between 1s and 30s.
     * If a failoverOrigin is specified, the maxAttemptsTimeout of the first configured origin sets the deadline for all connection attempts across all failoverOrigins.
     * 
     */
    private @Nullable String maxAttemptsTimeout;
    /**
     * @return The maximum duration to wait between reads of a single HTTP connection/stream.
     * Defaults to 15 seconds.  The timeout must be a value between 1s and 30s.
     * The readTimeout is capped by the responseTimeout.  All reads of the HTTP connection/stream must be completed by the deadline set by the responseTimeout.
     * If the response headers have already been written to the connection, the response will be truncated and logged.
     * 
     * &lt;a name=&#34;nested_aws_v4_authentication&#34;&gt;&lt;/a&gt;The `aws_v4_authentication` block supports:
     * 
     */
    private @Nullable String readTimeout;
    /**
     * @return The maximum duration to wait for the last byte of a response to arrive when reading from the HTTP connection/stream.
     * Defaults to 30 seconds. The timeout must be a value between 1s and 120s.
     * The responseTimeout starts after the connection has been established.
     * This also applies to HTTP Chunked Transfer Encoding responses, and/or when an open-ended Range request is made to the origin. Origins that take longer to write additional bytes to the response than the configured responseTimeout will result in an error being returned to the client.
     * If the response headers have already been written to the connection, the response will be truncated and logged.
     * 
     */
    private @Nullable String responseTimeout;

    private EdgeCacheOriginTimeout() {}
    /**
     * @return The maximum duration to wait for a single origin connection to be established, including DNS lookup, TLS handshake and TCP/QUIC connection establishment.
     * Defaults to 5 seconds. The timeout must be a value between 1s and 15s.
     * The connectTimeout capped by the deadline set by the request&#39;s maxAttemptsTimeout.  The last connection attempt may have a smaller connectTimeout in order to adhere to the overall maxAttemptsTimeout.
     * 
     */
    public Optional<String> connectTimeout() {
        return Optional.ofNullable(this.connectTimeout);
    }
    /**
     * @return The maximum time across all connection attempts to the origin, including failover origins, before returning an error to the client. A HTTP 504 will be returned if the timeout is reached before a response is returned.
     * Defaults to 15 seconds. The timeout must be a value between 1s and 30s.
     * If a failoverOrigin is specified, the maxAttemptsTimeout of the first configured origin sets the deadline for all connection attempts across all failoverOrigins.
     * 
     */
    public Optional<String> maxAttemptsTimeout() {
        return Optional.ofNullable(this.maxAttemptsTimeout);
    }
    /**
     * @return The maximum duration to wait between reads of a single HTTP connection/stream.
     * Defaults to 15 seconds.  The timeout must be a value between 1s and 30s.
     * The readTimeout is capped by the responseTimeout.  All reads of the HTTP connection/stream must be completed by the deadline set by the responseTimeout.
     * If the response headers have already been written to the connection, the response will be truncated and logged.
     * 
     * &lt;a name=&#34;nested_aws_v4_authentication&#34;&gt;&lt;/a&gt;The `aws_v4_authentication` block supports:
     * 
     */
    public Optional<String> readTimeout() {
        return Optional.ofNullable(this.readTimeout);
    }
    /**
     * @return The maximum duration to wait for the last byte of a response to arrive when reading from the HTTP connection/stream.
     * Defaults to 30 seconds. The timeout must be a value between 1s and 120s.
     * The responseTimeout starts after the connection has been established.
     * This also applies to HTTP Chunked Transfer Encoding responses, and/or when an open-ended Range request is made to the origin. Origins that take longer to write additional bytes to the response than the configured responseTimeout will result in an error being returned to the client.
     * If the response headers have already been written to the connection, the response will be truncated and logged.
     * 
     */
    public Optional<String> responseTimeout() {
        return Optional.ofNullable(this.responseTimeout);
    }

    public static Builder builder() {
        return new Builder();
    }

    public static Builder builder(EdgeCacheOriginTimeout defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable String connectTimeout;
        private @Nullable String maxAttemptsTimeout;
        private @Nullable String readTimeout;
        private @Nullable String responseTimeout;
        public Builder() {}
        public Builder(EdgeCacheOriginTimeout defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.connectTimeout = defaults.connectTimeout;
    	      this.maxAttemptsTimeout = defaults.maxAttemptsTimeout;
    	      this.readTimeout = defaults.readTimeout;
    	      this.responseTimeout = defaults.responseTimeout;
        }

        @CustomType.Setter
        public Builder connectTimeout(@Nullable String connectTimeout) {
            this.connectTimeout = connectTimeout;
            return this;
        }
        @CustomType.Setter
        public Builder maxAttemptsTimeout(@Nullable String maxAttemptsTimeout) {
            this.maxAttemptsTimeout = maxAttemptsTimeout;
            return this;
        }
        @CustomType.Setter
        public Builder readTimeout(@Nullable String readTimeout) {
            this.readTimeout = readTimeout;
            return this;
        }
        @CustomType.Setter
        public Builder responseTimeout(@Nullable String responseTimeout) {
            this.responseTimeout = responseTimeout;
            return this;
        }
        public EdgeCacheOriginTimeout build() {
            final var o = new EdgeCacheOriginTimeout();
            o.connectTimeout = connectTimeout;
            o.maxAttemptsTimeout = maxAttemptsTimeout;
            o.readTimeout = readTimeout;
            o.responseTimeout = responseTimeout;
            return o;
        }
    }
}
