Skip to content

Commit a49f557

Browse files
author
Afroz Mohammed
committed
added inputtoken, output token, limit key
1 parent a676ce2 commit a49f557

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

generator/ServiceClientGeneratorLib/Generators/SourceFiles/StructureGenerator.tt

+17-8
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,25 @@ namespace <#=this.Config.Namespace#>.Model
220220
{
221221
propertyAttributes.Add("Max=" + member.Shape.Max);
222222
}
223-
if (this.StructureType == StructureType.Request)
223+
224+
// Add PaginationRequestKey attribute to Request Pagination properties that will be used by PowerShell for Auto-Iteration
225+
bool hasPaginatorInputToken = this.StructureType == StructureType.Request && this.Operation?.Paginators?.InputTokens.Any(x => x.PropertyName == member.PropertyName) == true;
226+
bool hasPaginatorLimitKey = this.StructureType == StructureType.Request && this.Operation?.Paginators?.LimitKey?.PropertyName == member.PropertyName;
227+
bool hasPaginatorOutputToken = this.StructureType == StructureType.Response && this.Operation?.Paginators?.OutputTokens.Any(x => x.PropertyName == member.PropertyName) == true;
228+
229+
if (hasPaginatorInputToken)
224230
{
225-
// Add PaginationRequestKey attribute to Request Pagination properties that will be used by PowerShell for Auto-Iteration
226-
bool hasPaginatorInputToken = this.StructureType == StructureType.Request && this.Operation?.Paginators?.InputTokens.Any(x => x.PropertyName == member.PropertyName) == true;
227-
bool hasPaginatorLimitKey = this.StructureType == StructureType.Request && this.Operation?.Paginators?.LimitKey?.PropertyName == member.PropertyName;
228-
if (hasPaginatorInputToken || hasPaginatorLimitKey)
229-
{
230-
propertyAttributes.Add("PaginationRequestKey=true");
231-
}
231+
propertyAttributes.Add("PaginationInputToken=true");
232+
}
233+
else if (hasPaginatorLimitKey)
234+
{
235+
propertyAttributes.Add("PaginationLimitKey=true");
236+
}
237+
else if (hasPaginatorOutputToken)
238+
{
239+
propertyAttributes.Add("PaginationOutputToken=true");
232240
}
241+
233242

234243
if (propertyAttributes.Count > 0)
235244
{

sdk/src/Core/Amazon.Runtime/Internal/AWSPropertyAttribute.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22

33
namespace Amazon.Runtime.Internal
44
{
5+
6+
57
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
68
public sealed class AWSPropertyAttribute : Attribute
79
{
810
private long min;
911
private long max;
1012
public bool Sensitive { get; set; }
1113
public bool Required { get; set; }
12-
public bool PaginationRequestKey { get; set; }
14+
public bool PaginationInputToken { get; set; }
15+
public bool PaginationOutputToken { get; set; }
16+
public bool PaginationLimitKey { get; set; }
17+
1318

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

0 commit comments

Comments
 (0)