1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. getNetworks
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

gcp.compute.getNetworks

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

    List all networks in a specified Google Cloud project.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const my-networks = gcp.compute.getNetworks({
        project: "my-cloud-project",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    my_networks = gcp.compute.get_networks(project="my-cloud-project")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := compute.GetNetworks(ctx, &compute.GetNetworksArgs{
    			Project: pulumi.StringRef("my-cloud-project"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var my_networks = Gcp.Compute.GetNetworks.Invoke(new()
        {
            Project = "my-cloud-project",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.ComputeFunctions;
    import com.pulumi.gcp.compute.inputs.GetNetworksArgs;
    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 my-networks = ComputeFunctions.getNetworks(GetNetworksArgs.builder()
                .project("my-cloud-project")
                .build());
    
        }
    }
    
    variables:
      my-networks:
        fn::invoke:
          Function: gcp:compute:getNetworks
          Arguments:
            project: my-cloud-project
    

    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(project: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetNetworksResult
    def get_networks_output(project: 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: gcp:compute/getNetworks:getNetworks
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Project string
    The name of the project.
    Project string
    The name of the project.
    project String
    The name of the project.
    project string
    The name of the project.
    project str
    The name of the project.
    project String
    The name of the project.

    getNetworks Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Networks List<string>
    The list of networks in the specified project.
    SelfLink string
    The URI of the resource.
    Project string
    The project name being queried.
    Id string
    The provider-assigned unique ID for this managed resource.
    Networks []string
    The list of networks in the specified project.
    SelfLink string
    The URI of the resource.
    Project string
    The project name being queried.
    id String
    The provider-assigned unique ID for this managed resource.
    networks List<String>
    The list of networks in the specified project.
    selfLink String
    The URI of the resource.
    project String
    The project name being queried.
    id string
    The provider-assigned unique ID for this managed resource.
    networks string[]
    The list of networks in the specified project.
    selfLink string
    The URI of the resource.
    project string
    The project name being queried.
    id str
    The provider-assigned unique ID for this managed resource.
    networks Sequence[str]
    The list of networks in the specified project.
    self_link str
    The URI of the resource.
    project str
    The project name being queried.
    id String
    The provider-assigned unique ID for this managed resource.
    networks List<String>
    The list of networks in the specified project.
    selfLink String
    The URI of the resource.
    project String
    The project name being queried.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi