import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Describes a query that has been saved by a user. * * To get more information about SavedQuery, see: * * * [API documentation](https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.locations.savedQueries) * * How-to Guides * * [Official Documentation](https://cloud.google.com/logging/docs/apis) * * [Save and share SQL queries](https://docs.cloud.google.com/logging/docs/analyze/save-share-query) * * [Save and share queries](https://docs.cloud.google.com/logging/docs/view/building-queries#saved-queries) * * ## Example Usage * * ### Logging Saved Query Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const savedQuery = new gcp.logging.SavedQuery("saved_query", { * name: "my-saved-query", * displayName: "My Saved Query", * parent: "projects/my-project-name", * location: "global", * description: "A saved query", * loggingQuery: { * filter: "resource.type=gce_instance", * }, * visibility: "SHARED", * }); * ``` * ### Logging Saved Query Private * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const savedQuery = new gcp.logging.SavedQuery("saved_query", { * name: "my-saved-query-private", * displayName: "My Saved Query", * parent: "projects/my-project-name", * location: "global", * description: "A saved query", * loggingQuery: { * filter: "resource.type=gce_instance", * }, * visibility: "PRIVATE", * }); * ``` * ### Logging Saved Query Summary Fields * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const savedQuery = new gcp.logging.SavedQuery("saved_query", { * name: "my-saved-query-summary-fields", * displayName: "My Saved Query", * parent: "projects/my-project-name", * location: "global", * description: "A saved query", * loggingQuery: { * filter: "resource.type=gce_instance", * summaryFields: [ * { * field: "jsonPayload.paymentId", * }, * { * field: "jsonPayload.errorMessage", * }, * ], * summaryFieldStart: 100, * }, * visibility: "SHARED", * }); * ``` * ### Logging Saved Query Sql Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const savedQuery = new gcp.logging.SavedQuery("saved_query", { * name: "my-saved-query-sql", * displayName: "My Saved Query", * parent: "projects/my-project-name", * location: "global", * description: "A saved query", * opsAnalyticsQuery: { * sqlQueryText: `SELECT * timestamp, log_name, severity, json_payload, resource, labels * FROM * VIEW * WHERE * timestamp > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR) * ORDER BY timestamp ASC * LIMIT 100 * `, * }, * visibility: "SHARED", * }); * ``` * * ## Import * * SavedQuery can be imported using any of these accepted formats: * * * `{{parent}}/locations/{{location}}/savedQueries/{{name}}` * * When using the `pulumi import` command, SavedQuery can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:logging/savedQuery:SavedQuery default {{parent}}/locations/{{location}}/savedQueries/{{name}} * ``` */ export declare class SavedQuery extends pulumi.CustomResource { /** * Get an existing SavedQuery resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: SavedQueryState, opts?: pulumi.CustomResourceOptions): SavedQuery; /** * Returns true if the given object is an instance of SavedQuery. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is SavedQuery; /** * Output only. The creation timestamp of the saved query. */ readonly createTime: pulumi.Output; /** * A description of the saved query. */ readonly description: pulumi.Output; /** * The user-visible display name of the saved query. */ readonly displayName: pulumi.Output; /** * The location of the resource see * [supported regions](https://docs.cloud.google.com/logging/docs/region-support#bucket-regions). */ readonly location: pulumi.Output; /** * The contents of the saved query. * Structure is documented below. */ readonly loggingQuery: pulumi.Output; /** * The name of the saved query. For example: `my-saved-query` */ readonly name: pulumi.Output; /** * The contents of the saved query. * Structure is documented below. */ readonly opsAnalyticsQuery: pulumi.Output; /** * The parent of the resource. */ readonly parent: pulumi.Output; /** * Output only. The last update timestamp of the saved query. */ readonly updateTime: pulumi.Output; /** * The visibility of the saved query. * Possible values are: `SHARED`, `PRIVATE`. */ readonly visibility: pulumi.Output; /** * Create a SavedQuery resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: SavedQueryArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering SavedQuery resources. */ export interface SavedQueryState { /** * Output only. The creation timestamp of the saved query. */ createTime?: pulumi.Input; /** * A description of the saved query. */ description?: pulumi.Input; /** * The user-visible display name of the saved query. */ displayName?: pulumi.Input; /** * The location of the resource see * [supported regions](https://docs.cloud.google.com/logging/docs/region-support#bucket-regions). */ location?: pulumi.Input; /** * The contents of the saved query. * Structure is documented below. */ loggingQuery?: pulumi.Input; /** * The name of the saved query. For example: `my-saved-query` */ name?: pulumi.Input; /** * The contents of the saved query. * Structure is documented below. */ opsAnalyticsQuery?: pulumi.Input; /** * The parent of the resource. */ parent?: pulumi.Input; /** * Output only. The last update timestamp of the saved query. */ updateTime?: pulumi.Input; /** * The visibility of the saved query. * Possible values are: `SHARED`, `PRIVATE`. */ visibility?: pulumi.Input; } /** * The set of arguments for constructing a SavedQuery resource. */ export interface SavedQueryArgs { /** * A description of the saved query. */ description?: pulumi.Input; /** * The user-visible display name of the saved query. */ displayName: pulumi.Input; /** * The location of the resource see * [supported regions](https://docs.cloud.google.com/logging/docs/region-support#bucket-regions). */ location: pulumi.Input; /** * The contents of the saved query. * Structure is documented below. */ loggingQuery?: pulumi.Input; /** * The name of the saved query. For example: `my-saved-query` */ name?: pulumi.Input; /** * The contents of the saved query. * Structure is documented below. */ opsAnalyticsQuery?: pulumi.Input; /** * The parent of the resource. */ parent: pulumi.Input; /** * The visibility of the saved query. * Possible values are: `SHARED`, `PRIVATE`. */ visibility: pulumi.Input; }