serverless-add-api-key icon indicating copy to clipboard operation
serverless-add-api-key copied to clipboard

Provide ApiKeyId & UsagePlanId

Open moroine opened this issue 3 years ago • 1 comments

Hi,

Not really sure if it can be achieved with this plugin, but I'm looking for a way to use existing apiKey + usagePlan using apiKeyId & usagePlanId directly instead of name.

The goal would be to reduce required IAM permissions for the deploy user, i.e. being able to restrict permissions to something like:

{
            "Effect": "Allow",
            "Action": [
                "apigateway:DELETE",
                "apigateway:PATCH",
                "apigateway:POST",
                "apigateway:GET"
            ],
            "Resource": [
                "arn:aws:apigateway:us-east-1::/usageplans/yyyy",
                "arn:aws:apigateway:us-east-1::/usageplans/yyyy/*",
                "arn:aws:apigateway:us-east-1::/apikeys/xxxx",
                "arn:aws:apigateway:us-east-1::/apikeys/xxxx/*"
            ]
        },

moroine avatar May 24 '21 13:05 moroine

From what I understand in the code, looks like in this scenario we only need associateRestApiWithUsagePlan function 🤔

moroine avatar May 24 '21 13:05 moroine