1. Packages
  2. Hcloud Provider
  3. API Docs
  4. getNetwork
Hetzner Cloud v1.21.0 published on Tuesday, Nov 12, 2024 by Pulumi

hcloud.getNetwork

Explore with Pulumi AI

hcloud logo
Hetzner Cloud v1.21.0 published on Tuesday, Nov 12, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as hcloud from "@pulumi/hcloud";
    
    const network1 = hcloud.getNetwork({
        id: 1234,
    });
    const network2 = hcloud.getNetwork({
        name: "my-network",
    });
    const network3 = hcloud.getNetwork({
        withSelector: "key=value",
    });
    
    import pulumi
    import pulumi_hcloud as hcloud
    
    network1 = hcloud.get_network(id=1234)
    network2 = hcloud.get_network(name="my-network")
    network3 = hcloud.get_network(with_selector="key=value")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := hcloud.LookupNetwork(ctx, &hcloud.LookupNetworkArgs{
    			Id: pulumi.IntRef(1234),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = hcloud.LookupNetwork(ctx, &hcloud.LookupNetworkArgs{
    			Name: pulumi.StringRef("my-network"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = hcloud.LookupNetwork(ctx, &hcloud.LookupNetworkArgs{
    			WithSelector: pulumi.StringRef("key=value"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using HCloud = Pulumi.HCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var network1 = HCloud.GetNetwork.Invoke(new()
        {
            Id = 1234,
        });
    
        var network2 = HCloud.GetNetwork.Invoke(new()
        {
            Name = "my-network",
        });
    
        var network3 = HCloud.GetNetwork.Invoke(new()
        {
            WithSelector = "key=value",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.hcloud.HcloudFunctions;
    import com.pulumi.hcloud.inputs.GetNetworkArgs;
    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 network1 = HcloudFunctions.getNetwork(GetNetworkArgs.builder()
                .id("1234")
                .build());
    
            final var network2 = HcloudFunctions.getNetwork(GetNetworkArgs.builder()
                .name("my-network")
                .build());
    
            final var network3 = HcloudFunctions.getNetwork(GetNetworkArgs.builder()
                .withSelector("key=value")
                .build());
    
        }
    }
    
    variables:
      network1:
        fn::invoke:
          Function: hcloud:getNetwork
          Arguments:
            id: '1234'
      network2:
        fn::invoke:
          Function: hcloud:getNetwork
          Arguments:
            name: my-network
      network3:
        fn::invoke:
          Function: hcloud:getNetwork
          Arguments:
            withSelector: key=value
    

    Using getNetwork

    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 getNetwork(args: GetNetworkArgs, opts?: InvokeOptions): Promise<GetNetworkResult>
    function getNetworkOutput(args: GetNetworkOutputArgs, opts?: InvokeOptions): Output<GetNetworkResult>
    def get_network(id: Optional[int] = None,
                    ip_range: Optional[str] = None,
                    labels: Optional[Mapping[str, str]] = None,
                    most_recent: Optional[bool] = None,
                    name: Optional[str] = None,
                    with_selector: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetNetworkResult
    def get_network_output(id: Optional[pulumi.Input[int]] = None,
                    ip_range: Optional[pulumi.Input[str]] = None,
                    labels: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                    most_recent: Optional[pulumi.Input[bool]] = None,
                    name: Optional[pulumi.Input[str]] = None,
                    with_selector: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetNetworkResult]
    func LookupNetwork(ctx *Context, args *LookupNetworkArgs, opts ...InvokeOption) (*LookupNetworkResult, error)
    func LookupNetworkOutput(ctx *Context, args *LookupNetworkOutputArgs, opts ...InvokeOption) LookupNetworkResultOutput

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

    public static class GetNetwork 
    {
        public static Task<GetNetworkResult> InvokeAsync(GetNetworkArgs args, InvokeOptions? opts = null)
        public static Output<GetNetworkResult> Invoke(GetNetworkInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNetworkResult> getNetwork(GetNetworkArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: hcloud:index/getNetwork:getNetwork
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id int
    ID of the Network.
    IpRange string
    IPv4 prefix of the Network.
    Labels Dictionary<string, string>
    MostRecent bool

    Deprecated: This attribute has no purpose.

    Name string
    Name of the Network.
    WithSelector string
    Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
    Id int
    ID of the Network.
    IpRange string
    IPv4 prefix of the Network.
    Labels map[string]string
    MostRecent bool

    Deprecated: This attribute has no purpose.

    Name string
    Name of the Network.
    WithSelector string
    Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
    id Integer
    ID of the Network.
    ipRange String
    IPv4 prefix of the Network.
    labels Map<String,String>
    mostRecent Boolean

    Deprecated: This attribute has no purpose.

    name String
    Name of the Network.
    withSelector String
    Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
    id number
    ID of the Network.
    ipRange string
    IPv4 prefix of the Network.
    labels {[key: string]: string}
    mostRecent boolean

    Deprecated: This attribute has no purpose.

    name string
    Name of the Network.
    withSelector string
    Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
    id int
    ID of the Network.
    ip_range str
    IPv4 prefix of the Network.
    labels Mapping[str, str]
    most_recent bool

    Deprecated: This attribute has no purpose.

    name str
    Name of the Network.
    with_selector str
    Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
    id Number
    ID of the Network.
    ipRange String
    IPv4 prefix of the Network.
    labels Map<String>
    mostRecent Boolean

    Deprecated: This attribute has no purpose.

    name String
    Name of the Network.
    withSelector String
    Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.

    getNetwork Result

    The following output properties are available:

    DeleteProtection bool
    (bool) Whether delete protection is enabled.
    ExposeRoutesToVswitch bool
    (bool) Indicates if the routes from this network should be exposed to the vSwitch connection. The exposing only takes effect if a vSwitch connection is active.
    Id int
    Unique ID of the Network.
    IpRange string
    IPv4 prefix of the Network.
    Labels Dictionary<string, string>
    Name string
    Name of the Network.
    MostRecent bool

    Deprecated: This attribute has no purpose.

    WithSelector string
    DeleteProtection bool
    (bool) Whether delete protection is enabled.
    ExposeRoutesToVswitch bool
    (bool) Indicates if the routes from this network should be exposed to the vSwitch connection. The exposing only takes effect if a vSwitch connection is active.
    Id int
    Unique ID of the Network.
    IpRange string
    IPv4 prefix of the Network.
    Labels map[string]string
    Name string
    Name of the Network.
    MostRecent bool

    Deprecated: This attribute has no purpose.

    WithSelector string
    deleteProtection Boolean
    (bool) Whether delete protection is enabled.
    exposeRoutesToVswitch Boolean
    (bool) Indicates if the routes from this network should be exposed to the vSwitch connection. The exposing only takes effect if a vSwitch connection is active.
    id Integer
    Unique ID of the Network.
    ipRange String
    IPv4 prefix of the Network.
    labels Map<String,String>
    name String
    Name of the Network.
    mostRecent Boolean

    Deprecated: This attribute has no purpose.

    withSelector String
    deleteProtection boolean
    (bool) Whether delete protection is enabled.
    exposeRoutesToVswitch boolean
    (bool) Indicates if the routes from this network should be exposed to the vSwitch connection. The exposing only takes effect if a vSwitch connection is active.
    id number
    Unique ID of the Network.
    ipRange string
    IPv4 prefix of the Network.
    labels {[key: string]: string}
    name string
    Name of the Network.
    mostRecent boolean

    Deprecated: This attribute has no purpose.

    withSelector string
    delete_protection bool
    (bool) Whether delete protection is enabled.
    expose_routes_to_vswitch bool
    (bool) Indicates if the routes from this network should be exposed to the vSwitch connection. The exposing only takes effect if a vSwitch connection is active.
    id int
    Unique ID of the Network.
    ip_range str
    IPv4 prefix of the Network.
    labels Mapping[str, str]
    name str
    Name of the Network.
    most_recent bool

    Deprecated: This attribute has no purpose.

    with_selector str
    deleteProtection Boolean
    (bool) Whether delete protection is enabled.
    exposeRoutesToVswitch Boolean
    (bool) Indicates if the routes from this network should be exposed to the vSwitch connection. The exposing only takes effect if a vSwitch connection is active.
    id Number
    Unique ID of the Network.
    ipRange String
    IPv4 prefix of the Network.
    labels Map<String>
    name String
    Name of the Network.
    mostRecent Boolean

    Deprecated: This attribute has no purpose.

    withSelector String

    Package Details

    Repository
    Hetzner Cloud pulumi/pulumi-hcloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the hcloud Terraform Provider.
    hcloud logo
    Hetzner Cloud v1.21.0 published on Tuesday, Nov 12, 2024 by Pulumi