fix: response-key casing for EC2/NetworkManager reads + duplicate DescribeConnections call - #2
Open
agudmund wants to merge 1 commit into
Open
Conversation
…p eager duplicate DescribeConnections call
- get_vpn_details: read PascalCase VgwTelemetry fields (Status,
OutsideIpAddress, StatusMessage, AcceptedRouteCount), State, and
Routes so tunnel status, static routes, and tunnels_up report real
values instead of null/0
- get_virtual_gateway_details: read State and VpcAttachments VpcId
(PascalCase) so VGW state and attached VPC ids are populated
- analyze_cloudwan_topology: read PascalCase State for global networks,
core networks, and peerings; normalize the output key to lowercase
"state" to match every other tool
- get_dx_vif_details: read camelCase amazonSideAsn (Direct Connect is
the camelCase API)
- drop the eagerly-evaluated fallback in
describe_connections().get("connections", <second call>) which made
a duplicate API call on every invocation and discarded the result
Fixes aws-samples#1
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #1.
What this changes
All fixes are response-key casing corrections along the camelCase/PascalCase split between the AWS APIs (Direct Connect speaks camelCase; EC2 and Network Manager speak PascalCase). 15 lines changed, no behavior added.
get_vpn_details— reads the PascalCaseVgwTelemetryfields (Status,OutsideIpAddress,StatusMessage,AcceptedRouteCount), plusStateandRoutes. Before this, every tunnel rendered asnull/0andtunnels_upwas always 0, contradictingnetwork_architecture_summarywhich already readStatuscorrectly.get_virtual_gateway_details— readsState, andVpcIdinsideVpcAttachments. Thevpc_idfix is one additional instance of the same defect found while preparing this PR (not listed in #1): attached VPC ids previously came backnull.analyze_cloudwan_topology— reads PascalCaseStatefor global networks, core networks, and peerings. The output key is also normalized from"State"to"state"to match every other tool in the file; flagging this explicitly since it is a (small) output-schema change — the previous value was alwaysnull, so nothing working can break.get_dx_vif_details— reads camelCaseamazonSideAsn(Direct Connect is the camelCase API; this one was inverted in the other direction).Duplicate API call —
describe_connections().get("connections", dx.describe_connections()...)evaluated its fallback eagerly, making twoDescribeConnectionscalls per invocation and discarding the second result (three sites). The fallback is dropped, matching whatnetwork_architecture_summaryalready does.I chose direct key corrections over wiring in the existing
_get_key()helper to keep the diff minimal and reviewable; happy to rework onto_get_key()if you'd prefer that direction.Testing
python -m py_compile server.pypasses.DescribeVpnConnections,DescribeVpnGateways,DescribeGlobalNetworks,ListCoreNetworks,ListPeerings, andDescribeVirtualInterfaces.Licensing
I confirm this contribution is made under the terms of the MIT-0 license of this repository.