1. Packages
  2. Linode
  3. API Docs
  4. getVlans
Linode v4.7.0 published on Friday, Sep 29, 2023 by Pulumi

linode.getVlans

Explore with Pulumi AI

linode logo
Linode v4.7.0 published on Friday, Sep 29, 2023 by Pulumi

    Provides details about Linode VLANs.

    Filterable Fields

    • label

    • region

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Linode = Pulumi.Linode;
    
    return await Deployment.RunAsync(() => 
    {
        var myInstance = new Linode.Instance("myInstance", new()
        {
            Label = "my_instance",
            Image = "linode/ubuntu18.04",
            Region = "us-southeast",
            Type = "g6-standard-1",
            RootPass = "bogusPassword$",
            Interfaces = new[]
            {
                new Linode.Inputs.InstanceInterfaceArgs
                {
                    Purpose = "vlan",
                    Label = "my-vlan",
                },
            },
        });
    
        var my_vlans = Linode.GetVlans.Invoke(new()
        {
            Filters = new[]
            {
                new Linode.Inputs.GetVlansFilterInputArgs
                {
                    Name = "label",
                    Values = new[]
                    {
                        "my-vlan",
                    },
                },
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["vlanLinodes"] = my_vlans.Apply(my_vlans => my_vlans.Apply(getVlansResult => getVlansResult.Vlans[0]?.Linodes)),
        };
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := linode.NewInstance(ctx, "myInstance", &linode.InstanceArgs{
    			Label:    pulumi.String("my_instance"),
    			Image:    pulumi.String("linode/ubuntu18.04"),
    			Region:   pulumi.String("us-southeast"),
    			Type:     pulumi.String("g6-standard-1"),
    			RootPass: pulumi.String("bogusPassword$"),
    			Interfaces: linode.InstanceInterfaceArray{
    				&linode.InstanceInterfaceArgs{
    					Purpose: pulumi.String("vlan"),
    					Label:   pulumi.String("my-vlan"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		my_vlans, err := linode.GetVlans(ctx, &linode.GetVlansArgs{
    			Filters: []linode.GetVlansFilter{
    				{
    					Name: "label",
    					Values: []string{
    						"my-vlan",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vlanLinodes", my_vlans.Vlans[0].Linodes)
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.linode.Instance;
    import com.pulumi.linode.InstanceArgs;
    import com.pulumi.linode.inputs.InstanceInterfaceArgs;
    import com.pulumi.linode.LinodeFunctions;
    import com.pulumi.linode.inputs.GetVlansArgs;
    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) {
            var myInstance = new Instance("myInstance", InstanceArgs.builder()        
                .label("my_instance")
                .image("linode/ubuntu18.04")
                .region("us-southeast")
                .type("g6-standard-1")
                .rootPass("bogusPassword$")
                .interfaces(InstanceInterfaceArgs.builder()
                    .purpose("vlan")
                    .label("my-vlan")
                    .build())
                .build());
    
            final var my-vlans = LinodeFunctions.getVlans(GetVlansArgs.builder()
                .filters(GetVlansFilterArgs.builder()
                    .name("label")
                    .values("my-vlan")
                    .build())
                .build());
    
            ctx.export("vlanLinodes", my_vlans.vlans()[0].linodes());
        }
    }
    
    import pulumi
    import pulumi_linode as linode
    
    my_instance = linode.Instance("myInstance",
        label="my_instance",
        image="linode/ubuntu18.04",
        region="us-southeast",
        type="g6-standard-1",
        root_pass="bogusPassword$",
        interfaces=[linode.InstanceInterfaceArgs(
            purpose="vlan",
            label="my-vlan",
        )])
    my_vlans = linode.get_vlans(filters=[linode.GetVlansFilterArgs(
        name="label",
        values=["my-vlan"],
    )])
    pulumi.export("vlanLinodes", my_vlans.vlans[0].linodes)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as linode from "@pulumi/linode";
    
    const myInstance = new linode.Instance("myInstance", {
        label: "my_instance",
        image: "linode/ubuntu18.04",
        region: "us-southeast",
        type: "g6-standard-1",
        rootPass: "bogusPassword$",
        interfaces: [{
            purpose: "vlan",
            label: "my-vlan",
        }],
    });
    const my-vlans = linode.getVlans({
        filters: [{
            name: "label",
            values: ["my-vlan"],
        }],
    });
    export const vlanLinodes = my_vlans.then(my_vlans => my_vlans.vlans?.[0]?.linodes);
    
    resources:
      myInstance:
        type: linode:Instance
        properties:
          label: my_instance
          image: linode/ubuntu18.04
          region: us-southeast
          type: g6-standard-1
          rootPass: bogusPassword$
          interfaces:
            - purpose: vlan
              label: my-vlan
    variables:
      my-vlans:
        fn::invoke:
          Function: linode:getVlans
          Arguments:
            filters:
              - name: label
                values:
                  - my-vlan
    outputs:
      vlanLinodes: ${["my-vlans"].vlans[0].linodes}
    

    Using getVlans

    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 getVlans(args: GetVlansArgs, opts?: InvokeOptions): Promise<GetVlansResult>
    function getVlansOutput(args: GetVlansOutputArgs, opts?: InvokeOptions): Output<GetVlansResult>
    def get_vlans(filters: Optional[Sequence[GetVlansFilter]] = None,
                  order: Optional[str] = None,
                  order_by: Optional[str] = None,
                  vlans: Optional[Sequence[GetVlansVlan]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetVlansResult
    def get_vlans_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetVlansFilterArgs]]]] = None,
                  order: Optional[pulumi.Input[str]] = None,
                  order_by: Optional[pulumi.Input[str]] = None,
                  vlans: Optional[pulumi.Input[Sequence[pulumi.Input[GetVlansVlanArgs]]]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetVlansResult]
    func GetVlans(ctx *Context, args *GetVlansArgs, opts ...InvokeOption) (*GetVlansResult, error)
    func GetVlansOutput(ctx *Context, args *GetVlansOutputArgs, opts ...InvokeOption) GetVlansResultOutput

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

    public static class GetVlans 
    {
        public static Task<GetVlansResult> InvokeAsync(GetVlansArgs args, InvokeOptions? opts = null)
        public static Output<GetVlansResult> Invoke(GetVlansInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVlansResult> getVlans(GetVlansArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: linode:index/getVlans:getVlans
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<GetVlansFilter>
    Order string

    The order in which results should be returned. (asc, desc; default asc)

    OrderBy string

    The attribute to order the results by. See the Filterable Fields section for a list of valid fields.

    Vlans List<GetVlansVlan>
    Filters []GetVlansFilter
    Order string

    The order in which results should be returned. (asc, desc; default asc)

    OrderBy string

    The attribute to order the results by. See the Filterable Fields section for a list of valid fields.

    Vlans []GetVlansVlan
    filters List<GetVlansFilter>
    order String

    The order in which results should be returned. (asc, desc; default asc)

    orderBy String

    The attribute to order the results by. See the Filterable Fields section for a list of valid fields.

    vlans List<GetVlansVlan>
    filters GetVlansFilter[]
    order string

    The order in which results should be returned. (asc, desc; default asc)

    orderBy string

    The attribute to order the results by. See the Filterable Fields section for a list of valid fields.

    vlans GetVlansVlan[]
    filters Sequence[GetVlansFilter]
    order str

    The order in which results should be returned. (asc, desc; default asc)

    order_by str

    The attribute to order the results by. See the Filterable Fields section for a list of valid fields.

    vlans Sequence[GetVlansVlan]
    filters List<Property Map>
    order String

    The order in which results should be returned. (asc, desc; default asc)

    orderBy String

    The attribute to order the results by. See the Filterable Fields section for a list of valid fields.

    vlans List<Property Map>

    getVlans Result

    The following output properties are available:

    Supporting Types

    GetVlansFilter

    Name string

    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.

    Values List<string>

    A list of values for the filter to allow. These values should all be in string form.

    MatchBy string

    The method to match the field by. (exact, regex, substring; default exact)

    Name string

    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.

    Values []string

    A list of values for the filter to allow. These values should all be in string form.

    MatchBy string

    The method to match the field by. (exact, regex, substring; default exact)

    name String

    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.

    values List<String>

    A list of values for the filter to allow. These values should all be in string form.

    matchBy String

    The method to match the field by. (exact, regex, substring; default exact)

    name string

    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.

    values string[]

    A list of values for the filter to allow. These values should all be in string form.

    matchBy string

    The method to match the field by. (exact, regex, substring; default exact)

    name str

    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.

    values Sequence[str]

    A list of values for the filter to allow. These values should all be in string form.

    match_by str

    The method to match the field by. (exact, regex, substring; default exact)

    name String

    The name of the field to filter by. See the Filterable Fields section for a complete list of filterable fields.

    values List<String>

    A list of values for the filter to allow. These values should all be in string form.

    matchBy String

    The method to match the field by. (exact, regex, substring; default exact)

    GetVlansVlan

    Created string

    When the VLAN was created.

    Label string

    The unique label of the VLAN.

    Linodes List<int>

    The running Linodes currently attached to the VLAN.

    Region string

    The region the VLAN is located in. See all regions here.

    Created string

    When the VLAN was created.

    Label string

    The unique label of the VLAN.

    Linodes []int

    The running Linodes currently attached to the VLAN.

    Region string

    The region the VLAN is located in. See all regions here.

    created String

    When the VLAN was created.

    label String

    The unique label of the VLAN.

    linodes List<Integer>

    The running Linodes currently attached to the VLAN.

    region String

    The region the VLAN is located in. See all regions here.

    created string

    When the VLAN was created.

    label string

    The unique label of the VLAN.

    linodes number[]

    The running Linodes currently attached to the VLAN.

    region string

    The region the VLAN is located in. See all regions here.

    created str

    When the VLAN was created.

    label str

    The unique label of the VLAN.

    linodes Sequence[int]

    The running Linodes currently attached to the VLAN.

    region str

    The region the VLAN is located in. See all regions here.

    created String

    When the VLAN was created.

    label String

    The unique label of the VLAN.

    linodes List<Number>

    The running Linodes currently attached to the VLAN.

    region String

    The region the VLAN is located in. See all regions here.

    Package Details

    Repository
    Linode pulumi/pulumi-linode
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the linode Terraform Provider.

    linode logo
    Linode v4.7.0 published on Friday, Sep 29, 2023 by Pulumi