diff --git a/lib/createAliasStack.js b/lib/createAliasStack.js index adadc43..7189584 100644 --- a/lib/createAliasStack.js +++ b/lib/createAliasStack.js @@ -38,9 +38,7 @@ module.exports = { return this._provider.request( 'CloudFormation', 'createStack', - params, - this._options.stage, - this._options.region + params ).then(cfData => this.monitorStack('create', cfData)); }, @@ -73,9 +71,7 @@ module.exports = { return this._provider.request('CloudFormation', 'describeStackResources', - { StackName: this._aliasStackName }, - this._options.stage, - this._options.region) + { StackName: this._aliasStackName }) .then(() => BbPromise.resolve('alreadyCreated')) .catch(e => { if (_.includes(e.message, 'does not exist')) { diff --git a/lib/listAliases.js b/lib/listAliases.js index 1d1e80f..2cf03e2 100644 --- a/lib/listAliases.js +++ b/lib/listAliases.js @@ -22,18 +22,14 @@ module.exports = { { restApiId: apiId, stageName: stageName - }, - this._options.stage, - this._options.region) + }) .then(stage => { return this._provider.request('APIGateway', 'getDeployment', { restApiId: apiId, deploymentId: stage.deploymentId - }, - this._options.stage, - this._options.region); + }); }) .catch(err => { if (/^Invalid stage/.test(err.message)) { @@ -50,9 +46,7 @@ module.exports = { { LogicalResourceId: 'ApiGatewayRestApi', StackName: stackName - }, - this._options.stage, - this._options.region) + }) .then(cfData => cfData.StackResourceDetail.PhysicalResourceId) .catch(() => BbPromise.resolve(null)); }, diff --git a/lib/logs.js b/lib/logs.js index 69ebd0f..1170345 100644 --- a/lib/logs.js +++ b/lib/logs.js @@ -73,9 +73,7 @@ module.exports = { return this.provider .request('CloudWatchLogs', 'describeLogStreams', - params, - this.options.stage, - this.options.region) + params) .then(reply => { if (!reply || _.isEmpty(reply.logStreams)) { throw new this.serverless.classes @@ -104,9 +102,7 @@ module.exports = { return this.provider.request( 'CloudWatchLogs', 'describeLogStreams', - params, - this.options.stage, - this.options.region + params ) .then(reply => { if (!reply || _.isEmpty(reply.logStreams)) { @@ -196,9 +192,7 @@ module.exports = { return this.provider .request('CloudWatchLogs', 'filterLogEvents', - params, - this.options.stage, - this.options.region) + params) .then(results => { if (results.events) { _.forEach(results.events, e => { diff --git a/lib/removeAlias.js b/lib/removeAlias.js index 4b1126c..0f423f3 100644 --- a/lib/removeAlias.js +++ b/lib/removeAlias.js @@ -171,9 +171,7 @@ module.exports = { return this._provider.request('CloudFormation', 'updateStack', - params, - this.options.stage, - this.options.region) + params) .then(cfData => this.monitorStack('update', cfData)) .then(() => BbPromise.resolve([ currentTemplate, aliasStackTemplates, currentAliasStackTemplate ])) .catch(err => { @@ -193,9 +191,7 @@ module.exports = { return this._provider.request('CloudFormation', 'deleteStack', - { StackName: stackName }, - this._options.stage, - this._options.region) + { StackName: stackName }) .then(cfData => { // monitorStack wants a StackId member cfData.StackId = stackName; diff --git a/lib/stackInformation.js b/lib/stackInformation.js index 62479b6..7c41e10 100644 --- a/lib/stackInformation.js +++ b/lib/stackInformation.js @@ -21,9 +21,7 @@ module.exports = { return this._provider.request('CloudFormation', 'getTemplate', - params, - this._options.stage, - this._options.region) + params) .then(cfData => { try { return BbPromise.resolve(JSON.parse(cfData.TemplateBody)); @@ -45,9 +43,7 @@ module.exports = { return this._provider.request('CloudFormation', 'listImports', - params, - this._options.stage, - this._options.region) + params) .then(cfData => BbPromise.resolve(cfData.Imports)); }, @@ -61,9 +57,7 @@ module.exports = { return this._provider.request('CloudFormation', 'getTemplate', - params, - this._options.stage, - this._options.region) + params) .then(cfData => { return BbPromise.resolve(JSON.parse(cfData.TemplateBody)); }) @@ -98,9 +92,7 @@ module.exports = { return this._provider.request('CloudFormation', 'describeStackResources', - { StackName: stackName }, - this._options.stage, - this._options.region); + { StackName: stackName }); }, aliasStacksDescribeResource(resourceId) { @@ -112,9 +104,7 @@ module.exports = { { StackName: stackName, LogicalResourceId: resourceId - }, - this._options.stage, - this._options.region); + }); }, aliasStacksDescribeAliases() { @@ -124,9 +114,7 @@ module.exports = { return this._provider.request('CloudFormation', 'listImports', - params, - this._options.stage, - this._options.region) + params) .then(cfData => BbPromise.resolve(cfData.Imports)) .mapSeries(stack => { const describeParams = { @@ -135,9 +123,7 @@ module.exports = { return this._provider.request('CloudFormation', 'describeStackResources', - describeParams, - this._options.stage, - this._options.region); + describeParams); }); }, @@ -188,9 +174,7 @@ module.exports = { const stackName = `${this._provider.naming.getStackName()}-${aliasName}`; return this._provider.request('CloudFormation', 'describeStackResources', - { StackName: stackName }, - this._options.stage, - this._options.region); + { StackName: stackName }); }, aliasGetAliasFunctionVersions(aliasName) { @@ -207,9 +191,7 @@ module.exports = { aliasGetAliasLatestFunctionVersionByFunctionName(aliasName, functionName) { return this._provider.request('Lambda', 'getAlias', - { FunctionName: functionName, Name: aliasName }, - this._options.stage, - this._options.region) + { FunctionName: functionName, Name: aliasName }) .then(result => _.get(result, 'FunctionVersion', null)); }, diff --git a/lib/updateAliasStack.js b/lib/updateAliasStack.js index 15e7ec2..31ad07a 100644 --- a/lib/updateAliasStack.js +++ b/lib/updateAliasStack.js @@ -38,9 +38,7 @@ module.exports = { return this._provider.request('CloudFormation', 'createStack', - params, - this._options.stage, - this._options.region) + params) .then((cfData) => this.monitorStack('create', cfData)); }, @@ -81,9 +79,7 @@ module.exports = { return this._provider.request('CloudFormation', 'updateStack', - params, - this._options.stage, - this._options.region) + params) .then((cfData) => this.monitorStack('update', cfData)) .catch((e) => { if (e.message === NO_UPDATE_MESSAGE) { diff --git a/lib/updateFunctionAlias.js b/lib/updateFunctionAlias.js index 5319a67..c42d577 100644 --- a/lib/updateFunctionAlias.js +++ b/lib/updateFunctionAlias.js @@ -22,8 +22,7 @@ module.exports = { return this.provider.request( 'Lambda', 'getFunction', - params, - this.options.stage, this.options.region + params ); }) .then(result => { @@ -37,8 +36,7 @@ module.exports = { return this.provider.request( 'Lambda', 'publishVersion', - params, - this.options.stage, this.options.region + params ); }) .then(result => { @@ -53,8 +51,7 @@ module.exports = { return this.provider.request( 'Lambda', 'updateAlias', - params, - this.options.stage, this.options.region + params ); }) .then(result => { diff --git a/lib/uploadAliasArtifacts.js b/lib/uploadAliasArtifacts.js index ade3154..6f6267b 100644 --- a/lib/uploadAliasArtifacts.js +++ b/lib/uploadAliasArtifacts.js @@ -25,9 +25,7 @@ module.exports = { return this.provider.request('S3', 'putObject', - params, - this._options.stage, - this._options.region); + params); }, uploadAliasArtifacts() { diff --git a/test/createAliasStack.test.js b/test/createAliasStack.test.js index b2e3053..4c4783c 100644 --- a/test/createAliasStack.test.js +++ b/test/createAliasStack.test.js @@ -82,7 +82,7 @@ describe('createAliasStack', () => { expect(providerRequestStub).to.have.been.calledOnce, expect(monitorStackStub).to.have.been.calledOnce, expect(providerRequestStub).to.have.been - .calledWithExactly('CloudFormation', 'createStack', expectedCFData, 'myStage', 'us-east-1'), + .calledWithExactly('CloudFormation', 'createStack', expectedCFData), expect(monitorStackStub).to.have.been .calledWithExactly('create', requestResult) ])); @@ -117,7 +117,7 @@ describe('createAliasStack', () => { .then(() => BbPromise.all([ expect(providerRequestStub).to.have.been.calledOnce, expect(providerRequestStub).to.have.been - .calledWithExactly('CloudFormation', 'createStack', expectedCFData, 'myStage', 'us-east-1'), + .calledWithExactly('CloudFormation', 'createStack', expectedCFData), ])); }); @@ -208,7 +208,7 @@ describe('createAliasStack', () => { expect(providerRequestStub).to.have.been.calledOnce, expect(createAliasStub).to.not.have.been.called, expect(providerRequestStub).to.have.been - .calledWithExactly('CloudFormation', 'describeStackResources', expectedCFData, 'myStage', 'us-east-1'), + .calledWithExactly('CloudFormation', 'describeStackResources', expectedCFData), ])); }); diff --git a/test/logs.test.js b/test/logs.test.js index 65a1887..f6631cf 100644 --- a/test/logs.test.js +++ b/test/logs.test.js @@ -220,9 +220,7 @@ describe('logs', () => { descending: true, limit: 50, orderBy: 'LastEventTime', - }, - awsAlias.options.stage, - awsAlias.options.region + } ), expect(logStreamNames).to.have.lengthOf(2), expect(logStreamNames[0]) @@ -284,9 +282,7 @@ describe('logs', () => { descending: true, limit: 50, orderBy: 'LastEventTime', - }, - awsAlias.options.stage, - awsAlias.options.region + } ), expect(logStreamNames).to.have.lengthOf(4), ])); @@ -355,9 +351,7 @@ describe('logs', () => { logStreamNames: logStreamNamesMock, filterPattern: 'error', startTime: 1475269200000, - }, - awsAlias.options.stage, - awsAlias.options.region + } ), ])); }); @@ -405,9 +399,7 @@ describe('logs', () => { logStreamNames: logStreamNamesMock, startTime: 1287532800000, filterPattern: 'error', - }, - awsAlias.options.stage, - awsAlias.options.region + } ), ])); }); @@ -470,7 +462,7 @@ describe('logs', () => { expect(formatter(testEvent)).to.be.a('string') .that.contains('This is a test message'); expect(formatter(testEvent)).to.be.a('string') - .that.contains('2017-07-09 00:00:00.000 (+'); + .that.contains('2017-07-09 00:00:00.000 ('); }); }); }); diff --git a/test/updateAliasStack.test.js b/test/updateAliasStack.test.js index 41b115c..8975d8f 100644 --- a/test/updateAliasStack.test.js +++ b/test/updateAliasStack.test.js @@ -84,7 +84,7 @@ describe('updateAliasStack', () => { expect(providerRequestStub).to.have.been.calledOnce, expect(monitorStackStub).to.have.been.calledOnce, expect(providerRequestStub).to.have.been - .calledWithExactly('CloudFormation', 'createStack', expectedCFData, 'myStage', 'us-east-1'), + .calledWithExactly('CloudFormation', 'createStack', expectedCFData), expect(monitorStackStub).to.have.been .calledWithExactly('create', requestResult) ])); @@ -119,7 +119,7 @@ describe('updateAliasStack', () => { .then(() => BbPromise.all([ expect(providerRequestStub).to.have.been.calledOnce, expect(providerRequestStub).to.have.been - .calledWithExactly('CloudFormation', 'createStack', expectedCFData, 'myStage', 'us-east-1'), + .calledWithExactly('CloudFormation', 'createStack', expectedCFData), ])); }); @@ -147,7 +147,7 @@ describe('updateAliasStack', () => { .then(() => BbPromise.all([ expect(providerRequestStub).to.have.been.calledOnce, expect(providerRequestStub).to.have.been - .calledWithExactly('CloudFormation', 'createStack', expectedCFData, 'myStage', 'us-east-1'), + .calledWithExactly('CloudFormation', 'createStack', expectedCFData), ])); }); @@ -186,7 +186,7 @@ describe('updateAliasStack', () => { expect(providerRequestStub).to.have.been.calledOnce, expect(monitorStackStub).to.have.been.calledOnce, expect(providerRequestStub).to.have.been - .calledWithExactly('CloudFormation', 'updateStack', expectedCFData, 'myStage', 'us-east-1'), + .calledWithExactly('CloudFormation', 'updateStack', expectedCFData), expect(monitorStackStub).to.have.been .calledWithExactly('update', requestResult) ])); @@ -220,7 +220,7 @@ describe('updateAliasStack', () => { .then(() => BbPromise.all([ expect(providerRequestStub).to.have.been.calledOnce, expect(providerRequestStub).to.have.been - .calledWithExactly('CloudFormation', 'updateStack', expectedCFData, 'myStage', 'us-east-1'), + .calledWithExactly('CloudFormation', 'updateStack', expectedCFData), ])); }); @@ -247,7 +247,7 @@ describe('updateAliasStack', () => { .then(() => BbPromise.all([ expect(providerRequestStub).to.have.been.calledOnce, expect(providerRequestStub).to.have.been - .calledWithExactly('CloudFormation', 'updateStack', expectedCFData, 'myStage', 'us-east-1'), + .calledWithExactly('CloudFormation', 'updateStack', expectedCFData), ])); }); diff --git a/test/uploadAliasArtifacts.test.js b/test/uploadAliasArtifacts.test.js index 5174654..60c1bdc 100644 --- a/test/uploadAliasArtifacts.test.js +++ b/test/uploadAliasArtifacts.test.js @@ -73,7 +73,7 @@ describe('uploadAliasArtifacts', () => { .then(() => BbPromise.all([ expect(providerRequestStub).to.have.been.calledOnce, expect(providerRequestStub).to.have.been - .calledWithExactly('S3', 'putObject', expectedData, 'myStage', 'us-east-1'), + .calledWithExactly('S3', 'putObject', expectedData), ])); }); @@ -107,7 +107,7 @@ describe('uploadAliasArtifacts', () => { .then(() => BbPromise.all([ expect(providerRequestStub).to.have.been.calledOnce, expect(providerRequestStub).to.have.been - .calledWithExactly('S3', 'putObject', expectedData, 'myStage', 'us-east-1'), + .calledWithExactly('S3', 'putObject', expectedData), ])); }); @@ -138,7 +138,7 @@ describe('uploadAliasArtifacts', () => { .then(() => BbPromise.all([ expect(providerRequestStub).to.have.been.calledOnce, expect(providerRequestStub).to.have.been - .calledWithExactly('S3', 'putObject', expectedData, 'myStage', 'us-east-1'), + .calledWithExactly('S3', 'putObject', expectedData), ])); });