1. Packages
  2. Linode Provider
  3. API Docs
  4. getVpcs
Linode v4.30.0 published on Friday, Nov 8, 2024 by Pulumi

linode.getVpcs

Explore with Pulumi AI

linode logo
Linode v4.30.0 published on Friday, Nov 8, 2024 by Pulumi

    Provides information about a list of Linode VPCs that match a set of filters. For more information, see the Linode APIv4 docs.

    Example Usage

    The following example shows how one might use this data source to list VPCs.

    import * as pulumi from "@pulumi/pulumi";
    import * as linode from "@pulumi/linode";
    
    const filtered-vpcs = linode.getVpcs({
        filters: [{
            name: "label",
            values: ["test"],
        }],
    });
    export const vpcs = filtered_vpcs.then(filtered_vpcs => filtered_vpcs.vpcs);
    
    import pulumi
    import pulumi_linode as linode
    
    filtered_vpcs = linode.get_vpcs(filters=[{
        "name": "label",
        "values": ["test"],
    }])
    pulumi.export("vpcs", filtered_vpcs.vpcs)
    
    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 {
    		filtered_vpcs, err := linode.GetVpcs(ctx, &linode.GetVpcsArgs{
    			Filters: []linode.GetVpcsFilter{
    				{
    					Name: "label",
    					Values: []string{
    						"test",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("vpcs", filtered_vpcs.Vpcs)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Linode = Pulumi.Linode;
    
    return await Deployment.RunAsync(() => 
    {
        var filtered_vpcs = Linode.GetVpcs.Invoke(new()
        {
            Filters = new[]
            {
                new Linode.Inputs.GetVpcsFilterInputArgs
                {
                    Name = "label",
                    Values = new[]
                    {
                        "test",
                    },
                },
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["vpcs"] = filtered_vpcs.Apply(filtered_vpcs => filtered_vpcs.Apply(getVpcsResult => getVpcsResult.Vpcs)),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.linode.LinodeFunctions;
    import com.pulumi.linode.inputs.GetVpcsArgs;
    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 filtered-vpcs = LinodeFunctions.getVpcs(GetVpcsArgs.builder()
                .filters(GetVpcsFilterArgs.builder()
                    .name("label")
                    .values("test")
                    .build())
                .build());
    
            ctx.export("vpcs", filtered_vpcs.vpcs());
        }
    }
    
    variables:
      filtered-vpcs:
        fn::invoke:
          Function: linode:getVpcs
          Arguments:
            filters:
              - name: label
                values:
                  - test
    outputs:
      vpcs: ${["filtered-vpcs"].vpcs}
    

    Filterable Fields

    • id

    • label

    • description

    • region

    Using getVpcs

    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 getVpcs(args: GetVpcsArgs, opts?: InvokeOptions): Promise<GetVpcsResult>
    function getVpcsOutput(args: GetVpcsOutputArgs, opts?: InvokeOptions): Output<GetVpcsResult>
    def get_vpcs(filters: Optional[Sequence[GetVpcsFilter]] = None,
                 vpcs: Optional[Sequence[GetVpcsVpc]] = None,
                 opts: Optional[InvokeOptions] = None) -> GetVpcsResult
    def get_vpcs_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetVpcsFilterArgs]]]] = None,
                 vpcs: Optional[pulumi.Input[Sequence[pulumi.Input[GetVpcsVpcArgs]]]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetVpcsResult]
    func GetVpcs(ctx *Context, args *GetVpcsArgs, opts ...InvokeOption) (*GetVpcsResult, error)
    func GetVpcsOutput(ctx *Context, args *GetVpcsOutputArgs, opts ...InvokeOption) GetVpcsResultOutput

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

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

    The following arguments are supported:

    getVpcs Result

    The following output properties are available:

    Id string
    The unique id of this VPC.
    Filters List<GetVpcsFilter>
    Vpcs List<GetVpcsVpc>
    Id string
    The unique id of this VPC.
    Filters []GetVpcsFilter
    Vpcs []GetVpcsVpc
    id String
    The unique id of this VPC.
    filters List<GetVpcsFilter>
    vpcs List<GetVpcsVpc>
    id string
    The unique id of this VPC.
    filters GetVpcsFilter[]
    vpcs GetVpcsVpc[]
    id String
    The unique id of this VPC.
    filters List<Property Map>
    vpcs List<Property Map>

    Supporting Types

    GetVpcsFilter

    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)

    GetVpcsVpc

    Created string
    The date and time when the VPC was created.
    Description string
    The user-defined description of this VPC.
    Id string
    The unique id of this VPC.
    Label string
    The label of the VPC.
    Region string
    The region where the VPC is deployed.
    Updated string
    The date and time when the VPC was last updated.
    Created string
    The date and time when the VPC was created.
    Description string
    The user-defined description of this VPC.
    Id string
    The unique id of this VPC.
    Label string
    The label of the VPC.
    Region string
    The region where the VPC is deployed.
    Updated string
    The date and time when the VPC was last updated.
    created String
    The date and time when the VPC was created.
    description String
    The user-defined description of this VPC.
    id String
    The unique id of this VPC.
    label String
    The label of the VPC.
    region String
    The region where the VPC is deployed.
    updated String
    The date and time when the VPC was last updated.
    created string
    The date and time when the VPC was created.
    description string
    The user-defined description of this VPC.
    id string
    The unique id of this VPC.
    label string
    The label of the VPC.
    region string
    The region where the VPC is deployed.
    updated string
    The date and time when the VPC was last updated.
    created str
    The date and time when the VPC was created.
    description str
    The user-defined description of this VPC.
    id str
    The unique id of this VPC.
    label str
    The label of the VPC.
    region str
    The region where the VPC is deployed.
    updated str
    The date and time when the VPC was last updated.
    created String
    The date and time when the VPC was created.
    description String
    The user-defined description of this VPC.
    id String
    The unique id of this VPC.
    label String
    The label of the VPC.
    region String
    The region where the VPC is deployed.
    updated String
    The date and time when the VPC was last updated.

    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.30.0 published on Friday, Nov 8, 2024 by Pulumi