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

netaddr.getRangeUsageIpv4

Explore with Pulumi AI

netaddr logo
netaddr 0.5.1 published on Tuesday, Apr 15, 2025 by ferlab-ste-justine

    Retrieves ipv4 addresses utilisation data on an address range.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netaddr from "@pulumi/netaddr";
    
    const testRangeIpv4 = netaddr.getRangeIpv4({
        keyPrefix: "/test/ipv4/",
    });
    const testRangeUsageIpv4 = testRangeIpv4.then(testRangeIpv4 => netaddr.getRangeUsageIpv4({
        rangeId: testRangeIpv4.id,
    }));
    export const rangeCapacity = testRangeUsageIpv4.then(testRangeUsageIpv4 => testRangeUsageIpv4.capacity);
    export const rangeUsedCapacity = testRangeUsageIpv4.then(testRangeUsageIpv4 => testRangeUsageIpv4.usedCapacity);
    export const rangeFreeCapacity = testRangeUsageIpv4.then(testRangeUsageIpv4 => testRangeUsageIpv4.freeCapacity);
    
    import pulumi
    import pulumi_netaddr as netaddr
    
    test_range_ipv4 = netaddr.get_range_ipv4(key_prefix="/test/ipv4/")
    test_range_usage_ipv4 = netaddr.get_range_usage_ipv4(range_id=test_range_ipv4.id)
    pulumi.export("rangeCapacity", test_range_usage_ipv4.capacity)
    pulumi.export("rangeUsedCapacity", test_range_usage_ipv4.used_capacity)
    pulumi.export("rangeFreeCapacity", test_range_usage_ipv4.free_capacity)
    
    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
    		}
    		testRangeUsageIpv4, err := netaddr.GetRangeUsageIpv4(ctx, &netaddr.GetRangeUsageIpv4Args{
    			RangeId: testRangeIpv4.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("rangeCapacity", testRangeUsageIpv4.Capacity)
    		ctx.Export("rangeUsedCapacity", testRangeUsageIpv4.UsedCapacity)
    		ctx.Export("rangeFreeCapacity", testRangeUsageIpv4.FreeCapacity)
    		return nil
    	})
    }
    
    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 testRangeUsageIpv4 = Netaddr.GetRangeUsageIpv4.Invoke(new()
        {
            RangeId = testRangeIpv4.Apply(getRangeIpv4Result => getRangeIpv4Result.Id),
        });
    
        return new Dictionary<string, object?>
        {
            ["rangeCapacity"] = testRangeUsageIpv4.Apply(getRangeUsageIpv4Result => getRangeUsageIpv4Result.Capacity),
            ["rangeUsedCapacity"] = testRangeUsageIpv4.Apply(getRangeUsageIpv4Result => getRangeUsageIpv4Result.UsedCapacity),
            ["rangeFreeCapacity"] = testRangeUsageIpv4.Apply(getRangeUsageIpv4Result => getRangeUsageIpv4Result.FreeCapacity),
        };
    });
    
    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.GetRangeUsageIpv4Args;
    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 testRangeUsageIpv4 = NetaddrFunctions.getRangeUsageIpv4(GetRangeUsageIpv4Args.builder()
                .rangeId(testRangeIpv4.applyValue(getRangeIpv4Result -> getRangeIpv4Result.id()))
                .build());
    
            ctx.export("rangeCapacity", testRangeUsageIpv4.applyValue(getRangeUsageIpv4Result -> getRangeUsageIpv4Result.capacity()));
            ctx.export("rangeUsedCapacity", testRangeUsageIpv4.applyValue(getRangeUsageIpv4Result -> getRangeUsageIpv4Result.usedCapacity()));
            ctx.export("rangeFreeCapacity", testRangeUsageIpv4.applyValue(getRangeUsageIpv4Result -> getRangeUsageIpv4Result.freeCapacity()));
        }
    }
    
    variables:
      testRangeIpv4:
        fn::invoke:
          function: netaddr:getRangeIpv4
          arguments:
            keyPrefix: /test/ipv4/
      testRangeUsageIpv4:
        fn::invoke:
          function: netaddr:getRangeUsageIpv4
          arguments:
            rangeId: ${testRangeIpv4.id}
    outputs:
      rangeCapacity: ${testRangeUsageIpv4.capacity}
      rangeUsedCapacity: ${testRangeUsageIpv4.usedCapacity}
      rangeFreeCapacity: ${testRangeUsageIpv4.freeCapacity}
    

    Using getRangeUsageIpv4

    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 getRangeUsageIpv4(args: GetRangeUsageIpv4Args, opts?: InvokeOptions): Promise<GetRangeUsageIpv4Result>
    function getRangeUsageIpv4Output(args: GetRangeUsageIpv4OutputArgs, opts?: InvokeOptions): Output<GetRangeUsageIpv4Result>
    def get_range_usage_ipv4(id: Optional[str] = None,
                             range_id: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetRangeUsageIpv4Result
    def get_range_usage_ipv4_output(id: Optional[pulumi.Input[str]] = None,
                             range_id: Optional[pulumi.Input[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetRangeUsageIpv4Result]
    func GetRangeUsageIpv4(ctx *Context, args *GetRangeUsageIpv4Args, opts ...InvokeOption) (*GetRangeUsageIpv4Result, error)
    func GetRangeUsageIpv4Output(ctx *Context, args *GetRangeUsageIpv4OutputArgs, opts ...InvokeOption) GetRangeUsageIpv4ResultOutput

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

    public static class GetRangeUsageIpv4 
    {
        public static Task<GetRangeUsageIpv4Result> InvokeAsync(GetRangeUsageIpv4Args args, InvokeOptions? opts = null)
        public static Output<GetRangeUsageIpv4Result> Invoke(GetRangeUsageIpv4InvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRangeUsageIpv4Result> getRangeUsageIpv4(GetRangeUsageIpv4Args args, InvokeOptions options)
    public static Output<GetRangeUsageIpv4Result> getRangeUsageIpv4(GetRangeUsageIpv4Args args, InvokeOptions options)
    
    fn::invoke:
      function: netaddr:index/getRangeUsageIpv4:getRangeUsageIpv4
      arguments:
        # arguments dictionary

    The following arguments are supported:

    RangeId string
    Identifier of the address range to get the capacity from.
    Id string
    The ID of this resource.
    RangeId string
    Identifier of the address range to get the capacity from.
    Id string
    The ID of this resource.
    rangeId String
    Identifier of the address range to get the capacity from.
    id String
    The ID of this resource.
    rangeId string
    Identifier of the address range to get the capacity from.
    id string
    The ID of this resource.
    range_id str
    Identifier of the address range to get the capacity from.
    id str
    The ID of this resource.
    rangeId String
    Identifier of the address range to get the capacity from.
    id String
    The ID of this resource.

    getRangeUsageIpv4 Result

    The following output properties are available:

    Capacity double
    Number of addresses in the range.
    FreeCapacity double
    Number of free addresses in the range.
    Id string
    The ID of this resource.
    RangeId string
    Identifier of the address range to get the capacity from.
    UsedCapacity double
    Number of used addresses in the range.
    Capacity float64
    Number of addresses in the range.
    FreeCapacity float64
    Number of free addresses in the range.
    Id string
    The ID of this resource.
    RangeId string
    Identifier of the address range to get the capacity from.
    UsedCapacity float64
    Number of used addresses in the range.
    capacity Double
    Number of addresses in the range.
    freeCapacity Double
    Number of free addresses in the range.
    id String
    The ID of this resource.
    rangeId String
    Identifier of the address range to get the capacity from.
    usedCapacity Double
    Number of used addresses in the range.
    capacity number
    Number of addresses in the range.
    freeCapacity number
    Number of free addresses in the range.
    id string
    The ID of this resource.
    rangeId string
    Identifier of the address range to get the capacity from.
    usedCapacity number
    Number of used addresses in the range.
    capacity float
    Number of addresses in the range.
    free_capacity float
    Number of free addresses in the range.
    id str
    The ID of this resource.
    range_id str
    Identifier of the address range to get the capacity from.
    used_capacity float
    Number of used addresses in the range.
    capacity Number
    Number of addresses in the range.
    freeCapacity Number
    Number of free addresses in the range.
    id String
    The ID of this resource.
    rangeId String
    Identifier of the address range to get the capacity from.
    usedCapacity Number
    Number of used addresses in the range.

    Package Details

    Repository
    netaddr ferlab-ste-justine/terraform-provider-netaddr
    License
    Notes
    This Pulumi package is based on the netaddr Terraform Provider.
    netaddr logo
    netaddr 0.5.1 published on Tuesday, Apr 15, 2025 by ferlab-ste-justine