Skip to content

Commit

Permalink
Adjustments to S3 RequestsWith200Error request list generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
boblodgett authored Jan 6, 2025
1 parent 9a08624 commit 4cb4246
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 23 deletions.
11 changes: 11 additions & 0 deletions generator/.DevConfigs/afb5e312-3d08-469e-a9c3-c392635eac53.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"services": [
{
"serviceName": "S3",
"type": "patch",
"changeLogMessages": [
"Adjustments to S3 RequestsWith200Error request list generation."
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace ServiceClientGenerator.Generators.SourceFiles
/// Class to produce the template output
/// </summary>

#line 1 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\SourceFiles\AmazonS3RetryPolicy.tt"
#line 1 "C:\Dev\worktrees\s3-200\generator\ServiceClientGeneratorLib\Generators\SourceFiles\AmazonS3RetryPolicy.tt"
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
public partial class AmazonS3RetryPolicy : BaseGenerator
{
Expand All @@ -29,7 +29,7 @@ public partial class AmazonS3RetryPolicy : BaseGenerator
public override string TransformText()
{

#line 6 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\SourceFiles\AmazonS3RetryPolicy.tt"
#line 6 "C:\Dev\worktrees\s3-200\generator\ServiceClientGeneratorLib\Generators\SourceFiles\AmazonS3RetryPolicy.tt"

AddLicenseHeader();

Expand Down Expand Up @@ -58,27 +58,35 @@ public partial class AmazonS3RetryPolicy : DefaultRetryPolicy
{
");

#line 29 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\SourceFiles\AmazonS3RetryPolicy.tt"
#line 29 "C:\Dev\worktrees\s3-200\generator\ServiceClientGeneratorLib\Generators\SourceFiles\AmazonS3RetryPolicy.tt"


foreach(var operation in this.Config.ServiceModel.Operations)
{
if(operation.RequestStructure != null && !operation.RequestStructure.Members.Any(member => member.IsStreaming))
// List all operations without an output shape or an output shape that does not match any of the following conditions:
// "streaming":true
// "eventstream":true
// "payload" of type "string"
if((operation.ResponseStructure != null &&
!operation.ResponseStructure.Members.Any(member => member.IsStreaming || member.IsEventStream) &&
operation.ResponseStructure.PayloadMember?.OwningShape.IsString != true) ||
operation.ResponseStructure == null // When ResponseStructure is null the operation does not have an output shape.
)
{


#line default
#line hidden
this.Write("\t\t\ttypeof(");

#line 36 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\SourceFiles\AmazonS3RetryPolicy.tt"
#line 44 "C:\Dev\worktrees\s3-200\generator\ServiceClientGeneratorLib\Generators\SourceFiles\AmazonS3RetryPolicy.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(operation.Name));

#line default
#line hidden
this.Write("Request),\r\n");

#line 37 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\SourceFiles\AmazonS3RetryPolicy.tt"
#line 45 "C:\Dev\worktrees\s3-200\generator\ServiceClientGeneratorLib\Generators\SourceFiles\AmazonS3RetryPolicy.tt"

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,15 @@ namespace Amazon.S3.Internal

foreach(var operation in this.Config.ServiceModel.Operations)
{
if(operation.RequestStructure != null && !operation.RequestStructure.Members.Any(member => member.IsStreaming))
// List all operations without an output shape or an output shape that does not match any of the following conditions:
// "streaming":true
// "eventstream":true
// "payload" of type "string"
if((operation.ResponseStructure != null &&
!operation.ResponseStructure.Members.Any(member => member.IsStreaming || member.IsEventStream) &&
operation.ResponseStructure.PayloadMember?.OwningShape.IsString != true) ||
operation.ResponseStructure == null // When ResponseStructure is null the operation does not have an output shape.
)
{
#>
typeof(<#= operation.Name#>Request),
Expand Down
14 changes: 0 additions & 14 deletions generator/ServiceClientGeneratorLib/Shape.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,20 +433,6 @@ public Member PayloadMember
}
}

public bool IsEventStream
{
get
{
var isEventStream = data[EventStreamKey];
if (isEventStream != null && isEventStream.IsBoolean)
{
return (bool)isEventStream;
}

return false;
}
}

/// <summary>
/// If this shape is a primitive type this returns true so that the request can show if the member has been set or not
/// </summary>
Expand Down
18 changes: 18 additions & 0 deletions generator/ServiceClientGeneratorLib/SimpleModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,24 @@ public bool IsStreaming
}
}

/// <summary>
/// Determines if the given node has "eventstream": true which can be applied to a shape
/// or a member.
/// </summary>
public bool IsEventStream
{
get
{
var isEventStream = data[Shape.EventStreamKey];
if (isEventStream != null && isEventStream.IsBoolean)
{
return (bool)isEventStream;
}

return false;
}
}

/// <summary>
/// If defined, specifies the namespace prefix the xml constructed
/// </summary>
Expand Down
5 changes: 3 additions & 2 deletions sdk/src/Services/S3/Generated/AmazonS3RetryPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,12 @@ public partial class AmazonS3RetryPolicy : DefaultRetryPolicy
typeof(GetBucketWebsiteRequest),
typeof(GetCORSConfigurationRequest),
typeof(GetLifecycleConfigurationRequest),
typeof(GetObjectRequest),
typeof(GetObjectAttributesRequest),
typeof(GetObjectLegalHoldRequest),
typeof(GetObjectLockConfigurationRequest),
typeof(GetObjectMetadataRequest),
typeof(GetObjectRetentionRequest),
typeof(GetObjectTaggingRequest),
typeof(GetObjectTorrentRequest),
typeof(GetPublicAccessBlockRequest),
typeof(HeadBucketRequest),
typeof(InitiateMultipartUploadRequest),
Expand Down Expand Up @@ -122,13 +120,16 @@ public partial class AmazonS3RetryPolicy : DefaultRetryPolicy
typeof(PutBucketWebsiteRequest),
typeof(PutCORSConfigurationRequest),
typeof(PutLifecycleConfigurationRequest),
typeof(PutObjectRequest),
typeof(PutObjectLegalHoldRequest),
typeof(PutObjectLockConfigurationRequest),
typeof(PutObjectRetentionRequest),
typeof(PutObjectTaggingRequest),
typeof(PutPublicAccessBlockRequest),
typeof(RestoreObjectRequest),
typeof(SelectObjectContentRequest),
typeof(UploadPartRequest),
typeof(WriteGetObjectResponseRequest),
};
}
}

0 comments on commit 4cb4246

Please sign in to comment.