UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

90 lines 3.59 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.QueryDefinition = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a CloudWatch Logs query definition resource. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.cloudwatch.QueryDefinition("example", { * name: "custom_query", * logGroupNames: [ * "/aws/logGroup1", * "/aws/logGroup2", * ], * queryString: `fields @timestamp, @message * | sort @timestamp desc * | limit 25 * `, * }); * ``` * * ## Import * * Using `pulumi import`, import CloudWatch query definitions using the query definition ARN. The ARN can be found on the "Edit Query" page for the query in the AWS Console. For example: * * ```sh * $ pulumi import aws:cloudwatch/queryDefinition:QueryDefinition example arn:aws:logs:us-west-2:123456789012:query-definition:269951d7-6f75-496d-9d7b-6b7a5486bdbd * ``` */ class QueryDefinition extends pulumi.CustomResource { /** * Get an existing QueryDefinition 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, id, state, opts) { return new QueryDefinition(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of QueryDefinition. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === QueryDefinition.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["logGroupNames"] = state?.logGroupNames; resourceInputs["name"] = state?.name; resourceInputs["queryDefinitionId"] = state?.queryDefinitionId; resourceInputs["queryString"] = state?.queryString; resourceInputs["region"] = state?.region; } else { const args = argsOrState; if (args?.queryString === undefined && !opts.urn) { throw new Error("Missing required property 'queryString'"); } resourceInputs["logGroupNames"] = args?.logGroupNames; resourceInputs["name"] = args?.name; resourceInputs["queryString"] = args?.queryString; resourceInputs["region"] = args?.region; resourceInputs["queryDefinitionId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(QueryDefinition.__pulumiType, name, resourceInputs, opts); } } exports.QueryDefinition = QueryDefinition; /** @internal */ QueryDefinition.__pulumiType = 'aws:cloudwatch/queryDefinition:QueryDefinition'; //# sourceMappingURL=queryDefinition.js.map