@amaabca/aws-lex-custom-resources
Version:
AWS Lex infrastructure as code via the CDK
43 lines (42 loc) • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const constructs_1 = require("constructs");
const aws_cdk_lib_1 = require("aws-cdk-lib");
const __1 = require("..");
class default_1 extends constructs_1.Construct {
constructor(scope, id, serviceToken, props) {
super(scope, id);
this.scope = scope;
this.serviceToken = serviceToken;
this.resource = new aws_cdk_lib_1.CfnResource(scope, `LexBot-${id}`, {
type: 'Custom::LexBot',
properties: {
ServiceToken: serviceToken,
...props,
},
});
}
automaticVersion() {
return new __1.LexBotVersion(this.scope, 'AutomaticVersion', this.serviceToken, {
botId: this.botId(),
'CR.botLocaleIds': this.botLocaleIds(),
'CR.lastUpdatedDateTime': this.lastUpdatedDateTime(),
});
}
addAlias(aliasProps) {
return new __1.LexBotAlias(this.scope, `BotAlias-${aliasProps.botAliasName}`, this.serviceToken, {
botId: this.botId(),
...aliasProps,
});
}
lastUpdatedDateTime() {
return this.resource.getAtt('lastUpdatedDateTime');
}
botId() {
return this.resource.getAtt('botId');
}
botLocaleIds() {
return this.resource.getAtt('botLocaleIds');
}
}
exports.default = default_1;