Enum Protocol

java.lang.Object
java.lang.Enum<Protocol>
software.amazon.awscdk.services.ecs.Protocol
All Implemented Interfaces:
Serializable, Comparable<Protocol>, java.lang.constant.Constable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:47.430Z") @Stability(Stable) public enum Protocol extends Enum<Protocol>
Network protocol.

Example:

 TaskDefinition taskDefinition;
 Cluster cluster;
 // Add a container to the task definition
 ContainerDefinition specificContainer = taskDefinition.addContainer("Container", ContainerDefinitionOptions.builder()
         .image(ContainerImage.fromRegistry("/aws/aws-example-app"))
         .memoryLimitMiB(2048)
         .build());
 // Add a port mapping
 specificContainer.addPortMappings(PortMapping.builder()
         .containerPort(7600)
         .protocol(Protocol.TCP)
         .build());
 Ec2Service.Builder.create(this, "Service")
         .cluster(cluster)
         .taskDefinition(taskDefinition)
         .cloudMapOptions(CloudMapOptions.builder()
                 // Create SRV records - useful for bridge networking
                 .dnsRecordType(DnsRecordType.SRV)
                 // Targets port TCP port 7600 `specificContainer`
                 .container(specificContainer)
                 .containerPort(7600)
                 .build())
         .build();
 
  • Enum Constant Details

    • TCP

      @Stability(Stable) public static final Protocol TCP
      TCP.
    • UDP

      @Stability(Stable) public static final Protocol UDP
      UDP.
  • Method Details

    • values

      public static Protocol[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static Protocol valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null