UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

143 lines (142 loc) 5.65 kB
import * as pulumi from "@pulumi/pulumi"; import * as outputs from "../types/output"; /** * Retrieve all the resources within a given accessible CRM scope (project/folder/organization). See the * [REST API](https://cloud.google.com/asset-inventory/docs/reference/rest/v1p1beta1/resources/searchAll) * for more details. * * ## Example Usage * * ### Searching For All Projects In An Org * * ```typescript * 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"], * }); * ``` * * ### Searching For All Projects With CloudBuild API Enabled * * ```typescript * 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", * }); * ``` * * ### Searching For All Service Accounts In A Project * * ```typescript * 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"], * }); * ``` */ export declare function getResourcesSearchAll(args: GetResourcesSearchAllArgs, opts?: pulumi.InvokeOptions): Promise<GetResourcesSearchAllResult>; /** * A collection of arguments for invoking getResourcesSearchAll. */ export interface GetResourcesSearchAllArgs { /** * A list of asset types that this request searches for. If empty, it will search all the [supported asset types](https://cloud.google.com/asset-inventory/docs/supported-asset-types). */ assetTypes?: string[]; /** * The query statement. See [how to construct a query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) for more information. If not specified or empty, it will search all the resources within the specified `scope` and `assetTypes`. */ query?: 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") */ scope: string; } /** * A collection of values returned by getResourcesSearchAll. */ export interface GetResourcesSearchAllResult { readonly assetTypes?: string[]; /** * The provider-assigned unique ID for this managed resource. */ readonly id: string; readonly query?: string; /** * A list of search results based on provided inputs. Structure is defined below. */ readonly results: outputs.cloudasset.GetResourcesSearchAllResult[]; readonly scope: string; } /** * Retrieve all the resources within a given accessible CRM scope (project/folder/organization). See the * [REST API](https://cloud.google.com/asset-inventory/docs/reference/rest/v1p1beta1/resources/searchAll) * for more details. * * ## Example Usage * * ### Searching For All Projects In An Org * * ```typescript * 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"], * }); * ``` * * ### Searching For All Projects With CloudBuild API Enabled * * ```typescript * 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", * }); * ``` * * ### Searching For All Service Accounts In A Project * * ```typescript * 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"], * }); * ``` */ export declare function getResourcesSearchAllOutput(args: GetResourcesSearchAllOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetResourcesSearchAllResult>; /** * A collection of arguments for invoking getResourcesSearchAll. */ export interface GetResourcesSearchAllOutputArgs { /** * A list of asset types that this request searches for. If empty, it will search all the [supported asset types](https://cloud.google.com/asset-inventory/docs/supported-asset-types). */ assetTypes?: pulumi.Input<pulumi.Input<string>[]>; /** * The query statement. See [how to construct a query](https://cloud.google.com/asset-inventory/docs/searching-resources#how_to_construct_a_query) for more information. If not specified or empty, it will search all the resources within the specified `scope` and `assetTypes`. */ query?: pulumi.Input<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") */ scope: pulumi.Input<string>; }