Skip to content

Commit a25b031

Browse files
committed
Address PR Feedback
1 parent 0cce950 commit a25b031

File tree

8 files changed

+133
-190
lines changed

8 files changed

+133
-190
lines changed

generator/.DevConfigs/c881e931-b1ff-45ff-9521-9653e179466e.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"serviceName": "S3",
55
"type": "patch",
66
"changeLogMessages": [
7-
"Update ExceptionUnmarshallers and add S3 Exception t4 file. Generate PutBucketPolicy, PutObjectLegalHold, PutObjectLock, PutObjectRetention, PutPublicAccessBlock, HeadBucket, ListParts",
7+
"Update ExceptionUnmarshallers and add S3 Exception t4 file. Generate PutBucketPolicy, PutObjectLegalHold, PutObjectLockConfiguration, PutObjectRetention, PutPublicAccessBlock, HeadBucket, ListParts, PutObjectTagging",
88
"[Breaking Change] `LastModified` in `Amazon.S3.Model.PartDetail` is `DateTime?` instead of `DateTime` to follow v4 pattern of nullable types",
99
"[Breaking Change] `Tagging` in `PutBucketPolicyRequest` is no longer automatically initialized if null. You must initialize the object."
1010
]

generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlRequestMarshaller.cs

Lines changed: 78 additions & 81 deletions
Large diffs are not rendered by default.

generator/ServiceClientGeneratorLib/Generators/Marshallers/RestXmlRequestMarshaller.tt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -731,12 +731,9 @@ WriteXmlAttributeString(level + 1, member, variableName, isPayload: true, operat
731731
#>
732732
<#=new string(' ', level * 4)#>request.Content = Encoding.UTF8.GetBytes(<#=this.Operation.RequestPayloadMember.PrimitiveMarshaller#>(publicRequest.<#=this.Operation.RequestPayloadMember.PropertyName#>));
733733
<#+
734-
if (this.Operation.Name != "PutBucketPolicy")
735-
{
736734
#>
737735
<#=new string(' ', level * 4)#>request.Headers["Content-Type"] = "text/plain";
738736
<#+
739-
}
740737
}
741738
else if(payload.Shape.IsMemoryStream)
742739
{

generator/ServiceClientGeneratorLib/Operation.cs

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -304,24 +304,32 @@ public Member RequestPayloadMember
304304
var payload = this.RequestStructure.PayloadMemberName;
305305
// check to see if the payload member has been overridden by another member defined in the service customizations
306306
// file. For example, the payload member could've been included in the "exclude" array and another member
307-
// could've been injected.
308-
if (this.model.Customizations.ShapeModifiers.ContainsKey(this.RequestStructure.Name))
307+
// could've been injected.
308+
// For example:
309+
// "RestoreObjectRequest": {
310+
// "exclude": ["RestoreRequest"],
311+
// "inject": [
312+
// {
313+
// "Days": {
314+
// "shape": "Days",
315+
// "originalMember": "RestoreRequest"
316+
// }
317+
// }
318+
// ]
319+
// },
320+
// The payload is "RestoreRequest" but it has been excluded via a customization. so we check for
321+
// that scenario here.
322+
if (this.model.Customizations.ShapeModifiers.TryGetValue(this.RequestStructure.Name, out var customization) && customization.IsExcludedProperty(payload))
309323
{
310-
var customization = this.model.Customizations.ShapeModifiers[this.RequestStructure.Name];
311-
if (customization.IsExcludedProperty(payload))
324+
foreach (var injectedProperty in customization.InjectedPropertyNames)
312325
{
313-
foreach (var injectedProperty in customization.InjectedPropertyNames)
326+
var propertyInjector = customization.InjectedPropertyData(injectedProperty);
327+
if (string.Equals(propertyInjector.Data[CustomizationsModel.OriginalMemberKey].ToString(), payload, StringComparison.OrdinalIgnoreCase))
314328
{
315-
var propertyInjector = customization.InjectedPropertyData(injectedProperty);
316-
if (string.Equals(propertyInjector.Data[CustomizationsModel.OriginalMemberKey].ToString(), payload, StringComparison.OrdinalIgnoreCase))
317-
{
318-
payload = injectedProperty;
319-
break;
320-
}
321-
329+
payload = injectedProperty;
330+
break;
322331
}
323332
}
324-
325333
}
326334
if (!string.IsNullOrWhiteSpace(payload))
327335
{

sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/PutBucketPolicyRequestMarshaller.cs

Lines changed: 0 additions & 42 deletions
This file was deleted.

sdk/src/Services/S3/Generated/Model/HeadBucketResponse.cs

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ namespace Amazon.S3.Model
3535
public partial class HeadBucketResponse : AmazonWebServiceResponse
3636
{
3737
private bool? _accessPointAlias;
38+
private string _bucketArn;
3839
private string _bucketLocationName;
3940
private LocationType _bucketLocationType;
4041
private string _bucketRegion;
41-
private string _bucketArn;
4242

4343
/// <summary>
4444
/// Gets and sets the property AccessPointAlias.
@@ -63,6 +63,33 @@ internal bool IsSetAccessPointAlias()
6363
return this._accessPointAlias.HasValue;
6464
}
6565

66+
/// <summary>
67+
/// Gets and sets the property BucketArn.
68+
/// <para>
69+
/// The Amazon Resource Name (ARN) of the S3 bucket. ARNs uniquely identify Amazon Web
70+
/// Services resources across all of Amazon Web Services.
71+
/// </para>
72+
/// <note>
73+
/// <para>
74+
/// This parameter is only supported for S3 directory buckets. For more information, see
75+
/// <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-buckets-tagging.html">Using
76+
/// tags with directory buckets</a>.
77+
/// </para>
78+
/// </note>
79+
/// </summary>
80+
[AWSProperty(Min=1, Max=128)]
81+
public string BucketArn
82+
{
83+
get { return this._bucketArn; }
84+
set { this._bucketArn = value; }
85+
}
86+
87+
// Check to see if BucketArn property is set
88+
internal bool IsSetBucketArn()
89+
{
90+
return this._bucketArn != null;
91+
}
92+
6693
/// <summary>
6794
/// Gets and sets the property BucketLocationName.
6895
/// <para>
@@ -133,31 +160,5 @@ internal bool IsSetBucketRegion()
133160
return this._bucketRegion != null;
134161
}
135162

136-
/// <summary>
137-
/// Gets and sets the property BucketArn.
138-
/// <para>
139-
/// The Amazon Resource Name (ARN) of the S3 bucket. ARNs uniquely identify Amazon Web
140-
/// Services resources across all of Amazon Web Services.
141-
/// </para>
142-
/// <note>
143-
/// <para>
144-
/// This parameter is only supported for S3 directory buckets. For more information, see
145-
/// <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-buckets-tagging.html">Using
146-
/// tags with directory buckets</a>.
147-
/// </para>
148-
/// </note>
149-
/// </summary>
150-
[AWSProperty(Min=1, Max=128)]
151-
public string BucketArn
152-
{
153-
get { return this._bucketArn; }
154-
set { this._bucketArn = value; }
155-
}
156-
157-
// Check to see if BucketArn property is set
158-
internal bool IsSetBucketArn()
159-
{
160-
return this._bucketArn != null;
161-
}
162163
}
163164
}

sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/HeadBucketResponseUnmarshaller.cs

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte
4848
HeadBucketResponse response = new HeadBucketResponse();
4949
if (context.ResponseData.IsHeaderPresent("x-amz-access-point-alias"))
5050
response.AccessPointAlias = bool.Parse(context.ResponseData.GetHeaderValue("x-amz-access-point-alias"));
51+
if (context.ResponseData.IsHeaderPresent("x-amz-bucket-arn"))
52+
response.BucketArn = context.ResponseData.GetHeaderValue("x-amz-bucket-arn");
5153
if (context.ResponseData.IsHeaderPresent("x-amz-bucket-location-name"))
5254
response.BucketLocationName = context.ResponseData.GetHeaderValue("x-amz-bucket-location-name");
5355
if (context.ResponseData.IsHeaderPresent("x-amz-bucket-location-type"))
@@ -56,29 +58,8 @@ public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext conte
5658
response.BucketRegion = context.ResponseData.GetHeaderValue("x-amz-bucket-region");
5759

5860
return response;
59-
}
60-
61-
private static void UnmarshallResult(XmlUnmarshallerContext context, HeadBucketResponse response)
62-
{
63-
IWebResponseData responseData = context.ResponseData;
64-
if (responseData.IsHeaderPresent("x-amz-bucket-location-type"))
65-
response.BucketLocationType = LocationType.FindValue(responseData.GetHeaderValue("x-amz-bucket-location-type"));
66-
67-
if (responseData.IsHeaderPresent("x-amz-bucket-location-name"))
68-
response.BucketLocationName = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-bucket-location-name"));
69-
70-
if (responseData.IsHeaderPresent("x-amz-bucket-region"))
71-
response.BucketRegion = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-bucket-region"));
72-
73-
if (responseData.IsHeaderPresent("x-amz-access-point-alias"))
74-
response.AccessPointAlias = S3Transforms.ToBool(responseData.GetHeaderValue("x-amz-access-point-alias"));
75-
76-
if (responseData.IsHeaderPresent("x-amz-bucket-arn"))
77-
response.BucketArn = S3Transforms.ToString(responseData.GetHeaderValue("x-amz-bucket-arn"));
78-
79-
return;
80-
}
81-
61+
}
62+
8263

8364
/// <summary>
8465
/// Unmarshaller error response to exception.

sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/PutBucketPolicyRequestMarshaller.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public IRequest Marshall(PutBucketPolicyRequest publicRequest)
8282
throw new System.ArgumentException("BucketName is a required property and must be set before making this call.", "PutBucketPolicyRequest.BucketName");
8383
request.ResourcePath = "/";
8484
request.Content = Encoding.UTF8.GetBytes(StringUtils.FromString(publicRequest.Policy));
85+
request.Headers["Content-Type"] = "text/plain";
8586
if (publicRequest.IsSetContentMD5())
8687
request.Headers[Amazon.Util.HeaderKeys.ContentMD5Header] = publicRequest.ContentMD5;
8788
ChecksumUtils.SetChecksumData(

0 commit comments

Comments
 (0)