Lints.
This commit is contained in:
parent
1433f28846
commit
f37bad0e00
260 changed files with 6363 additions and 3766 deletions
|
|
@ -12,7 +12,6 @@ class APIGatewayResponse(BaseResponse):
|
|||
def _get_param(self, key):
|
||||
return json.loads(self.body).get(key)
|
||||
|
||||
|
||||
def _get_param_with_default_value(self, key, default):
|
||||
jsonbody = json.loads(self.body)
|
||||
|
||||
|
|
@ -69,7 +68,8 @@ class APIGatewayResponse(BaseResponse):
|
|||
resource = self.backend.get_resource(function_id, resource_id)
|
||||
elif self.method == 'POST':
|
||||
path_part = self._get_param("pathPart")
|
||||
resource = self.backend.create_resource(function_id, resource_id, path_part)
|
||||
resource = self.backend.create_resource(
|
||||
function_id, resource_id, path_part)
|
||||
elif self.method == 'DELETE':
|
||||
resource = self.backend.delete_resource(function_id, resource_id)
|
||||
return 200, {}, json.dumps(resource.to_dict())
|
||||
|
|
@ -82,11 +82,13 @@ class APIGatewayResponse(BaseResponse):
|
|||
method_type = url_path_parts[6]
|
||||
|
||||
if self.method == 'GET':
|
||||
method = self.backend.get_method(function_id, resource_id, method_type)
|
||||
method = self.backend.get_method(
|
||||
function_id, resource_id, method_type)
|
||||
return 200, {}, json.dumps(method)
|
||||
elif self.method == 'PUT':
|
||||
authorization_type = self._get_param("authorizationType")
|
||||
method = self.backend.create_method(function_id, resource_id, method_type, authorization_type)
|
||||
method = self.backend.create_method(
|
||||
function_id, resource_id, method_type, authorization_type)
|
||||
return 200, {}, json.dumps(method)
|
||||
|
||||
def resource_method_responses(self, request, full_url, headers):
|
||||
|
|
@ -98,11 +100,14 @@ class APIGatewayResponse(BaseResponse):
|
|||
response_code = url_path_parts[8]
|
||||
|
||||
if self.method == 'GET':
|
||||
method_response = self.backend.get_method_response(function_id, resource_id, method_type, response_code)
|
||||
method_response = self.backend.get_method_response(
|
||||
function_id, resource_id, method_type, response_code)
|
||||
elif self.method == 'PUT':
|
||||
method_response = self.backend.create_method_response(function_id, resource_id, method_type, response_code)
|
||||
method_response = self.backend.create_method_response(
|
||||
function_id, resource_id, method_type, response_code)
|
||||
elif self.method == 'DELETE':
|
||||
method_response = self.backend.delete_method_response(function_id, resource_id, method_type, response_code)
|
||||
method_response = self.backend.delete_method_response(
|
||||
function_id, resource_id, method_type, response_code)
|
||||
return 200, {}, json.dumps(method_response)
|
||||
|
||||
def restapis_stages(self, request, full_url, headers):
|
||||
|
|
@ -113,10 +118,13 @@ class APIGatewayResponse(BaseResponse):
|
|||
if self.method == 'POST':
|
||||
stage_name = self._get_param("stageName")
|
||||
deployment_id = self._get_param("deploymentId")
|
||||
stage_variables = self._get_param_with_default_value('variables',{})
|
||||
description = self._get_param_with_default_value('description','')
|
||||
cacheClusterEnabled = self._get_param_with_default_value('cacheClusterEnabled',False)
|
||||
cacheClusterSize = self._get_param_with_default_value('cacheClusterSize',None)
|
||||
stage_variables = self._get_param_with_default_value(
|
||||
'variables', {})
|
||||
description = self._get_param_with_default_value('description', '')
|
||||
cacheClusterEnabled = self._get_param_with_default_value(
|
||||
'cacheClusterEnabled', False)
|
||||
cacheClusterSize = self._get_param_with_default_value(
|
||||
'cacheClusterSize', None)
|
||||
|
||||
stage_response = self.backend.create_stage(function_id, stage_name, deployment_id,
|
||||
variables=stage_variables, description=description,
|
||||
|
|
@ -135,12 +143,14 @@ class APIGatewayResponse(BaseResponse):
|
|||
|
||||
if self.method == 'GET':
|
||||
try:
|
||||
stage_response = self.backend.get_stage(function_id, stage_name)
|
||||
stage_response = self.backend.get_stage(
|
||||
function_id, stage_name)
|
||||
except StageNotFoundException as error:
|
||||
return error.code, {},'{{"message":"{0}","code":"{1}"}}'.format(error.message,error.error_type)
|
||||
return error.code, {}, '{{"message":"{0}","code":"{1}"}}'.format(error.message, error.error_type)
|
||||
elif self.method == 'PATCH':
|
||||
patch_operations = self._get_param('patchOperations')
|
||||
stage_response = self.backend.update_stage(function_id, stage_name, patch_operations)
|
||||
stage_response = self.backend.update_stage(
|
||||
function_id, stage_name, patch_operations)
|
||||
return 200, {}, json.dumps(stage_response)
|
||||
|
||||
def integrations(self, request, full_url, headers):
|
||||
|
|
@ -151,14 +161,17 @@ class APIGatewayResponse(BaseResponse):
|
|||
method_type = url_path_parts[6]
|
||||
|
||||
if self.method == 'GET':
|
||||
integration_response = self.backend.get_integration(function_id, resource_id, method_type)
|
||||
integration_response = self.backend.get_integration(
|
||||
function_id, resource_id, method_type)
|
||||
elif self.method == 'PUT':
|
||||
integration_type = self._get_param('type')
|
||||
uri = self._get_param('uri')
|
||||
request_templates = self._get_param('requestTemplates')
|
||||
integration_response = self.backend.create_integration(function_id, resource_id, method_type, integration_type, uri, request_templates=request_templates)
|
||||
integration_response = self.backend.create_integration(
|
||||
function_id, resource_id, method_type, integration_type, uri, request_templates=request_templates)
|
||||
elif self.method == 'DELETE':
|
||||
integration_response = self.backend.delete_integration(function_id, resource_id, method_type)
|
||||
integration_response = self.backend.delete_integration(
|
||||
function_id, resource_id, method_type)
|
||||
return 200, {}, json.dumps(integration_response)
|
||||
|
||||
def integration_responses(self, request, full_url, headers):
|
||||
|
|
@ -193,9 +206,11 @@ class APIGatewayResponse(BaseResponse):
|
|||
return 200, {}, json.dumps({"item": deployments})
|
||||
elif self.method == 'POST':
|
||||
name = self._get_param("stageName")
|
||||
description = self._get_param_with_default_value("description","")
|
||||
stage_variables = self._get_param_with_default_value('variables',{})
|
||||
deployment = self.backend.create_deployment(function_id, name, description,stage_variables)
|
||||
description = self._get_param_with_default_value("description", "")
|
||||
stage_variables = self._get_param_with_default_value(
|
||||
'variables', {})
|
||||
deployment = self.backend.create_deployment(
|
||||
function_id, name, description, stage_variables)
|
||||
return 200, {}, json.dumps(deployment)
|
||||
|
||||
def individual_deployment(self, request, full_url, headers):
|
||||
|
|
@ -205,7 +220,9 @@ class APIGatewayResponse(BaseResponse):
|
|||
deployment_id = url_path_parts[4]
|
||||
|
||||
if self.method == 'GET':
|
||||
deployment = self.backend.get_deployment(function_id, deployment_id)
|
||||
deployment = self.backend.get_deployment(
|
||||
function_id, deployment_id)
|
||||
elif self.method == 'DELETE':
|
||||
deployment = self.backend.delete_deployment(function_id, deployment_id)
|
||||
deployment = self.backend.delete_deployment(
|
||||
function_id, deployment_id)
|
||||
return 200, {}, json.dumps(deployment)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue