Skip to content

Commit 5bee66a

Browse files
committed
Generate GetBucketAnalyticsConfiguration
stack-info: PR: #4127, branch: peterrsongg/petesong/phase-3-pr-2-all/3
1 parent 42efdb7 commit 5bee66a

14 files changed

+610
-386
lines changed

generator/ServiceClientGeneratorLib/ServiceModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ public List<Operation> S3AllowListOperations
548548
new Operation(this, "ListObjectsV2", DocumentRoot[OperationsKey]["ListObjectsV2"]),
549549
// phase 3 (including those moved from phase 1)
550550
new Operation(this, "CreateSession", DocumentRoot[OperationsKey]["CreateSession"]),
551-
//new Operation(this, "GetBucketAnalyticsConfiguration", DocumentRoot[OperationsKey]["GetBucketAnalyticsConfiguration"]),
551+
new Operation(this, "GetBucketAnalyticsConfiguration", DocumentRoot[OperationsKey]["GetBucketAnalyticsConfiguration"]),
552552
//new Operation(this, "GetBucketIntelligentTieringConfiguration", DocumentRoot[OperationsKey]["GetBucketIntelligentTieringConfiguration"]),
553553
//new Operation(this, "GetBucketInventoryConfiguration", DocumentRoot[OperationsKey]["GetBucketInventoryConfiguration"]),
554554
//new Operation(this, "GetBucketLogging", DocumentRoot[OperationsKey]["GetBucketLogging"]),

generator/ServiceModels/s3/s3.customizations.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,28 @@
933933
"injectXmlMarshallCode": ["AnalyticsFilterCustomMarshall(publicRequest, xmlWriter);"]
934934
}
935935
}
936+
],
937+
"predicateListUnmarshallers": [
938+
{
939+
"AnalyticsFilter" :{
940+
"predicateListUnmarshallerName" : "AnalyticsPredicateListUnmarshaller",
941+
"filterPredicateName": "AnalyticsFilterPredicate"
942+
}
943+
}
944+
]
945+
},
946+
"GetBucketAnalyticsConfigurationRequest":{
947+
"modify" :[
948+
{
949+
"Id" :{"emitPropertyName": "AnalyticsId"}
950+
},
951+
{
952+
"ExpectedBucketOwner":{
953+
"injectXmlIsSet":[
954+
"return !String.IsNullOrEmpty(this._expectedBucketOwner);"
955+
]
956+
}
957+
}
936958
]
937959
},
938960
"AnalyticsS3BucketDestination" : {
@@ -951,6 +973,12 @@
951973
"Prefix":{
952974
"injectXmlIsSet": ["return !String.IsNullOrEmpty(this._prefix);"]
953975
}
976+
},
977+
{
978+
"Format" :{
979+
"skipContextTestExpressionUnmarshallingLogic" : true,
980+
"injectXmlUnmarshallCode": ["FormatCustomUnmarshall(context, unmarshalledObject);"]
981+
}
954982
}
955983
]
956984
}

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

Lines changed: 15 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -12,87 +12,30 @@
1212
* express or implied. See the License for the specific language governing
1313
* permissions and limitations under the License.
1414
*/
15-
using System.Collections.Generic;
1615

17-
using Amazon.S3.Model;
16+
using Amazon.Runtime;
17+
using Amazon.Runtime.Internal;
1818
using Amazon.Runtime.Internal.Transform;
19+
using Amazon.Runtime.Internal.Util;
20+
using Amazon.S3.Model;
21+
using System;
22+
using System.Collections.Generic;
23+
using System.Globalization;
24+
using System.IO;
25+
using System.Net;
26+
using System.Text;
27+
using System.Xml.Serialization;
1928

2029
namespace Amazon.S3.Model.Internal.MarshallTransformations
2130
{
2231
/// <summary>
23-
/// AnalyticsS3BucketDestination Unmarshaller
32+
/// Custom unmarshaller for AnalyticsS3BucketDestination Object
2433
/// </summary>
25-
public class AnalyticsS3BucketDestinationUnmarshaller : IXmlUnmarshaller<AnalyticsS3BucketDestination, XmlUnmarshallerContext>
34+
public partial class AnalyticsS3BucketDestinationUnmarshaller : IXmlUnmarshaller<AnalyticsS3BucketDestination, XmlUnmarshallerContext>
2635
{
27-
/// <summary>
28-
/// Unmarshaller the response from the service to the response class.
29-
/// </summary>
30-
/// <param name="context"></param>
31-
/// <returns></returns>
32-
public AnalyticsS3BucketDestination Unmarshall(XmlUnmarshallerContext context)
33-
{
34-
AnalyticsS3BucketDestination AnalyticsS3BucketDestination = new AnalyticsS3BucketDestination();
35-
int originalDepth = context.CurrentDepth;
36-
int targetDepth = originalDepth + 1;
37-
38-
if (context.IsStartOfDocument)
39-
targetDepth += 2;
40-
41-
while (context.Read())
42-
{
43-
if (context.IsStartElement || context.IsAttribute)
44-
{
45-
if (context.TestExpression("Format", targetDepth))
46-
{
47-
AnalyticsS3BucketDestination.Format = AnalyticsS3ExportFileFormat.FindValue(StringUnmarshaller.Instance.Unmarshall(context));
48-
49-
continue;
50-
}
51-
if (context.TestExpression("BucketAccountId", targetDepth))
52-
{
53-
AnalyticsS3BucketDestination.BucketAccountId = StringUnmarshaller.Instance.Unmarshall(context);
54-
55-
continue;
56-
}
57-
if (context.TestExpression("Bucket", targetDepth))
58-
{
59-
AnalyticsS3BucketDestination.BucketName = StringUnmarshaller.Instance.Unmarshall(context);
60-
61-
continue;
62-
}
63-
if (context.TestExpression("Prefix", targetDepth))
64-
{
65-
AnalyticsS3BucketDestination.Prefix = StringUnmarshaller.Instance.Unmarshall(context);
66-
67-
continue;
68-
}
69-
}
70-
else if (context.IsEndElement && context.CurrentDepth < originalDepth)
71-
{
72-
return AnalyticsS3BucketDestination;
73-
}
74-
}
75-
76-
77-
78-
return AnalyticsS3BucketDestination;
79-
}
80-
81-
private static AnalyticsS3BucketDestinationUnmarshaller _instance;
82-
83-
/// <summary>
84-
/// Singleton for the unmarshaller
85-
/// </summary>
86-
public static AnalyticsS3BucketDestinationUnmarshaller Instance
36+
void FormatCustomUnmarshall(XmlUnmarshallerContext context, AnalyticsS3BucketDestination unmarshalledObject)
8737
{
88-
get
89-
{
90-
if (_instance == null)
91-
{
92-
_instance = new AnalyticsS3BucketDestinationUnmarshaller();
93-
}
94-
return _instance;
95-
}
38+
unmarshalledObject.Format = AnalyticsS3ExportFileFormat.FindValue(StringUnmarshaller.Instance.Unmarshall(context));
9639
}
9740
}
9841
}

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

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -24,49 +24,11 @@ namespace Amazon.S3.Model.Internal.MarshallTransformations
2424
/// <summary>
2525
/// Get BucketAnalyticsConfiguration Request Marshaller
2626
/// </summary>
27-
public class GetBucketAnalyticsConfigurationRequestMarshaller : IMarshaller<IRequest, GetBucketAnalyticsConfigurationRequest>, IMarshaller<IRequest, Amazon.Runtime.AmazonWebServiceRequest>
27+
public partial class GetBucketAnalyticsConfigurationRequestMarshaller : IMarshaller<IRequest, GetBucketAnalyticsConfigurationRequest>, IMarshaller<IRequest, Amazon.Runtime.AmazonWebServiceRequest>
2828
{
29-
public IRequest Marshall(Amazon.Runtime.AmazonWebServiceRequest input)
29+
partial void PreMarshallCustomization(DefaultRequest defaultRequest, GetBucketAnalyticsConfigurationRequest publicRequest)
3030
{
31-
return this.Marshall((GetBucketAnalyticsConfigurationRequest)input);
32-
}
33-
34-
public IRequest Marshall(GetBucketAnalyticsConfigurationRequest getAnalyticsConfigurationRequest)
35-
{
36-
IRequest request = new DefaultRequest(getAnalyticsConfigurationRequest, "Amazon.S3");
37-
38-
request.Suppress404Exceptions = true;
39-
request.HttpMethod = "GET";
40-
41-
if (getAnalyticsConfigurationRequest.IsSetExpectedBucketOwner())
42-
request.Headers.Add(S3Constants.AmzHeaderExpectedBucketOwner, S3Transforms.ToStringValue(getAnalyticsConfigurationRequest.ExpectedBucketOwner));
43-
44-
if (string.IsNullOrEmpty(getAnalyticsConfigurationRequest.BucketName))
45-
throw new System.ArgumentException("BucketName is a required property and must be set before making this call.", "GetBucketAnalyticsConfigurationRequest.BucketName");
46-
47-
request.ResourcePath = "/";
48-
request.AddSubResource("analytics");
49-
request.AddSubResource("id", getAnalyticsConfigurationRequest.AnalyticsId);
50-
request.UseQueryString = true;
51-
52-
return request;
53-
}
54-
55-
private static GetBucketAnalyticsConfigurationRequestMarshaller _instance;
56-
57-
/// <summary>
58-
/// Singleton for marshaller
59-
/// </summary>
60-
public static GetBucketAnalyticsConfigurationRequestMarshaller Instance
61-
{
62-
get
63-
{
64-
if (_instance == null)
65-
{
66-
_instance = new GetBucketAnalyticsConfigurationRequestMarshaller();
67-
}
68-
return _instance;
69-
}
31+
defaultRequest.Suppress404Exceptions = true;
7032
}
7133
}
7234
}

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

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

0 commit comments

Comments
 (0)