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

Added Pagination attributes to support PowerShell Auto-Iteration #3679

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"core": {
"changeLogMessages": [
"Added PaginatorKey attributes to Request properties that PowerShell consumes for Auto-Iteration."
],
"type": "patch",
"updateMinimum": true
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -220,6 +220,26 @@ namespace <#=this.Config.Namespace#>.Model
{
propertyAttributes.Add("Max=" + member.Shape.Max);
}

// Add PaginationRequestKey attribute to Request Pagination properties that will be used by PowerShell for Auto-Iteration
bool hasPaginatorInputToken = this.StructureType == StructureType.Request && this.Operation?.Paginators?.InputTokens.Any(x => x.PropertyName == member.PropertyName) == true;
bool hasPaginatorLimitKey = this.StructureType == StructureType.Request && this.Operation?.Paginators?.LimitKey?.PropertyName == member.PropertyName;
bool hasPaginatorOutputToken = this.StructureType == StructureType.Response && this.Operation?.Paginators?.OutputTokens.Any(x => x.PropertyName == member.PropertyName) == true;

if (hasPaginatorInputToken)
{
propertyAttributes.Add("PaginationInputToken=true");
}
else if (hasPaginatorLimitKey)
{
propertyAttributes.Add("PaginationLimitKey=true");
}
else if (hasPaginatorOutputToken)
{
propertyAttributes.Add("PaginationOutputToken=true");
}


if (propertyAttributes.Count > 0)
{
#>
6 changes: 6 additions & 0 deletions sdk/src/Core/Amazon.Runtime/Internal/AWSPropertyAttribute.cs
Original file line number Diff line number Diff line change
@@ -2,13 +2,19 @@

namespace Amazon.Runtime.Internal
{


[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public sealed class AWSPropertyAttribute : Attribute
{
private long min;
private long max;
public bool Sensitive { get; set; }
public bool Required { get; set; }
public bool PaginationInputToken { get; set; }
public bool PaginationOutputToken { get; set; }
public bool PaginationLimitKey { get; set; }


public bool IsMinSet { get; private set; }
public long Min