UNPKG

10.7 kBJavaScriptView Raw
1"use strict";
2var _a, _b;
3Object.defineProperty(exports, "__esModule", { value: true });
4exports.QueryDefinition = exports.QueryString = void 0;
5const jsiiDeprecationWarnings = require("../.warnings.jsii.js");
6const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
7const core_1 = require("@aws-cdk/core");
8const _1 = require(".");
9/**
10 * Define a QueryString
11 */
12class QueryString {
13 constructor(props = {}) {
14 try {
15 jsiiDeprecationWarnings._aws_cdk_aws_logs_QueryStringProps(props);
16 }
17 catch (error) {
18 if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
19 Error.captureStackTrace(error, QueryString);
20 }
21 throw error;
22 }
23 this.fields = props.fields;
24 this.parse = props.parse;
25 this.filter = props.filter;
26 this.stats = props.stats;
27 this.sort = props.sort;
28 this.limit = props.limit;
29 this.display = props.display;
30 }
31 /**
32 * String representation of this QueryString.
33 */
34 toString() {
35 return noUndef({
36 fields: this.fields !== undefined ? this.fields.join(', ') : this.fields,
37 parse: this.parse,
38 filter: this.filter,
39 stats: this.stats,
40 sort: this.sort,
41 limit: this.limit,
42 display: this.display,
43 }).join(' | ');
44 }
45}
46exports.QueryString = QueryString;
47_a = JSII_RTTI_SYMBOL_1;
48QueryString[_a] = { fqn: "@aws-cdk/aws-logs.QueryString", version: "1.204.0" };
49function noUndef(x) {
50 const ret = [];
51 for (const [key, value] of Object.entries(x)) {
52 if (value !== undefined) {
53 ret.push(`${key} ${value}`);
54 }
55 }
56 return ret;
57}
58/**
59 * Define a query definition for CloudWatch Logs Insights
60 */
61class QueryDefinition extends core_1.Resource {
62 constructor(scope, id, props) {
63 super(scope, id, {
64 physicalName: props.queryDefinitionName,
65 });
66 try {
67 jsiiDeprecationWarnings._aws_cdk_aws_logs_QueryDefinitionProps(props);
68 }
69 catch (error) {
70 if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
71 Error.captureStackTrace(error, QueryDefinition);
72 }
73 throw error;
74 }
75 const queryDefinition = new _1.CfnQueryDefinition(this, 'Resource', {
76 name: props.queryDefinitionName,
77 queryString: props.queryString.toString(),
78 logGroupNames: typeof props.logGroups === 'undefined' ? [] : props.logGroups.flatMap(logGroup => logGroup.logGroupName),
79 });
80 this.queryDefinitionId = queryDefinition.attrQueryDefinitionId;
81 }
82}
83exports.QueryDefinition = QueryDefinition;
84_b = JSII_RTTI_SYMBOL_1;
85QueryDefinition[_b] = { fqn: "@aws-cdk/aws-logs.QueryDefinition", version: "1.204.0" };
86//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVlcnktZGVmaW5pdGlvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInF1ZXJ5LWRlZmluaXRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsd0NBQXlDO0FBRXpDLHdCQUF1QztBQW9FdkM7O0dBRUc7QUFDSCxNQUFhLFdBQVc7SUFTdEIsWUFBWSxRQUEwQixFQUFFOzs7Ozs7K0NBVDdCLFdBQVc7Ozs7UUFVcEIsSUFBSSxDQUFDLE1BQU0sR0FBRyxLQUFLLENBQUMsTUFBTSxDQUFDO1FBQzNCLElBQUksQ0FBQyxLQUFLLEdBQUcsS0FBSyxDQUFDLEtBQUssQ0FBQztRQUN6QixJQUFJLENBQUMsTUFBTSxHQUFHLEtBQUssQ0FBQyxNQUFNLENBQUM7UUFDM0IsSUFBSSxDQUFDLEtBQUssR0FBRyxLQUFLLENBQUMsS0FBSyxDQUFDO1FBQ3pCLElBQUksQ0FBQyxJQUFJLEdBQUcsS0FBSyxDQUFDLElBQUksQ0FBQztRQUN2QixJQUFJLENBQUMsS0FBSyxHQUFHLEtBQUssQ0FBQyxLQUFLLENBQUM7UUFDekIsSUFBSSxDQUFDLE9BQU8sR0FBRyxLQUFLLENBQUMsT0FBTyxDQUFDO0tBQzlCO0lBRUQ7O01BRUU7SUFDSyxRQUFRO1FBQ2Is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