Class responsible for allocating subnets within availability zones.

Constructors

Methods

  • Allocates a subnet within an availability zone.

    Parameters

    • accountName: string

      Name of the account

    • vpcName: string

      Name of the VPC (generated from region)

    • provider: string

      Cloud provider name

    • regionName: string

      Name of the region

    • azName: string

      Name of the availability zone

    • regionCidr: string

      CIDR of the region

    • vpcCidr: string

      CIDR of the VPC

    • azCidr: string

      CIDR of the availability zone

    • azPrefixLength: number

      Prefix length of the AZ

    • subnetType: InternalSubnetType

      Subnet type to allocate

    • remainingSpace: string[]

      Array of remaining CIDR blocks

    • cidrTracker: CidrTracker

      Tracker for CIDR allocations

    • Optional allocations: Allocation[]

      Optional array to append allocations to

    Returns string[]

    Updated array of remaining CIDR blocks

  • Calculates the effective prefix length for a subnet.

    Parameters

    • subnetType: string

      Name of the subnet type

    • prefixLength: number

      Desired prefix length

    • azPrefixLength: number

      AZ's prefix length

    Returns number

    The effective prefix length to use

  • Subdivides a CIDR block for a subnet allocation.

    Parameters

    • subnetCidr: string

      The CIDR block to subdivide

    • effectivePrefixLength: number

      Desired prefix length

    • subnetType: string

      Name of the subnet type

    • azName: string

      Name of the AZ

    Returns {
        allocatedCidr: string;
        updatedSpace: string[];
    }

    The allocated CIDR and updated remaining space

    • allocatedCidr: string
    • updatedSpace: string[]