1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. cloudconnect
  5. getNetworks
Alibaba Cloud v3.59.0 published on Friday, Jul 12, 2024 by Pulumi

alicloud.cloudconnect.getNetworks

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.59.0 published on Friday, Jul 12, 2024 by Pulumi

    This data source provides Cloud Connect Networks available to the user.

    NOTE: Available in 1.59.0+

    NOTE: Only the following regions support create Cloud Connect Network. [cn-shanghai, cn-shanghai-finance-1, cn-hongkong, ap-southeast-1, ap-southeast-3, ap-southeast-5, ap-northeast-1, eu-central-1]

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const default = alicloud.cloudconnect.getNetworks({
        ids: [defaultAlicloudCloudConnectNetworks.id],
        nameRegex: "^tf-testAcc.*",
    });
    const defaultNetwork = new alicloud.cloudconnect.Network("default", {
        name: "tf-testAccCloudConnectNetworkName",
        description: "tf-testAccCloudConnectNetworkDescription",
        cidrBlock: "192.168.0.0/24",
        isDefault: true,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    default = alicloud.cloudconnect.get_networks(ids=[default_alicloud_cloud_connect_networks["id"]],
        name_regex="^tf-testAcc.*")
    default_network = alicloud.cloudconnect.Network("default",
        name="tf-testAccCloudConnectNetworkName",
        description="tf-testAccCloudConnectNetworkDescription",
        cidr_block="192.168.0.0/24",
        is_default=True)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/cloudconnect"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
    _, err := cloudconnect.GetNetworks(ctx, &cloudconnect.GetNetworksArgs{
    Ids: interface{}{
    defaultAlicloudCloudConnectNetworks.Id,
    },
    NameRegex: pulumi.StringRef("^tf-testAcc.*"),
    }, nil);
    if err != nil {
    return err
    }
    _, err = cloudconnect.NewNetwork(ctx, "default", &cloudconnect.NetworkArgs{
    Name: pulumi.String("tf-testAccCloudConnectNetworkName"),
    Description: pulumi.String("tf-testAccCloudConnectNetworkDescription"),
    CidrBlock: pulumi.String("192.168.0.0/24"),
    IsDefault: pulumi.Bool(true),
    })
    if err != nil {
    return err
    }
    return nil
    })
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = AliCloud.CloudConnect.GetNetworks.Invoke(new()
        {
            Ids = new[]
            {
                defaultAlicloudCloudConnectNetworks.Id,
            },
            NameRegex = "^tf-testAcc.*",
        });
    
        var defaultNetwork = new AliCloud.CloudConnect.Network("default", new()
        {
            Name = "tf-testAccCloudConnectNetworkName",
            Description = "tf-testAccCloudConnectNetworkDescription",
            CidrBlock = "192.168.0.0/24",
            IsDefault = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.cloudconnect.CloudconnectFunctions;
    import com.pulumi.alicloud.cloudconnect.inputs.GetNetworksArgs;
    import com.pulumi.alicloud.cloudconnect.Network;
    import com.pulumi.alicloud.cloudconnect.NetworkArgs;
    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 default = CloudconnectFunctions.getNetworks(GetNetworksArgs.builder()
                .ids(defaultAlicloudCloudConnectNetworks.id())
                .nameRegex("^tf-testAcc.*")
                .build());
    
            var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
                .name("tf-testAccCloudConnectNetworkName")
                .description("tf-testAccCloudConnectNetworkDescription")
                .cidrBlock("192.168.0.0/24")
                .isDefault(true)
                .build());
    
        }
    }
    
    resources:
      defaultNetwork:
        type: alicloud:cloudconnect:Network
        name: default
        properties:
          name: tf-testAccCloudConnectNetworkName
          description: tf-testAccCloudConnectNetworkDescription
          cidrBlock: 192.168.0.0/24
          isDefault: true
    variables:
      default:
        fn::invoke:
          Function: alicloud:cloudconnect:getNetworks
          Arguments:
            ids:
              - ${defaultAlicloudCloudConnectNetworks.id}
            nameRegex: ^tf-testAcc.*
    

    Using getNetworks

    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 getNetworks(args: GetNetworksArgs, opts?: InvokeOptions): Promise<GetNetworksResult>
    function getNetworksOutput(args: GetNetworksOutputArgs, opts?: InvokeOptions): Output<GetNetworksResult>
    def get_networks(ids: Optional[Sequence[str]] = None,
                     name_regex: Optional[str] = None,
                     output_file: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetNetworksResult
    def get_networks_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                     name_regex: Optional[pulumi.Input[str]] = None,
                     output_file: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetNetworksResult]
    func GetNetworks(ctx *Context, args *GetNetworksArgs, opts ...InvokeOption) (*GetNetworksResult, error)
    func GetNetworksOutput(ctx *Context, args *GetNetworksOutputArgs, opts ...InvokeOption) GetNetworksResultOutput

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

    public static class GetNetworks 
    {
        public static Task<GetNetworksResult> InvokeAsync(GetNetworksArgs args, InvokeOptions? opts = null)
        public static Output<GetNetworksResult> Invoke(GetNetworksInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNetworksResult> getNetworks(GetNetworksArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: alicloud:cloudconnect/getNetworks:getNetworks
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Ids List<string>
    A list of CCN instances IDs.
    NameRegex string
    A regex string to filter CCN instances by name.
    OutputFile string
    Ids []string
    A list of CCN instances IDs.
    NameRegex string
    A regex string to filter CCN instances by name.
    OutputFile string
    ids List<String>
    A list of CCN instances IDs.
    nameRegex String
    A regex string to filter CCN instances by name.
    outputFile String
    ids string[]
    A list of CCN instances IDs.
    nameRegex string
    A regex string to filter CCN instances by name.
    outputFile string
    ids Sequence[str]
    A list of CCN instances IDs.
    name_regex str
    A regex string to filter CCN instances by name.
    output_file str
    ids List<String>
    A list of CCN instances IDs.
    nameRegex String
    A regex string to filter CCN instances by name.
    outputFile String

    getNetworks Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of CCN instances IDs.
    Names List<string>
    A list of CCN instances names.
    Networks List<Pulumi.AliCloud.CloudConnect.Outputs.GetNetworksNetwork>
    A list of CCN instances. Each element contains the following attributes:
    NameRegex string
    OutputFile string
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of CCN instances IDs.
    Names []string
    A list of CCN instances names.
    Networks []GetNetworksNetwork
    A list of CCN instances. Each element contains the following attributes:
    NameRegex string
    OutputFile string
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of CCN instances IDs.
    names List<String>
    A list of CCN instances names.
    networks List<GetNetworksNetwork>
    A list of CCN instances. Each element contains the following attributes:
    nameRegex String
    outputFile String
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of CCN instances IDs.
    names string[]
    A list of CCN instances names.
    networks GetNetworksNetwork[]
    A list of CCN instances. Each element contains the following attributes:
    nameRegex string
    outputFile string
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of CCN instances IDs.
    names Sequence[str]
    A list of CCN instances names.
    networks Sequence[GetNetworksNetwork]
    A list of CCN instances. Each element contains the following attributes:
    name_regex str
    output_file str
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of CCN instances IDs.
    names List<String>
    A list of CCN instances names.
    networks List<Property Map>
    A list of CCN instances. Each element contains the following attributes:
    nameRegex String
    outputFile String

    Supporting Types

    GetNetworksNetwork

    CidrBlock string
    CidrBlock of the CCN instance.
    Description string
    Id string
    ID of the CCN instance.
    IsDefault bool
    IsDefault of the CCN instance.
    Name string
    Name of the CCN instance.
    CidrBlock string
    CidrBlock of the CCN instance.
    Description string
    Id string
    ID of the CCN instance.
    IsDefault bool
    IsDefault of the CCN instance.
    Name string
    Name of the CCN instance.
    cidrBlock String
    CidrBlock of the CCN instance.
    description String
    id String
    ID of the CCN instance.
    isDefault Boolean
    IsDefault of the CCN instance.
    name String
    Name of the CCN instance.
    cidrBlock string
    CidrBlock of the CCN instance.
    description string
    id string
    ID of the CCN instance.
    isDefault boolean
    IsDefault of the CCN instance.
    name string
    Name of the CCN instance.
    cidr_block str
    CidrBlock of the CCN instance.
    description str
    id str
    ID of the CCN instance.
    is_default bool
    IsDefault of the CCN instance.
    name str
    Name of the CCN instance.
    cidrBlock String
    CidrBlock of the CCN instance.
    description String
    id String
    ID of the CCN instance.
    isDefault Boolean
    IsDefault of the CCN instance.
    name String
    Name of the CCN instance.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.59.0 published on Friday, Jul 12, 2024 by Pulumi