UNPKG

1.37 kBJavaScriptView Raw
1/**
2 * This module overrides the Kes Class
3 * to support specific needs of the Cumulus Deployment.
4 *
5 * Specifically, this module changes the default Kes Deployment in the following ways:
6 *
7 * - Adds checking for this.config.params.db and using it for cloudFormation parameters
8 * intended for the db deployment
9 *
10 */
11
12'use strict';
13
14const { Kes } = require('kes');
15
16/**
17 * A subclass of Kes class that overrides cloudFormation method
18 *
19 * @class UpdatedKes
20 */
21class UpdatedKes extends Kes {
22 /**
23 * Overrides the default constructor.
24 * Sets the cf_template_name to have a prefix.
25 *
26 * @param {Object} config - kes config object
27 */
28 constructor(config) {
29 super(config);
30 this.cf_template_name = `db.${this.cf_template_name}`;
31 this.templateUrl = `https://s3.amazonaws.com/${this.bucket}/${this.stack}/${this.cf_template_name}`;
32 }
33
34 /**
35 * Calls CloudFormation's update-stack or create-stack methods
36 * Changed to support multi-template configs by checking for params sub-objects, i.e.:
37 * params:
38 * db:
39 * - name: someName
40 * value: someValue
41 *
42 * @returns {Promise} returns the promise of an AWS response object
43 */
44 cloudFormation() {
45 if (this.config.db && this.config.db.params) this.config.params = this.config.db.params;
46 return super.cloudFormation();
47 }
48}
49
50module.exports = UpdatedKes;