diff --git a/IMPLEMENTATION_COVERAGE.md b/IMPLEMENTATION_COVERAGE.md index 80e38656b..3d2e0bcaa 100644 --- a/IMPLEMENTATION_COVERAGE.md +++ b/IMPLEMENTATION_COVERAGE.md @@ -257,9 +257,9 @@ ## apigateway
-34% implemented +38% implemented -- [ ] create_api_key +- [X] create_api_key - [X] create_authorizer - [ ] create_base_path_mapping - [X] create_deployment @@ -274,7 +274,7 @@ - [X] create_usage_plan - [X] create_usage_plan_key - [ ] create_vpc_link -- [ ] delete_api_key +- [X] delete_api_key - [X] delete_authorizer - [ ] delete_base_path_mapping - [ ] delete_client_certificate @@ -299,8 +299,8 @@ - [ ] flush_stage_cache - [ ] generate_client_certificate - [ ] get_account -- [ ] get_api_key -- [ ] get_api_keys +- [X] get_api_key +- [X] get_api_keys - [X] get_authorizer - [X] get_authorizers - [ ] get_base_path_mapping diff --git a/moto/apigateway/models.py b/moto/apigateway/models.py index 0011af46c..d520e50ae 100644 --- a/moto/apigateway/models.py +++ b/moto/apigateway/models.py @@ -1155,18 +1155,18 @@ class APIGatewayBackend(BaseBackend): api = self.get_rest_api(function_id) return api.delete_deployment(deployment_id) - def create_apikey(self, payload): + def create_api_key(self, payload): if payload.get("value") is not None: if len(payload.get("value", [])) < 20: raise ApiKeyValueMinLength() - for api_key in self.get_apikeys(include_values=True): + for api_key in self.get_api_keys(include_values=True): if api_key.get("value") == payload["value"]: raise ApiKeyAlreadyExists() key = ApiKey(**payload) self.keys[key["id"]] = key return key - def get_apikeys(self, include_values=False): + def get_api_keys(self, include_values=False): api_keys = list(self.keys.values()) if not include_values: @@ -1179,7 +1179,7 @@ class APIGatewayBackend(BaseBackend): return api_keys - def get_apikey(self, api_key_id, include_value=False): + def get_api_key(self, api_key_id, include_value=False): api_key = self.keys[api_key_id] if not include_value: @@ -1189,11 +1189,11 @@ class APIGatewayBackend(BaseBackend): return api_key - def update_apikey(self, api_key_id, patch_operations): + def update_api_key(self, api_key_id, patch_operations): key = self.keys[api_key_id] return key.update_operations(patch_operations) - def delete_apikey(self, api_key_id): + def delete_api_key(self, api_key_id): self.keys.pop(api_key_id) return {} diff --git a/moto/apigateway/responses.py b/moto/apigateway/responses.py index 4b50af68a..1f7effcea 100644 --- a/moto/apigateway/responses.py +++ b/moto/apigateway/responses.py @@ -429,7 +429,7 @@ class APIGatewayResponse(BaseResponse): if self.method == "POST": try: - apikey_response = self.backend.create_apikey(json.loads(self.body)) + apikey_response = self.backend.create_api_key(json.loads(self.body)) except ApiKeyAlreadyExists as error: return ( error.code, @@ -451,7 +451,7 @@ class APIGatewayResponse(BaseResponse): elif self.method == "GET": include_values = self._get_bool_param("includeValues") - apikeys_response = self.backend.get_apikeys(include_values=include_values) + apikeys_response = self.backend.get_api_keys(include_values=include_values) return 200, {}, json.dumps({"item": apikeys_response}) def apikey_individual(self, request, full_url, headers): @@ -463,14 +463,14 @@ class APIGatewayResponse(BaseResponse): status_code = 200 if self.method == "GET": include_value = self._get_bool_param("includeValue") - apikey_response = self.backend.get_apikey( + apikey_response = self.backend.get_api_key( apikey, include_value=include_value ) elif self.method == "PATCH": patch_operations = self._get_param("patchOperations") - apikey_response = self.backend.update_apikey(apikey, patch_operations) + apikey_response = self.backend.update_api_key(apikey, patch_operations) elif self.method == "DELETE": - apikey_response = self.backend.delete_apikey(apikey) + apikey_response = self.backend.delete_api_key(apikey) status_code = 202 return status_code, {}, json.dumps(apikey_response)