Skip to content

Commit 931e652

Browse files
Added support for renaming objects within the same bucket using the new RenameObject API.
1 parent 9caea46 commit 931e652

17 files changed

+4532
-221
lines changed

generator/ServiceModels/s3/s3-2006-03-01.api.json

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,18 @@
12291229
"UseS3ExpressControlEndpoint":{"value":true}
12301230
}
12311231
},
1232+
"RenameObject":{
1233+
"name":"RenameObject",
1234+
"http":{
1235+
"method":"PUT",
1236+
"requestUri":"/{Bucket}/{Key+}?renameObject"
1237+
},
1238+
"input":{"shape":"RenameObjectRequest"},
1239+
"output":{"shape":"RenameObjectOutput"},
1240+
"errors":[
1241+
{"shape":"IdempotencyParameterMismatch"}
1242+
]
1243+
},
12321244
"RestoreObject":{
12331245
"name":"RestoreObject",
12341246
"http":{
@@ -1736,6 +1748,7 @@
17361748
"FULL_OBJECT"
17371749
]
17381750
},
1751+
"ClientToken":{"type":"string"},
17391752
"CloudFunction":{"type":"string"},
17401753
"CloudFunctionConfiguration":{
17411754
"type":"structure",
@@ -2814,6 +2827,11 @@
28142827
"shape":"IntelligentTieringId",
28152828
"location":"querystring",
28162829
"locationName":"id"
2830+
},
2831+
"ExpectedBucketOwner":{
2832+
"shape":"AccountId",
2833+
"location":"header",
2834+
"locationName":"x-amz-expected-bucket-owner"
28172835
}
28182836
}
28192837
},
@@ -3615,6 +3633,11 @@
36153633
"shape":"IntelligentTieringId",
36163634
"location":"querystring",
36173635
"locationName":"id"
3636+
},
3637+
"ExpectedBucketOwner":{
3638+
"shape":"AccountId",
3639+
"location":"header",
3640+
"locationName":"x-amz-expected-bucket-owner"
36183641
}
36193642
}
36203643
},
@@ -5003,6 +5026,11 @@
50035026
"location":"header",
50045027
"locationName":"x-amz-mp-parts-count"
50055028
},
5029+
"TagCount":{
5030+
"shape":"TagCount",
5031+
"location":"header",
5032+
"locationName":"x-amz-tagging-count"
5033+
},
50065034
"ObjectLockMode":{
50075035
"shape":"ObjectLockMode",
50085036
"location":"header",
@@ -5140,6 +5168,12 @@
51405168
"HttpErrorCodeReturnedEquals":{"type":"string"},
51415169
"HttpRedirectCode":{"type":"string"},
51425170
"ID":{"type":"string"},
5171+
"IdempotencyParameterMismatch":{
5172+
"type":"structure",
5173+
"members":{},
5174+
"error":{"httpStatusCode":400},
5175+
"exception":true
5176+
},
51435177
"IfMatch":{"type":"string"},
51445178
"IfMatchInitiatedTime":{
51455179
"type":"timestamp",
@@ -5586,6 +5620,11 @@
55865620
"shape":"Token",
55875621
"location":"querystring",
55885622
"locationName":"continuation-token"
5623+
},
5624+
"ExpectedBucketOwner":{
5625+
"shape":"AccountId",
5626+
"location":"header",
5627+
"locationName":"x-amz-expected-bucket-owner"
55895628
}
55905629
}
55915630
},
@@ -7002,6 +7041,11 @@
70027041
"location":"querystring",
70037042
"locationName":"id"
70047043
},
7044+
"ExpectedBucketOwner":{
7045+
"shape":"AccountId",
7046+
"location":"header",
7047+
"locationName":"x-amz-expected-bucket-owner"
7048+
},
70057049
"IntelligentTieringConfiguration":{
70067050
"shape":"IntelligentTieringConfiguration",
70077051
"locationName":"IntelligentTieringConfiguration",
@@ -8280,6 +8324,97 @@
82808324
"max":20,
82818325
"min":0
82828326
},
8327+
"RenameObjectOutput":{
8328+
"type":"structure",
8329+
"members":{}
8330+
},
8331+
"RenameObjectRequest":{
8332+
"type":"structure",
8333+
"required":[
8334+
"Bucket",
8335+
"Key",
8336+
"RenameSource"
8337+
],
8338+
"members":{
8339+
"Bucket":{
8340+
"shape":"BucketName",
8341+
"contextParam":{"name":"Bucket"},
8342+
"location":"uri",
8343+
"locationName":"Bucket"
8344+
},
8345+
"Key":{
8346+
"shape":"ObjectKey",
8347+
"contextParam":{"name":"Key"},
8348+
"location":"uri",
8349+
"locationName":"Key"
8350+
},
8351+
"RenameSource":{
8352+
"shape":"RenameSource",
8353+
"location":"header",
8354+
"locationName":"x-amz-rename-source"
8355+
},
8356+
"DestinationIfMatch":{
8357+
"shape":"IfMatch",
8358+
"location":"header",
8359+
"locationName":"If-Match"
8360+
},
8361+
"DestinationIfNoneMatch":{
8362+
"shape":"IfNoneMatch",
8363+
"location":"header",
8364+
"locationName":"If-None-Match"
8365+
},
8366+
"DestinationIfModifiedSince":{
8367+
"shape":"IfModifiedSince",
8368+
"location":"header",
8369+
"locationName":"If-Modified-Since"
8370+
},
8371+
"DestinationIfUnmodifiedSince":{
8372+
"shape":"IfUnmodifiedSince",
8373+
"location":"header",
8374+
"locationName":"If-Unmodified-Since"
8375+
},
8376+
"SourceIfMatch":{
8377+
"shape":"RenameSourceIfMatch",
8378+
"location":"header",
8379+
"locationName":"x-amz-rename-source-if-match"
8380+
},
8381+
"SourceIfNoneMatch":{
8382+
"shape":"RenameSourceIfNoneMatch",
8383+
"location":"header",
8384+
"locationName":"x-amz-rename-source-if-none-match"
8385+
},
8386+
"SourceIfModifiedSince":{
8387+
"shape":"RenameSourceIfModifiedSince",
8388+
"location":"header",
8389+
"locationName":"x-amz-rename-source-if-modified-since"
8390+
},
8391+
"SourceIfUnmodifiedSince":{
8392+
"shape":"RenameSourceIfUnmodifiedSince",
8393+
"location":"header",
8394+
"locationName":"x-amz-rename-source-if-unmodified-since"
8395+
},
8396+
"ClientToken":{
8397+
"shape":"ClientToken",
8398+
"idempotencyToken":true,
8399+
"location":"header",
8400+
"locationName":"x-amz-client-token"
8401+
}
8402+
}
8403+
},
8404+
"RenameSource":{
8405+
"type":"string",
8406+
"pattern":"\\/?.+\\/.+"
8407+
},
8408+
"RenameSourceIfMatch":{"type":"string"},
8409+
"RenameSourceIfModifiedSince":{
8410+
"type":"timestamp",
8411+
"timestampFormat":"rfc822"
8412+
},
8413+
"RenameSourceIfNoneMatch":{"type":"string"},
8414+
"RenameSourceIfUnmodifiedSince":{
8415+
"type":"timestamp",
8416+
"timestampFormat":"rfc822"
8417+
},
82838418
"ReplaceKeyPrefixWith":{"type":"string"},
82848419
"ReplaceKeyWith":{"type":"string"},
82858420
"ReplicaKmsKeyID":{"type":"string"},

generator/ServiceModels/s3/s3-2006-03-01.docs.json

Lines changed: 82 additions & 22 deletions
Large diffs are not rendered by default.

generator/ServiceModels/s3/s3-2006-03-01.normal.json

Lines changed: 172 additions & 18 deletions
Large diffs are not rendered by default.
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
using System;
16+
using System.Collections.Generic;
17+
using System.Xml.Serialization;
18+
using System.Text;
19+
using System.IO;
20+
using System.Net;
21+
22+
using Amazon.Runtime;
23+
using Amazon.Runtime.Internal;
24+
25+
namespace Amazon.S3.Model
26+
{
27+
/// <summary>
28+
/// The request includes a client token value that was used for a previous request, but at least one of the request parameters is different from
29+
/// the previous request that used that client token.
30+
/// </summary>
31+
/// <remarks>
32+
/// This exception is specific to operations that use idempotency tokens, such as the RenameObject operation.
33+
/// When you receive this exception, it means you're attempting to retry an operation with the same client token but with different parameters,
34+
/// which violates the idempotency guarantee.
35+
/// </remarks>
36+
#if !NETSTANDARD
37+
[Serializable]
38+
#endif
39+
public partial class IdempotencyParameterMismatchException : AmazonS3Exception
40+
{
41+
/// <summary>
42+
/// Constructs a new IdempotencyParameterMismatchException with the specified error
43+
/// message.
44+
/// </summary>
45+
/// <param name="message">
46+
/// Describes the error encountered.
47+
/// </param>
48+
public IdempotencyParameterMismatchException(string message)
49+
: base(message) { }
50+
51+
/// <summary>
52+
/// Construct instance of IdempotencyParameterMismatchException
53+
/// </summary>
54+
/// <param name="message"></param>
55+
/// <param name="innerException"></param>
56+
public IdempotencyParameterMismatchException(string message, Exception innerException)
57+
: base(message, innerException) { }
58+
59+
/// <summary>
60+
/// Construct instance of IdempotencyParameterMismatchException
61+
/// </summary>
62+
/// <param name="innerException"></param>
63+
public IdempotencyParameterMismatchException(Exception innerException)
64+
: base(innerException) { }
65+
66+
/// <summary>
67+
/// Construct instance of IdempotencyParameterMismatchException
68+
/// </summary>
69+
/// <param name="message"></param>
70+
/// <param name="innerException"></param>
71+
/// <param name="errorType"></param>
72+
/// <param name="errorCode"></param>
73+
/// <param name="requestId"></param>
74+
/// <param name="statusCode"></param>
75+
public IdempotencyParameterMismatchException(string message, Exception innerException, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode)
76+
: base(message, innerException, errorType, errorCode, requestId, statusCode) { }
77+
78+
/// <summary>
79+
/// Construct instance of IdempotencyParameterMismatchException
80+
/// </summary>
81+
/// <param name="message"></param>
82+
/// <param name="errorType"></param>
83+
/// <param name="errorCode"></param>
84+
/// <param name="requestId"></param>
85+
/// <param name="statusCode"></param>
86+
public IdempotencyParameterMismatchException(string message, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode)
87+
: base(message, errorType, errorCode, requestId, statusCode) { }
88+
89+
/// <summary>
90+
/// Construct instance of IdempotencyParameterMismatchException
91+
/// </summary>
92+
/// <param name="message"></param>
93+
/// <param name="innerException"></param>
94+
/// <param name="errorType"></param>
95+
/// <param name="errorCode"></param>
96+
/// <param name="requestId"></param>
97+
/// <param name="statusCode"></param>
98+
/// <param name="amazonId2"></param>
99+
/// <param name="amazonCfId"></param>
100+
public IdempotencyParameterMismatchException(string message, Exception innerException, ErrorType errorType, string errorCode, string requestId, HttpStatusCode statusCode, string amazonId2, string amazonCfId)
101+
: base(message, innerException, errorType, errorCode, requestId, statusCode, amazonId2, amazonCfId) { }
102+
103+
#if !NETSTANDARD
104+
/// <summary>
105+
/// Constructs a new instance of the IdempotencyParameterMismatchException class with serialized data.
106+
/// </summary>
107+
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
108+
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
109+
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info" /> parameter is null. </exception>
110+
/// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult" /> is zero (0). </exception>
111+
protected IdempotencyParameterMismatchException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
112+
: base(info, context)
113+
{
114+
}
115+
116+
/// <summary>
117+
/// Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with information about the exception.
118+
/// </summary>
119+
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
120+
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
121+
/// <exception cref="T:System.ArgumentNullException">The <paramref name="info" /> parameter is a null reference (Nothing in Visual Basic). </exception>
122+
#if BCL35
123+
[System.Security.Permissions.SecurityPermission(
124+
System.Security.Permissions.SecurityAction.LinkDemand,
125+
Flags = System.Security.Permissions.SecurityPermissionFlag.SerializationFormatter)]
126+
#endif
127+
[System.Security.SecurityCritical]
128+
// These FxCop rules are giving false-positives for this method
129+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2123:OverrideLinkDemandsShouldBeIdenticalToBase")]
130+
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2134:MethodsMustOverrideWithConsistentTransparencyFxCopRule")]
131+
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
132+
{
133+
base.GetObjectData(info, context);
134+
}
135+
#endif
136+
}
137+
}

0 commit comments

Comments
 (0)