mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
adds Project.getAllRegionNames(stageName)
This commit is contained in:
parent
47dea979d8
commit
4e45bc3a97
@ -263,6 +263,10 @@ class Project extends SerializerFileSystem {
|
||||
return this.getStage( stageName ).getAllRegions();
|
||||
}
|
||||
|
||||
getAllRegionNames(stageName){
|
||||
return _.map(this.getAllRegions(stageName), 'name');
|
||||
}
|
||||
|
||||
setRegion(stageName, region){
|
||||
let stage = this.getStage(stageName);
|
||||
stage.setRegion(region);
|
||||
|
||||
@ -169,7 +169,7 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
|
||||
// Set defaults
|
||||
_this.evt.options.names = _this.evt.options.names ? _this.evt.options.names : [];
|
||||
_this.regions = _this.evt.options.region ? [_this.evt.options.region] : _this.project.getAllRegions(_this.evt.options.stage).map(r => {return r.name;});
|
||||
_this.regions = _this.evt.options.region ? [_this.evt.options.region] : _this.project.getAllRegionNames(_this.evt.options.stage);
|
||||
|
||||
if (_this.evt.options.names.length) {
|
||||
_this.evt.options.names.forEach(function(name) {
|
||||
|
||||
@ -151,7 +151,7 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
|
||||
// Set defaults
|
||||
_this.evt.options.names = _this.evt.options.names ? _this.evt.options.names : [];
|
||||
_this.regions = _this.evt.options.region ? [_this.evt.options.region] : Object.keys(_this.meta.stages[_this.evt.options.stage].regions);
|
||||
_this.regions = _this.evt.options.region ? [_this.evt.options.region] : _this.project.getAllRegionNames(_this.evt.options.stage);
|
||||
|
||||
if (_this.evt.options.names.length) {
|
||||
_this.evt.options.names.forEach(function(endpointName) {
|
||||
|
||||
@ -186,8 +186,7 @@ module.exports = function(SPlugin, serverlessPath) {
|
||||
_this.project = _this.S.getProject();
|
||||
|
||||
// Set Deploy Regions
|
||||
_this.regions = _this.evt.options.region ? [_this.evt.options.region] : _this.S.getProject().getAllRegions(_this.evt.options.stage).map(r => r.name);
|
||||
|
||||
_this.regions = _this.evt.options.region ? [_this.evt.options.region] : _this.S.getProject().getAllRegionNames(_this.evt.options.stage);
|
||||
|
||||
if (_this.evt.options.names.length) {
|
||||
_this.evt.options.names.forEach(function(name) {
|
||||
|
||||
@ -472,7 +472,7 @@ module.exports = {
|
||||
return BbPromise.reject(new SError(`Invalid stage ${stage}`, SError.errorCodes.UNKNOWN));
|
||||
}
|
||||
|
||||
regions = _.map(S.getProject().getAllRegions(stage), 'name');
|
||||
regions = S.getProject().getAllRegionNames(stage);
|
||||
}
|
||||
|
||||
return BbPromise.map(regions, (region => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user