1. Packages
  2. Netbox Provider
  3. API Docs
  4. AvailablePrefix
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

netbox.AvailablePrefix

Explore with Pulumi AI

netbox logo
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as netbox from "@pulumi/netbox";
    
    const testPrefix = netbox.getPrefix({
        cidr: "10.0.0.0/24",
    });
    const testAvailablePrefix = new netbox.AvailablePrefix("testAvailablePrefix", {
        parentPrefixId: testPrefix.then(testPrefix => testPrefix.id),
        prefixLength: 25,
        status: "active",
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    test_prefix = netbox.get_prefix(cidr="10.0.0.0/24")
    test_available_prefix = netbox.AvailablePrefix("testAvailablePrefix",
        parent_prefix_id=test_prefix.id,
        prefix_length=25,
        status="active")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v3/netbox"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		testPrefix, err := netbox.LookupPrefix(ctx, &netbox.LookupPrefixArgs{
    			Cidr: pulumi.StringRef("10.0.0.0/24"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = netbox.NewAvailablePrefix(ctx, "testAvailablePrefix", &netbox.AvailablePrefixArgs{
    			ParentPrefixId: pulumi.Float64(testPrefix.Id),
    			PrefixLength:   pulumi.Float64(25),
    			Status:         pulumi.String("active"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Netbox = Pulumi.Netbox;
    
    return await Deployment.RunAsync(() => 
    {
        var testPrefix = Netbox.GetPrefix.Invoke(new()
        {
            Cidr = "10.0.0.0/24",
        });
    
        var testAvailablePrefix = new Netbox.AvailablePrefix("testAvailablePrefix", new()
        {
            ParentPrefixId = testPrefix.Apply(getPrefixResult => getPrefixResult.Id),
            PrefixLength = 25,
            Status = "active",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.netbox.NetboxFunctions;
    import com.pulumi.netbox.inputs.GetPrefixArgs;
    import com.pulumi.netbox.AvailablePrefix;
    import com.pulumi.netbox.AvailablePrefixArgs;
    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 testPrefix = NetboxFunctions.getPrefix(GetPrefixArgs.builder()
                .cidr("10.0.0.0/24")
                .build());
    
            var testAvailablePrefix = new AvailablePrefix("testAvailablePrefix", AvailablePrefixArgs.builder()
                .parentPrefixId(testPrefix.applyValue(getPrefixResult -> getPrefixResult.id()))
                .prefixLength(25)
                .status("active")
                .build());
    
        }
    }
    
    resources:
      testAvailablePrefix:
        type: netbox:AvailablePrefix
        properties:
          parentPrefixId: ${testPrefix.id}
          prefixLength: 25
          status: active
    variables:
      testPrefix:
        fn::invoke:
          function: netbox:getPrefix
          arguments:
            cidr: 10.0.0.0/24
    

    Create AvailablePrefix Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new AvailablePrefix(name: string, args: AvailablePrefixArgs, opts?: CustomResourceOptions);
    @overload
    def AvailablePrefix(resource_name: str,
                        args: AvailablePrefixArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def AvailablePrefix(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        parent_prefix_id: Optional[float] = None,
                        status: Optional[str] = None,
                        prefix_length: Optional[float] = None,
                        role_id: Optional[float] = None,
                        mark_utilized: Optional[bool] = None,
                        is_pool: Optional[bool] = None,
                        available_prefix_id: Optional[str] = None,
                        site_id: Optional[float] = None,
                        description: Optional[str] = None,
                        tags: Optional[Sequence[str]] = None,
                        tenant_id: Optional[float] = None,
                        vlan_id: Optional[float] = None,
                        vrf_id: Optional[float] = None)
    func NewAvailablePrefix(ctx *Context, name string, args AvailablePrefixArgs, opts ...ResourceOption) (*AvailablePrefix, error)
    public AvailablePrefix(string name, AvailablePrefixArgs args, CustomResourceOptions? opts = null)
    public AvailablePrefix(String name, AvailablePrefixArgs args)
    public AvailablePrefix(String name, AvailablePrefixArgs args, CustomResourceOptions options)
    
    type: netbox:AvailablePrefix
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args AvailablePrefixArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args AvailablePrefixArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args AvailablePrefixArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AvailablePrefixArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AvailablePrefixArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var availablePrefixResource = new Netbox.AvailablePrefix("availablePrefixResource", new()
    {
        ParentPrefixId = 0,
        Status = "string",
        PrefixLength = 0,
        RoleId = 0,
        MarkUtilized = false,
        IsPool = false,
        AvailablePrefixId = "string",
        SiteId = 0,
        Description = "string",
        Tags = new[]
        {
            "string",
        },
        TenantId = 0,
        VlanId = 0,
        VrfId = 0,
    });
    
    example, err := netbox.NewAvailablePrefix(ctx, "availablePrefixResource", &netbox.AvailablePrefixArgs{
    ParentPrefixId: pulumi.Float64(0),
    Status: pulumi.String("string"),
    PrefixLength: pulumi.Float64(0),
    RoleId: pulumi.Float64(0),
    MarkUtilized: pulumi.Bool(false),
    IsPool: pulumi.Bool(false),
    AvailablePrefixId: pulumi.String("string"),
    SiteId: pulumi.Float64(0),
    Description: pulumi.String("string"),
    Tags: pulumi.StringArray{
    pulumi.String("string"),
    },
    TenantId: pulumi.Float64(0),
    VlanId: pulumi.Float64(0),
    VrfId: pulumi.Float64(0),
    })
    
    var availablePrefixResource = new AvailablePrefix("availablePrefixResource", AvailablePrefixArgs.builder()
        .parentPrefixId(0)
        .status("string")
        .prefixLength(0)
        .roleId(0)
        .markUtilized(false)
        .isPool(false)
        .availablePrefixId("string")
        .siteId(0)
        .description("string")
        .tags("string")
        .tenantId(0)
        .vlanId(0)
        .vrfId(0)
        .build());
    
    available_prefix_resource = netbox.AvailablePrefix("availablePrefixResource",
        parent_prefix_id=0,
        status="string",
        prefix_length=0,
        role_id=0,
        mark_utilized=False,
        is_pool=False,
        available_prefix_id="string",
        site_id=0,
        description="string",
        tags=["string"],
        tenant_id=0,
        vlan_id=0,
        vrf_id=0)
    
    const availablePrefixResource = new netbox.AvailablePrefix("availablePrefixResource", {
        parentPrefixId: 0,
        status: "string",
        prefixLength: 0,
        roleId: 0,
        markUtilized: false,
        isPool: false,
        availablePrefixId: "string",
        siteId: 0,
        description: "string",
        tags: ["string"],
        tenantId: 0,
        vlanId: 0,
        vrfId: 0,
    });
    
    type: netbox:AvailablePrefix
    properties:
        availablePrefixId: string
        description: string
        isPool: false
        markUtilized: false
        parentPrefixId: 0
        prefixLength: 0
        roleId: 0
        siteId: 0
        status: string
        tags:
            - string
        tenantId: 0
        vlanId: 0
        vrfId: 0
    

    AvailablePrefix Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The AvailablePrefix resource accepts the following input properties:

    ParentPrefixId double
    PrefixLength double
    Status string
    Valid values are active, container, reserved and deprecated.
    AvailablePrefixId string
    The ID of this resource.
    Description string
    IsPool bool
    MarkUtilized bool
    RoleId double
    SiteId double
    Tags List<string>
    TenantId double
    VlanId double
    VrfId double
    ParentPrefixId float64
    PrefixLength float64
    Status string
    Valid values are active, container, reserved and deprecated.
    AvailablePrefixId string
    The ID of this resource.
    Description string
    IsPool bool
    MarkUtilized bool
    RoleId float64
    SiteId float64
    Tags []string
    TenantId float64
    VlanId float64
    VrfId float64
    parentPrefixId Double
    prefixLength Double
    status String
    Valid values are active, container, reserved and deprecated.
    availablePrefixId String
    The ID of this resource.
    description String
    isPool Boolean
    markUtilized Boolean
    roleId Double
    siteId Double
    tags List<String>
    tenantId Double
    vlanId Double
    vrfId Double
    parentPrefixId number
    prefixLength number
    status string
    Valid values are active, container, reserved and deprecated.
    availablePrefixId string
    The ID of this resource.
    description string
    isPool boolean
    markUtilized boolean
    roleId number
    siteId number
    tags string[]
    tenantId number
    vlanId number
    vrfId number
    parent_prefix_id float
    prefix_length float
    status str
    Valid values are active, container, reserved and deprecated.
    available_prefix_id str
    The ID of this resource.
    description str
    is_pool bool
    mark_utilized bool
    role_id float
    site_id float
    tags Sequence[str]
    tenant_id float
    vlan_id float
    vrf_id float
    parentPrefixId Number
    prefixLength Number
    status String
    Valid values are active, container, reserved and deprecated.
    availablePrefixId String
    The ID of this resource.
    description String
    isPool Boolean
    markUtilized Boolean
    roleId Number
    siteId Number
    tags List<String>
    tenantId Number
    vlanId Number
    vrfId Number

    Outputs

    All input properties are implicitly available as output properties. Additionally, the AvailablePrefix resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Prefix string
    Id string
    The provider-assigned unique ID for this managed resource.
    Prefix string
    id String
    The provider-assigned unique ID for this managed resource.
    prefix String
    id string
    The provider-assigned unique ID for this managed resource.
    prefix string
    id str
    The provider-assigned unique ID for this managed resource.
    prefix str
    id String
    The provider-assigned unique ID for this managed resource.
    prefix String

    Look up Existing AvailablePrefix Resource

    Get an existing AvailablePrefix resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: AvailablePrefixState, opts?: CustomResourceOptions): AvailablePrefix
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            available_prefix_id: Optional[str] = None,
            description: Optional[str] = None,
            is_pool: Optional[bool] = None,
            mark_utilized: Optional[bool] = None,
            parent_prefix_id: Optional[float] = None,
            prefix: Optional[str] = None,
            prefix_length: Optional[float] = None,
            role_id: Optional[float] = None,
            site_id: Optional[float] = None,
            status: Optional[str] = None,
            tags: Optional[Sequence[str]] = None,
            tenant_id: Optional[float] = None,
            vlan_id: Optional[float] = None,
            vrf_id: Optional[float] = None) -> AvailablePrefix
    func GetAvailablePrefix(ctx *Context, name string, id IDInput, state *AvailablePrefixState, opts ...ResourceOption) (*AvailablePrefix, error)
    public static AvailablePrefix Get(string name, Input<string> id, AvailablePrefixState? state, CustomResourceOptions? opts = null)
    public static AvailablePrefix get(String name, Output<String> id, AvailablePrefixState state, CustomResourceOptions options)
    resources:  _:    type: netbox:AvailablePrefix    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    AvailablePrefixId string
    The ID of this resource.
    Description string
    IsPool bool
    MarkUtilized bool
    ParentPrefixId double
    Prefix string
    PrefixLength double
    RoleId double
    SiteId double
    Status string
    Valid values are active, container, reserved and deprecated.
    Tags List<string>
    TenantId double
    VlanId double
    VrfId double
    AvailablePrefixId string
    The ID of this resource.
    Description string
    IsPool bool
    MarkUtilized bool
    ParentPrefixId float64
    Prefix string
    PrefixLength float64
    RoleId float64
    SiteId float64
    Status string
    Valid values are active, container, reserved and deprecated.
    Tags []string
    TenantId float64
    VlanId float64
    VrfId float64
    availablePrefixId String
    The ID of this resource.
    description String
    isPool Boolean
    markUtilized Boolean
    parentPrefixId Double
    prefix String
    prefixLength Double
    roleId Double
    siteId Double
    status String
    Valid values are active, container, reserved and deprecated.
    tags List<String>
    tenantId Double
    vlanId Double
    vrfId Double
    availablePrefixId string
    The ID of this resource.
    description string
    isPool boolean
    markUtilized boolean
    parentPrefixId number
    prefix string
    prefixLength number
    roleId number
    siteId number
    status string
    Valid values are active, container, reserved and deprecated.
    tags string[]
    tenantId number
    vlanId number
    vrfId number
    available_prefix_id str
    The ID of this resource.
    description str
    is_pool bool
    mark_utilized bool
    parent_prefix_id float
    prefix str
    prefix_length float
    role_id float
    site_id float
    status str
    Valid values are active, container, reserved and deprecated.
    tags Sequence[str]
    tenant_id float
    vlan_id float
    vrf_id float
    availablePrefixId String
    The ID of this resource.
    description String
    isPool Boolean
    markUtilized Boolean
    parentPrefixId Number
    prefix String
    prefixLength Number
    roleId Number
    siteId Number
    status String
    Valid values are active, container, reserved and deprecated.
    tags List<String>
    tenantId Number
    vlanId Number
    vrfId Number

    Package Details

    Repository
    netbox e-breuninger/terraform-provider-netbox
    License
    Notes
    This Pulumi package is based on the netbox Terraform Provider.
    netbox logo
    netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger