Linode v4.30.1 published on Thursday, Nov 21, 2024 by Pulumi
linode.getVlans
Explore with Pulumi AI
Beta Notice VLANs are currently available through early access. To use early access resources, the
api_version
provider argument must be set tov4beta
. To learn more, see the early access documentation.
Provides details about Linode VLANs. For more information, see the Linode APIv4 docs.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";
const myInstance = new linode.Instance("my_instance", {
label: "my_instance",
image: "linode/ubuntu22.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);
import pulumi
import pulumi_linode as linode
my_instance = linode.Instance("my_instance",
label="my_instance",
image="linode/ubuntu22.04",
region="us-southeast",
type="g6-standard-1",
root_pass="bogusPassword$",
interfaces=[{
"purpose": "vlan",
"label": "my-vlan",
}])
my_vlans = linode.get_vlans(filters=[{
"name": "label",
"values": ["my-vlan"],
}])
pulumi.export("vlanLinodes", my_vlans.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, "my_instance", &linode.InstanceArgs{
Label: pulumi.String("my_instance"),
Image: pulumi.String("linode/ubuntu22.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
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;
return await Deployment.RunAsync(() =>
{
var myInstance = new Linode.Instance("my_instance", new()
{
Label = "my_instance",
Image = "linode/ubuntu22.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 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/ubuntu22.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());
}
}
resources:
myInstance:
type: linode:Instance
name: my_instance
properties:
label: my_instance
image: linode/ubuntu22.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}
Filterable Fields
label
region
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<Get
Vlans Filter> - Order string
- The order in which results should be returned. (
asc
,desc
; defaultasc
) - Order
By string - The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
- Vlans
List<Get
Vlans Vlan>
- Filters
[]Get
Vlans Filter - Order string
- The order in which results should be returned. (
asc
,desc
; defaultasc
) - Order
By string - The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
- Vlans
[]Get
Vlans Vlan
- filters
List<Get
Vlans Filter> - order String
- The order in which results should be returned. (
asc
,desc
; defaultasc
) - order
By String - The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
- vlans
List<Get
Vlans Vlan>
- filters
Get
Vlans Filter[] - order string
- The order in which results should be returned. (
asc
,desc
; defaultasc
) - order
By string - The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
- vlans
Get
Vlans Vlan[]
- filters
Sequence[Get
Vlans Filter] - order str
- The order in which results should be returned. (
asc
,desc
; defaultasc
) - order_
by str - The attribute to order the results by. See the Filterable Fields section for a list of valid fields.
- vlans
Sequence[Get
Vlans Vlan]
- filters List<Property Map>
- order String
- The order in which results should be returned. (
asc
,desc
; defaultasc
) - order
By 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:
- Id string
- Filters
List<Get
Vlans Filter> - Order string
- Order
By string - Vlans
List<Get
Vlans Vlan>
- Id string
- Filters
[]Get
Vlans Filter - Order string
- Order
By string - Vlans
[]Get
Vlans Vlan
- id String
- filters
List<Get
Vlans Filter> - order String
- order
By String - vlans
List<Get
Vlans Vlan>
- id string
- filters
Get
Vlans Filter[] - order string
- order
By string - vlans
Get
Vlans Vlan[]
- id String
- filters List<Property Map>
- order String
- order
By String - vlans List<Property Map>
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.
- Match
By string - The method to match the field by. (
exact
,regex
,substring
; defaultexact
)
- 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.
- Match
By string - The method to match the field by. (
exact
,regex
,substring
; defaultexact
)
- 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.
- match
By String - The method to match the field by. (
exact
,regex
,substring
; defaultexact
)
- 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.
- match
By string - The method to match the field by. (
exact
,regex
,substring
; defaultexact
)
- 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
; defaultexact
)
- 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.
- match
By String - The method to match the field by. (
exact
,regex
,substring
; defaultexact
)
GetVlansVlan
Package Details
- Repository
- Linode pulumi/pulumi-linode
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
linode
Terraform Provider.