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

software.amazon.awssdk.services.elasticloadbalancingv2.model.RuleCondition Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Elastic Load Balancing module holds the client classes that are used for communicating with Elastic Load Balancing Service (API Version 2015-12-01)

There is a newer version: 2.29.39
Show newest version
/*
 * Copyright 2014-2019 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.elasticloadbalancingv2.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Information about a condition for a rule. *

*/ @Generated("software.amazon.awssdk:codegen") public final class RuleCondition implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField FIELD_FIELD = SdkField. builder(MarshallingType.STRING) .getter(getter(RuleCondition::field)).setter(setter(Builder::field)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Field").build()).build(); private static final SdkField> VALUES_FIELD = SdkField .> builder(MarshallingType.LIST) .getter(getter(RuleCondition::values)) .setter(setter(Builder::values)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Values").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final SdkField HOST_HEADER_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).getter(getter(RuleCondition::hostHeaderConfig)) .setter(setter(Builder::hostHeaderConfig)).constructor(HostHeaderConditionConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HostHeaderConfig").build()).build(); private static final SdkField PATH_PATTERN_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).getter(getter(RuleCondition::pathPatternConfig)) .setter(setter(Builder::pathPatternConfig)).constructor(PathPatternConditionConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PathPatternConfig").build()).build(); private static final SdkField HTTP_HEADER_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).getter(getter(RuleCondition::httpHeaderConfig)) .setter(setter(Builder::httpHeaderConfig)).constructor(HttpHeaderConditionConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HttpHeaderConfig").build()).build(); private static final SdkField QUERY_STRING_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).getter(getter(RuleCondition::queryStringConfig)) .setter(setter(Builder::queryStringConfig)).constructor(QueryStringConditionConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QueryStringConfig").build()).build(); private static final SdkField HTTP_REQUEST_METHOD_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO) .getter(getter(RuleCondition::httpRequestMethodConfig)).setter(setter(Builder::httpRequestMethodConfig)) .constructor(HttpRequestMethodConditionConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("HttpRequestMethodConfig").build()) .build(); private static final SdkField SOURCE_IP_CONFIG_FIELD = SdkField . builder(MarshallingType.SDK_POJO).getter(getter(RuleCondition::sourceIpConfig)) .setter(setter(Builder::sourceIpConfig)).constructor(SourceIpConditionConfig::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SourceIpConfig").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FIELD_FIELD, VALUES_FIELD, HOST_HEADER_CONFIG_FIELD, PATH_PATTERN_CONFIG_FIELD, HTTP_HEADER_CONFIG_FIELD, QUERY_STRING_CONFIG_FIELD, HTTP_REQUEST_METHOD_CONFIG_FIELD, SOURCE_IP_CONFIG_FIELD)); private static final long serialVersionUID = 1L; private final String field; private final List values; private final HostHeaderConditionConfig hostHeaderConfig; private final PathPatternConditionConfig pathPatternConfig; private final HttpHeaderConditionConfig httpHeaderConfig; private final QueryStringConditionConfig queryStringConfig; private final HttpRequestMethodConditionConfig httpRequestMethodConfig; private final SourceIpConditionConfig sourceIpConfig; private RuleCondition(BuilderImpl builder) { this.field = builder.field; this.values = builder.values; this.hostHeaderConfig = builder.hostHeaderConfig; this.pathPatternConfig = builder.pathPatternConfig; this.httpHeaderConfig = builder.httpHeaderConfig; this.queryStringConfig = builder.queryStringConfig; this.httpRequestMethodConfig = builder.httpRequestMethodConfig; this.sourceIpConfig = builder.sourceIpConfig; } /** *

* The field in the HTTP request. The following are the possible values: *

*
    *
  • *

    * http-header *

    *
  • *
  • *

    * http-request-method *

    *
  • *
  • *

    * host-header *

    *
  • *
  • *

    * path-pattern *

    *
  • *
  • *

    * query-string *

    *
  • *
  • *

    * source-ip *

    *
  • *
* * @return The field in the HTTP request. The following are the possible values:

*
    *
  • *

    * http-header *

    *
  • *
  • *

    * http-request-method *

    *
  • *
  • *

    * host-header *

    *
  • *
  • *

    * path-pattern *

    *
  • *
  • *

    * query-string *

    *
  • *
  • *

    * source-ip *

    *
  • */ public String field() { return field; } /** *

    * The condition value. You can use Values if the rule contains only host-header and * path-pattern conditions. Otherwise, you can use HostHeaderConfig for * host-header conditions and PathPatternConfig for path-pattern conditions. *

    *

    * If Field is host-header, you can specify a single host name (for example, * my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any of * the following characters. *

    *
      *
    • *

      * A-Z, a-z, 0-9 *

      *
    • *
    • *

      * - . *

      *
    • *
    • *

      * * (matches 0 or more characters) *

      *
    • *
    • *

      * ? (matches exactly 1 character) *

      *
    • *
    *

    * If Field is path-pattern, you can specify a single path pattern (for example, /img/*). * A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the following * characters. *

    *
      *
    • *

      * A-Z, a-z, 0-9 *

      *
    • *
    • *

      * _ - . $ / ~ " ' @ : + *

      *
    • *
    • *

      * & (using &) *

      *
    • *
    • *

      * * (matches 0 or more characters) *

      *
    • *
    • *

      * ? (matches exactly 1 character) *

      *
    • *
    *

    * Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

    * * @return The condition value. You can use Values if the rule contains only host-header * and path-pattern conditions. Otherwise, you can use HostHeaderConfig for * host-header conditions and PathPatternConfig for path-pattern * conditions.

    *

    * If Field is host-header, you can specify a single host name (for example, * my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain * any of the following characters. *

    *
      *
    • *

      * A-Z, a-z, 0-9 *

      *
    • *
    • *

      * - . *

      *
    • *
    • *

      * * (matches 0 or more characters) *

      *
    • *
    • *

      * ? (matches exactly 1 character) *

      *
    • *
    *

    * If Field is path-pattern, you can specify a single path pattern (for example, * /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of * the following characters. *

    *
      *
    • *

      * A-Z, a-z, 0-9 *

      *
    • *
    • *

      * _ - . $ / ~ " ' @ : + *

      *
    • *
    • *

      * & (using &) *

      *
    • *
    • *

      * * (matches 0 or more characters) *

      *
    • *
    • *

      * ? (matches exactly 1 character) *

      *
    • */ public List values() { return values; } /** *

      * Information for a host header condition. Specify only when Field is host-header. *

      * * @return Information for a host header condition. Specify only when Field is host-header * . */ public HostHeaderConditionConfig hostHeaderConfig() { return hostHeaderConfig; } /** *

      * Information for a path pattern condition. Specify only when Field is path-pattern. *

      * * @return Information for a path pattern condition. Specify only when Field is * path-pattern. */ public PathPatternConditionConfig pathPatternConfig() { return pathPatternConfig; } /** *

      * Information for an HTTP header condition. Specify only when Field is http-header. *

      * * @return Information for an HTTP header condition. Specify only when Field is * http-header. */ public HttpHeaderConditionConfig httpHeaderConfig() { return httpHeaderConfig; } /** *

      * Information for a query string condition. Specify only when Field is query-string. *

      * * @return Information for a query string condition. Specify only when Field is * query-string. */ public QueryStringConditionConfig queryStringConfig() { return queryStringConfig; } /** *

      * Information for an HTTP method condition. Specify only when Field is * http-request-method. *

      * * @return Information for an HTTP method condition. Specify only when Field is * http-request-method. */ public HttpRequestMethodConditionConfig httpRequestMethodConfig() { return httpRequestMethodConfig; } /** *

      * Information for a source IP condition. Specify only when Field is source-ip. *

      * * @return Information for a source IP condition. Specify only when Field is source-ip. */ public SourceIpConditionConfig sourceIpConfig() { return sourceIpConfig; } @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(field()); hashCode = 31 * hashCode + Objects.hashCode(values()); hashCode = 31 * hashCode + Objects.hashCode(hostHeaderConfig()); hashCode = 31 * hashCode + Objects.hashCode(pathPatternConfig()); hashCode = 31 * hashCode + Objects.hashCode(httpHeaderConfig()); hashCode = 31 * hashCode + Objects.hashCode(queryStringConfig()); hashCode = 31 * hashCode + Objects.hashCode(httpRequestMethodConfig()); hashCode = 31 * hashCode + Objects.hashCode(sourceIpConfig()); 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 RuleCondition)) { return false; } RuleCondition other = (RuleCondition) obj; return Objects.equals(field(), other.field()) && Objects.equals(values(), other.values()) && Objects.equals(hostHeaderConfig(), other.hostHeaderConfig()) && Objects.equals(pathPatternConfig(), other.pathPatternConfig()) && Objects.equals(httpHeaderConfig(), other.httpHeaderConfig()) && Objects.equals(queryStringConfig(), other.queryStringConfig()) && Objects.equals(httpRequestMethodConfig(), other.httpRequestMethodConfig()) && Objects.equals(sourceIpConfig(), other.sourceIpConfig()); } /** * 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("RuleCondition").add("Field", field()).add("Values", values()) .add("HostHeaderConfig", hostHeaderConfig()).add("PathPatternConfig", pathPatternConfig()) .add("HttpHeaderConfig", httpHeaderConfig()).add("QueryStringConfig", queryStringConfig()) .add("HttpRequestMethodConfig", httpRequestMethodConfig()).add("SourceIpConfig", sourceIpConfig()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Field": return Optional.ofNullable(clazz.cast(field())); case "Values": return Optional.ofNullable(clazz.cast(values())); case "HostHeaderConfig": return Optional.ofNullable(clazz.cast(hostHeaderConfig())); case "PathPatternConfig": return Optional.ofNullable(clazz.cast(pathPatternConfig())); case "HttpHeaderConfig": return Optional.ofNullable(clazz.cast(httpHeaderConfig())); case "QueryStringConfig": return Optional.ofNullable(clazz.cast(queryStringConfig())); case "HttpRequestMethodConfig": return Optional.ofNullable(clazz.cast(httpRequestMethodConfig())); case "SourceIpConfig": return Optional.ofNullable(clazz.cast(sourceIpConfig())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((RuleCondition) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

      * The field in the HTTP request. The following are the possible values: *

      *
        *
      • *

        * http-header *

        *
      • *
      • *

        * http-request-method *

        *
      • *
      • *

        * host-header *

        *
      • *
      • *

        * path-pattern *

        *
      • *
      • *

        * query-string *

        *
      • *
      • *

        * source-ip *

        *
      • *
      * * @param field * The field in the HTTP request. The following are the possible values:

      *
        *
      • *

        * http-header *

        *
      • *
      • *

        * http-request-method *

        *
      • *
      • *

        * host-header *

        *
      • *
      • *

        * path-pattern *

        *
      • *
      • *

        * query-string *

        *
      • *
      • *

        * source-ip *

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

        * The condition value. You can use Values if the rule contains only host-header and * path-pattern conditions. Otherwise, you can use HostHeaderConfig for * host-header conditions and PathPatternConfig for path-pattern * conditions. *

        *

        * If Field is host-header, you can specify a single host name (for example, * my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any * of the following characters. *

        *
          *
        • *

          * A-Z, a-z, 0-9 *

          *
        • *
        • *

          * - . *

          *
        • *
        • *

          * * (matches 0 or more characters) *

          *
        • *
        • *

          * ? (matches exactly 1 character) *

          *
        • *
        *

        * If Field is path-pattern, you can specify a single path pattern (for example, * /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the * following characters. *

        *
          *
        • *

          * A-Z, a-z, 0-9 *

          *
        • *
        • *

          * _ - . $ / ~ " ' @ : + *

          *
        • *
        • *

          * & (using &) *

          *
        • *
        • *

          * * (matches 0 or more characters) *

          *
        • *
        • *

          * ? (matches exactly 1 character) *

          *
        • *
        * * @param values * The condition value. You can use Values if the rule contains only * host-header and path-pattern conditions. Otherwise, you can use * HostHeaderConfig for host-header conditions and * PathPatternConfig for path-pattern conditions.

        *

        * If Field is host-header, you can specify a single host name (for example, * my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can * contain any of the following characters. *

        *
          *
        • *

          * A-Z, a-z, 0-9 *

          *
        • *
        • *

          * - . *

          *
        • *
        • *

          * * (matches 0 or more characters) *

          *
        • *
        • *

          * ? (matches exactly 1 character) *

          *
        • *
        *

        * If Field is path-pattern, you can specify a single path pattern (for * example, /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can * contain any of the following characters. *

        *
          *
        • *

          * A-Z, a-z, 0-9 *

          *
        • *
        • *

          * _ - . $ / ~ " ' @ : + *

          *
        • *
        • *

          * & (using &) *

          *
        • *
        • *

          * * (matches 0 or more characters) *

          *
        • *
        • *

          * ? (matches exactly 1 character) *

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

          * The condition value. You can use Values if the rule contains only host-header and * path-pattern conditions. Otherwise, you can use HostHeaderConfig for * host-header conditions and PathPatternConfig for path-pattern * conditions. *

          *

          * If Field is host-header, you can specify a single host name (for example, * my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can contain any * of the following characters. *

          *
            *
          • *

            * A-Z, a-z, 0-9 *

            *
          • *
          • *

            * - . *

            *
          • *
          • *

            * * (matches 0 or more characters) *

            *
          • *
          • *

            * ? (matches exactly 1 character) *

            *
          • *
          *

          * If Field is path-pattern, you can specify a single path pattern (for example, * /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can contain any of the * following characters. *

          *
            *
          • *

            * A-Z, a-z, 0-9 *

            *
          • *
          • *

            * _ - . $ / ~ " ' @ : + *

            *
          • *
          • *

            * & (using &) *

            *
          • *
          • *

            * * (matches 0 or more characters) *

            *
          • *
          • *

            * ? (matches exactly 1 character) *

            *
          • *
          * * @param values * The condition value. You can use Values if the rule contains only * host-header and path-pattern conditions. Otherwise, you can use * HostHeaderConfig for host-header conditions and * PathPatternConfig for path-pattern conditions.

          *

          * If Field is host-header, you can specify a single host name (for example, * my.example.com). A host name is case insensitive, can be up to 128 characters in length, and can * contain any of the following characters. *

          *
            *
          • *

            * A-Z, a-z, 0-9 *

            *
          • *
          • *

            * - . *

            *
          • *
          • *

            * * (matches 0 or more characters) *

            *
          • *
          • *

            * ? (matches exactly 1 character) *

            *
          • *
          *

          * If Field is path-pattern, you can specify a single path pattern (for * example, /img/*). A path pattern is case-sensitive, can be up to 128 characters in length, and can * contain any of the following characters. *

          *
            *
          • *

            * A-Z, a-z, 0-9 *

            *
          • *
          • *

            * _ - . $ / ~ " ' @ : + *

            *
          • *
          • *

            * & (using &) *

            *
          • *
          • *

            * * (matches 0 or more characters) *

            *
          • *
          • *

            * ? (matches exactly 1 character) *

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

            * Information for a host header condition. Specify only when Field is host-header. *

            * * @param hostHeaderConfig * Information for a host header condition. Specify only when Field is * host-header. * @return Returns a reference to this object so that method calls can be chained together. */ Builder hostHeaderConfig(HostHeaderConditionConfig hostHeaderConfig); /** *

            * Information for a host header condition. Specify only when Field is host-header. *

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

            * Information for a path pattern condition. Specify only when Field is path-pattern. *

            * * @param pathPatternConfig * Information for a path pattern condition. Specify only when Field is * path-pattern. * @return Returns a reference to this object so that method calls can be chained together. */ Builder pathPatternConfig(PathPatternConditionConfig pathPatternConfig); /** *

            * Information for a path pattern condition. Specify only when Field is path-pattern. *

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

            * Information for an HTTP header condition. Specify only when Field is http-header. *

            * * @param httpHeaderConfig * Information for an HTTP header condition. Specify only when Field is * http-header. * @return Returns a reference to this object so that method calls can be chained together. */ Builder httpHeaderConfig(HttpHeaderConditionConfig httpHeaderConfig); /** *

            * Information for an HTTP header condition. Specify only when Field is http-header. *

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

            * Information for a query string condition. Specify only when Field is query-string. *

            * * @param queryStringConfig * Information for a query string condition. Specify only when Field is * query-string. * @return Returns a reference to this object so that method calls can be chained together. */ Builder queryStringConfig(QueryStringConditionConfig queryStringConfig); /** *

            * Information for a query string condition. Specify only when Field is query-string. *

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

            * Information for an HTTP method condition. Specify only when Field is * http-request-method. *

            * * @param httpRequestMethodConfig * Information for an HTTP method condition. Specify only when Field is * http-request-method. * @return Returns a reference to this object so that method calls can be chained together. */ Builder httpRequestMethodConfig(HttpRequestMethodConditionConfig httpRequestMethodConfig); /** *

            * Information for an HTTP method condition. Specify only when Field is * http-request-method. *

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

            * Information for a source IP condition. Specify only when Field is source-ip. *

            * * @param sourceIpConfig * Information for a source IP condition. Specify only when Field is source-ip. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sourceIpConfig(SourceIpConditionConfig sourceIpConfig); /** *

            * Information for a source IP condition. Specify only when Field is source-ip. *

            * This is a convenience that creates an instance of the {@link SourceIpConditionConfig.Builder} avoiding the * need to create one manually via {@link SourceIpConditionConfig#builder()}. * * When the {@link Consumer} completes, {@link SourceIpConditionConfig.Builder#build()} is called immediately * and its result is passed to {@link #sourceIpConfig(SourceIpConditionConfig)}. * * @param sourceIpConfig * a consumer that will call methods on {@link SourceIpConditionConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #sourceIpConfig(SourceIpConditionConfig) */ default Builder sourceIpConfig(Consumer sourceIpConfig) { return sourceIpConfig(SourceIpConditionConfig.builder().applyMutation(sourceIpConfig).build()); } } static final class BuilderImpl implements Builder { private String field; private List values = DefaultSdkAutoConstructList.getInstance(); private HostHeaderConditionConfig hostHeaderConfig; private PathPatternConditionConfig pathPatternConfig; private HttpHeaderConditionConfig httpHeaderConfig; private QueryStringConditionConfig queryStringConfig; private HttpRequestMethodConditionConfig httpRequestMethodConfig; private SourceIpConditionConfig sourceIpConfig; private BuilderImpl() { } private BuilderImpl(RuleCondition model) { field(model.field); values(model.values); hostHeaderConfig(model.hostHeaderConfig); pathPatternConfig(model.pathPatternConfig); httpHeaderConfig(model.httpHeaderConfig); queryStringConfig(model.queryStringConfig); httpRequestMethodConfig(model.httpRequestMethodConfig); sourceIpConfig(model.sourceIpConfig); } public final String getField() { return field; } @Override public final Builder field(String field) { this.field = field; return this; } public final void setField(String field) { this.field = field; } public final Collection getValues() { return values; } @Override public final Builder values(Collection values) { this.values = ListOfStringCopier.copy(values); return this; } @Override @SafeVarargs public final Builder values(String... values) { values(Arrays.asList(values)); return this; } public final void setValues(Collection values) { this.values = ListOfStringCopier.copy(values); } public final HostHeaderConditionConfig.Builder getHostHeaderConfig() { return hostHeaderConfig != null ? hostHeaderConfig.toBuilder() : null; } @Override public final Builder hostHeaderConfig(HostHeaderConditionConfig hostHeaderConfig) { this.hostHeaderConfig = hostHeaderConfig; return this; } public final void setHostHeaderConfig(HostHeaderConditionConfig.BuilderImpl hostHeaderConfig) { this.hostHeaderConfig = hostHeaderConfig != null ? hostHeaderConfig.build() : null; } public final PathPatternConditionConfig.Builder getPathPatternConfig() { return pathPatternConfig != null ? pathPatternConfig.toBuilder() : null; } @Override public final Builder pathPatternConfig(PathPatternConditionConfig pathPatternConfig) { this.pathPatternConfig = pathPatternConfig; return this; } public final void setPathPatternConfig(PathPatternConditionConfig.BuilderImpl pathPatternConfig) { this.pathPatternConfig = pathPatternConfig != null ? pathPatternConfig.build() : null; } public final HttpHeaderConditionConfig.Builder getHttpHeaderConfig() { return httpHeaderConfig != null ? httpHeaderConfig.toBuilder() : null; } @Override public final Builder httpHeaderConfig(HttpHeaderConditionConfig httpHeaderConfig) { this.httpHeaderConfig = httpHeaderConfig; return this; } public final void setHttpHeaderConfig(HttpHeaderConditionConfig.BuilderImpl httpHeaderConfig) { this.httpHeaderConfig = httpHeaderConfig != null ? httpHeaderConfig.build() : null; } public final QueryStringConditionConfig.Builder getQueryStringConfig() { return queryStringConfig != null ? queryStringConfig.toBuilder() : null; } @Override public final Builder queryStringConfig(QueryStringConditionConfig queryStringConfig) { this.queryStringConfig = queryStringConfig; return this; } public final void setQueryStringConfig(QueryStringConditionConfig.BuilderImpl queryStringConfig) { this.queryStringConfig = queryStringConfig != null ? queryStringConfig.build() : null; } public final HttpRequestMethodConditionConfig.Builder getHttpRequestMethodConfig() { return httpRequestMethodConfig != null ? httpRequestMethodConfig.toBuilder() : null; } @Override public final Builder httpRequestMethodConfig(HttpRequestMethodConditionConfig httpRequestMethodConfig) { this.httpRequestMethodConfig = httpRequestMethodConfig; return this; } public final void setHttpRequestMethodConfig(HttpRequestMethodConditionConfig.BuilderImpl httpRequestMethodConfig) { this.httpRequestMethodConfig = httpRequestMethodConfig != null ? httpRequestMethodConfig.build() : null; } public final SourceIpConditionConfig.Builder getSourceIpConfig() { return sourceIpConfig != null ? sourceIpConfig.toBuilder() : null; } @Override public final Builder sourceIpConfig(SourceIpConditionConfig sourceIpConfig) { this.sourceIpConfig = sourceIpConfig; return this; } public final void setSourceIpConfig(SourceIpConditionConfig.BuilderImpl sourceIpConfig) { this.sourceIpConfig = sourceIpConfig != null ? sourceIpConfig.build() : null; } @Override public RuleCondition build() { return new RuleCondition(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy