UNPKG

5.69 kBJavaScriptView Raw
1"use strict";
2var _a;
3Object.defineProperty(exports, "__esModule", { value: true });
4exports.LogStream = 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 logs_generated_1 = require("./logs.generated");
9/**
10 * Define a Log Stream in a Log Group
11 */
12class LogStream extends core_1.Resource {
13 constructor(scope, id, props) {
14 super(scope, id, {
15 physicalName: props.logStreamName,
16 });
17 try {
18 jsiiDeprecationWarnings._aws_cdk_aws_logs_LogStreamProps(props);
19 }
20 catch (error) {
21 if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
22 Error.captureStackTrace(error, LogStream);
23 }
24 throw error;
25 }
26 const resource = new logs_generated_1.CfnLogStream(this, 'Resource', {
27 logGroupName: props.logGroup.logGroupName,
28 logStreamName: this.physicalName,
29 });
30 resource.applyRemovalPolicy(props.removalPolicy);
31 this.logStreamName = this.getResourceNameAttribute(resource.ref);
32 }
33 /**
34 * Import an existing LogGroup
35 */
36 static fromLogStreamName(scope, id, logStreamName) {
37 class Import extends core_1.Resource {
38 constructor() {
39 super(...arguments);
40 this.logStreamName = logStreamName;
41 }
42 }
43 return new Import(scope, id);
44 }
45}
46exports.LogStream = LogStream;
47_a = JSII_RTTI_SYMBOL_1;
48LogStream[_a] = { fqn: "@aws-cdk/aws-logs.LogStream", version: "1.204.0" };
49//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nLXN0cmVhbS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbImxvZy1zdHJlYW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsd0NBQW1FO0FBR25FLHFEQUFnRDtBQTJDaEQ7O0dBRUc7QUFDSCxNQUFhLFNBQVUsU0FBUSxlQUFRO0lBaUJyQyxZQUFZLEtBQWdCLEVB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