Repository navigation
feat(ec2): a filter spec per never-parsed describe (#695) - #722
Merged
Merged
Conversation
Twelve EC2 describes declared a Filters parameter on their reference page and never parsed one: DescribeInstanceStatus, DescribeVpcs, DescribeInternetGateways, DescribeKeyPairs, DescribeAvailabilityZones, DescribePlacementGroups, DescribeAddresses, DescribeRegions, DescribeInstanceTypes, DescribeSpotPriceHistory, DescribeLaunchTemplates and DescribeLaunchTemplateVersions. A filter reached the handler and was discarded, so a request for one resource answered with every resource. Each gains an ec2FilterSpec. Three evaluate every name their page documents; the rest evaluate what state can answer and accept the remainder as inert, listed per operation in the docs. An undocumented name is refused. That split closes TODO(#495) on DescribeInstanceTypes. Wire changes: DescribeVpcs/CreateVpc rename vpcState to state, per AWS's own samples; seven response members appear where a filter now selects on them; the create and describe renderers for VPCs and internet gateways converge. DescribeLaunchTemplateVersions filters before paginating. Three indexed list parameters (LaunchTemplateId.N, LaunchTemplateName.N, ProductDescription.N) were read at index 1 only.
Codecov Report❌ Patch coverage is
📢 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.
Closes #695
Twelve EC2 describes declared a
Filtersparameter on their reference page and never parsedone:
DescribeInstanceStatus,DescribeVpcs,DescribeInternetGateways,DescribeKeyPairs,DescribeAvailabilityZones,DescribePlacementGroups,DescribeAddresses,DescribeRegions,DescribeInstanceTypes,DescribeSpotPriceHistory,DescribeLaunchTemplatesandDescribeLaunchTemplateVersions. A filter reached the handler and was discarded, so a requestfor one VPC by
cidranswered with every VPC in the account.With this, twenty-three of the twenty-four EC2 describes substrate serves parse
Filter.N.The exception is
DescribeInstanceAttribute, whose page documents noFiltersparameter at all.Correction to the issue
#695 says fourteen describes never parse
Filter.N. It is twelve:DescribeSubnetslanded in #685 and
DescribeTagsin #688, andDescribeInstanceAttributedocuments noFiltersparameter and is excluded rather than fixed.Evaluated, or accepted and inert
Three of the twelve evaluate every name their page documents —
DescribeInternetGateways(6/6),
DescribeRegions(3/3),DescribeLaunchTemplates(4/4). The rest evaluate whatsubstrate's records can answer and accept the remainder as inert, each inert name listed per
operation in
docs/services.md. An undocumented name is refused withInvalidParameterValue, per #687.That split is what closes
TODO(#495)onDescribeInstanceTypes. #495's objection to applyingfive of fifty-seven filters was never the five — it was that dropping the fifty-two silently
is indistinguishable from applying them. Naming every inert one resolves that; the code no
longer contradicts its own doc comment, which claimed
Filter.Nwas unapplied directly above aline applying it.
Eight of the twelve document no tag filter, which is why the choice is per operation.
DescribeLaunchTemplatesdocuments bothtag:<key>andtag-keywhileDescribeLaunchTemplateVersions, on the same page family, documents neither.Wire changes a consumer should know about
DescribeVpcs/CreateVpcname the state elementstate, notvpcState— both of AWS'ssamples render
<state>available</state>.it:
ownerIdandtagSeton a VPC;ownerId,attachmentSetandtagSeton an internetgateway;
groupArnon a placement group;tagSeton an address;availabilityZoneon aninstance status.
renders
<attachmentSet/>and<tagSet/>when empty because its sample does; a VPC and anaddress omit
tagSetbecause theirs do.DescribeLaunchTemplateVersionsfilters before it paginates.LaunchTemplateId.N,LaunchTemplateName.NandProductDescription.Nwere read atindex 1 only, so a caller naming three templates was answered about one.
The
CreateVpc/DescribeVpcsandCreateInternetGateway/DescribeInternetGatewaysrendererswere separate structs that had drifted; each pair now emits one shape by construction. Two tests
pin that, and both were vacuous until they asserted the members present — equality alone was
satisfied by the two responses being equally blank, which is exactly what they were before.
Provenance
operations take one:
KeyName.N/KeyPairId.N,ZoneName.N/ZoneId.N,GroupName.N/GroupId.N,AllocationId.N/PublicIp.N,LaunchTemplateId.N/LaunchTemplateName.N. The reading comes from what AWS does document:an unresolvable name or ID answers
NotFoundrather than an empty set, which only makes senseif every identifier named is expected in the response — and an intersection would answer
nothing for two identifiers that each resolve.
NotFound—KeyName.N,KeyPairId.N,GroupName.N/GroupId.Non placement groups,ZoneName.N/ZoneId.N,PublicIp.N. Stated as a gap in the docs rather than papered over.provenance of ec2: three inconsistent unknown-filter-name behaviours, where real AWS refuses #687.
DescribeAddresses,DescribeKeyPairs,DescribeAvailabilityZones,DescribePlacementGroups) publish noMaxResults/NextToken.IncludeAllInstancesandIncludeUnsupportedInRegionare unread, andAllRegionsis inert.Verification
22 new tests in
emulator/ec2_describe_filters_test.go; 20 of 21 fail at the base commit(verified in a throwaway worktree, not asserted). The one that passes,
_InertNameSelectsEverything, pins an invariant by design. The three tripwire tables inec2_filter_names_test.gogained 12, 13 and 14 rows.```
gofmt -l . && go build ./... && go vet ./... && golangci-lint run ./... # clean
make test # race on, green
make coverage # emulator 83.2%, total 82.5%
make docs-reference docs-reference-check docs-versions # up to date
npm --prefix docs run build # + href/id diff: no dangling anchors
go vet -C test/e2e ./... && go test -C test/e2e ./... # green
```