Adds keyId support to apigateway get_usage_plans

apigateway is able to filter the result set, returning only usage plans
with the given keyId.

This commit supports filtering the usage plans returned to the user by
filtering the list of usage plans by checking for usage plan keys
This commit is contained in:
George Alton 2018-10-17 13:44:00 +01:00
commit d919024510
No known key found for this signature in database
GPG key ID: BF2E281ABF61709E
3 changed files with 44 additions and 3 deletions

View file

@ -255,7 +255,8 @@ class APIGatewayResponse(BaseResponse):
if self.method == 'POST':
usage_plan_response = self.backend.create_usage_plan(json.loads(self.body))
elif self.method == 'GET':
usage_plans_response = self.backend.get_usage_plans()
api_key_id = self.querystring.get("keyId", [None])[0]
usage_plans_response = self.backend.get_usage_plans(api_key_id=api_key_id)
return 200, {}, json.dumps({"item": usage_plans_response})
return 200, {}, json.dumps(usage_plan_response)