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

netbox.getDeviceRole

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 coreSw = netbox.getDeviceRole({
        name: "core-sw",
    });
    
    import pulumi
    import pulumi_netbox as netbox
    
    core_sw = netbox.get_device_role(name="core-sw")
    
    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.LookupDeviceRole(ctx, &netbox.LookupDeviceRoleArgs{
    			Name: "core-sw",
    		}, 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 coreSw = Netbox.GetDeviceRole.Invoke(new()
        {
            Name = "core-sw",
        });
    
    });
    
    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.GetDeviceRoleArgs;
    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 coreSw = NetboxFunctions.getDeviceRole(GetDeviceRoleArgs.builder()
                .name("core-sw")
                .build());
    
        }
    }
    
    variables:
      coreSw:
        fn::invoke:
          function: netbox:getDeviceRole
          arguments:
            name: core-sw
    

    Using getDeviceRole

    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 getDeviceRole(args: GetDeviceRoleArgs, opts?: InvokeOptions): Promise<GetDeviceRoleResult>
    function getDeviceRoleOutput(args: GetDeviceRoleOutputArgs, opts?: InvokeOptions): Output<GetDeviceRoleResult>
    def get_device_role(id: Optional[str] = None,
                        name: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetDeviceRoleResult
    def get_device_role_output(id: Optional[pulumi.Input[str]] = None,
                        name: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetDeviceRoleResult]
    func LookupDeviceRole(ctx *Context, args *LookupDeviceRoleArgs, opts ...InvokeOption) (*LookupDeviceRoleResult, error)
    func LookupDeviceRoleOutput(ctx *Context, args *LookupDeviceRoleOutputArgs, opts ...InvokeOption) LookupDeviceRoleResultOutput

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

    public static class GetDeviceRole 
    {
        public static Task<GetDeviceRoleResult> InvokeAsync(GetDeviceRoleArgs args, InvokeOptions? opts = null)
        public static Output<GetDeviceRoleResult> Invoke(GetDeviceRoleInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetDeviceRoleResult> getDeviceRole(GetDeviceRoleArgs args, InvokeOptions options)
    public static Output<GetDeviceRoleResult> getDeviceRole(GetDeviceRoleArgs args, InvokeOptions options)
    
    fn::invoke:
      function: netbox:index/getDeviceRole:getDeviceRole
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Id string
    The ID of this resource.
    Name string
    Id string
    The ID of this resource.
    name String
    id String
    The ID of this resource.
    name string
    id string
    The ID of this resource.
    name str
    id str
    The ID of this resource.
    name String
    id String
    The ID of this resource.

    getDeviceRole Result

    The following output properties are available:

    ColorHex string
    Id string
    The ID of this resource.
    Name string
    Slug string
    Tags List<string>
    ColorHex string
    Id string
    The ID of this resource.
    Name string
    Slug string
    Tags []string
    colorHex String
    id String
    The ID of this resource.
    name String
    slug String
    tags List<String>
    colorHex string
    id string
    The ID of this resource.
    name string
    slug string
    tags string[]
    color_hex str
    id str
    The ID of this resource.
    name str
    slug str
    tags Sequence[str]
    colorHex String
    id String
    The ID of this resource.
    name String
    slug String
    tags List<String>

    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