Skip to content

Commit ec4fd4a

Browse files
committed
generate ListMultipartUploads
stack-info: PR: #4207, branch: peterrsongg/petesong/phase-3-pr5-rebased-2/4
1 parent 50bdfc2 commit ec4fd4a

File tree

10 files changed

+807
-522
lines changed

10 files changed

+807
-522
lines changed

generator/ServiceClientGeneratorLib/ServiceModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,8 @@ public List<Operation> S3AllowListOperations
577577
new Operation(this, "GetBucketMetadataConfiguration", DocumentRoot[OperationsKey]["GetBucketMetadataConfiguration"]),
578578
new Operation(this, "DeleteBucketMetadataConfiguration", DocumentRoot[OperationsKey]["DeleteBucketMetadataConfiguration"]),
579579
new Operation(this, "ListObjects", DocumentRoot[OperationsKey]["ListObjects"]),
580-
new Operation(this,"UpdateBucketMetadataJournalTableConfiguration", DocumentRoot[OperationsKey]["UpdateBucketMetadataJournalTableConfiguration"])
580+
new Operation(this,"UpdateBucketMetadataJournalTableConfiguration", DocumentRoot[OperationsKey]["UpdateBucketMetadataJournalTableConfiguration"]),
581+
new Operation(this, "ListMultipartUploads", DocumentRoot[OperationsKey]["ListMultipartUploads"])
581582
};
582583
}
583584
return _s3AllowListOperations.Where(operation => operation.data != null).ToList();

generator/ServiceModels/s3/s3.customizations.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,31 @@
12631263
}
12641264

12651265
]
1266+
},
1267+
"ListMultipartUploadsRequest":{
1268+
"modify":[
1269+
{
1270+
"EncodingType":{"emitPropertyName":"Encoding"}
1271+
},
1272+
{
1273+
"ExpectedBucketOwner":{"injectXmlIsSet":["return !String.IsNullOrEmpty(this._expectedBucketOwner);"]}
1274+
}
1275+
]
1276+
},
1277+
"ListMultipartUploadsOutput":{
1278+
"modify":[
1279+
{
1280+
"CommonPrefixes":{
1281+
"injectXmlUnmarshallCode":["CommonPrefixesCustomUnmarshall(context, response);"],
1282+
"skipContextTestExpressionUnmarshallingLogic" : true
1283+
}
1284+
},
1285+
{
1286+
"Uploads":{"emitPropertyName":"MultipartUploads"}
1287+
1288+
1289+
}
1290+
]
12661291
}
12671292

12681293
},
@@ -1567,6 +1592,20 @@
15671592
"Marshaller": "StringUtils.FromString",
15681593
"Unmarshaller" : "CommonPrefixesItemUnmarshaller"
15691594
}
1595+
},
1596+
"ListMultipartUploadsRequest":{
1597+
"CommonPrefixes" : {
1598+
"Type": "List<string>",
1599+
"Marshaller": "StringUtils.FromString",
1600+
"Unmarshaller" : "CommonPrefixesItemUnmarshaller"
1601+
}
1602+
},
1603+
"ListMultipartUploadsOutput":{
1604+
"CommonPrefixes" : {
1605+
"Type": "List<string>",
1606+
"Marshaller": "StringUtils.FromString",
1607+
"Unmarshaller" : "CommonPrefixesItemUnmarshaller"
1608+
}
15701609
}
15711610
},
15721611
"excludeMembers":{

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

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

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

Lines changed: 9 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -26,150 +26,21 @@ namespace Amazon.S3.Model.Internal.MarshallTransformations
2626
/// <summary>
2727
/// Response Unmarshaller for ListMultipartUploads operation
2828
/// </summary>
29-
public class ListMultipartUploadsResponseUnmarshaller : S3ReponseUnmarshaller
30-
{
31-
/// <summary>
32-
/// Unmarshaller the response from the service to the response class.
33-
/// </summary>
34-
/// <param name="context"></param>
35-
/// <returns></returns>
36-
public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
37-
{
38-
ListMultipartUploadsResponse response = new ListMultipartUploadsResponse();
39-
40-
while (context.Read())
41-
{
42-
if (context.IsStartElement)
43-
{
44-
UnmarshallResult(context,response);
45-
continue;
46-
}
47-
}
48-
49-
IWebResponseData responseData = context.ResponseData;
50-
if (responseData.IsHeaderPresent(S3Constants.AmzHeaderRequestCharged))
51-
response.RequestCharged = RequestCharged.FindValue(responseData.GetHeaderValue(S3Constants.AmzHeaderRequestCharged));
52-
53-
return response;
54-
}
55-
56-
private static void UnmarshallResult(XmlUnmarshallerContext context,ListMultipartUploadsResponse response)
29+
public partial class ListMultipartUploadsResponseUnmarshaller : S3ReponseUnmarshaller
30+
{
31+
private static void CommonPrefixesCustomUnmarshall(XmlUnmarshallerContext context, ListMultipartUploadsResponse response)
5732
{
58-
59-
int originalDepth = context.CurrentDepth;
60-
int targetDepth = originalDepth + 1;
61-
62-
if (context.IsStartOfDocument)
63-
targetDepth += 2;
64-
65-
while (context.Read())
66-
{
67-
if (context.IsStartElement || context.IsAttribute)
68-
{
69-
if (context.TestExpression("Bucket", targetDepth))
70-
{
71-
response.BucketName = StringUnmarshaller.GetInstance().Unmarshall(context);
72-
73-
continue;
74-
}
75-
if (context.TestExpression("KeyMarker", targetDepth))
76-
{
77-
response.KeyMarker = StringUnmarshaller.GetInstance().Unmarshall(context);
78-
79-
continue;
80-
}
81-
if (context.TestExpression("UploadIdMarker", targetDepth))
82-
{
83-
response.UploadIdMarker = StringUnmarshaller.GetInstance().Unmarshall(context);
84-
85-
continue;
86-
}
87-
if (context.TestExpression("NextKeyMarker", targetDepth))
88-
{
89-
response.NextKeyMarker = StringUnmarshaller.GetInstance().Unmarshall(context);
90-
91-
continue;
92-
}
93-
if (context.TestExpression("NextUploadIdMarker", targetDepth))
94-
{
95-
response.NextUploadIdMarker = StringUnmarshaller.GetInstance().Unmarshall(context);
96-
97-
continue;
98-
}
99-
if (context.TestExpression("MaxUploads", targetDepth))
100-
{
101-
response.MaxUploads = IntUnmarshaller.GetInstance().Unmarshall(context);
102-
103-
continue;
104-
}
105-
if (context.TestExpression("IsTruncated", targetDepth))
106-
{
107-
response.IsTruncated = BoolUnmarshaller.GetInstance().Unmarshall(context);
108-
109-
continue;
110-
}
111-
if (context.TestExpression("Upload", targetDepth))
112-
{
113-
if (response.MultipartUploads == null)
114-
{
115-
response.MultipartUploads = new List<MultipartUpload>();
116-
}
117-
118-
response.MultipartUploads.Add(MultipartUploadUnmarshaller.Instance.Unmarshall(context));
119-
continue;
120-
}
121-
if (context.TestExpression("Delimiter", targetDepth))
122-
{
123-
response.Delimiter = StringUnmarshaller.GetInstance().Unmarshall(context);
124-
125-
continue;
126-
}
127-
if (context.TestExpression("Prefix", targetDepth))
128-
{
129-
response.Prefix = StringUnmarshaller.GetInstance().Unmarshall(context);
130-
131-
continue;
132-
}
133-
if (context.TestExpression("CommonPrefixes", targetDepth))
134-
{
135-
var prefix = CommonPrefixesItemUnmarshaller.Instance.Unmarshall(context);
136-
137-
if (prefix != null)
138-
{
139-
if (response.CommonPrefixes == null)
140-
{
141-
response.CommonPrefixes = new List<string>();
142-
}
143-
response.CommonPrefixes.Add(prefix);
144-
}
33+
var prefix = CommonPrefixesItemUnmarshaller.Instance.Unmarshall(context);
14534

146-
continue;
147-
}
148-
}
149-
else if (context.IsEndElement && context.CurrentDepth < originalDepth)
150-
{
151-
return;
152-
}
153-
}
154-
155-
return;
156-
}
157-
158-
private static ListMultipartUploadsResponseUnmarshaller _instance;
159-
160-
/// <summary>
161-
/// Singleton for the unmarshaller
162-
/// </summary>
163-
public static ListMultipartUploadsResponseUnmarshaller Instance
164-
{
165-
get
35+
if (prefix != null)
16636
{
167-
if (_instance == null)
37+
if (response.CommonPrefixes == null)
16838
{
169-
_instance = new ListMultipartUploadsResponseUnmarshaller();
39+
response.CommonPrefixes = new List<string>();
17040
}
171-
return _instance;
41+
response.CommonPrefixes.Add(prefix);
17242
}
43+
return;
17344
}
17445
}
17546
}

0 commit comments

Comments
 (0)