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

gcp.cloudasset.getResourcesSearchAll

Explore with Pulumi AI

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

    Example Usage

    Searching For All Projects In An Org

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const projects = gcp.cloudasset.getResourcesSearchAll({
        scope: "organizations/0123456789",
        assetTypes: ["cloudresourcemanager.googleapis.com/Project"],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    projects = gcp.cloudasset.get_resources_search_all(scope="organizations/0123456789",
        asset_types=["cloudresourcemanager.googleapis.com/Project"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/cloudasset"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudasset.LookupResourcesSearchAll(ctx, &cloudasset.LookupResourcesSearchAllArgs{
    			Scope: "organizations/0123456789",
    			AssetTypes: []string{
    				"cloudresourcemanager.googleapis.com/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 projects = Gcp.CloudAsset.GetResourcesSearchAll.Invoke(new()
        {
            Scope = "organizations/0123456789",
            AssetTypes = new[]
            {
                "cloudresourcemanager.googleapis.com/Project",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.cloudasset.CloudassetFunctions;
    import com.pulumi.gcp.cloudasset.inputs.GetResourcesSearchAllArgs;
    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 projects = CloudassetFunctions.getResourcesSearchAll(GetResourcesSearchAllArgs.builder()
                .scope("organizations/0123456789")
                .assetTypes("cloudresourcemanager.googleapis.com/Project")
                .build());
    
        }
    }
    
    variables:
      projects:
        fn::invoke:
          Function: gcp:cloudasset:getResourcesSearchAll
          Arguments:
            scope: organizations/0123456789
            assetTypes:
              - cloudresourcemanager.googleapis.com/Project
    

    Searching For All Projects With CloudBuild API Enabled

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const cloudBuildProjects = gcp.cloudasset.getResourcesSearchAll({
        scope: "organizations/0123456789",
        assetTypes: ["serviceusage.googleapis.com/Service"],
        query: "displayName:cloudbuild.googleapis.com AND state:ENABLED",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    cloud_build_projects = gcp.cloudasset.get_resources_search_all(scope="organizations/0123456789",
        asset_types=["serviceusage.googleapis.com/Service"],
        query="displayName:cloudbuild.googleapis.com AND state:ENABLED")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/cloudasset"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudasset.LookupResourcesSearchAll(ctx, &cloudasset.LookupResourcesSearchAllArgs{
    			Scope: "organizations/0123456789",
    			AssetTypes: []string{
    				"serviceusage.googleapis.com/Service",
    			},
    			Query: pulumi.StringRef("displayName:cloudbuild.googleapis.com AND state:ENABLED"),
    		}, 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 cloudBuildProjects = Gcp.CloudAsset.GetResourcesSearchAll.Invoke(new()
        {
            Scope = "organizations/0123456789",
            AssetTypes = new[]
            {
                "serviceusage.googleapis.com/Service",
            },
            Query = "displayName:cloudbuild.googleapis.com AND state:ENABLED",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.cloudasset.CloudassetFunctions;
    import com.pulumi.gcp.cloudasset.inputs.GetResourcesSearchAllArgs;
    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 cloudBuildProjects = CloudassetFunctions.getResourcesSearchAll(GetResourcesSearchAllArgs.builder()
                .scope("organizations/0123456789")
                .assetTypes("serviceusage.googleapis.com/Service")
                .query("displayName:cloudbuild.googleapis.com AND state:ENABLED")
                .build());
    
        }
    }
    
    variables:
      cloudBuildProjects:
        fn::invoke:
          Function: gcp:cloudasset:getResourcesSearchAll
          Arguments:
            scope: organizations/0123456789
            assetTypes:
              - serviceusage.googleapis.com/Service
            query: displayName:cloudbuild.googleapis.com AND state:ENABLED
    

    Searching For All Service Accounts In A Project

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const projectServiceAccounts = gcp.cloudasset.getResourcesSearchAll({
        scope: "projects/my-project-id",
        assetTypes: ["iam.googleapis.com/ServiceAccount"],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    project_service_accounts = gcp.cloudasset.get_resources_search_all(scope="projects/my-project-id",
        asset_types=["iam.googleapis.com/ServiceAccount"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/cloudasset"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := cloudasset.LookupResourcesSearchAll(ctx, &cloudasset.LookupResourcesSearchAllArgs{
    			Scope: "projects/my-project-id",
    			AssetTypes: []string{
    				"iam.googleapis.com/ServiceAccount",
    			},
    		}, 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 projectServiceAccounts = Gcp.CloudAsset.GetResourcesSearchAll.Invoke(new()
        {
            Scope = "projects/my-project-id",
            AssetTypes = new[]
            {
                "iam.googleapis.com/ServiceAccount",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.cloudasset.CloudassetFunctions;
    import com.pulumi.gcp.cloudasset.inputs.GetResourcesSearchAllArgs;
    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 projectServiceAccounts = CloudassetFunctions.getResourcesSearchAll(GetResourcesSearchAllArgs.builder()
                .scope("projects/my-project-id")
                .assetTypes("iam.googleapis.com/ServiceAccount")
                .build());
    
        }
    }
    
    variables:
      projectServiceAccounts:
        fn::invoke:
          Function: gcp:cloudasset:getResourcesSearchAll
          Arguments:
            scope: projects/my-project-id
            assetTypes:
              - iam.googleapis.com/ServiceAccount
    

    Using getResourcesSearchAll

    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 getResourcesSearchAll(args: GetResourcesSearchAllArgs, opts?: InvokeOptions): Promise<GetResourcesSearchAllResult>
    function getResourcesSearchAllOutput(args: GetResourcesSearchAllOutputArgs, opts?: InvokeOptions): Output<GetResourcesSearchAllResult>
    def get_resources_search_all(asset_types: Optional[Sequence[str]] = None,
                                 query: Optional[str] = None,
                                 scope: Optional[str] = None,
                                 opts: Optional[InvokeOptions] = None) -> GetResourcesSearchAllResult
    def get_resources_search_all_output(asset_types: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                                 query: Optional[pulumi.Input[str]] = None,
                                 scope: Optional[pulumi.Input[str]] = None,
                                 opts: Optional[InvokeOptions] = None) -> Output[GetResourcesSearchAllResult]
    func LookupResourcesSearchAll(ctx *Context, args *LookupResourcesSearchAllArgs, opts ...InvokeOption) (*LookupResourcesSearchAllResult, error)
    func LookupResourcesSearchAllOutput(ctx *Context, args *LookupResourcesSearchAllOutputArgs, opts ...InvokeOption) LookupResourcesSearchAllResultOutput

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

    public static class GetResourcesSearchAll 
    {
        public static Task<GetResourcesSearchAllResult> InvokeAsync(GetResourcesSearchAllArgs args, InvokeOptions? opts = null)
        public static Output<GetResourcesSearchAllResult> Invoke(GetResourcesSearchAllInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetResourcesSearchAllResult> getResourcesSearchAll(GetResourcesSearchAllArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:cloudasset/getResourcesSearchAll:getResourcesSearchAll
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Scope string
    A scope can be a project, a folder, or an organization. The allowed value must be: organization number (such as "organizations/123"), folder number (such as "folders/1234"), project number (such as "projects/12345") or project id (such as "projects/abc")
    AssetTypes List<string>
    A list of asset types that this request searches for. If empty, it will search all the supported asset types.
    Query string
    The query statement. See how to construct a query for more information. If not specified or empty, it will search all the resources within the specified scope and asset_types.
    Scope string
    A scope can be a project, a folder, or an organization. The allowed value must be: organization number (such as "organizations/123"), folder number (such as "folders/1234"), project number (such as "projects/12345") or project id (such as "projects/abc")
    AssetTypes []string
    A list of asset types that this request searches for. If empty, it will search all the supported asset types.
    Query string
    The query statement. See how to construct a query for more information. If not specified or empty, it will search all the resources within the specified scope and asset_types.
    scope String
    A scope can be a project, a folder, or an organization. The allowed value must be: organization number (such as "organizations/123"), folder number (such as "folders/1234"), project number (such as "projects/12345") or project id (such as "projects/abc")
    assetTypes List<String>
    A list of asset types that this request searches for. If empty, it will search all the supported asset types.
    query String
    The query statement. See how to construct a query for more information. If not specified or empty, it will search all the resources within the specified scope and asset_types.
    scope string
    A scope can be a project, a folder, or an organization. The allowed value must be: organization number (such as "organizations/123"), folder number (such as "folders/1234"), project number (such as "projects/12345") or project id (such as "projects/abc")
    assetTypes string[]
    A list of asset types that this request searches for. If empty, it will search all the supported asset types.
    query string
    The query statement. See how to construct a query for more information. If not specified or empty, it will search all the resources within the specified scope and asset_types.
    scope str
    A scope can be a project, a folder, or an organization. The allowed value must be: organization number (such as "organizations/123"), folder number (such as "folders/1234"), project number (such as "projects/12345") or project id (such as "projects/abc")
    asset_types Sequence[str]
    A list of asset types that this request searches for. If empty, it will search all the supported asset types.
    query str
    The query statement. See how to construct a query for more information. If not specified or empty, it will search all the resources within the specified scope and asset_types.
    scope String
    A scope can be a project, a folder, or an organization. The allowed value must be: organization number (such as "organizations/123"), folder number (such as "folders/1234"), project number (such as "projects/12345") or project id (such as "projects/abc")
    assetTypes List<String>
    A list of asset types that this request searches for. If empty, it will search all the supported asset types.
    query String
    The query statement. See how to construct a query for more information. If not specified or empty, it will search all the resources within the specified scope and asset_types.

    getResourcesSearchAll Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Results List<GetResourcesSearchAllResult>
    A list of search results based on provided inputs. Structure is defined below.
    Scope string
    AssetTypes List<string>
    Query string
    Id string
    The provider-assigned unique ID for this managed resource.
    Results []GetResourcesSearchAllResult
    A list of search results based on provided inputs. Structure is defined below.
    Scope string
    AssetTypes []string
    Query string
    id String
    The provider-assigned unique ID for this managed resource.
    results List<GetResourcesSearchAllResult>
    A list of search results based on provided inputs. Structure is defined below.
    scope String
    assetTypes List<String>
    query String
    id string
    The provider-assigned unique ID for this managed resource.
    results GetResourcesSearchAllResult[]
    A list of search results based on provided inputs. Structure is defined below.
    scope string
    assetTypes string[]
    query string
    id str
    The provider-assigned unique ID for this managed resource.
    results Sequence[GetResourcesSearchAllResult]
    A list of search results based on provided inputs. Structure is defined below.
    scope str
    asset_types Sequence[str]
    query str
    id String
    The provider-assigned unique ID for this managed resource.
    results List<Property Map>
    A list of search results based on provided inputs. Structure is defined below.
    scope String
    assetTypes List<String>
    query String

    Supporting Types

    GetResourcesSearchAllResult

    AdditionalAttributes List<string>
    Additional searchable attributes of this resource. Informational only. The exact set of attributes is subject to change. For example: project id, DNS name etc.
    AssetType string
    The type of this resource.
    Description string
    One or more paragraphs of text description of this resource. Maximum length could be up to 1M bytes.
    DisplayName string
    The display name of this resource.
    Labels Dictionary<string, string>
    Labels associated with this resource.
    Location string
    Location can be global, regional like us-east1, or zonal like us-west1-b.
    Name string
    The full resource name. See Resource Names for more information.
    NetworkTags List<string>
    Network tags associated with this resource.
    Project string
    The project that this resource belongs to, in the form of projects/{project_number}.
    AdditionalAttributes []string
    Additional searchable attributes of this resource. Informational only. The exact set of attributes is subject to change. For example: project id, DNS name etc.
    AssetType string
    The type of this resource.
    Description string
    One or more paragraphs of text description of this resource. Maximum length could be up to 1M bytes.
    DisplayName string
    The display name of this resource.
    Labels map[string]string
    Labels associated with this resource.
    Location string
    Location can be global, regional like us-east1, or zonal like us-west1-b.
    Name string
    The full resource name. See Resource Names for more information.
    NetworkTags []string
    Network tags associated with this resource.
    Project string
    The project that this resource belongs to, in the form of projects/{project_number}.
    additionalAttributes List<String>
    Additional searchable attributes of this resource. Informational only. The exact set of attributes is subject to change. For example: project id, DNS name etc.
    assetType String
    The type of this resource.
    description String
    One or more paragraphs of text description of this resource. Maximum length could be up to 1M bytes.
    displayName String
    The display name of this resource.
    labels Map<String,String>
    Labels associated with this resource.
    location String
    Location can be global, regional like us-east1, or zonal like us-west1-b.
    name String
    The full resource name. See Resource Names for more information.
    networkTags List<String>
    Network tags associated with this resource.
    project String
    The project that this resource belongs to, in the form of projects/{project_number}.
    additionalAttributes string[]
    Additional searchable attributes of this resource. Informational only. The exact set of attributes is subject to change. For example: project id, DNS name etc.
    assetType string
    The type of this resource.
    description string
    One or more paragraphs of text description of this resource. Maximum length could be up to 1M bytes.
    displayName string
    The display name of this resource.
    labels {[key: string]: string}
    Labels associated with this resource.
    location string
    Location can be global, regional like us-east1, or zonal like us-west1-b.
    name string
    The full resource name. See Resource Names for more information.
    networkTags string[]
    Network tags associated with this resource.
    project string
    The project that this resource belongs to, in the form of projects/{project_number}.
    additional_attributes Sequence[str]
    Additional searchable attributes of this resource. Informational only. The exact set of attributes is subject to change. For example: project id, DNS name etc.
    asset_type str
    The type of this resource.
    description str
    One or more paragraphs of text description of this resource. Maximum length could be up to 1M bytes.
    display_name str
    The display name of this resource.
    labels Mapping[str, str]
    Labels associated with this resource.
    location str
    Location can be global, regional like us-east1, or zonal like us-west1-b.
    name str
    The full resource name. See Resource Names for more information.
    network_tags Sequence[str]
    Network tags associated with this resource.
    project str
    The project that this resource belongs to, in the form of projects/{project_number}.
    additionalAttributes List<String>
    Additional searchable attributes of this resource. Informational only. The exact set of attributes is subject to change. For example: project id, DNS name etc.
    assetType String
    The type of this resource.
    description String
    One or more paragraphs of text description of this resource. Maximum length could be up to 1M bytes.
    displayName String
    The display name of this resource.
    labels Map<String>
    Labels associated with this resource.
    location String
    Location can be global, regional like us-east1, or zonal like us-west1-b.
    name String
    The full resource name. See Resource Names for more information.
    networkTags List<String>
    Network tags associated with this resource.
    project String
    The project that this resource belongs to, in the form of projects/{project_number}.

    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