Repository navigation
feat(#844): route the classic Elastic Load Balancing tag operations - #1317
Merged
Merged
Conversation
`AddTags`, `RemoveTags` and `DescribeTags` exist in both Elastic Load Balancing APIs with different shapes, so all three now read the Query `Version` member the way #1146's create/describe/delete trio does — six action names are discriminated where three were. Before this a classic caller's `AddTags` reached the ELBv2 handler and was refused `ResourceArns is required`, a member the 2012-06-01 API does not have: the same defect #1146 fixed, in its other half. The generations differ in every part of the shape. The resource is named rather than ARN'd on the way in (`LoadBalancerNames.member.N`) and on the way out (the classic `TagDescription` carries `LoadBalancerName`, and substrate's classic responses emit no `ResourceArn` at all). `AddTags` and `RemoveTags` take one load balancer where ELBv2's take a list, and `DescribeTags` takes 1-20. And classic `RemoveTags` names its keys as `Tags.member.N` of `TagKeyOnly`, not `TagKeys.member.N` — the one difference whose wrong answer would have been a silent 200, so the test asserts both spellings against each other rather than only the published one. The rules are not new. The published cap of 10 against ELBv2's 50, each generation's own `TooManyTags` wording and `LoadBalancerNotFound`/400 all come from #1148 and are resolved from the stored record rather than from the API door, so one load balancer gets the same answer through its create, through classic `AddTags` and through the Resource Groups Tagging API — #844's last acceptance row, now asserted in both directions. `DuplicateTagKeys`/400 is answered on `AddTags` only, because that is the only page publishing it, and every check runs before any write, so a refused request leaves the stored tag set as it was. The write goes through `elbTaggedResource.encode`, which stamps `ever_tagged` from the pre-merge count (#938) — this is that method's first caller, as its own doc comment anticipated, so `elb_classic.go`'s "no caller yet" paragraph goes. AWS's `RemoveTags` page contradicts itself about the member: its parameter table publishes the indexed `LoadBalancerNames.member.N` while its Sample Request shows singular `&LoadBalancerName=`. `AddTags` and `DescribeTags` publish and sample the indexed form, so the singular is a typo on one page rather than a second accepted spelling, and substrate follows the model — what every SDK serializes. `docs/services.md` records the contradiction so a reader who copies AWS's own sample curl understands the refusal. Each refusal asserts its message as well as its code and status, and that is what makes most of those rows mean anything: unrouted, these same requests reached the ELBv2 handler, which refused seven of them `ValidationError`/400 for a different reason, so code and status alone passed with the routing removed. With the three `case` lines deleted every new test and subtest fails except the one asserting the ELBv2 half is untouched, which is the control in the other direction. Refs #844
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AddTags,RemoveTagsandDescribeTagsexist in both Elastic Load Balancing APIs with different shapes, so all three now read the QueryVersionmember the way #1146's create/describe/delete trio does — six action names are discriminated where three were. Before this a classic caller'sAddTagsreached the ELBv2 handler and was refusedResourceArns is required, a member the 2012-06-01 API does not have: the same defect #1146 fixed, in its other half.This is #844's Tier 1b, which closes AC7's tag half and AC9. AC8 (the
AWS::ElasticLoadBalancing::LoadBalancerdeploy helper) is Tier 2 and follows in its own PR, so #844 stays open.What differs between the generations
Every part of the shape, which is why these are separate handlers rather than a shared one with a flag:
LoadBalancerNames.member.Nin, and the classicTagDescriptioncarriesLoadBalancerNameout. Substrate's classic responses emit noResourceArnat all, which the round-trip test asserts against the raw body because a decode can only see members its struct declares.AddTagsandRemoveTagstake one load balancer ("You can specify one load balancer only" / "a maximum of one load balancer name"); ELBv2's take a list with no published bound.DescribeTagstakes 1–20 in both generations. Neither bound has a code of its own, so exceeding it answersValidationError/400 from the Query Common Errors page.RemoveTagsnames its keys asTags.member.NofTagKeyOnly, notTagKeys.member.N. This is the one difference whose wrong answer would have been a silent 200 — routed but decoded with v2's member name, the operation would have removed nothing and said so with a success. The test asserts both spellings against each other rather than only the published one.What is reused rather than reimplemented
The rules all come from #1148 and are resolved from the stored record, never from the API door: the published cap of 10 against ELBv2's 50, each generation's own
TooManyTagswording, andLoadBalancerNotFound/400. So one load balancer gets the same answer through its create, through classicAddTagsand through the Resource Groups Tagging API — AC9, now asserted in both directions.DuplicateTagKeys/400 is answered onAddTagsonly, because that is the only page publishing it. Every check runs before any write, so a refused request leaves the stored tag set exactly as it was.The write goes through
elbTaggedResource.encode, which stampsever_taggedfrom the pre-merge count (#938). This is that method's first caller, as its own doc comment anticipated, soelb_classic.go's "the closure has no caller yet" paragraph goes. The duplicated classicLoadBalancerNotFoundbody is hoisted toelbClassicNotFoundError, reading its code fromelbNotFoundCodes, so the four classic doors cannot drift in either code or wording.Provenance
AWS's
RemoveTagspage contradicts itself about the member it takes: its parameter table publishes the indexedLoadBalancerNames.member.N, while its Sample Request shows singular&LoadBalancerName=my-loadbalancer.AddTagsandDescribeTagsboth publish and sample the indexed form, so the singular is a typo on one page rather than a second accepted spelling — and the indexed form is what every SDK serializes. Substrate follows the model, which is the resolutionelbMaxTagKeyLengthalready records for the Tag-length contradiction. A reader who copies AWS's own sample curl is therefore refusedValidationError/400, anddocs/services.mdsays so rather than leaving it to be discovered.LoadBalancerNotFound's message ("There is no ACTIVE Load Balancer named '…'") is AWS's observed text; its published text is the one-line description of the code itself, which is not a response body. The code, status and the operations that publish it all come from the API reference.Verification
make lint— 0 issues;make test(race,-count=1) green.make docs-reference-check docs-versions version-check discarded-unmarshal-check wire-bookkeeping-check operation-catalog-check operation-docs-checkall pass. The emulator: substrate bookkeeping fields render as response members AWS does not publish #756 ratchet is byte-identical at 319 declared, 133 projected across 50 records, 186 still reachable —ELBClassicLoadBalanceris already projected and the newDescribeTagsrenders aTagDescription, not the record.operation-catalog-checkreports no change, since the catalog is generated from action names and all three already appeared in the v2 arm.caselines deleted, every new test and subtest fails exceptTestELBClassicTags_TheELBv2FormOfTheSameActionsIsUntouched, which is by construction the control in the other direction. Getting there changed the tests: the refusal table originally asserted only code and status, and seven of its twelve rows still passed unrouted, because the ELBv2 handler refuses the same requestsValidationError/400 for a different reason ("ResourceArns is required"). Each row now asserts the message too, which is the only part of the refusal that says which generation turned the caller away.emulator/elb_classic_tags.go, every statement.Refs #844