-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Implement v2-debug checks for args, config, customizations, s3, and environment variables #9775
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
Merged
aemous
merged 22 commits into
aws:debug-migration
from
aemous:debug-migration-args-config
Oct 21, 2025
Merged
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
aa0059e
Implement s3 and env vars v2-debug checks with tests.
aemous b1e4f12
Implement v2-debug runtime checks for customizations.
aemous 4145b1c
Fix bug with s3 tests.
aemous f1196fb
Implement checks for api_versions in config and plugins.
aemous fab0005
Fix s3 tests.
aemous 7d42580
Fix failing tests.
aemous 9f336ca
Implement S3 us-east-1 global endpoint behavior.
aemous 408023a
Finish implementing cli-input-json and other use cases.
aemous d77948a
Ensure timestamp warning only prints at most once.
aemous a9599d2
Add test to s3 v2-debug.
aemous 427325a
Merge branch 'debug-migration-s3-env-vars' into debug-migration-args-…
aemous efb76f6
Formatting.
aemous 64c0d77
Add test-input-json paginate test and format.
aemous 6999974
Test fixes.
aemous ccc918f
Fix opt-out case of cli_binary_format warning.
aemous 8d074f3
Fix failing unit tests in test_clidriver.
aemous 5ff72bc
Update s3 us-east-1 behavior.
aemous 1f322d6
Formatting.
aemous f75c3af
Switch migration warnings to use stderr.
aemous df5fec0
Fix failing s3 test.
aemous 73a8347
Revise based on feedback.
aemous 4411c1c
Fix failing s3 tests.
aemous File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,6 +135,9 @@ def unify_paging_params(argument_table, operation_model, event_name, | |
_remove_existing_paging_arguments(argument_table, paginator_config) | ||
parsed_args_event = event_name.replace('building-argument-table.', | ||
'operation-args-parsed.') | ||
call_parameters_event = event_name.replace( | ||
'building-argument-table', 'calling-command' | ||
) | ||
shadowed_args = {} | ||
add_paging_argument(argument_table, 'starting-token', | ||
PageArgument('starting-token', STARTING_TOKEN_HELP, | ||
|
@@ -168,6 +171,13 @@ def unify_paging_params(argument_table, operation_model, event_name, | |
partial(check_should_enable_pagination, | ||
list(_get_all_cli_input_tokens(paginator_config)), | ||
shadowed_args, argument_table)) | ||
session.register( | ||
call_parameters_event, | ||
partial( | ||
check_should_enable_pagination_call_parameters, | ||
list(_get_all_input_tokens(paginator_config)), | ||
), | ||
) | ||
|
||
|
||
def add_paging_argument(argument_table, arg_name, argument, shadowed_args): | ||
|
@@ -240,6 +250,18 @@ def _get_all_cli_input_tokens(pagination_config): | |
yield cli_name | ||
|
||
|
||
# Get all tokens but return them in API namespace rather than CLI namespace | ||
def _get_all_input_tokens(pagination_config): | ||
# Get all input tokens including the limit_key | ||
# if it exists. | ||
tokens = _get_input_tokens(pagination_config) | ||
for token_name in tokens: | ||
yield token_name | ||
if 'limit_key' in pagination_config: | ||
key_name = pagination_config['limit_key'] | ||
yield key_name | ||
|
||
|
||
def _get_input_tokens(pagination_config): | ||
tokens = pagination_config['input_token'] | ||
if not isinstance(tokens, list): | ||
|
@@ -253,6 +275,32 @@ def _get_cli_name(param_objects, token_name): | |
return param.cli_name.lstrip('-') | ||
|
||
|
||
# This function checks for pagination args in the actual calling | ||
# arguments passed to the function. If the user is using the | ||
# --cli-input-json parameter to provide JSON parameters they are | ||
# all in the API naming space rather than the CLI naming space | ||
# and would be missed by the processing above. This function gets | ||
# called on the calling-command event. | ||
|
||
def check_should_enable_pagination_call_parameters( | ||
input_tokens, call_parameters, parsed_args, parsed_globals, **kwargs | ||
): | ||
if parsed_globals.v2_debug: | ||
pagination_params_in_input_tokens = [ | ||
param for param in call_parameters if param in input_tokens | ||
] | ||
ashovlin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if pagination_params_in_input_tokens: | ||
uni_print( | ||
'AWS CLI v2 MIGRATION WARNING: In AWS CLI v2, if you specify ' | ||
'pagination parameters by using a file with the ' | ||
'`--cli-input-json` parameter, automatic pagination will be ' | ||
'turned off. This is not the case in v1. See ' | ||
'https://docs.aws.amazon.com/cli/latest/userguide/' | ||
'cliv2-migration-changes.html' | ||
'#cliv2-migration-skeleton-paging.\n', | ||
out_file=sys.stderr | ||
) | ||
|
||
|
||
class PageArgument(BaseCLIArgument): | ||
type_map = { | ||
'string': str, | ||
|
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.