Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for stringArray and operationContextParams #9153

Merged

Conversation

ashovlin
Copy link
Member

@ashovlin ashovlin commented Dec 19, 2024

Note for reviewers: I intentionally did not include a changelog file, as this should not result in any user-observable changes for now, but let me know if you think we should.

Issue #, if available: CLI-4648

Description of changes:

Primary Change

In the rules-based endpoints resolver, this adds support for:

  1. stringArray as parameters into endpoint resolution
  2. operationContextParams - this is a new trait in the service model, which can extract more complicated endpoint resolution parameters (including lists of strings) out of an operation's request.

This is a port of boto/botocore#3301.

Supporting Changes

This includes two more PRs from botocore:

  1. Add support for tuples in get_attr boto/botocore#3302 - this is fixing a bug in get_attr, which is a built-in function used within endpoint resolution to resolve named keys and/or indices into arrays or dicts.
  2. Reduce memory usage for scripts with many Session objects boto/botocore#2934 - this was an optimization made for boto3 to reduce memory usage when using multiple Session objects. While this is less of an issue for the CLI given a single command invocation will typically use a single Session, by overriding the LRU cache we're using for resolve_endpoint, we can support unhashable types (i.e. list, which is used for our new stringArray), which the lru_cache in functools does not.

Testing

In addition to porting the automated tests, I manually tested an internal, future service update that is taking advantage of this, and confirmed that the unit and functional tests pass locally against the updated model and endpoints files.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

This allows the CLI's endpoint resolver to consider collections of strings as an input
to endpoint resolution, and use operationContextParams to resolve parameters from the
operation's input.
@ashovlin ashovlin requested review from kdaily, aemous and hssyoo December 19, 2024 20:35
Copy link
Contributor

@hssyoo hssyoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just needs a new change entry.

EDIT: Oops, just saw the note in the description. I do think it's still nice to have since it makes it easier to identify the version that introduced this change.

@ashovlin
Copy link
Member Author

Just needs a new change entry.

EDIT: Oops, just saw the note in the description. I do think it's still nice to have since it makes it easier to identify the version that introduced this change.

Added via 838d7c0

@ashovlin ashovlin merged commit 0007fe6 into aws:v2 Dec 20, 2024
45 checks passed
@ashovlin ashovlin deleted the shovlia/endpoints-arrays-operationcontextparams branch December 20, 2024 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants