From 75beb9d1f28b88c0dcf415d2c4f022b1fb9fd966 Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Sat, 25 Sep 2021 16:20:33 +0000 Subject: [PATCH] Prepare release 2.2.8 (#4345) --- CHANGELOG.md | 22 +++++++++++++++++++++- IMPLEMENTATION_COVERAGE.md | 18 +++++++++--------- moto/apigateway/models.py | 22 ++++++++++++++++++++++ moto/apigateway/responses.py | 26 +++++++++++--------------- 4 files changed, 63 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8a1fda94..fd51411be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,28 @@ Moto Changelog =================== -Unreleased +2.2.8 ----- + New Services: + * ACM: + * export_certificate() + * APIGateway: + * create_request_validator() + * delete_request_validator() + * get_request_validators() + * update_request_validator() + + Miscellaneous: + * APIGateway: update_rest_api() now has improved support for the patchOperations-parameter + * Batch: register_job_definition() now supports the tags-parameter + * CloudFormation: Stack Events are now propagated to SNS when the NotificationARNs-parameter is supplied. + * EC2: describe_vpc_endpoint_services() now returns the default endpoints for implemented services + * IOT: list_job_executions_for_job() now supports the status-parameter + * IOT: list_job_executions_for_thing() now supports the status-parameter + * KMS: list_resource_tags() now supports an ARN as the KeyId-parameter + * KMS: tag_resource() now supports an ARN as the KeyId-parameter + * KMS: untag_resource() now supports an ARN as the KeyId-parameter + * SecretsManager: update_secret() now supports the ClientRequestToken-parameter 2.2.7 ----- diff --git a/IMPLEMENTATION_COVERAGE.md b/IMPLEMENTATION_COVERAGE.md index 8024e604e..47c2ed42a 100644 --- a/IMPLEMENTATION_COVERAGE.md +++ b/IMPLEMENTATION_COVERAGE.md @@ -22,7 +22,7 @@ ## apigateway
-44% implemented +48% implemented - [X] create_api_key - [X] create_authorizer @@ -32,7 +32,7 @@ - [ ] create_documentation_version - [X] create_domain_name - [X] create_model -- [ ] create_request_validator +- [X] create_request_validator - [X] create_resource - [X] create_rest_api - [X] create_stage @@ -53,7 +53,7 @@ - [X] delete_method - [X] delete_method_response - [ ] delete_model -- [ ] delete_request_validator +- [X] delete_request_validator - [X] delete_resource - [X] delete_rest_api - [X] delete_stage @@ -90,8 +90,8 @@ - [X] get_model - [ ] get_model_template - [X] get_models -- [ ] get_request_validator -- [ ] get_request_validators +- [X] get_request_validator +- [X] get_request_validators - [X] get_resource - [ ] get_resources - [X] get_rest_api @@ -137,7 +137,7 @@ - [X] update_method - [X] update_method_response - [ ] update_model -- [ ] update_request_validator +- [X] update_request_validator - [ ] update_resource - [X] update_rest_api - [X] update_stage @@ -1687,7 +1687,7 @@ ## elb
-34% implemented +37% implemented - [ ] add_tags - [X] apply_security_groups_to_load_balancer @@ -1715,7 +1715,7 @@ - [ ] modify_load_balancer_attributes - [ ] register_instances_with_load_balancer - [ ] remove_tags -- [ ] set_load_balancer_listener_ssl_certificate +- [X] set_load_balancer_listener_ssl_certificate - [ ] set_load_balancer_policies_for_backend_server - [X] set_load_balancer_policies_of_listener
@@ -4619,4 +4619,4 @@ - workmailmessageflow - workspaces - xray -
+ \ No newline at end of file diff --git a/moto/apigateway/models.py b/moto/apigateway/models.py index e55fdbafd..a48ee3f7d 100644 --- a/moto/apigateway/models.py +++ b/moto/apigateway/models.py @@ -1684,6 +1684,28 @@ class APIGatewayBackend(BaseBackend): else: return model + def get_request_validators(self, restapi_id): + restApi = self.get_rest_api(restapi_id) + return restApi.get_request_validators() + + def create_request_validator(self, restapi_id, name, body, params): + restApi = self.get_rest_api(restapi_id) + return restApi.create_request_validator( + name=name, validateRequestBody=body, validateRequestParameters=params, + ) + + def get_request_validator(self, restapi_id, validator_id): + restApi = self.get_rest_api(restapi_id) + return restApi.get_request_validator(validator_id) + + def delete_request_validator(self, restapi_id, validator_id): + restApi = self.get_rest_api(restapi_id) + restApi.delete_request_validator(validator_id) + + def update_request_validator(self, restapi_id, validator_id, patch_operations): + restApi = self.get_rest_api(restapi_id) + return restApi.update_request_validator(validator_id, patch_operations) + apigateway_backends = {} for region_name in Session().get_available_regions("apigateway"): diff --git a/moto/apigateway/responses.py b/moto/apigateway/responses.py index 4b1af8e66..d930ef3d2 100644 --- a/moto/apigateway/responses.py +++ b/moto/apigateway/responses.py @@ -311,23 +311,19 @@ class APIGatewayResponse(BaseResponse): url_path_parts = self.path.split("/") restapi_id = url_path_parts[2] try: - restApi = self.backend.get_rest_api(restapi_id) + if self.method == "GET": - validators = restApi.get_request_validators() + validators = self.backend.get_request_validators(restapi_id) res = json.dumps( {"item": [validator.to_dict() for validator in validators]} ) return 200, {}, res if self.method == "POST": name = self._get_param("name") - validateRequestBody = self._get_bool_param("validateRequestBody") - validateRequestParameters = self._get_bool_param( - "validateRequestParameters" - ) - validator = restApi.create_request_validator( - name=name, - validateRequestBody=validateRequestBody, - validateRequestParameters=validateRequestParameters, + body = self._get_bool_param("validateRequestBody") + params = self._get_bool_param("validateRequestParameters") + validator = self.backend.create_request_validator( + restapi_id, name, body, params ) return 200, {}, json.dumps(validator) except BadRequestException as e: @@ -341,16 +337,16 @@ class APIGatewayResponse(BaseResponse): restapi_id = url_path_parts[2] validator_id = url_path_parts[4] try: - restApi = self.backend.get_rest_api(restapi_id) if self.method == "GET": - return 200, {}, json.dumps(restApi.get_request_validator(validator_id)) + validator = self.backend.get_request_validator(restapi_id, validator_id) + return 200, {}, json.dumps(validator) if self.method == "DELETE": - restApi.delete_request_validator(validator_id) + self.backend.delete_request_validator(restapi_id, validator_id) return 202, {}, "" if self.method == "PATCH": patch_operations = self._get_param("patchOperations") - validator = restApi.update_request_validator( - validator_id, patch_operations + validator = self.backend.update_request_validator( + restapi_id, validator_id, patch_operations ) return 200, {}, json.dumps(validator) except BadRequestException as e: