UNPKG

deep-package-manager

Version:
85 lines (70 loc) 1.66 kB
/** * Created by AlexanderC on 11/24/15. */ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.ElastiCacheDriver = undefined; var _AbstractDriver = require('./AbstractDriver'); var _ElasticacheService = require('../Service/ElasticacheService'); class ElastiCacheDriver extends _AbstractDriver.AbstractDriver { /** * @param {*} args */ constructor(...args) { super(...args); } /** * @returns {String[]} */ static get AVAILABLE_REGIONS() { return _ElasticacheService.ElasticacheService.AVAILABLE_REGIONS; } /** * @param {Function} cb */ list(cb) { this._listClusters(cb); } /** * @param {Function} cb * @param {String|null} nextMarker * @private */ _listClusters(cb, nextMarker = null) { let payload = { MaxRecords: ElastiCacheDriver.MAX_RECORDS, ShowCacheNodeInfo: false }; if (nextMarker) { payload.Marker = nextMarker; } this._awsService.describeCacheClusters(payload, (error, data) => { if (error) { cb(error); return; } for (let i in data.CacheClusters) { if (!data.CacheClusters.hasOwnProperty(i)) { continue; } let clusterData = data.CacheClusters[i]; let clusterId = clusterData.CacheClusterId; this._checkPushStack(clusterId, clusterId, clusterData); } if (data.Marker) { this._listClusters(cb, data.Marker); } else { cb(null); } }); } /** * @returns {Number} */ static get MAX_RECORDS() { return 100; } } exports.ElastiCacheDriver = ElastiCacheDriver;