1. Packages
  2. Netaddr Provider
  3. API Docs
  4. getRangeKeyspaceIpv4
netaddr 0.5.1 published on Tuesday, Apr 15, 2025 by ferlab-ste-justine

netaddr.getRangeKeyspaceIpv4

Explore with Pulumi AI

Retrieves the lower level keyspace details of an ipv4 addresses space. See github repo README for details about the keyspace

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as netaddr from "@pulumi/netaddr";

const testRangeIpv4 = netaddr.getRangeIpv4({
    keyPrefix: "/test/ipv4/",
});
const testRangeKeyspaceIpv4 = testRangeIpv4.then(testRangeIpv4 => netaddr.getRangeKeyspaceIpv4({
    rangeId: testRangeIpv4.id,
}));
export const firstAddress = testRangeKeyspaceIpv4.then(testRangeKeyspaceIpv4 => testRangeKeyspaceIpv4.firstAddress);
export const lastAddress = testRangeKeyspaceIpv4.then(testRangeKeyspaceIpv4 => testRangeKeyspaceIpv4.lastAddress);
export const nextAddress = testRangeKeyspaceIpv4.then(testRangeKeyspaceIpv4 => testRangeKeyspaceIpv4.nextAddress);
export const addresses = testRangeKeyspaceIpv4.then(testRangeKeyspaceIpv4 => testRangeKeyspaceIpv4.addresses);
export const generatedAddresses = testRangeKeyspaceIpv4.then(testRangeKeyspaceIpv4 => testRangeKeyspaceIpv4.generatedAddresses);
export const hardcodedAddresses = testRangeKeyspaceIpv4.then(testRangeKeyspaceIpv4 => testRangeKeyspaceIpv4.hardcodedAddresses);
export const deletedAddresses = testRangeKeyspaceIpv4.then(testRangeKeyspaceIpv4 => testRangeKeyspaceIpv4.deletedAddresses);
Copy
import pulumi
import pulumi_netaddr as netaddr

test_range_ipv4 = netaddr.get_range_ipv4(key_prefix="/test/ipv4/")
test_range_keyspace_ipv4 = netaddr.get_range_keyspace_ipv4(range_id=test_range_ipv4.id)
pulumi.export("firstAddress", test_range_keyspace_ipv4.first_address)
pulumi.export("lastAddress", test_range_keyspace_ipv4.last_address)
pulumi.export("nextAddress", test_range_keyspace_ipv4.next_address)
pulumi.export("addresses", test_range_keyspace_ipv4.addresses)
pulumi.export("generatedAddresses", test_range_keyspace_ipv4.generated_addresses)
pulumi.export("hardcodedAddresses", test_range_keyspace_ipv4.hardcoded_addresses)
pulumi.export("deletedAddresses", test_range_keyspace_ipv4.deleted_addresses)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netaddr/netaddr"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		testRangeIpv4, err := netaddr.LookupRangeIpv4(ctx, &netaddr.LookupRangeIpv4Args{
			KeyPrefix: "/test/ipv4/",
		}, nil)
		if err != nil {
			return err
		}
		testRangeKeyspaceIpv4, err := netaddr.GetRangeKeyspaceIpv4(ctx, &netaddr.GetRangeKeyspaceIpv4Args{
			RangeId: testRangeIpv4.Id,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("firstAddress", testRangeKeyspaceIpv4.FirstAddress)
		ctx.Export("lastAddress", testRangeKeyspaceIpv4.LastAddress)
		ctx.Export("nextAddress", testRangeKeyspaceIpv4.NextAddress)
		ctx.Export("addresses", testRangeKeyspaceIpv4.Addresses)
		ctx.Export("generatedAddresses", testRangeKeyspaceIpv4.GeneratedAddresses)
		ctx.Export("hardcodedAddresses", testRangeKeyspaceIpv4.HardcodedAddresses)
		ctx.Export("deletedAddresses", testRangeKeyspaceIpv4.DeletedAddresses)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Netaddr = Pulumi.Netaddr;

return await Deployment.RunAsync(() => 
{
    var testRangeIpv4 = Netaddr.GetRangeIpv4.Invoke(new()
    {
        KeyPrefix = "/test/ipv4/",
    });

    var testRangeKeyspaceIpv4 = Netaddr.GetRangeKeyspaceIpv4.Invoke(new()
    {
        RangeId = testRangeIpv4.Apply(getRangeIpv4Result => getRangeIpv4Result.Id),
    });

    return new Dictionary<string, object?>
    {
        ["firstAddress"] = testRangeKeyspaceIpv4.Apply(getRangeKeyspaceIpv4Result => getRangeKeyspaceIpv4Result.FirstAddress),
        ["lastAddress"] = testRangeKeyspaceIpv4.Apply(getRangeKeyspaceIpv4Result => getRangeKeyspaceIpv4Result.LastAddress),
        ["nextAddress"] = testRangeKeyspaceIpv4.Apply(getRangeKeyspaceIpv4Result => getRangeKeyspaceIpv4Result.NextAddress),
        ["addresses"] = testRangeKeyspaceIpv4.Apply(getRangeKeyspaceIpv4Result => getRangeKeyspaceIpv4Result.Addresses),
        ["generatedAddresses"] = testRangeKeyspaceIpv4.Apply(getRangeKeyspaceIpv4Result => getRangeKeyspaceIpv4Result.GeneratedAddresses),
        ["hardcodedAddresses"] = testRangeKeyspaceIpv4.Apply(getRangeKeyspaceIpv4Result => getRangeKeyspaceIpv4Result.HardcodedAddresses),
        ["deletedAddresses"] = testRangeKeyspaceIpv4.Apply(getRangeKeyspaceIpv4Result => getRangeKeyspaceIpv4Result.DeletedAddresses),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netaddr.NetaddrFunctions;
import com.pulumi.netaddr.inputs.GetRangeIpv4Args;
import com.pulumi.netaddr.inputs.GetRangeKeyspaceIpv4Args;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var testRangeIpv4 = NetaddrFunctions.getRangeIpv4(GetRangeIpv4Args.builder()
            .keyPrefix("/test/ipv4/")
            .build());

        final var testRangeKeyspaceIpv4 = NetaddrFunctions.getRangeKeyspaceIpv4(GetRangeKeyspaceIpv4Args.builder()
            .rangeId(testRangeIpv4.applyValue(getRangeIpv4Result -> getRangeIpv4Result.id()))
            .build());

        ctx.export("firstAddress", testRangeKeyspaceIpv4.applyValue(getRangeKeyspaceIpv4Result -> getRangeKeyspaceIpv4Result.firstAddress()));
        ctx.export("lastAddress", testRangeKeyspaceIpv4.applyValue(getRangeKeyspaceIpv4Result -> getRangeKeyspaceIpv4Result.lastAddress()));
        ctx.export("nextAddress", testRangeKeyspaceIpv4.applyValue(getRangeKeyspaceIpv4Result -> getRangeKeyspaceIpv4Result.nextAddress()));
        ctx.export("addresses", testRangeKeyspaceIpv4.applyValue(getRangeKeyspaceIpv4Result -> getRangeKeyspaceIpv4Result.addresses()));
        ctx.export("generatedAddresses", testRangeKeyspaceIpv4.applyValue(getRangeKeyspaceIpv4Result -> getRangeKeyspaceIpv4Result.generatedAddresses()));
        ctx.export("hardcodedAddresses", testRangeKeyspaceIpv4.applyValue(getRangeKeyspaceIpv4Result -> getRangeKeyspaceIpv4Result.hardcodedAddresses()));
        ctx.export("deletedAddresses", testRangeKeyspaceIpv4.applyValue(getRangeKeyspaceIpv4Result -> getRangeKeyspaceIpv4Result.deletedAddresses()));
    }
}
Copy
variables:
  testRangeIpv4:
    fn::invoke:
      function: netaddr:getRangeIpv4
      arguments:
        keyPrefix: /test/ipv4/
  testRangeKeyspaceIpv4:
    fn::invoke:
      function: netaddr:getRangeKeyspaceIpv4
      arguments:
        rangeId: ${testRangeIpv4.id}
outputs:
  firstAddress: ${testRangeKeyspaceIpv4.firstAddress}
  lastAddress: ${testRangeKeyspaceIpv4.lastAddress}
  nextAddress: ${testRangeKeyspaceIpv4.nextAddress}
  addresses: ${testRangeKeyspaceIpv4.addresses}
  generatedAddresses: ${testRangeKeyspaceIpv4.generatedAddresses}
  hardcodedAddresses: ${testRangeKeyspaceIpv4.hardcodedAddresses}
  deletedAddresses: ${testRangeKeyspaceIpv4.deletedAddresses}
Copy

Using getRangeKeyspaceIpv4

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getRangeKeyspaceIpv4(args: GetRangeKeyspaceIpv4Args, opts?: InvokeOptions): Promise<GetRangeKeyspaceIpv4Result>
function getRangeKeyspaceIpv4Output(args: GetRangeKeyspaceIpv4OutputArgs, opts?: InvokeOptions): Output<GetRangeKeyspaceIpv4Result>
Copy
def get_range_keyspace_ipv4(id: Optional[str] = None,
                            range_id: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetRangeKeyspaceIpv4Result
def get_range_keyspace_ipv4_output(id: Optional[pulumi.Input[str]] = None,
                            range_id: Optional[pulumi.Input[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetRangeKeyspaceIpv4Result]
Copy
func GetRangeKeyspaceIpv4(ctx *Context, args *GetRangeKeyspaceIpv4Args, opts ...InvokeOption) (*GetRangeKeyspaceIpv4Result, error)
func GetRangeKeyspaceIpv4Output(ctx *Context, args *GetRangeKeyspaceIpv4OutputArgs, opts ...InvokeOption) GetRangeKeyspaceIpv4ResultOutput
Copy

> Note: This function is named GetRangeKeyspaceIpv4 in the Go SDK.

public static class GetRangeKeyspaceIpv4 
{
    public static Task<GetRangeKeyspaceIpv4Result> InvokeAsync(GetRangeKeyspaceIpv4Args args, InvokeOptions? opts = null)
    public static Output<GetRangeKeyspaceIpv4Result> Invoke(GetRangeKeyspaceIpv4InvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetRangeKeyspaceIpv4Result> getRangeKeyspaceIpv4(GetRangeKeyspaceIpv4Args args, InvokeOptions options)
public static Output<GetRangeKeyspaceIpv4Result> getRangeKeyspaceIpv4(GetRangeKeyspaceIpv4Args args, InvokeOptions options)
Copy
fn::invoke:
  function: netaddr:index/getRangeKeyspaceIpv4:getRangeKeyspaceIpv4
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

RangeId This property is required. string
Identifier of the address range to get the key space from.
Id string
The ID of this resource.
RangeId This property is required. string
Identifier of the address range to get the key space from.
Id string
The ID of this resource.
rangeId This property is required. String
Identifier of the address range to get the key space from.
id String
The ID of this resource.
rangeId This property is required. string
Identifier of the address range to get the key space from.
id string
The ID of this resource.
range_id This property is required. str
Identifier of the address range to get the key space from.
id str
The ID of this resource.
rangeId This property is required. String
Identifier of the address range to get the key space from.
id String
The ID of this resource.

getRangeKeyspaceIpv4 Result

The following output properties are available:

Addresses List<GetRangeKeyspaceIpv4Address>
List of all addresses in the range.
DeletedAddresses List<GetRangeKeyspaceIpv4DeletedAddress>
List of all addresses that were deleted and are available to be reclaimed in the range.
FirstAddress string
First assignable address in the range.
GeneratedAddresses List<GetRangeKeyspaceIpv4GeneratedAddress>
List of all addresses that are flagged as generated in the range.
HardcodedAddresses List<GetRangeKeyspaceIpv4HardcodedAddress>
List of all addresses that are flagged as hardcoded in the range.
Id string
The ID of this resource.
LastAddress string
Last assignable address in the range.
NextAddress string
Next assignable new address in the range.
RangeId string
Identifier of the address range to get the key space from.
Addresses []GetRangeKeyspaceIpv4Address
List of all addresses in the range.
DeletedAddresses []GetRangeKeyspaceIpv4DeletedAddress
List of all addresses that were deleted and are available to be reclaimed in the range.
FirstAddress string
First assignable address in the range.
GeneratedAddresses []GetRangeKeyspaceIpv4GeneratedAddress
List of all addresses that are flagged as generated in the range.
HardcodedAddresses []GetRangeKeyspaceIpv4HardcodedAddress
List of all addresses that are flagged as hardcoded in the range.
Id string
The ID of this resource.
LastAddress string
Last assignable address in the range.
NextAddress string
Next assignable new address in the range.
RangeId string
Identifier of the address range to get the key space from.
addresses List<GetRangeKeyspaceIpv4Address>
List of all addresses in the range.
deletedAddresses List<GetRangeKeyspaceIpv4DeletedAddress>
List of all addresses that were deleted and are available to be reclaimed in the range.
firstAddress String
First assignable address in the range.
generatedAddresses List<GetRangeKeyspaceIpv4GeneratedAddress>
List of all addresses that are flagged as generated in the range.
hardcodedAddresses List<GetRangeKeyspaceIpv4HardcodedAddress>
List of all addresses that are flagged as hardcoded in the range.
id String
The ID of this resource.
lastAddress String
Last assignable address in the range.
nextAddress String
Next assignable new address in the range.
rangeId String
Identifier of the address range to get the key space from.
addresses GetRangeKeyspaceIpv4Address[]
List of all addresses in the range.
deletedAddresses GetRangeKeyspaceIpv4DeletedAddress[]
List of all addresses that were deleted and are available to be reclaimed in the range.
firstAddress string
First assignable address in the range.
generatedAddresses GetRangeKeyspaceIpv4GeneratedAddress[]
List of all addresses that are flagged as generated in the range.
hardcodedAddresses GetRangeKeyspaceIpv4HardcodedAddress[]
List of all addresses that are flagged as hardcoded in the range.
id string
The ID of this resource.
lastAddress string
Last assignable address in the range.
nextAddress string
Next assignable new address in the range.
rangeId string
Identifier of the address range to get the key space from.
addresses Sequence[GetRangeKeyspaceIpv4Address]
List of all addresses in the range.
deleted_addresses Sequence[GetRangeKeyspaceIpv4DeletedAddress]
List of all addresses that were deleted and are available to be reclaimed in the range.
first_address str
First assignable address in the range.
generated_addresses Sequence[GetRangeKeyspaceIpv4GeneratedAddress]
List of all addresses that are flagged as generated in the range.
hardcoded_addresses Sequence[GetRangeKeyspaceIpv4HardcodedAddress]
List of all addresses that are flagged as hardcoded in the range.
id str
The ID of this resource.
last_address str
Last assignable address in the range.
next_address str
Next assignable new address in the range.
range_id str
Identifier of the address range to get the key space from.
addresses List<Property Map>
List of all addresses in the range.
deletedAddresses List<Property Map>
List of all addresses that were deleted and are available to be reclaimed in the range.
firstAddress String
First assignable address in the range.
generatedAddresses List<Property Map>
List of all addresses that are flagged as generated in the range.
hardcodedAddresses List<Property Map>
List of all addresses that are flagged as hardcoded in the range.
id String
The ID of this resource.
lastAddress String
Last assignable address in the range.
nextAddress String
Next assignable new address in the range.
rangeId String
Identifier of the address range to get the key space from.

Supporting Types

GetRangeKeyspaceIpv4Address

Address This property is required. string
Name This property is required. string
Address This property is required. string
Name This property is required. string
address This property is required. String
name This property is required. String
address This property is required. string
name This property is required. string
address This property is required. str
name This property is required. str
address This property is required. String
name This property is required. String

GetRangeKeyspaceIpv4DeletedAddress

Address This property is required. string
Name This property is required. string
Address This property is required. string
Name This property is required. string
address This property is required. String
name This property is required. String
address This property is required. string
name This property is required. string
address This property is required. str
name This property is required. str
address This property is required. String
name This property is required. String

GetRangeKeyspaceIpv4GeneratedAddress

Address This property is required. string
Name This property is required. string
Address This property is required. string
Name This property is required. string
address This property is required. String
name This property is required. String
address This property is required. string
name This property is required. string
address This property is required. str
name This property is required. str
address This property is required. String
name This property is required. String

GetRangeKeyspaceIpv4HardcodedAddress

Address This property is required. string
Name This property is required. string
Address This property is required. string
Name This property is required. string
address This property is required. String
name This property is required. String
address This property is required. string
name This property is required. string
address This property is required. str
name This property is required. str
address This property is required. String
name This property is required. String

Package Details

Repository
netaddr ferlab-ste-justine/terraform-provider-netaddr
License
Notes
This Pulumi package is based on the netaddr Terraform Provider.