UNPKG

@pulumi/gcp

Version:

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

143 lines (142 loc) 5.79 kB
import * as pulumi from "@pulumi/pulumi"; import * as outputs from "../types/output"; /** * Searches all Google Cloud resources within the specified scope, such as a project, folder, or organization. See the * [REST API](https://cloud.google.com/asset-inventory/docs/reference/rest/v1/TopLevel/searchAllResources) * 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.getSearchAllResources({ * 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.getSearchAllResources({ * 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.getSearchAllResources({ * scope: "projects/my-project-id", * assetTypes: ["iam.googleapis.com/ServiceAccount"], * }); * ``` */ export declare function getSearchAllResources(args: GetSearchAllResourcesArgs, opts?: pulumi.InvokeOptions): Promise<GetSearchAllResourcesResult>; /** * A collection of arguments for invoking getSearchAllResources. */ export interface GetSearchAllResourcesArgs { /** * 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 search is limited to the resources within the scope. 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 getSearchAllResources. */ export interface GetSearchAllResourcesResult { 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.GetSearchAllResourcesResult[]; readonly scope: string; } /** * Searches all Google Cloud resources within the specified scope, such as a project, folder, or organization. See the * [REST API](https://cloud.google.com/asset-inventory/docs/reference/rest/v1/TopLevel/searchAllResources) * 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.getSearchAllResources({ * 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.getSearchAllResources({ * 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.getSearchAllResources({ * scope: "projects/my-project-id", * assetTypes: ["iam.googleapis.com/ServiceAccount"], * }); * ``` */ export declare function getSearchAllResourcesOutput(args: GetSearchAllResourcesOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetSearchAllResourcesResult>; /** * A collection of arguments for invoking getSearchAllResources. */ export interface GetSearchAllResourcesOutputArgs { /** * 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 search is limited to the resources within the scope. 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>; }