Skip to content

Commit

Permalink
refactor: split GetACL into GetBucketACL and GetObjectACL. Split PutA…
Browse files Browse the repository at this point in the history
…CL into PutObjectACL and PutBucketACL. Obsolete PutACL and GetACL.
  • Loading branch information
peterrsongg committed Aug 9, 2024
1 parent a17338c commit e83c9f2
Show file tree
Hide file tree
Showing 40 changed files with 12,169 additions and 6,220 deletions.
11 changes: 11 additions & 0 deletions generator/.DevConfigs/4f49cfc6-d4a8-477c-a685-6b96d52d73ab.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"services": [
{
"serviceName": "S3",
"type": "patch",
"changeLogMessages": [
"Split GetACL into GetBucketACL and GetObjectACL. Split PutACL into PutObjectACL and PutBucketACL. Obsolete PutACL and GetACL"
]
}
]
}
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,22 @@ 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, but we must still include them in here because they haven't been removed. Remove this in V5, or
// whenever these 2 operations are removed.


#line default
#line hidden

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

#line default
Expand All @@ -232,16 +241,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 123 "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 126 "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,10 @@ namespace <#=Config.Namespace#>.Internal
}

<#}#>
<#
// GetACL and PutACL are deprecated in V4, but we must still include them in here because they haven't been removed. Remove this in V5, or
// whenever these 2 operations are removed.
#>
<#if (Config.ClassName == "S3") {#>
// Special handling of GetPreSignedUrlRequest
if (requestContext.Request.RequestName == "GetPreSignedUrlRequest")
Expand All @@ -104,6 +108,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
2 changes: 2 additions & 0 deletions generator/ServiceClientGeneratorLib/Operation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public string Name
return ShapeName;
}
}


/// <summary>
/// Returns the raw shape name without customization
/// </summary>
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 @@ -228,15 +228,9 @@
"DeleteBucketLifecycle": {
"name": "DeleteLifecycleConfiguration"
},
"GetBucketAcl": {
"name": "GetACL"
},
"GetBucketCors": {
"name": "GetCORSConfiguration"
},
"GetObjectAcl": {
"exclude": true
},
"HeadBucket": {
"internal": true
},
Expand All @@ -246,15 +240,9 @@
"ListObjectVersions": {
"name": "ListVersions"
},
"PutBucketAcl": {
"name": "PutACL"
},
"PutBucketCors": {
"name": "PutCORSConfiguration"
},
"PutObjectAcl": {
"exclude": true
},
"UploadPartCopy": {
"name": "CopyPart"
},
Expand Down
10 changes: 4 additions & 6 deletions sdk/src/Services/S3/AWSSDK.S3.NetStandard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@
</Choose>

<ItemGroup Condition="$(RunAnalyzersDuringBuild)">
<Analyzer Include= "../../../../buildtools/CustomRoslynAnalyzers.dll" />
<Analyzer Include="../../../../buildtools/CustomRoslynAnalyzers.dll" />
</ItemGroup>
<ItemGroup>
<Compile Remove="**/_bcl/**"/>
<Compile Remove="**/obj/**"/>
<Compile Remove="**/_bcl/**" />
<Compile Remove="**/obj/**" />
<None Remove="**/obj/**" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../../Core/AWSSDK.Core.NetStandard.csproj"/>
<ProjectReference Include="../../Core/AWSSDK.Core.NetStandard.csproj" />
</ItemGroup>

<ItemGroup Condition="$(RunAnalyzersDuringBuild)">
Expand All @@ -82,8 +82,6 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
</ItemGroup>

<ItemGroup>
</ItemGroup>
Expand Down
Loading

0 comments on commit e83c9f2

Please sign in to comment.