From a2dfbf4e7aa4fc44757237c451e7ad8221448d58 Mon Sep 17 00:00:00 2001 From: icereval Date: Sun, 20 Sep 2015 17:20:32 -0400 Subject: [PATCH] remove duplicated methods _createEndpointMethodResponses _createEndpointMethodIntegResponses --- lib/commands/deploy_endpoint.js | 110 -------------------------------- 1 file changed, 110 deletions(-) diff --git a/lib/commands/deploy_endpoint.js b/lib/commands/deploy_endpoint.js index 905f961af..1c72df0ae 100644 --- a/lib/commands/deploy_endpoint.js +++ b/lib/commands/deploy_endpoint.js @@ -794,116 +794,6 @@ ApiDeployer.prototype._createEndpointMethodIntegResponses = Promise.method(funct }); }); -/** - * API Deployer: Create Endpoint Method Responses - */ - -ApiDeployer.prototype._createEndpointMethodResponses = Promise.method(function(endpoint) { - - var _this = this; - - return Promise.try(function() { - - // Collect Response Keys - if (endpoint.apiGateway.cloudFormation.Responses) return Object.keys(endpoint.apiGateway.cloudFormation.Responses); - else return []; - }) - .each(function(responseKey) { - - var thisResponse = endpoint.apiGateway.cloudFormation.Responses[responseKey]; - var methodResponseBody = {}; - - // Format Response Parameters per APIG API's Expectations - for (prop in thisResponse.responseParameters) { - var param = endpoint.apiGateway.cloudFormation.ResponseParameters[prop]; - methodResponseBody.responseParameters[param[prop]] = true; - } - - // Create Method Response - return _this.ApiClient.putMethodResponse( - _this._restApiId, - endpoint.apiGateway.apig.resource.id, - endpoint.apiGateway.cloudFormation.Method, - thisResponse.statusCode, - methodResponseBody) - .then(function() { - JawsCli.log( - 'Endpoint Deployer: "' - + _this._stage - + ' - ' - + _this._regionJson.region - + ' - ' - + endpoint.apiGateway.cloudFormation.Path - + '": ' - + 'created method response'); - }) - .catch(function(error) { - throw new JawsError( - error.message, - JawsError.errorCodes.UNKNOWN); - }); - }) - .then(function() { - return endpoint; - }); -}); - -/** - * API Deployer: Create Endpoint Method Integration Responses - */ - -ApiDeployer.prototype._createEndpointMethodIntegResponses = Promise.method(function(endpoint) { - - var _this = this; - - return Promise.try(function() { - - // Collect Response Keys - if (endpoint.apiGateway.cloudFormation.Responses) { - return Object.keys(endpoint.apiGateway.cloudFormation.Responses); - } else { - return []; - } - }) - .each(function(responseKey) { - - var thisResponse = endpoint.apiGateway.cloudFormation.Responses[responseKey]; - var integrationResponseBody = {}; - - // Add Response Parameters - integrationResponseBody.responseParameters = thisResponse.responseParameters; - - // Add Response Templates - integrationResponseBody.responseTemplates = thisResponse.responseTemplates; - - // Add SelectionPattern - integrationResponseBody.selectionPattern = responseKey === 'default' ? null : responseKey;// null = default - - // Create Integration Response - return _this.ApiClient.putIntegrationResponse( - _this._restApiId, - endpoint.apiGateway.apig.resource.id, - endpoint.apiGateway.cloudFormation.Method, - thisResponse.statusCode, - integrationResponseBody) - .then(function() { - JawsCli.log( - 'Endpoint Deployer: "' - + _this._stage - + ' - ' - + _this._regionJson.region - + ' - ' - + endpoint.apiGateway.cloudFormation.Path - + '": ' - + 'created method integration response'); - }).catch(function(error) { - throw new JawsError( - error.message, - JawsError.errorCodes.UNKNOWN); - }); - }); -}); - /** * API Deployer: Create Deployment */