java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ec2.Peer
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-12-27T17:02:00.999Z") @Stability(Stable) public class Peer extends software.amazon.jsii.JsiiObject
Peer object factories (to be used in Security Group management).

The static methods on this object can be used to create peer objects which represent a connection partner in Security Group rules.

Use this object if you need to represent connection partners using plain IP addresses, or a prefix list ID.

If you want to address a connection partner by Security Group, you can just use the Security Group (or the construct that contains a Security Group) directly, as it already implements IPeer.

Example:

 Vpc vpc;
 Cluster cluster = Cluster.Builder.create(this, "Cluster")
         .clusterName("myCluster")
         .kafkaVersion(KafkaVersion.V2_8_1)
         .vpc(vpc)
         .build();
 cluster.connections.allowFrom(Peer.ipv4("1.2.3.4/8"), Port.tcp(2181));
 cluster.connections.allowFrom(Peer.ipv4("1.2.3.4/8"), Port.tcp(9094));
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
     
    protected
    Peer(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    Peer(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static IPeer
    Any IPv4 address.
    static IPeer
    Any IPv6 address.
    static IPeer
    ipv4(String cidrIp)
    Create an IPv4 peer from a CIDR.
    static IPeer
    ipv6(String cidrIp)
    Create an IPv6 peer from a CIDR.
    static IPeer
    prefixList(String prefixListId)
    A prefix list.
    static IPeer
    securityGroupId(String securityGroupId)
    A security group ID.
    static IPeer
    securityGroupId(String securityGroupId, String sourceSecurityGroupOwnerId)
    A security group ID.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • Peer

      protected Peer(software.amazon.jsii.JsiiObjectRef objRef)
    • Peer

      protected Peer(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Peer

      @Stability(Stable) public Peer()
  • Method Details

    • anyIpv4

      @Stability(Stable) @NotNull public static IPeer anyIpv4()
      Any IPv4 address.
    • anyIpv6

      @Stability(Stable) @NotNull public static IPeer anyIpv6()
      Any IPv6 address.
    • ipv4

      @Stability(Stable) @NotNull public static IPeer ipv4(@NotNull String cidrIp)
      Create an IPv4 peer from a CIDR.

      Parameters:
      cidrIp - This parameter is required.
    • ipv6

      @Stability(Stable) @NotNull public static IPeer ipv6(@NotNull String cidrIp)
      Create an IPv6 peer from a CIDR.

      Parameters:
      cidrIp - This parameter is required.
    • prefixList

      @Stability(Stable) @NotNull public static IPeer prefixList(@NotNull String prefixListId)
      A prefix list.

      Parameters:
      prefixListId - This parameter is required.
    • securityGroupId

      @Stability(Stable) @NotNull public static IPeer securityGroupId(@NotNull String securityGroupId, @Nullable String sourceSecurityGroupOwnerId)
      A security group ID.

      Parameters:
      securityGroupId - This parameter is required.
      sourceSecurityGroupOwnerId -
    • securityGroupId

      @Stability(Stable) @NotNull public static IPeer securityGroupId(@NotNull String securityGroupId)
      A security group ID.

      Parameters:
      securityGroupId - This parameter is required.