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

netbox.getAsn

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 asn1 = netbox.getAsn({
        asn: "1111",
        tag: "tag-1",
    });
    const asn2 = netbox.getAsn({
        tag: "tag-1",
        tagN: "tag-2",
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    asn1 = netbox.get_asn(asn="1111",
        tag="tag-1")
    asn2 = netbox.get_asn(tag="tag-1",
        tag_n="tag-2")
    
    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 {
    		_, err := netbox.LookupAsn(ctx, &netbox.LookupAsnArgs{
    			Asn: pulumi.StringRef("1111"),
    			Tag: pulumi.StringRef("tag-1"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = netbox.LookupAsn(ctx, &netbox.LookupAsnArgs{
    			Tag:  pulumi.StringRef("tag-1"),
    			TagN: pulumi.StringRef("tag-2"),
    		}, nil)
    		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 asn1 = Netbox.GetAsn.Invoke(new()
        {
            Asn = "1111",
            Tag = "tag-1",
        });
    
        var asn2 = Netbox.GetAsn.Invoke(new()
        {
            Tag = "tag-1",
            TagN = "tag-2",
        });
    
    });
    
    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.GetAsnArgs;
    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 asn1 = NetboxFunctions.getAsn(GetAsnArgs.builder()
                .asn("1111")
                .tag("tag-1")
                .build());
    
            final var asn2 = NetboxFunctions.getAsn(GetAsnArgs.builder()
                .tag("tag-1")
                .tagN("tag-2")
                .build());
    
        }
    }
    
    variables:
      asn1:
        fn::invoke:
          function: netbox:getAsn
          arguments:
            asn: '1111'
            tag: tag-1
      asn2:
        fn::invoke:
          function: netbox:getAsn
          arguments:
            tag: tag-1
            tagN: tag-2
    

    Using getAsn

    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 getAsn(args: GetAsnArgs, opts?: InvokeOptions): Promise<GetAsnResult>
    function getAsnOutput(args: GetAsnOutputArgs, opts?: InvokeOptions): Output<GetAsnResult>
    def get_asn(asn: Optional[str] = None,
                tag: Optional[str] = None,
                tag_n: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetAsnResult
    def get_asn_output(asn: Optional[pulumi.Input[str]] = None,
                tag: Optional[pulumi.Input[str]] = None,
                tag_n: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetAsnResult]
    func LookupAsn(ctx *Context, args *LookupAsnArgs, opts ...InvokeOption) (*LookupAsnResult, error)
    func LookupAsnOutput(ctx *Context, args *LookupAsnOutputArgs, opts ...InvokeOption) LookupAsnResultOutput

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

    public static class GetAsn 
    {
        public static Task<GetAsnResult> InvokeAsync(GetAsnArgs args, InvokeOptions? opts = null)
        public static Output<GetAsnResult> Invoke(GetAsnInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAsnResult> getAsn(GetAsnArgs args, InvokeOptions options)
    public static Output<GetAsnResult> getAsn(GetAsnArgs args, InvokeOptions options)
    
    fn::invoke:
      function: netbox:index/getAsn:getAsn
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Asn string
    At least one of asn or tag must be given.
    Tag string
    Tag to include in the data source filter (must match the tag's slug). At least one of asn or tag must be given.
    TagN string
    Tag to exclude from the data source filter (must match the tag's slug). Refer to Netbox's documentation for more information on available lookup expressions.
    Asn string
    At least one of asn or tag must be given.
    Tag string
    Tag to include in the data source filter (must match the tag's slug). At least one of asn or tag must be given.
    TagN string
    Tag to exclude from the data source filter (must match the tag's slug). Refer to Netbox's documentation for more information on available lookup expressions.
    asn String
    At least one of asn or tag must be given.
    tag String
    Tag to include in the data source filter (must match the tag's slug). At least one of asn or tag must be given.
    tagN String
    Tag to exclude from the data source filter (must match the tag's slug). Refer to Netbox's documentation for more information on available lookup expressions.
    asn string
    At least one of asn or tag must be given.
    tag string
    Tag to include in the data source filter (must match the tag's slug). At least one of asn or tag must be given.
    tagN string
    Tag to exclude from the data source filter (must match the tag's slug). Refer to Netbox's documentation for more information on available lookup expressions.
    asn str
    At least one of asn or tag must be given.
    tag str
    Tag to include in the data source filter (must match the tag's slug). At least one of asn or tag must be given.
    tag_n str
    Tag to exclude from the data source filter (must match the tag's slug). Refer to Netbox's documentation for more information on available lookup expressions.
    asn String
    At least one of asn or tag must be given.
    tag String
    Tag to include in the data source filter (must match the tag's slug). At least one of asn or tag must be given.
    tagN String
    Tag to exclude from the data source filter (must match the tag's slug). Refer to Netbox's documentation for more information on available lookup expressions.

    getAsn Result

    The following output properties are available:

    Description string
    Id double
    The ID of this resource.
    Tags List<string>
    Asn string
    At least one of asn or tag must be given.
    Tag string
    Tag to include in the data source filter (must match the tag's slug). At least one of asn or tag must be given.
    TagN string
    Tag to exclude from the data source filter (must match the tag's slug). Refer to Netbox's documentation for more information on available lookup expressions.
    Description string
    Id float64
    The ID of this resource.
    Tags []string
    Asn string
    At least one of asn or tag must be given.
    Tag string
    Tag to include in the data source filter (must match the tag's slug). At least one of asn or tag must be given.
    TagN string
    Tag to exclude from the data source filter (must match the tag's slug). Refer to Netbox's documentation for more information on available lookup expressions.
    description String
    id Double
    The ID of this resource.
    tags List<String>
    asn String
    At least one of asn or tag must be given.
    tag String
    Tag to include in the data source filter (must match the tag's slug). At least one of asn or tag must be given.
    tagN String
    Tag to exclude from the data source filter (must match the tag's slug). Refer to Netbox's documentation for more information on available lookup expressions.
    description string
    id number
    The ID of this resource.
    tags string[]
    asn string
    At least one of asn or tag must be given.
    tag string
    Tag to include in the data source filter (must match the tag's slug). At least one of asn or tag must be given.
    tagN string
    Tag to exclude from the data source filter (must match the tag's slug). Refer to Netbox's documentation for more information on available lookup expressions.
    description str
    id float
    The ID of this resource.
    tags Sequence[str]
    asn str
    At least one of asn or tag must be given.
    tag str
    Tag to include in the data source filter (must match the tag's slug). At least one of asn or tag must be given.
    tag_n str
    Tag to exclude from the data source filter (must match the tag's slug). Refer to Netbox's documentation for more information on available lookup expressions.
    description String
    id Number
    The ID of this resource.
    tags List<String>
    asn String
    At least one of asn or tag must be given.
    tag String
    Tag to include in the data source filter (must match the tag's slug). At least one of asn or tag must be given.
    tagN String
    Tag to exclude from the data source filter (must match the tag's slug). Refer to Netbox's documentation for more information on available lookup expressions.

    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