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

software.amazon.awssdk.services.cloudfront.model.CustomOriginConfig Maven / Gradle / Ivy

/*
 * 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.cloudfront.model;

import java.beans.Transient;
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.Consumer;
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;

/**
 * 

* A custom origin. A custom origin is any origin that is not an Amazon S3 bucket, with one exception. An Amazon * S3 bucket that is configured with * static website hosting is a custom origin. *

*/ @Generated("software.amazon.awssdk:codegen") public final class CustomOriginConfig implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField HTTP_PORT_FIELD = SdkField . builder(MarshallingType.INTEGER) .memberName("HTTPPort") .getter(getter(CustomOriginConfig::httpPort)) .setter(setter(Builder::httpPort)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HTTPPort") .unmarshallLocationName("HTTPPort").build()).build(); private static final SdkField HTTPS_PORT_FIELD = SdkField . builder(MarshallingType.INTEGER) .memberName("HTTPSPort") .getter(getter(CustomOriginConfig::httpsPort)) .setter(setter(Builder::httpsPort)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HTTPSPort") .unmarshallLocationName("HTTPSPort").build()).build(); private static final SdkField ORIGIN_PROTOCOL_POLICY_FIELD = SdkField . builder(MarshallingType.STRING) .memberName("OriginProtocolPolicy") .getter(getter(CustomOriginConfig::originProtocolPolicyAsString)) .setter(setter(Builder::originProtocolPolicy)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OriginProtocolPolicy") .unmarshallLocationName("OriginProtocolPolicy").build()).build(); private static final SdkField ORIGIN_SSL_PROTOCOLS_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .memberName("OriginSslProtocols") .getter(getter(CustomOriginConfig::originSslProtocols)) .setter(setter(Builder::originSslProtocols)) .constructor(OriginSslProtocols::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OriginSslProtocols") .unmarshallLocationName("OriginSslProtocols").build()).build(); private static final SdkField ORIGIN_READ_TIMEOUT_FIELD = SdkField . builder(MarshallingType.INTEGER) .memberName("OriginReadTimeout") .getter(getter(CustomOriginConfig::originReadTimeout)) .setter(setter(Builder::originReadTimeout)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OriginReadTimeout") .unmarshallLocationName("OriginReadTimeout").build()).build(); private static final SdkField ORIGIN_KEEPALIVE_TIMEOUT_FIELD = SdkField . builder(MarshallingType.INTEGER) .memberName("OriginKeepaliveTimeout") .getter(getter(CustomOriginConfig::originKeepaliveTimeout)) .setter(setter(Builder::originKeepaliveTimeout)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OriginKeepaliveTimeout") .unmarshallLocationName("OriginKeepaliveTimeout").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(HTTP_PORT_FIELD, HTTPS_PORT_FIELD, ORIGIN_PROTOCOL_POLICY_FIELD, ORIGIN_SSL_PROTOCOLS_FIELD, ORIGIN_READ_TIMEOUT_FIELD, ORIGIN_KEEPALIVE_TIMEOUT_FIELD)); private static final long serialVersionUID = 1L; private final Integer httpPort; private final Integer httpsPort; private final String originProtocolPolicy; private final OriginSslProtocols originSslProtocols; private final Integer originReadTimeout; private final Integer originKeepaliveTimeout; private CustomOriginConfig(BuilderImpl builder) { this.httpPort = builder.httpPort; this.httpsPort = builder.httpsPort; this.originProtocolPolicy = builder.originProtocolPolicy; this.originSslProtocols = builder.originSslProtocols; this.originReadTimeout = builder.originReadTimeout; this.originKeepaliveTimeout = builder.originKeepaliveTimeout; } /** *

* The HTTP port that CloudFront uses to connect to the origin. Specify the HTTP port that the origin listens on. *

* * @return The HTTP port that CloudFront uses to connect to the origin. Specify the HTTP port that the origin * listens on. */ public final Integer httpPort() { return httpPort; } /** *

* The HTTPS port that CloudFront uses to connect to the origin. Specify the HTTPS port that the origin listens on. *

* * @return The HTTPS port that CloudFront uses to connect to the origin. Specify the HTTPS port that the origin * listens on. */ public final Integer httpsPort() { return httpsPort; } /** *

* Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. Valid values are: *

*
    *
  • *

    * http-only – CloudFront always uses HTTP to connect to the origin. *

    *
  • *
  • *

    * match-viewer – CloudFront connects to the origin using the same protocol that the viewer used to * connect to CloudFront. *

    *
  • *
  • *

    * https-only – CloudFront always uses HTTPS to connect to the origin. *

    *
  • *
*

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

* * @return Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. Valid values * are:

*
    *
  • *

    * http-only – CloudFront always uses HTTP to connect to the origin. *

    *
  • *
  • *

    * match-viewer – CloudFront connects to the origin using the same protocol that the viewer * used to connect to CloudFront. *

    *
  • *
  • *

    * https-only – CloudFront always uses HTTPS to connect to the origin. *

    *
  • * @see OriginProtocolPolicy */ public final OriginProtocolPolicy originProtocolPolicy() { return OriginProtocolPolicy.fromValue(originProtocolPolicy); } /** *

    * Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. Valid values are: *

    *
      *
    • *

      * http-only – CloudFront always uses HTTP to connect to the origin. *

      *
    • *
    • *

      * match-viewer – CloudFront connects to the origin using the same protocol that the viewer used to * connect to CloudFront. *

      *
    • *
    • *

      * https-only – CloudFront always uses HTTPS to connect to the origin. *

      *
    • *
    *

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

    * * @return Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. Valid values * are:

    *
      *
    • *

      * http-only – CloudFront always uses HTTP to connect to the origin. *

      *
    • *
    • *

      * match-viewer – CloudFront connects to the origin using the same protocol that the viewer * used to connect to CloudFront. *

      *
    • *
    • *

      * https-only – CloudFront always uses HTTPS to connect to the origin. *

      *
    • * @see OriginProtocolPolicy */ public final String originProtocolPolicyAsString() { return originProtocolPolicy; } /** *

      * Specifies the minimum SSL/TLS protocol that CloudFront uses when connecting to your origin over HTTPS. Valid * values include SSLv3, TLSv1, TLSv1.1, and TLSv1.2. *

      *

      * For more information, see Minimum Origin SSL Protocol in the Amazon CloudFront Developer Guide. *

      * * @return Specifies the minimum SSL/TLS protocol that CloudFront uses when connecting to your origin over HTTPS. * Valid values include SSLv3, TLSv1, TLSv1.1, and * TLSv1.2.

      *

      * For more information, see Minimum Origin SSL Protocol in the Amazon CloudFront Developer Guide. */ public final OriginSslProtocols originSslProtocols() { return originSslProtocols; } /** *

      * Specifies how long, in seconds, CloudFront waits for a response from the origin. This is also known as the * origin response timeout. The minimum timeout is 1 second, the maximum is 60 seconds, and the default (if * you don’t specify otherwise) is 30 seconds. *

      *

      * For more information, see Origin Response Timeout in the Amazon CloudFront Developer Guide. *

      * * @return Specifies how long, in seconds, CloudFront waits for a response from the origin. This is also known as * the origin response timeout. The minimum timeout is 1 second, the maximum is 60 seconds, and the * default (if you don’t specify otherwise) is 30 seconds.

      *

      * For more information, see Origin Response Timeout in the Amazon CloudFront Developer Guide. */ public final Integer originReadTimeout() { return originReadTimeout; } /** *

      * Specifies how long, in seconds, CloudFront persists its connection to the origin. The minimum timeout is 1 * second, the maximum is 60 seconds, and the default (if you don’t specify otherwise) is 5 seconds. *

      *

      * For more information, see Origin Keep-alive Timeout in the Amazon CloudFront Developer Guide. *

      * * @return Specifies how long, in seconds, CloudFront persists its connection to the origin. The minimum timeout is * 1 second, the maximum is 60 seconds, and the default (if you don’t specify otherwise) is 5 seconds.

      *

      * For more information, see Origin Keep-alive Timeout in the Amazon CloudFront Developer Guide. */ public final Integer originKeepaliveTimeout() { return originKeepaliveTimeout; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(httpPort()); hashCode = 31 * hashCode + Objects.hashCode(httpsPort()); hashCode = 31 * hashCode + Objects.hashCode(originProtocolPolicyAsString()); hashCode = 31 * hashCode + Objects.hashCode(originSslProtocols()); hashCode = 31 * hashCode + Objects.hashCode(originReadTimeout()); hashCode = 31 * hashCode + Objects.hashCode(originKeepaliveTimeout()); 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 CustomOriginConfig)) { return false; } CustomOriginConfig other = (CustomOriginConfig) obj; return Objects.equals(httpPort(), other.httpPort()) && Objects.equals(httpsPort(), other.httpsPort()) && Objects.equals(originProtocolPolicyAsString(), other.originProtocolPolicyAsString()) && Objects.equals(originSslProtocols(), other.originSslProtocols()) && Objects.equals(originReadTimeout(), other.originReadTimeout()) && Objects.equals(originKeepaliveTimeout(), other.originKeepaliveTimeout()); } /** * 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("CustomOriginConfig").add("HTTPPort", httpPort()).add("HTTPSPort", httpsPort()) .add("OriginProtocolPolicy", originProtocolPolicyAsString()).add("OriginSslProtocols", originSslProtocols()) .add("OriginReadTimeout", originReadTimeout()).add("OriginKeepaliveTimeout", originKeepaliveTimeout()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "HTTPPort": return Optional.ofNullable(clazz.cast(httpPort())); case "HTTPSPort": return Optional.ofNullable(clazz.cast(httpsPort())); case "OriginProtocolPolicy": return Optional.ofNullable(clazz.cast(originProtocolPolicyAsString())); case "OriginSslProtocols": return Optional.ofNullable(clazz.cast(originSslProtocols())); case "OriginReadTimeout": return Optional.ofNullable(clazz.cast(originReadTimeout())); case "OriginKeepaliveTimeout": return Optional.ofNullable(clazz.cast(originKeepaliveTimeout())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((CustomOriginConfig) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

      * The HTTP port that CloudFront uses to connect to the origin. Specify the HTTP port that the origin listens * on. *

      * * @param httpPort * The HTTP port that CloudFront uses to connect to the origin. Specify the HTTP port that the origin * listens on. * @return Returns a reference to this object so that method calls can be chained together. */ Builder httpPort(Integer httpPort); /** *

      * The HTTPS port that CloudFront uses to connect to the origin. Specify the HTTPS port that the origin listens * on. *

      * * @param httpsPort * The HTTPS port that CloudFront uses to connect to the origin. Specify the HTTPS port that the origin * listens on. * @return Returns a reference to this object so that method calls can be chained together. */ Builder httpsPort(Integer httpsPort); /** *

      * Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. Valid values are: *

      *
        *
      • *

        * http-only – CloudFront always uses HTTP to connect to the origin. *

        *
      • *
      • *

        * match-viewer – CloudFront connects to the origin using the same protocol that the viewer used to * connect to CloudFront. *

        *
      • *
      • *

        * https-only – CloudFront always uses HTTPS to connect to the origin. *

        *
      • *
      * * @param originProtocolPolicy * Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. Valid values * are:

      *
        *
      • *

        * http-only – CloudFront always uses HTTP to connect to the origin. *

        *
      • *
      • *

        * match-viewer – CloudFront connects to the origin using the same protocol that the viewer * used to connect to CloudFront. *

        *
      • *
      • *

        * https-only – CloudFront always uses HTTPS to connect to the origin. *

        *
      • * @see OriginProtocolPolicy * @return Returns a reference to this object so that method calls can be chained together. * @see OriginProtocolPolicy */ Builder originProtocolPolicy(String originProtocolPolicy); /** *

        * Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. Valid values are: *

        *
          *
        • *

          * http-only – CloudFront always uses HTTP to connect to the origin. *

          *
        • *
        • *

          * match-viewer – CloudFront connects to the origin using the same protocol that the viewer used to * connect to CloudFront. *

          *
        • *
        • *

          * https-only – CloudFront always uses HTTPS to connect to the origin. *

          *
        • *
        * * @param originProtocolPolicy * Specifies the protocol (HTTP or HTTPS) that CloudFront uses to connect to the origin. Valid values * are:

        *
          *
        • *

          * http-only – CloudFront always uses HTTP to connect to the origin. *

          *
        • *
        • *

          * match-viewer – CloudFront connects to the origin using the same protocol that the viewer * used to connect to CloudFront. *

          *
        • *
        • *

          * https-only – CloudFront always uses HTTPS to connect to the origin. *

          *
        • * @see OriginProtocolPolicy * @return Returns a reference to this object so that method calls can be chained together. * @see OriginProtocolPolicy */ Builder originProtocolPolicy(OriginProtocolPolicy originProtocolPolicy); /** *

          * Specifies the minimum SSL/TLS protocol that CloudFront uses when connecting to your origin over HTTPS. Valid * values include SSLv3, TLSv1, TLSv1.1, and TLSv1.2. *

          *

          * For more information, see Minimum Origin SSL Protocol in the Amazon CloudFront Developer Guide. *

          * * @param originSslProtocols * Specifies the minimum SSL/TLS protocol that CloudFront uses when connecting to your origin over HTTPS. * Valid values include SSLv3, TLSv1, TLSv1.1, and * TLSv1.2.

          *

          * For more information, see Minimum Origin SSL Protocol in the Amazon CloudFront Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder originSslProtocols(OriginSslProtocols originSslProtocols); /** *

          * Specifies the minimum SSL/TLS protocol that CloudFront uses when connecting to your origin over HTTPS. Valid * values include SSLv3, TLSv1, TLSv1.1, and TLSv1.2. *

          *

          * For more information, see Minimum Origin SSL Protocol in the Amazon CloudFront Developer Guide. *

          * This is a convenience that creates an instance of the {@link OriginSslProtocols.Builder} avoiding the need to * create one manually via {@link OriginSslProtocols#builder()}. * * When the {@link Consumer} completes, {@link OriginSslProtocols.Builder#build()} is called immediately and its * result is passed to {@link #originSslProtocols(OriginSslProtocols)}. * * @param originSslProtocols * a consumer that will call methods on {@link OriginSslProtocols.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #originSslProtocols(OriginSslProtocols) */ default Builder originSslProtocols(Consumer originSslProtocols) { return originSslProtocols(OriginSslProtocols.builder().applyMutation(originSslProtocols).build()); } /** *

          * Specifies how long, in seconds, CloudFront waits for a response from the origin. This is also known as the * origin response timeout. The minimum timeout is 1 second, the maximum is 60 seconds, and the default * (if you don’t specify otherwise) is 30 seconds. *

          *

          * For more information, see Origin Response Timeout in the Amazon CloudFront Developer Guide. *

          * * @param originReadTimeout * Specifies how long, in seconds, CloudFront waits for a response from the origin. This is also known as * the origin response timeout. The minimum timeout is 1 second, the maximum is 60 seconds, and * the default (if you don’t specify otherwise) is 30 seconds.

          *

          * For more information, see Origin Response Timeout in the Amazon CloudFront Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder originReadTimeout(Integer originReadTimeout); /** *

          * Specifies how long, in seconds, CloudFront persists its connection to the origin. The minimum timeout is 1 * second, the maximum is 60 seconds, and the default (if you don’t specify otherwise) is 5 seconds. *

          *

          * For more information, see Origin Keep-alive Timeout in the Amazon CloudFront Developer Guide. *

          * * @param originKeepaliveTimeout * Specifies how long, in seconds, CloudFront persists its connection to the origin. The minimum timeout * is 1 second, the maximum is 60 seconds, and the default (if you don’t specify otherwise) is 5 * seconds.

          *

          * For more information, see Origin Keep-alive Timeout in the Amazon CloudFront Developer Guide. * @return Returns a reference to this object so that method calls can be chained together. */ Builder originKeepaliveTimeout(Integer originKeepaliveTimeout); } static final class BuilderImpl implements Builder { private Integer httpPort; private Integer httpsPort; private String originProtocolPolicy; private OriginSslProtocols originSslProtocols; private Integer originReadTimeout; private Integer originKeepaliveTimeout; private BuilderImpl() { } private BuilderImpl(CustomOriginConfig model) { httpPort(model.httpPort); httpsPort(model.httpsPort); originProtocolPolicy(model.originProtocolPolicy); originSslProtocols(model.originSslProtocols); originReadTimeout(model.originReadTimeout); originKeepaliveTimeout(model.originKeepaliveTimeout); } public final Integer getHttpPort() { return httpPort; } public final void setHttpPort(Integer httpPort) { this.httpPort = httpPort; } @Override @Transient public final Builder httpPort(Integer httpPort) { this.httpPort = httpPort; return this; } public final Integer getHttpsPort() { return httpsPort; } public final void setHttpsPort(Integer httpsPort) { this.httpsPort = httpsPort; } @Override @Transient public final Builder httpsPort(Integer httpsPort) { this.httpsPort = httpsPort; return this; } public final String getOriginProtocolPolicy() { return originProtocolPolicy; } public final void setOriginProtocolPolicy(String originProtocolPolicy) { this.originProtocolPolicy = originProtocolPolicy; } @Override @Transient public final Builder originProtocolPolicy(String originProtocolPolicy) { this.originProtocolPolicy = originProtocolPolicy; return this; } @Override @Transient public final Builder originProtocolPolicy(OriginProtocolPolicy originProtocolPolicy) { this.originProtocolPolicy(originProtocolPolicy == null ? null : originProtocolPolicy.toString()); return this; } public final OriginSslProtocols.Builder getOriginSslProtocols() { return originSslProtocols != null ? originSslProtocols.toBuilder() : null; } public final void setOriginSslProtocols(OriginSslProtocols.BuilderImpl originSslProtocols) { this.originSslProtocols = originSslProtocols != null ? originSslProtocols.build() : null; } @Override @Transient public final Builder originSslProtocols(OriginSslProtocols originSslProtocols) { this.originSslProtocols = originSslProtocols; return this; } public final Integer getOriginReadTimeout() { return originReadTimeout; } public final void setOriginReadTimeout(Integer originReadTimeout) { this.originReadTimeout = originReadTimeout; } @Override @Transient public final Builder originReadTimeout(Integer originReadTimeout) { this.originReadTimeout = originReadTimeout; return this; } public final Integer getOriginKeepaliveTimeout() { return originKeepaliveTimeout; } public final void setOriginKeepaliveTimeout(Integer originKeepaliveTimeout) { this.originKeepaliveTimeout = originKeepaliveTimeout; } @Override @Transient public final Builder originKeepaliveTimeout(Integer originKeepaliveTimeout) { this.originKeepaliveTimeout = originKeepaliveTimeout; return this; } @Override public CustomOriginConfig build() { return new CustomOriginConfig(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy