fix: use ApiId as the resource id for apigatewayv2 APIs - #165
Conversation
An apigatewayv2 list item carries both Name and ApiId. Name ranks ahead
of ApiId in _ID_FIELDS, so _extract_id returned the name and the detail
lookup called get_api(ApiId="<name>"), which raises NotFoundException:
GET /api/resources/apigateway/apis/my-api -> 500
NotFoundException: API my-api not found
("apigateway", "apis") was missing from _PREFERRED_ID_FIELD, the map that
exists to correct exactly this. DaviReisVieira#111 added the rest_apis override and
missed the v2 sibling.
cli.py had the same bug on a second surface: it called _extract_id without
the override at all, so `stackport list` printed the wrong id for every
entry in _PREFERRED_ID_FIELD (route53, events, wafv2, appsync,
elasticmapreduce, cognito-idp, apigateway) -- and that is the id a user
would then pass to `stackport describe`. Thread `preferred` through both
call sites.
|
Merged!! Thanks for this one. The repro was a single command, the AWS references were right there, and the CLI part is something I would not have noticed on my own. I checked it on MiniStack and Floci and it behaves the same on both. Turns out the same pattern hits five more resource types, I opened #170 for those. If you feel like taking that one too, the door is open! |
Thanks. I would like to work on that issue. |
|
It's yours!! Thanks. Everything you need is in #170: the five entries, the describe params, and the idea for the shape-based test. Ping me there if anything is unclear. |
Fixes #164
An apigatewayv2 list item carries both Name and ApiId. Name ranks ahead of ApiId in _ID_FIELDS, so _extract_id returned the name and the detail lookup called get_api(ApiId=""), which raises NotFoundException:
GET /api/resources/apigateway/apis/my-api -> 500
NotFoundException: API my-api not found
("apigateway", "apis") was missing from _PREFERRED_ID_FIELD, the map that exists to correct exactly this. #111 added the rest_apis override and missed the v2 sibling.
cli.py had the same bug on a second surface: it called _extract_id without the override at all, so
stackport listprinted the wrong id for every entry in _PREFERRED_ID_FIELD (route53, events, wafv2, appsync, elasticmapreduce, cognito-idp, apigateway) -- and that is the id a user would then pass tostackport describe. Threadpreferredthrough both call sites.