Skip to content

Commit

Permalink
Split GetACL into GetBucketACL and GetObject ACL and the same for Put…
Browse files Browse the repository at this point in the history
…ACL (#3408)

* refactor: split GetACL into GetBucketACL and GetObjectACL. Split PutACL into PutObjectACL and PutBucketACL. Obsolete PutACL and GetACL.
  • Loading branch information
peterrsongg authored Aug 20, 2024
1 parent 3fb7211 commit 6c740df
Show file tree
Hide file tree
Showing 37 changed files with 12,554 additions and 6,215 deletions.
13 changes: 13 additions & 0 deletions generator/.DevConfigs/4f49cfc6-d4a8-477c-a685-6b96d52d73ab.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"services": [
{
"serviceName": "S3",
"type": "patch",
"changeLogMessages": [
"Split GetACL into GetBucketAcl and GetObjectAcl",
"Split PutACL into PutObjectACL and PutBucketACL.",
"Obsolete PutACL and GetACL. These operations are being split into separate operations, because context parameters that could be used for endpoint resolution were not being copied over due to the two operations being merged into one. These context parameters were not being used currently so there is no effect as of now."
]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace ServiceClientGenerator.Generators.Endpoints
/// Class to produce the template output
/// </summary>

#line 1 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 1 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
public partial class EndpointResolver : BaseGenerator
{
Expand All @@ -30,7 +30,7 @@ public partial class EndpointResolver : BaseGenerator
public override string TransformText()
{

#line 7 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 7 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"

AddLicenseHeader();

Expand All @@ -39,60 +39,60 @@ public override string TransformText()
#line hidden
this.Write("\r\nusing System;\r\nusing Amazon.");

#line 12 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 12 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(Config.ServiceNameRoot));

#line default
#line hidden
this.Write(".Model;\r\nusing Amazon.Runtime;\r\nusing Amazon.Runtime.Internal;\r\nusing Amazon.Runt" +
"ime.Endpoints;\r\nusing Amazon.Util;\r\nusing ");

#line 17 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 17 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(Config.Namespace));

#line default
#line hidden
this.Write(".Endpoints;\r\n\r\n#pragma warning disable 1591\r\n\r\nnamespace ");

#line 21 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 21 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(Config.Namespace));

#line default
#line hidden
this.Write(".Internal\r\n{\r\n /// <summary>\r\n /// Amazon ");

#line 24 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 24 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.ClassName));

#line default
#line hidden
this.Write(" endpoint resolver.\r\n /// Custom PipelineHandler responsible for resolving end" +
"point and setting authentication parameters for ");

#line 25 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 25 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.ClassName));

#line default
#line hidden
this.Write(" service requests.\r\n /// Collects values for ");

#line 26 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 26 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.ClassName));

#line default
#line hidden
this.Write("EndpointParameters and then tries to resolve endpoint by calling \r\n /// Resolv" +
"eEndpoint method on GlobalEndpoints.Provider if present, otherwise uses ");

#line 27 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 27 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.Config.ClassName));

#line default
#line hidden
this.Write("EndpointProvider.\r\n /// Responsible for setting authentication and http header" +
"s provided by resolved endpoint.\r\n /// </summary>\r\n public class Amazon");

#line 30 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 30 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(Config.ClassName));

#line default
Expand All @@ -101,7 +101,7 @@ public override string TransformText()
"erviceSpecificHandler(IExecutionContext executionContext, EndpointParameters par" +
"ameters)\r\n {\r\n");

#line 34 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 34 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
if (Config.ServiceId == "S3") {

#line default
Expand Down Expand Up @@ -129,57 +129,57 @@ public override string TransformText()
}
");

#line 56 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 56 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
}

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

#line 58 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 58 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
if (!this.dontInjectHostPrefixForServices.Contains(Config.ServiceId)) {

#line default
#line hidden
this.Write(" InjectHostPrefix(executionContext.RequestContext);\r\n");

#line 60 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 60 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
}

#line default
#line hidden
this.Write(" }\r\n\r\n protected override EndpointParameters MapEndpointsParameters" +
"(IRequestContext requestContext)\r\n {\r\n var config = (Amazon");

#line 65 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 65 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(Config.ClassName));

#line default
#line hidden
this.Write("Config)requestContext.ClientConfig;\r\n var result = new ");

#line 66 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 66 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(Config.ClassName));

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

#line 67 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 67 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.AssignBuiltins()));

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

#line 68 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 68 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.AssignClientContext()));

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

#line 69 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 69 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
if (Config.EndpointsRuleSet.parameters.ContainsKey("Region")) {

#line default
Expand Down Expand Up @@ -214,13 +214,21 @@ public override string TransformText()
");

#line 98 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 98 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
}

#line default
#line hidden

#line 99 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 99 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"

// GetACL and PutACL are deprecated in V4 and may be removed in the future


#line default
#line hidden

#line 102 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
if (Config.ClassName == "S3") {

#line default
Expand All @@ -232,16 +240,28 @@ public override string TransformText()
result.Bucket = request.BucketName;
return result;
}
if (requestContext.RequestName == ""GetACLRequest"") {
result.UseS3ExpressControlEndpoint = true;
var request = (GetACLRequest)requestContext.OriginalRequest;
result.Bucket = request.BucketName;
return result;
}
if (requestContext.RequestName == ""PutACLRequest"") {
result.UseS3ExpressControlEndpoint = true;
var request = (PutACLRequest)requestContext.OriginalRequest;
result.Bucket = request.BucketName;
return result;
}
");

#line 107 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 122 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
}

#line default
#line hidden
this.Write("\r\n // Assign staticContextParams and contextParam per operation\r\n");

#line 110 "C:\codebase\v3\AWSDotNetPublic\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
#line 125 "C:\Dev\Repos\aws-sdk-net-staging\generator\ServiceClientGeneratorLib\Generators\Endpoints\EndpointResolver.tt"
this.Write(this.ToStringHelper.ToStringWithCulture(this.AssignOperationContext()));

#line default
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ namespace <#=Config.Namespace#>.Internal
}

<#}#>
<#
// GetACL and PutACL are deprecated in V4 and may be removed in the future
#>
<#if (Config.ClassName == "S3") {#>
// Special handling of GetPreSignedUrlRequest
if (requestContext.Request.RequestName == "GetPreSignedUrlRequest")
Expand All @@ -104,6 +107,18 @@ namespace <#=Config.Namespace#>.Internal
result.Bucket = request.BucketName;
return result;
}
if (requestContext.RequestName == "GetACLRequest") {
result.UseS3ExpressControlEndpoint = true;
var request = (GetACLRequest)requestContext.OriginalRequest;
result.Bucket = request.BucketName;
return result;
}
if (requestContext.RequestName == "PutACLRequest") {
result.UseS3ExpressControlEndpoint = true;
var request = (PutACLRequest)requestContext.OriginalRequest;
result.Bucket = request.BucketName;
return result;
}
<#}#>

// Assign staticContextParams and contextParam per operation
Expand Down
12 changes: 0 additions & 12 deletions generator/ServiceModels/s3/s3.customizations.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,9 @@
"DeleteBucketLifecycle": {
"name": "DeleteLifecycleConfiguration"
},
"GetBucketAcl": {
"name": "GetACL"
},
"GetBucketCors": {
"name": "GetCORSConfiguration"
},
"GetObjectAcl": {
"exclude": true
},
"HeadBucket": {
"internal": true
},
Expand All @@ -255,15 +249,9 @@
"ListObjectVersions": {
"name": "ListVersions"
},
"PutBucketAcl": {
"name": "PutACL"
},
"PutBucketCors": {
"name": "PutCORSConfiguration"
},
"PutObjectAcl": {
"exclude": true
},
"UploadPartCopy": {
"name": "CopyPart"
},
Expand Down
Loading

0 comments on commit 6c740df

Please sign in to comment.