Skip to content

Adds AWSPaginator attribute to methods in Paginator Factory interface that PowerShell consumes #3726

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
merged 6 commits into from
Apr 15, 2025

Conversation

afroz429
Copy link
Contributor

@afroz429 afroz429 commented Mar 26, 2025

Description

AWS Tools for PowerShell's(AWS PS) auto-iteration implementation requires metadata for paginators. This PR adds AWSPaginator attribute to Paginator methods in the Paginator Factory interface. AWS PS will use this metadata for auto-iteration implementation.
The attribute properties that are being added are InputToken, LimitKey and OutputToken.

Added following generated files for review

  • sdk/src/Services/AccessAnalyzer/Generated/Model/_bcl45+netstandard/IAccessAnalyzerPaginatorFactory.cs
  • sdk/src/Services/SimpleWorkflow/Generated/Model/_bcl45+netstandard/ISimpleWorkflowPaginatorFactory.cs

Motivation and Context

Add metadata that AWS PS can use for generating auto-iteration.

Testing

DRY Run succeeded.
Tested AWS PS generation code after copying the assemblies and verifying that the attributes are readable.

            var pageFactoryInterfaceTypeName = string.Format("{0}.Model.I{1}PaginatorFactory", CurrentModel.ServiceNamespace, CurrentModel.AssemblyName);
            
            var pageFactoryInterfaceType = CurrentServiceAssembly.GetType(pageFactoryInterfaceTypeName);

            if (pageFactoryInterfaceType != null)
            {
                var pageFactoryInterfaceMethods = pageFactoryInterfaceType.GetMethods().OrderBy(m => m.Name).ToList();
                foreach (var pageFactoryMethod in pageFactoryInterfaceMethods)
                {
                    dynamic awsPaginatorFactoryAttribute = pageFactoryMethod
                        .GetCustomAttributes().SingleOrDefault(attribute =>
                            attribute.GetType().FullName == "Amazon.Runtime.Internal.AWSPaginatorAttribute");
                    if (awsPaginatorFactoryAttribute != null)
                    {
                        if (awsPaginatorFactoryAttribute.LimitKey == null)
                        {
                            Console.WriteLine("limitkey null");
                        }
                        Console.WriteLine(awsPaginatorFactoryAttribute);
                    }
                }
            
            }

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the README document
  • I have added tests to cover my changes
  • All new and existing tests passed

License

  • I confirm that this pull request can be released under the Apache 2 license

@afroz429 afroz429 changed the base branch from main to main-staging March 26, 2025 16:13
@afroz429 afroz429 requested a review from normj March 26, 2025 16:14
@dscpinheiro dscpinheiro added v4 and removed v4 labels Apr 14, 2025
@afroz429 afroz429 merged commit 36e88f9 into main-staging Apr 15, 2025
2 of 6 checks passed
@afroz429 afroz429 deleted the ps-pagination branch April 15, 2025 16:59
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.

3 participants