@amaabca/aws-lex-custom-resources
Version:
AWS Lex infrastructure as code via the CDK
48 lines (47 loc) • 1.82 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const cdk = __importStar(require("@aws-cdk/core"));
class LexIntent extends cdk.Construct {
// the service token must match the exported service token by the lex-intent stack
constructor(scope, id, serviceToken, props) {
super(scope, id);
this.scope = scope;
this.id = id;
this.props = props;
this.props.name = id;
this.props.description = `${id} Intent`;
new cdk.CustomResource(scope, `${id}_Custom_Lex_Intent`, {
serviceToken: cdk.Fn.importValue(serviceToken),
properties: {
description: this.props.description,
props: JSON.stringify(this.props)
}
});
}
toCDK(version) {
return {
intentName: this.props.name,
intentVersion: version ? version : "$LATEST"
};
}
}
exports.default = LexIntent;