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

software.amazon.awssdk.services.ecs.model.ProxyConfiguration 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.ecs.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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* The configuration details for the App Mesh proxy. *

*

* For tasks using the EC2 launch type, the container instances require at least version 1.26.0 of the container agent * and at least version 1.26.0-1 of the ecs-init package to enable a proxy configuration. If your container * instances are launched from the Amazon ECS-optimized AMI version 20190301 or later, then they contain * the required versions of the container agent and ecs-init. For more information, see Amazon ECS-optimized Linux * AMI *

*/ @Generated("software.amazon.awssdk:codegen") public final class ProxyConfiguration implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("type") .getter(getter(ProxyConfiguration::typeAsString)).setter(setter(Builder::type)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("type").build()).build(); private static final SdkField CONTAINER_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("containerName").getter(getter(ProxyConfiguration::containerName)).setter(setter(Builder::containerName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("containerName").build()).build(); private static final SdkField> PROPERTIES_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("properties") .getter(getter(ProxyConfiguration::properties)) .setter(setter(Builder::properties)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("properties").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.SDK_POJO) .constructor(KeyValuePair::builder) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(TYPE_FIELD, CONTAINER_NAME_FIELD, PROPERTIES_FIELD)); private static final long serialVersionUID = 1L; private final String type; private final String containerName; private final List properties; private ProxyConfiguration(BuilderImpl builder) { this.type = builder.type; this.containerName = builder.containerName; this.properties = builder.properties; } /** *

* The proxy type. The only supported value is APPMESH. *

*

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

* * @return The proxy type. The only supported value is APPMESH. * @see ProxyConfigurationType */ public final ProxyConfigurationType type() { return ProxyConfigurationType.fromValue(type); } /** *

* The proxy type. The only supported value is APPMESH. *

*

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

* * @return The proxy type. The only supported value is APPMESH. * @see ProxyConfigurationType */ public final String typeAsString() { return type; } /** *

* The name of the container that will serve as the App Mesh proxy. *

* * @return The name of the container that will serve as the App Mesh proxy. */ public final String containerName() { return containerName; } /** * Returns true if the Properties property was specified by the sender (it may be empty), or false if the sender did * not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service. */ public final boolean hasProperties() { return properties != null && !(properties instanceof SdkAutoConstructList); } /** *

* The set of network configuration parameters to provide the Container Network Interface (CNI) plugin, specified as * key-value pairs. *

*
    *
  • *

    * IgnoredUID - (Required) The user ID (UID) of the proxy container as defined by the user * parameter in a container definition. This is used to ensure the proxy ignores its own traffic. If * IgnoredGID is specified, this field can be empty. *

    *
  • *
  • *

    * IgnoredGID - (Required) The group ID (GID) of the proxy container as defined by the * user parameter in a container definition. This is used to ensure the proxy ignores its own traffic. * If IgnoredUID is specified, this field can be empty. *

    *
  • *
  • *

    * AppPorts - (Required) The list of ports that the application uses. Network traffic to these ports is * forwarded to the ProxyIngressPort and ProxyEgressPort. *

    *
  • *
  • *

    * ProxyIngressPort - (Required) Specifies the port that incoming traffic to the AppPorts * is directed to. *

    *
  • *
  • *

    * ProxyEgressPort - (Required) Specifies the port that outgoing traffic from the AppPorts * is directed to. *

    *
  • *
  • *

    * EgressIgnoredPorts - (Required) The egress traffic going to the specified ports is ignored and not * redirected to the ProxyEgressPort. It can be an empty list. *

    *
  • *
  • *

    * EgressIgnoredIPs - (Required) The egress traffic going to the specified IP addresses is ignored and * not redirected to the ProxyEgressPort. It can be an empty list. *

    *
  • *
*

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

*

* You can use {@link #hasProperties()} to see if a value was sent in this field. *

* * @return The set of network configuration parameters to provide the Container Network Interface (CNI) plugin, * specified as key-value pairs.

*
    *
  • *

    * IgnoredUID - (Required) The user ID (UID) of the proxy container as defined by the * user parameter in a container definition. This is used to ensure the proxy ignores its own * traffic. If IgnoredGID is specified, this field can be empty. *

    *
  • *
  • *

    * IgnoredGID - (Required) The group ID (GID) of the proxy container as defined by the * user parameter in a container definition. This is used to ensure the proxy ignores its own * traffic. If IgnoredUID is specified, this field can be empty. *

    *
  • *
  • *

    * AppPorts - (Required) The list of ports that the application uses. Network traffic to these * ports is forwarded to the ProxyIngressPort and ProxyEgressPort. *

    *
  • *
  • *

    * ProxyIngressPort - (Required) Specifies the port that incoming traffic to the * AppPorts is directed to. *

    *
  • *
  • *

    * ProxyEgressPort - (Required) Specifies the port that outgoing traffic from the * AppPorts is directed to. *

    *
  • *
  • *

    * EgressIgnoredPorts - (Required) The egress traffic going to the specified ports is ignored * and not redirected to the ProxyEgressPort. It can be an empty list. *

    *
  • *
  • *

    * EgressIgnoredIPs - (Required) The egress traffic going to the specified IP addresses is * ignored and not redirected to the ProxyEgressPort. It can be an empty list. *

    *
  • */ public final List properties() { return properties; } @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(typeAsString()); hashCode = 31 * hashCode + Objects.hashCode(containerName()); hashCode = 31 * hashCode + Objects.hashCode(hasProperties() ? properties() : null); 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 ProxyConfiguration)) { return false; } ProxyConfiguration other = (ProxyConfiguration) obj; return Objects.equals(typeAsString(), other.typeAsString()) && Objects.equals(containerName(), other.containerName()) && hasProperties() == other.hasProperties() && Objects.equals(properties(), other.properties()); } /** * 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("ProxyConfiguration").add("Type", typeAsString()).add("ContainerName", containerName()) .add("Properties", hasProperties() ? properties() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "type": return Optional.ofNullable(clazz.cast(typeAsString())); case "containerName": return Optional.ofNullable(clazz.cast(containerName())); case "properties": return Optional.ofNullable(clazz.cast(properties())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ProxyConfiguration) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

    * The proxy type. The only supported value is APPMESH. *

    * * @param type * The proxy type. The only supported value is APPMESH. * @see ProxyConfigurationType * @return Returns a reference to this object so that method calls can be chained together. * @see ProxyConfigurationType */ Builder type(String type); /** *

    * The proxy type. The only supported value is APPMESH. *

    * * @param type * The proxy type. The only supported value is APPMESH. * @see ProxyConfigurationType * @return Returns a reference to this object so that method calls can be chained together. * @see ProxyConfigurationType */ Builder type(ProxyConfigurationType type); /** *

    * The name of the container that will serve as the App Mesh proxy. *

    * * @param containerName * The name of the container that will serve as the App Mesh proxy. * @return Returns a reference to this object so that method calls can be chained together. */ Builder containerName(String containerName); /** *

    * The set of network configuration parameters to provide the Container Network Interface (CNI) plugin, * specified as key-value pairs. *

    *
      *
    • *

      * IgnoredUID - (Required) The user ID (UID) of the proxy container as defined by the * user parameter in a container definition. This is used to ensure the proxy ignores its own * traffic. If IgnoredGID is specified, this field can be empty. *

      *
    • *
    • *

      * IgnoredGID - (Required) The group ID (GID) of the proxy container as defined by the * user parameter in a container definition. This is used to ensure the proxy ignores its own * traffic. If IgnoredUID is specified, this field can be empty. *

      *
    • *
    • *

      * AppPorts - (Required) The list of ports that the application uses. Network traffic to these * ports is forwarded to the ProxyIngressPort and ProxyEgressPort. *

      *
    • *
    • *

      * ProxyIngressPort - (Required) Specifies the port that incoming traffic to the * AppPorts is directed to. *

      *
    • *
    • *

      * ProxyEgressPort - (Required) Specifies the port that outgoing traffic from the * AppPorts is directed to. *

      *
    • *
    • *

      * EgressIgnoredPorts - (Required) The egress traffic going to the specified ports is ignored and * not redirected to the ProxyEgressPort. It can be an empty list. *

      *
    • *
    • *

      * EgressIgnoredIPs - (Required) The egress traffic going to the specified IP addresses is ignored * and not redirected to the ProxyEgressPort. It can be an empty list. *

      *
    • *
    * * @param properties * The set of network configuration parameters to provide the Container Network Interface (CNI) plugin, * specified as key-value pairs.

    *
      *
    • *

      * IgnoredUID - (Required) The user ID (UID) of the proxy container as defined by the * user parameter in a container definition. This is used to ensure the proxy ignores its * own traffic. If IgnoredGID is specified, this field can be empty. *

      *
    • *
    • *

      * IgnoredGID - (Required) The group ID (GID) of the proxy container as defined by the * user parameter in a container definition. This is used to ensure the proxy ignores its * own traffic. If IgnoredUID is specified, this field can be empty. *

      *
    • *
    • *

      * AppPorts - (Required) The list of ports that the application uses. Network traffic to * these ports is forwarded to the ProxyIngressPort and ProxyEgressPort. *

      *
    • *
    • *

      * ProxyIngressPort - (Required) Specifies the port that incoming traffic to the * AppPorts is directed to. *

      *
    • *
    • *

      * ProxyEgressPort - (Required) Specifies the port that outgoing traffic from the * AppPorts is directed to. *

      *
    • *
    • *

      * EgressIgnoredPorts - (Required) The egress traffic going to the specified ports is * ignored and not redirected to the ProxyEgressPort. It can be an empty list. *

      *
    • *
    • *

      * EgressIgnoredIPs - (Required) The egress traffic going to the specified IP addresses is * ignored and not redirected to the ProxyEgressPort. It can be an empty list. *

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

      * The set of network configuration parameters to provide the Container Network Interface (CNI) plugin, * specified as key-value pairs. *

      *
        *
      • *

        * IgnoredUID - (Required) The user ID (UID) of the proxy container as defined by the * user parameter in a container definition. This is used to ensure the proxy ignores its own * traffic. If IgnoredGID is specified, this field can be empty. *

        *
      • *
      • *

        * IgnoredGID - (Required) The group ID (GID) of the proxy container as defined by the * user parameter in a container definition. This is used to ensure the proxy ignores its own * traffic. If IgnoredUID is specified, this field can be empty. *

        *
      • *
      • *

        * AppPorts - (Required) The list of ports that the application uses. Network traffic to these * ports is forwarded to the ProxyIngressPort and ProxyEgressPort. *

        *
      • *
      • *

        * ProxyIngressPort - (Required) Specifies the port that incoming traffic to the * AppPorts is directed to. *

        *
      • *
      • *

        * ProxyEgressPort - (Required) Specifies the port that outgoing traffic from the * AppPorts is directed to. *

        *
      • *
      • *

        * EgressIgnoredPorts - (Required) The egress traffic going to the specified ports is ignored and * not redirected to the ProxyEgressPort. It can be an empty list. *

        *
      • *
      • *

        * EgressIgnoredIPs - (Required) The egress traffic going to the specified IP addresses is ignored * and not redirected to the ProxyEgressPort. It can be an empty list. *

        *
      • *
      * * @param properties * The set of network configuration parameters to provide the Container Network Interface (CNI) plugin, * specified as key-value pairs.

      *
        *
      • *

        * IgnoredUID - (Required) The user ID (UID) of the proxy container as defined by the * user parameter in a container definition. This is used to ensure the proxy ignores its * own traffic. If IgnoredGID is specified, this field can be empty. *

        *
      • *
      • *

        * IgnoredGID - (Required) The group ID (GID) of the proxy container as defined by the * user parameter in a container definition. This is used to ensure the proxy ignores its * own traffic. If IgnoredUID is specified, this field can be empty. *

        *
      • *
      • *

        * AppPorts - (Required) The list of ports that the application uses. Network traffic to * these ports is forwarded to the ProxyIngressPort and ProxyEgressPort. *

        *
      • *
      • *

        * ProxyIngressPort - (Required) Specifies the port that incoming traffic to the * AppPorts is directed to. *

        *
      • *
      • *

        * ProxyEgressPort - (Required) Specifies the port that outgoing traffic from the * AppPorts is directed to. *

        *
      • *
      • *

        * EgressIgnoredPorts - (Required) The egress traffic going to the specified ports is * ignored and not redirected to the ProxyEgressPort. It can be an empty list. *

        *
      • *
      • *

        * EgressIgnoredIPs - (Required) The egress traffic going to the specified IP addresses is * ignored and not redirected to the ProxyEgressPort. It can be an empty list. *

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

        * The set of network configuration parameters to provide the Container Network Interface (CNI) plugin, * specified as key-value pairs. *

        *
          *
        • *

          * IgnoredUID - (Required) The user ID (UID) of the proxy container as defined by the * user parameter in a container definition. This is used to ensure the proxy ignores its own * traffic. If IgnoredGID is specified, this field can be empty. *

          *
        • *
        • *

          * IgnoredGID - (Required) The group ID (GID) of the proxy container as defined by the * user parameter in a container definition. This is used to ensure the proxy ignores its own * traffic. If IgnoredUID is specified, this field can be empty. *

          *
        • *
        • *

          * AppPorts - (Required) The list of ports that the application uses. Network traffic to these * ports is forwarded to the ProxyIngressPort and ProxyEgressPort. *

          *
        • *
        • *

          * ProxyIngressPort - (Required) Specifies the port that incoming traffic to the * AppPorts is directed to. *

          *
        • *
        • *

          * ProxyEgressPort - (Required) Specifies the port that outgoing traffic from the * AppPorts is directed to. *

          *
        • *
        • *

          * EgressIgnoredPorts - (Required) The egress traffic going to the specified ports is ignored and * not redirected to the ProxyEgressPort. It can be an empty list. *

          *
        • *
        • *

          * EgressIgnoredIPs - (Required) The egress traffic going to the specified IP addresses is ignored * and not redirected to the ProxyEgressPort. It can be an empty list. *

          *
        • *
        * This is a convenience that creates an instance of the {@link List.Builder} avoiding the need to * create one manually via {@link List#builder()}. * * When the {@link Consumer} completes, {@link List.Builder#build()} is called immediately and its * result is passed to {@link #properties(List)}. * * @param properties * a consumer that will call methods on {@link List.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #properties(List) */ Builder properties(Consumer... properties); } static final class BuilderImpl implements Builder { private String type; private String containerName; private List properties = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(ProxyConfiguration model) { type(model.type); containerName(model.containerName); properties(model.properties); } public final String getType() { return type; } @Override public final Builder type(String type) { this.type = type; return this; } @Override public final Builder type(ProxyConfigurationType type) { this.type(type == null ? null : type.toString()); return this; } public final void setType(String type) { this.type = type; } public final String getContainerName() { return containerName; } @Override public final Builder containerName(String containerName) { this.containerName = containerName; return this; } public final void setContainerName(String containerName) { this.containerName = containerName; } public final Collection getProperties() { if (properties instanceof SdkAutoConstructList) { return null; } return properties != null ? properties.stream().map(KeyValuePair::toBuilder).collect(Collectors.toList()) : null; } @Override public final Builder properties(Collection properties) { this.properties = ProxyConfigurationPropertiesCopier.copy(properties); return this; } @Override @SafeVarargs public final Builder properties(KeyValuePair... properties) { properties(Arrays.asList(properties)); return this; } @Override @SafeVarargs public final Builder properties(Consumer... properties) { properties(Stream.of(properties).map(c -> KeyValuePair.builder().applyMutation(c).build()) .collect(Collectors.toList())); return this; } public final void setProperties(Collection properties) { this.properties = ProxyConfigurationPropertiesCopier.copyFromBuilder(properties); } @Override public ProxyConfiguration build() { return new ProxyConfiguration(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy