Skip to content

Commit 1347904

Browse files
committed
Generate DeleteObject
stack-info: PR: #4239, branch: peterrsongg/petesong/phase-3-pr6/1
1 parent ea64644 commit 1347904

File tree

11 files changed

+1239
-849
lines changed

11 files changed

+1239
-849
lines changed

generator/ServiceClientGeneratorLib/Generators/Marshallers/BaseMarshaller.cs

Lines changed: 451 additions & 450 deletions
Large diffs are not rendered by default.

generator/ServiceClientGeneratorLib/Generators/Marshallers/BaseMarshaller.tt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ using Amazon.Runtime.Internal.Util;
3737
{
3838
if (structure != null && this.Config.ServiceModel.Customizations.ShapeModifiers.TryGetValue(structure.Name, out var modifier) && modifier.ExcludedMarshallingProperties.Contains(member.ModeledName))
3939
continue;
40+
else if (this.Config.ServiceModel.Customizations.TryGetPropertyModifier(member.OwningShape.Name, member.ModeledName, out var headerPropertyModifier) && headerPropertyModifier.InjectXmlMarshallCode.Count > 0)
41+
{
42+
WriteInjectXmlMarshallCode(0, headerPropertyModifier.InjectXmlMarshallCode);
43+
continue;
44+
}
4045
#>
4146
if (<#=variableName#>.IsSet<#=member.PropertyName#>())
4247
{
@@ -47,10 +52,6 @@ using Amazon.Runtime.Internal.Util;
4752
request.Headers["<#=member.MarshallLocationName#>"] = <#=member.CustomMarshallerTransformation#>(<#=variableName#>.<#=member.PropertyName#>);
4853
<#+
4954
}
50-
else if (this.Config.ServiceModel.Customizations.TryGetPropertyModifier(member.OwningShape.Name, member.ModeledName, out var headerPropertyModifier) && headerPropertyModifier.InjectXmlMarshallCode.Count > 0)
51-
{
52-
WriteInjectXmlMarshallCode(3, headerPropertyModifier.InjectXmlMarshallCode);
53-
}
5455
else if (member.IsJsonValue)
5556
{
5657
#>

generator/ServiceClientGeneratorLib/ServiceModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,8 @@ public List<Operation> S3AllowListOperations
579579
new Operation(this, "ListObjects", DocumentRoot[OperationsKey]["ListObjects"]),
580580
new Operation(this,"UpdateBucketMetadataJournalTableConfiguration", DocumentRoot[OperationsKey]["UpdateBucketMetadataJournalTableConfiguration"]),
581581
new Operation(this, "ListMultipartUploads", DocumentRoot[OperationsKey]["ListMultipartUploads"]),
582-
new Operation(this, "CompleteMultipartUpload", DocumentRoot[OperationsKey]["CompleteMultipartUpload"])
582+
new Operation(this, "CompleteMultipartUpload", DocumentRoot[OperationsKey]["CompleteMultipartUpload"]),
583+
new Operation(this, "DeleteObject", DocumentRoot[OperationsKey]["DeleteObject"])
583584
};
584585
}
585586
return _s3AllowListOperations.Where(operation => operation.data != null).ToList();

generator/ServiceModels/s3/s3.customizations.json

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,8 +1371,33 @@
13711371
"Parts": {"emitPropertyName":"PartETags"}
13721372
}
13731373
]
1374+
},
1375+
"DeleteObjectRequest":{
1376+
"modify":[
1377+
{
1378+
"ExpectedBucketOwner":{"injectXmlIsSet": ["return !String.IsNullOrEmpty(this._expectedBucketOwner);"]}
1379+
},
1380+
{
1381+
"IfMatch" : {"injectXmlIsSet":["return !string.IsNullOrEmpty(this._ifMatch);"]}
1382+
},
1383+
{
1384+
"MFA": {"emitPropertyName": "MfaCodes"}
1385+
},
1386+
{
1387+
"MfaCodes":{
1388+
"injectXmlIsSet": ["return CustomMfaCodesIsSet();"],
1389+
"injectXmlMarshallCode" : ["MfaCodesCustomMarshall(request, publicRequest);"]
1390+
}
1391+
}
1392+
]
1393+
},
1394+
"DeleteObjectOutput":{
1395+
"modify":[
1396+
{
1397+
"DeleteMarker":{"injectXmlUnmarshallCode": ["DeleteMarkerCustomUnmarshall(context, response);"]}
1398+
}
1399+
]
13741400
}
1375-
13761401
},
13771402
"operationModifiers": {
13781403
"CreateBucket": {
@@ -1529,6 +1554,9 @@
15291554
},
15301555
"CompletedPart":{
15311556
"renameShape":"PartETag"
1557+
},
1558+
"MFA":{
1559+
"renameShape": "MfaCodes"
15321560
}
15331561
},
15341562
"overrideTreatEnumsAsString":{
@@ -1723,6 +1751,20 @@
17231751
"Marshaller":"blah",
17241752
"Unmarshaller":"StringUnmarshaller"
17251753
}
1754+
},
1755+
"DeleteObjectOutput":{
1756+
"DeleteMarker":{
1757+
"Type":"string",
1758+
"Marshaller": "StringUtils.FromString",
1759+
"Unmarshaller": "StringUnmarshaller"
1760+
}
1761+
},
1762+
"DeleteObjectRequest":{
1763+
"MfaCodes":{
1764+
"Type": "MfaCodes",
1765+
"Marshaller": "StringUtils.FromString",
1766+
"Unmarshaller": "StringUnmarshaller"
1767+
}
17261768
}
17271769
},
17281770
"excludeMembers":{

sdk/src/Services/S3/Custom/Model/DeleteObjectRequest.cs

Lines changed: 2 additions & 260 deletions
Original file line numberDiff line numberDiff line change
@@ -145,270 +145,12 @@ namespace Amazon.S3.Model
145145
/// </summary>
146146
public partial class DeleteObjectRequest : AmazonWebServiceRequest
147147
{
148-
private string bucketName;
149-
private bool? bypassGovernanceRetention;
150-
private string expectedBucketOwner;
151-
private string key;
152-
private MfaCodes mfaCodes;
153-
private RequestPayer requestPayer;
154-
private string versionId;
155-
private string ifMatch;
156-
private DateTime? ifMatchLastModifiedTime;
157-
private long? ifMatchSize;
158-
159-
160-
/// <summary>
161-
/// Gets and sets the property BucketName.
162-
/// <para>
163-
/// The bucket name of the bucket containing the object.
164-
/// </para>
165-
/// <para>
166-
/// <b>Directory buckets</b> - When you use this operation with a directory bucket, you must use virtual-hosted-style
167-
/// requests in the format <c> <i>Bucket-name</i>.s3express-<i>zone-id</i>.<i>region-code</i>.amazonaws.com</c>. Path-style
168-
/// requests are not supported. Directory bucket names must be unique in the chosen Zone (Availability Zone or Local Zone). Bucket
169-
/// names must follow the format <c> <i>bucket-base-name</i>--<i>zone-id</i>--x-s3</c> (for example, <c> <i>amzn-s3-demo-bucket</i>--<i>usw2-az1</i>--x-s3</c>). For
170-
/// information about bucket naming restrictions, see
171-
/// <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/directory-bucket-naming-rules.html">Directory bucket naming rules</a> in
172-
/// the <i>Amazon S3 User Guide</i>.
173-
/// </para>
174-
/// <para>
175-
/// <b>Access points</b> - When you use this action with an access point for general purpose buckets, you must provide the alias of
176-
/// the access point in place of the bucket name or specify the access point ARN. When you use this action with an access point for
177-
/// directory buckets, you must provide the access point name in place of the bucket name. When using the access point ARN, you must
178-
/// direct requests to the access point hostname. The access point hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When
179-
/// using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the
180-
/// bucket name. For more information about access point ARNs, see
181-
/// <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html">Using access points</a> in the <i>Amazon S3 User Guide</i>.
182-
/// </para>
183-
/// <note>
184-
/// <para>
185-
/// Object Lambda access points are not supported by directory buckets.
186-
/// </para>
187-
/// </note>
188-
/// <para>
189-
/// <b>S3 on Outposts</b> - When you use this action with S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts
190-
/// hostname takes the form <c> <i>AccessPointName</i>-<i>AccountId</i>.<i>outpostID</i>.s3-outposts.<i>Region</i>.amazonaws.com</c>. When you use
191-
/// this action with S3 on Outposts, the destination bucket must be the Outposts access point ARN or the access point alias. For more information
192-
/// about S3 on Outposts, see
193-
/// <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html">What is S3 on Outposts?</a> in the <i>Amazon S3 User Guide</i>.
194-
/// </para>
195-
/// </summary>
196-
public string BucketName
197-
{
198-
get { return this.bucketName; }
199-
set { this.bucketName = value; }
200-
}
201-
202-
// Check to see if BucketName property is set
203-
internal bool IsSetBucketName()
204-
{
205-
return this.bucketName != null;
206-
}
207-
208-
/// <summary>
209-
/// Gets and sets the property BypassGovernanceRetention.
210-
/// <para>
211-
/// Indicates whether S3 Object Lock should bypass Governance-mode restrictions to process
212-
/// this operation. To use this header, you must have the <c>s3:BypassGovernanceRetention</c>
213-
/// permission.
214-
/// </para>
215-
/// <note>
216-
/// <para>
217-
/// This functionality is not supported for directory buckets.
218-
/// </para>
219-
/// </note>
220-
/// </summary>
221-
public bool? BypassGovernanceRetention
222-
{
223-
get { return this.bypassGovernanceRetention; }
224-
set { this.bypassGovernanceRetention = value; }
225-
}
226-
227-
// Check to see if BypassGovernanceRetention property is set
228-
internal bool IsSetBypassGovernanceRetention()
229-
{
230-
return this.bypassGovernanceRetention.HasValue;
231-
}
232-
233-
/// <summary>
234-
/// Gets and sets the property ExpectedBucketOwner.
235-
/// <para>
236-
/// The account ID of the expected bucket owner. If the account ID that you provide does
237-
/// not match the actual owner of the bucket, the request fails with the HTTP status code
238-
/// <c>403 Forbidden</c> (access denied).
239-
/// </para>
240-
/// </summary>
241-
public string ExpectedBucketOwner
242-
{
243-
get { return this.expectedBucketOwner; }
244-
set { this.expectedBucketOwner = value; }
245-
}
246-
247-
// Check to see if ExpectedBucketOwner property is set
248-
internal bool IsSetExpectedBucketOwner()
249-
{
250-
return !String.IsNullOrEmpty(this.expectedBucketOwner);
251-
}
252-
253-
/// <summary>
254-
/// Gets and sets the property Key.
255-
/// <para>
256-
/// Key name of the object to delete.
257-
/// </para>
258-
/// </summary>
259-
public string Key
260-
{
261-
get { return this.key; }
262-
set { this.key = value; }
263-
}
264-
265-
// Check to see if Key property is set
266-
internal bool IsSetKey()
148+
internal bool CustomMfaCodesIsSet()
267149
{
268-
return this.key != null;
269-
}
270-
271-
/// <summary>
272-
/// Gets and sets the property MFA.
273-
/// <para>
274-
/// The concatenation of the authentication device's serial number, a space, and the value
275-
/// that is displayed on your authentication device. Required to permanently delete a
276-
/// versioned object if versioning is configured with MFA delete enabled.
277-
/// </para>
278-
/// <note>
279-
/// <para>
280-
/// This functionality is not supported for directory buckets.
281-
/// </para>
282-
/// </note>
283-
/// </summary>
284-
/// <remarks>
285-
/// This is a required property for this request if:<br />
286-
/// 1. EnableMfaDelete was configured on the bucket
287-
/// containing this object's version.<br />
288-
/// 2. You are deleting an object's version
289-
/// </remarks>
290-
public MfaCodes MfaCodes
291-
{
292-
get { return this.mfaCodes; }
293-
set { this.mfaCodes = value; }
294-
}
295-
296-
/// <summary>
297-
/// Checks if the MfaCodes property is set.
298-
/// </summary>
299-
/// <returns>true if the MfaCodes property is set.</returns>
300-
internal bool IsSetMfaCodes()
301-
{
302-
return (this.mfaCodes != null) &&
150+
return (this._mfaCodes != null) &&
303151
(!System.String.IsNullOrEmpty(MfaCodes.SerialNumber)) &&
304152
(!System.String.IsNullOrEmpty(MfaCodes.AuthenticationValue));
305153
}
306-
307-
/// <summary>
308-
/// Gets and sets the property RequestPayer.
309-
/// </summary>
310-
public RequestPayer RequestPayer
311-
{
312-
get { return this.requestPayer; }
313-
set { this.requestPayer = value; }
314-
}
315-
316-
// Check to see if RequestPayer property is set
317-
internal bool IsSetRequestPayer()
318-
{
319-
return requestPayer != null;
320-
}
321-
322-
/// <summary>
323-
/// Gets and sets the property VersionId.
324-
/// <para>
325-
/// Version ID used to reference a specific version of the object.
326-
/// </para>
327-
/// <note>
328-
/// <para>
329-
/// For directory buckets in this API operation, only the <c>null</c> value of the
330-
/// version ID is supported.
331-
/// </para>
332-
/// </note>
333-
/// </summary>
334-
public string VersionId
335-
{
336-
get { return this.versionId; }
337-
set { this.versionId = value; }
338-
}
339-
340-
// Check to see if VersionId property is set
341-
internal bool IsSetVersionId()
342-
{
343-
return !System.String.IsNullOrEmpty(this.versionId);
344-
}
345-
346-
/// <summary>
347-
/// Gets and sets the property IfMatch.
348-
/// <para>The <c>If-Match</c> header field makes the request method conditional on ETags. If the ETag value does not match, the operation returns
349-
/// a <c>412 Precondition Failed</c> error. If the ETag matches or if the object doesn't exist, the operation will return a <c>204 Success (No Content) response</c>.</para>
350-
/// <para>For more information about conditional requests, see <a href="https://docs.aws.amazon.com/https:/tools.ietf.org/html/rfc7232">RFC 7232</a>.</para>
351-
/// <note>
352-
/// <para>This functionality is only supported for directory buckets.</para>
353-
/// </note>
354-
/// </summary>
355-
public string IfMatch
356-
{
357-
get { return this.ifMatch; }
358-
set { this.ifMatch = value; }
359-
}
360-
361-
// Check to see if IfMatch property is set
362-
internal bool IsSetIfMatch()
363-
{
364-
return !String.IsNullOrEmpty(this.ifMatch);
365-
}
366-
367-
/// <summary>
368-
/// Gets and sets the property IfMatchLastModifiedTime.
369-
/// <para>If present, the object is deleted only if its modification times matches the provided
370-
/// <c>Timestamp</c>. If the <c>Timestamp</c> values do not match, the operation
371-
/// returns a <c>412 Precondition Failed</c> error. If the <c>Timestamp</c> matches
372-
/// or if the object doesn’t exist, the operation returns a <c>204 Success (No Content)</c> response.</para>
373-
/// <note>
374-
/// <para>This functionality is only supported for directory buckets.</para>
375-
/// </note>
376-
/// </summary>
377-
public DateTime? IfMatchLastModifiedTime
378-
{
379-
get { return this.ifMatchLastModifiedTime; }
380-
set { this.ifMatchLastModifiedTime = value; }
381-
}
382-
383-
// Check to see if IfMatchLastModifiedTime property is set
384-
internal bool IsSetIfMatchLastModifiedTime()
385-
{
386-
return this.ifMatchLastModifiedTime.HasValue;
387-
}
388-
389-
/// <summary>
390-
/// Gets and sets the property IfMatchSize.
391-
/// <para>If present, the object is deleted only if its size matches the provided size in bytes. If the <c>Size</c> value does not match, the operation returns a <c>412 Precondition Failed</c> error. If the <c>Size</c> matches or if the object doesn’t exist,
392-
/// the operation returns a <c>204 Success (No Content)</c> response.</para>
393-
/// <note>
394-
/// <para>This functionality is only supported for directory buckets.</para>
395-
/// </note>
396-
/// <important>
397-
/// <para>You can use the <c>If-Match</c>, <c>x-amz-if-match-last-modified-time</c> and <c>x-amz-if-match-size</c>
398-
/// conditional headers in conjunction with each-other or individually.</para>
399-
/// </important>
400-
/// </summary>
401-
public long IfMatchSize
402-
{
403-
get { return this.ifMatchSize.GetValueOrDefault(); }
404-
set { this.ifMatchSize = value; }
405-
}
406-
407-
// Check to see if MatchSize property is set
408-
internal bool IsSetIfMatchSize()
409-
{
410-
return this.ifMatchSize.HasValue;
411-
}
412154
}
413155
}
414156

0 commit comments

Comments
 (0)