When creating new Rest API (or modifying existing) to AWS API Gateway by importing swagger file. How could I set Require API Key property to true for all methods? When you have tens or hundreds methods it is quite a work to set this property one by one in console. Is there any easy way to modify swagger files so that every method contains?
"security" : [ {
"api_key" : [ ]
} ]
and schema contains
"securitySchemes" : {
"api_key" : {
"type" : "apiKey",
"name" : "x-api-key",
"in" : "header"
}
}
I got information that this should be made programmatically.
Here is CLI command to update Api Key required = true to one method.
aws apigateway update-method --rest-api-id xyz_123456 --resource-id xdfc452 --http-method GET --patch-operations op="replace",path="/apiKeyRequired",value="true"
I'm still looking way to update all methods at once.