diff --git a/generator/.DevConfigs/034a6dd8-9283-4dce-b019-8723f2fcc351.json b/generator/.DevConfigs/034a6dd8-9283-4dce-b019-8723f2fcc351.json new file mode 100644 index 000000000000..082ec131007b --- /dev/null +++ b/generator/.DevConfigs/034a6dd8-9283-4dce-b019-8723f2fcc351.json @@ -0,0 +1,11 @@ +{ + "services": [ + { + "serviceName": "S3", + "type": "patch", + "changeLogMessages": [ + "Generate GetBucketMetricsConfiguration" + ] + } + ] +} \ No newline at end of file diff --git a/generator/ServiceClientGeneratorLib/ServiceModel.cs b/generator/ServiceClientGeneratorLib/ServiceModel.cs index b84f10712edc..0cb93aa1f97d 100644 --- a/generator/ServiceClientGeneratorLib/ServiceModel.cs +++ b/generator/ServiceClientGeneratorLib/ServiceModel.cs @@ -552,7 +552,7 @@ public List S3AllowListOperations //new Operation(this, "GetBucketIntelligentTieringConfiguration", DocumentRoot[OperationsKey]["GetBucketIntelligentTieringConfiguration"]), //new Operation(this, "GetBucketInventoryConfiguration", DocumentRoot[OperationsKey]["GetBucketInventoryConfiguration"]), //new Operation(this, "GetBucketLogging", DocumentRoot[OperationsKey]["GetBucketLogging"]), - // new Operation(this, "GetBucketMetricsConfiguration", DocumentRoot[OperationsKey]["GetBucketMetricsConfiguration"]), + new Operation(this, "GetBucketMetricsConfiguration", DocumentRoot[OperationsKey]["GetBucketMetricsConfiguration"]), //new Operation(this, "GetBucketVersioning", DocumentRoot[OperationsKey]["GetBucketVersioning"]), //new Operation(this, "GetBucketWebsite", DocumentRoot[OperationsKey]["GetBucketWebsite"]), //new Operation(this, "ListBucketAnalyticsConfigurations", DocumentRoot[OperationsKey]["ListBucketAnalyticsConfigurations"]), diff --git a/generator/ServiceModels/s3/s3.customizations.json b/generator/ServiceModels/s3/s3.customizations.json index dc19ac9959a6..a06a384dd26c 100644 --- a/generator/ServiceModels/s3/s3.customizations.json +++ b/generator/ServiceModels/s3/s3.customizations.json @@ -817,6 +817,18 @@ } } ] + }, + "GetBucketMetricsConfigurationRequest":{ + "modify":[ + { + "Id":{"emitPropertyName": "MetricsId"} + }, + { + "ExpectedBucketOwner" :{ + "injectXmlIsSet":["return !String.IsNullOrEmpty(this._expectedBucketOwner);"] + } + } + ] } }, "operationModifiers": { diff --git a/sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationRequestMarshaller.cs b/sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationRequestMarshaller.cs index 2252ecaf7218..1ae782a4f3c3 100644 --- a/sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationRequestMarshaller.cs +++ b/sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationRequestMarshaller.cs @@ -24,49 +24,11 @@ namespace Amazon.S3.Model.Internal.MarshallTransformations /// /// Get Bucket MetricsConfigurationRequest Marshaller /// - public class GetBucketMetricsConfigurationRequestMarshaller : IMarshaller, IMarshaller + public partial class GetBucketMetricsConfigurationRequestMarshaller : IMarshaller, IMarshaller { - public IRequest Marshall(Amazon.Runtime.AmazonWebServiceRequest input) + partial void PreMarshallCustomization(DefaultRequest defaultRequest, GetBucketMetricsConfigurationRequest publicRequest) { - return this.Marshall((GetBucketMetricsConfigurationRequest)input); - } - - public IRequest Marshall(GetBucketMetricsConfigurationRequest getBucketMetricsConfigurationRequest) - { - IRequest request = new DefaultRequest(getBucketMetricsConfigurationRequest, "AmazonS3"); - - request.Suppress404Exceptions = true; - request.HttpMethod = "GET"; - - if (getBucketMetricsConfigurationRequest.IsSetExpectedBucketOwner()) - request.Headers.Add(S3Constants.AmzHeaderExpectedBucketOwner, S3Transforms.ToStringValue(getBucketMetricsConfigurationRequest.ExpectedBucketOwner)); - - if (string.IsNullOrEmpty(getBucketMetricsConfigurationRequest.BucketName)) - throw new System.ArgumentException("BucketName is a required property and must be set before making this call.", "GetBucketMetricsConfigurationRequest.BucketName"); - - request.ResourcePath = "/"; - request.AddSubResource("metrics"); - request.AddSubResource("id", getBucketMetricsConfigurationRequest.MetricsId); - request.UseQueryString = true; - - return request; - } - - private static GetBucketMetricsConfigurationRequestMarshaller _instance; - - /// - /// Singleton for marshaller - /// - public static GetBucketMetricsConfigurationRequestMarshaller Instance - { - get - { - if (_instance == null) - { - _instance = new GetBucketMetricsConfigurationRequestMarshaller(); - } - return _instance; - } + defaultRequest.Suppress404Exceptions = true; } } } diff --git a/sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationResponseUnmarshaller.cs b/sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationResponseUnmarshaller.cs deleted file mode 100644 index d6711fe6e004..000000000000 --- a/sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationResponseUnmarshaller.cs +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"). - * You may not use this file except in compliance with the License. - * A copy of the License is located at - * - * http://aws.amazon.com/apache2.0 - * - * or in the "license" file accompanying this file. This file is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either - * express or implied. See the License for the specific language governing - * permissions and limitations under the License. - */ -using System; -using System.Net; -using System.Collections.Generic; -using Amazon.S3.Model; -using Amazon.Runtime; -using Amazon.Runtime.Internal; -using Amazon.Runtime.Internal.Transform; - -namespace Amazon.S3.Model.Internal.MarshallTransformations -{ - /// - /// Response Unmarshaller for GetBucketMetricsConfiguration operation - /// - public class GetBucketMetricsConfigurationResponseUnmarshaller : S3ReponseUnmarshaller - { - /// - /// Unmarshaller the response from the service to the response class. - /// - /// - /// - public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) - { - GetBucketMetricsConfigurationResponse response = new GetBucketMetricsConfigurationResponse(); - - while (context.Read()) - { - if (context.IsStartElement) - { - UnmarshallResult(context, response); - continue; - } - } - - - return response; - } - - private static void UnmarshallResult(XmlUnmarshallerContext context, GetBucketMetricsConfigurationResponse response) - { - - int originalDepth = context.CurrentDepth; - int targetDepth = originalDepth + 1; - - if (context.IsStartOfDocument) - targetDepth += 2; - - response.MetricsConfiguration = new MetricsConfiguration(); - - while (context.Read()) - { - if (context.IsStartElement || context.IsAttribute) - { - if (context.TestExpression("Filter", targetDepth)) - { - response.MetricsConfiguration.MetricsFilter = new MetricsFilter(){ - MetricsFilterPredicate = (MetricsPredicateListFilterUnmarshaller.Instance.Unmarshall(context))[0] - }; - continue; - } - if (context.TestExpression("Id", targetDepth)) - { - response.MetricsConfiguration.MetricsId = StringUnmarshaller.Instance.Unmarshall(context); - - continue; - } - } - else if (context.IsEndElement && context.CurrentDepth < originalDepth) - { - return; - } - } - - - - return; - } - - private static GetBucketMetricsConfigurationResponseUnmarshaller _instance; - - /// - /// Singleton for the unmarshaller - /// - public static GetBucketMetricsConfigurationResponseUnmarshaller Instance - { - get - { - if (_instance == null) - { - _instance = new GetBucketMetricsConfigurationResponseUnmarshaller(); - } - return _instance; - } - } - } -} diff --git a/sdk/src/Services/S3/Custom/Model/GetBucketMetricsConfigurationRequest.cs b/sdk/src/Services/S3/Generated/Model/GetBucketMetricsConfigurationRequest.cs similarity index 69% rename from sdk/src/Services/S3/Custom/Model/GetBucketMetricsConfigurationRequest.cs rename to sdk/src/Services/S3/Generated/Model/GetBucketMetricsConfigurationRequest.cs index 967ba5467698..a8648d466fa8 100644 --- a/sdk/src/Services/S3/Custom/Model/GetBucketMetricsConfigurationRequest.cs +++ b/sdk/src/Services/S3/Generated/Model/GetBucketMetricsConfigurationRequest.cs @@ -12,22 +12,28 @@ * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ + +/* + * Do not modify this file. This file is generated from the s3-2006-03-01.normal.json service model. + */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; using System.IO; +using System.Net; using Amazon.Runtime; using Amazon.Runtime.Internal; +#pragma warning disable CS0612,CS0618,CS1570 namespace Amazon.S3.Model { /// /// Container for the parameters to the GetBucketMetricsConfiguration operation. /// /// - /// This operation is not supported by directory buckets. + /// This operation is not supported for directory buckets. /// /// /// @@ -36,7 +42,7 @@ namespace Amazon.S3.Model /// /// /// - /// To use this operation, you must have permissions to perform the s3:GetMetricsConfiguration + /// To use this operation, you must have permissions to perform the s3:GetMetricsConfiguration /// action. The bucket owner has this permission by default. The bucket owner can grant /// this permission to others. For more information about permissions, see Permissions /// Related to Bucket Subresource Operations and Managing @@ -49,7 +55,7 @@ namespace Amazon.S3.Model /// /// /// - /// The following operations are related to GetBucketMetricsConfiguration: + /// The following operations are related to GetBucketMetricsConfiguration: /// /// + /// + /// + /// You must URL encode any signed header values that contain spaces. For example, if + /// your header value is my file.txt, containing two spaces after my, you + /// must URL encode this value to my%20%20file.txt. + /// + /// /// public partial class GetBucketMetricsConfigurationRequest : AmazonWebServiceRequest { - private string bucketName; - private string metricsId; - private string expectedBucketOwner; + private string _bucketName; + private string _expectedBucketOwner; + private string _metricsId; /// + /// Gets and sets the property BucketName. + /// /// The name of the bucket containing the metrics configuration to retrieve. + /// /// + [AWSProperty(Required=true)] public string BucketName { - get { return this.bucketName; } - set { this.bucketName = value; } + get { return this._bucketName; } + set { this._bucketName = value; } } // Check to see if BucketName property is set internal bool IsSetBucketName() { - return this.bucketName != null; + return this._bucketName != null; } /// + /// Gets and sets the property ExpectedBucketOwner. /// - /// The ID used to identify the metrics configuration. - /// The ID has a 64 character limit and can only contain letters, numbers, periods, dashes, and underscores. + /// The account ID of the expected bucket owner. If the account ID that you provide does + /// not match the actual owner of the bucket, the request fails with the HTTP status code + /// 403 Forbidden (access denied). /// /// - public string MetricsId + public string ExpectedBucketOwner { - get { return this.metricsId; } - set { this.metricsId = value; } + get { return this._expectedBucketOwner; } + set { this._expectedBucketOwner = value; } } - // Check to see if MetricsId property is set - internal bool IsSetMetricsId() + // Check to see if ExpectedBucketOwner property is set + internal bool IsSetExpectedBucketOwner() { - return this.metricsId != null; + return !String.IsNullOrEmpty(this._expectedBucketOwner); } /// - /// Gets and sets the property ExpectedBucketOwner. + /// Gets and sets the property MetricsId. /// - /// The account ID of the expected bucket owner. If the account ID that you provide does - /// not match the actual owner of the bucket, the request fails with the HTTP status code - /// 403 Forbidden (access denied). + /// The ID used to identify the metrics configuration. The ID has a 64 character limit + /// and can only contain letters, numbers, periods, dashes, and underscores. /// /// - public string ExpectedBucketOwner + [AWSProperty(Required=true)] + public string MetricsId { - get { return this.expectedBucketOwner; } - set { this.expectedBucketOwner = value; } + get { return this._metricsId; } + set { this._metricsId = value; } } - /// - /// Checks to see if ExpectedBucketOwner is set. - /// - /// true, if ExpectedBucketOwner property is set. - internal bool IsSetExpectedBucketOwner() + // Check to see if MetricsId property is set + internal bool IsSetMetricsId() { - return !String.IsNullOrEmpty(this.expectedBucketOwner); + return this._metricsId != null; } + } -} +} \ No newline at end of file diff --git a/sdk/src/Services/S3/Custom/Model/GetBucketMetricsConfigurationResponse.cs b/sdk/src/Services/S3/Generated/Model/GetBucketMetricsConfigurationResponse.cs similarity index 64% rename from sdk/src/Services/S3/Custom/Model/GetBucketMetricsConfigurationResponse.cs rename to sdk/src/Services/S3/Generated/Model/GetBucketMetricsConfigurationResponse.cs index 5136fbd0a942..2e31a698f957 100644 --- a/sdk/src/Services/S3/Custom/Model/GetBucketMetricsConfigurationResponse.cs +++ b/sdk/src/Services/S3/Generated/Model/GetBucketMetricsConfigurationResponse.cs @@ -12,35 +12,47 @@ * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ + +/* + * Do not modify this file. This file is generated from the s3-2006-03-01.normal.json service model. + */ using System; using System.Collections.Generic; using System.Xml.Serialization; using System.Text; +using System.IO; +using System.Net; using Amazon.Runtime; +using Amazon.Runtime.Internal; +#pragma warning disable CS0612,CS0618,CS1570 namespace Amazon.S3.Model { /// - /// GetBucketMetricsConfiguration Response + /// This is the response object from the GetBucketMetricsConfiguration operation. /// public partial class GetBucketMetricsConfigurationResponse : AmazonWebServiceResponse { - private MetricsConfiguration metricsConfiguration; + private MetricsConfiguration _metricsConfiguration; /// + /// Gets and sets the property MetricsConfiguration. + /// /// Specifies the metrics configuration. + /// /// public MetricsConfiguration MetricsConfiguration { - get { return this.metricsConfiguration; } - set { this.metricsConfiguration = value; } + get { return this._metricsConfiguration; } + set { this._metricsConfiguration = value; } } // Check to see if MetricsConfiguration property is set internal bool IsSetMetricsConfiguration() { - return this.metricsConfiguration != null; + return this._metricsConfiguration != null; } + } -} +} \ No newline at end of file diff --git a/sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationRequestMarshaller.cs b/sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationRequestMarshaller.cs new file mode 100644 index 000000000000..905ec02dbf72 --- /dev/null +++ b/sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationRequestMarshaller.cs @@ -0,0 +1,101 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +/* + * Do not modify this file. This file is generated from the s3-2006-03-01.normal.json service model. + */ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Text; +using System.Xml.Serialization; + +using Amazon.S3.Model; +using Amazon.Runtime; +using Amazon.Runtime.Internal; +using Amazon.Runtime.Internal.Transform; +using Amazon.Runtime.Internal.Util; +using System.Xml; + +#pragma warning disable CS0612,CS0618 +namespace Amazon.S3.Model.Internal.MarshallTransformations +{ + /// + /// GetBucketMetricsConfiguration Request Marshaller + /// + public partial class GetBucketMetricsConfigurationRequestMarshaller : IMarshaller , IMarshaller + { + /// + /// Marshaller the request object to the HTTP request. + /// + /// + /// + public IRequest Marshall(AmazonWebServiceRequest input) + { + return this.Marshall((GetBucketMetricsConfigurationRequest)input); + } + + /// + /// Marshaller the request object to the HTTP request. + /// + /// + /// + public IRequest Marshall(GetBucketMetricsConfigurationRequest publicRequest) + { + var request = new DefaultRequest(publicRequest, "Amazon.S3"); + PreMarshallCustomization(request, publicRequest); + request.HttpMethod = "GET"; + request.AddSubResource("metrics"); + + if (publicRequest.IsSetExpectedBucketOwner()) + { + request.Headers["x-amz-expected-bucket-owner"] = publicRequest.ExpectedBucketOwner; + } + if (string.IsNullOrEmpty(publicRequest.BucketName)) + throw new System.ArgumentException("BucketName is a required property and must be set before making this call.", "GetBucketMetricsConfigurationRequest.BucketName"); + if (string.IsNullOrEmpty(publicRequest.MetricsId)) + throw new AmazonS3Exception("Request object does not have required field MetricsId set"); + + if (publicRequest.IsSetMetricsId()) + request.Parameters.Add("id", StringUtils.FromString(publicRequest.MetricsId)); + request.ResourcePath = "/"; + + PostMarshallCustomization(request, publicRequest); + request.UseQueryString = true; + return request; + } + private static GetBucketMetricsConfigurationRequestMarshaller _instance = new GetBucketMetricsConfigurationRequestMarshaller(); + + internal static GetBucketMetricsConfigurationRequestMarshaller GetInstance() + { + return _instance; + } + + /// + /// Gets the singleton. + /// + public static GetBucketMetricsConfigurationRequestMarshaller Instance + { + get + { + return _instance; + } + } + + partial void PostMarshallCustomization(DefaultRequest defaultRequest, GetBucketMetricsConfigurationRequest publicRequest); + partial void PreMarshallCustomization(DefaultRequest defaultRequest, GetBucketMetricsConfigurationRequest publicRequest); + } +} \ No newline at end of file diff --git a/sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationResponseUnmarshaller.cs b/sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationResponseUnmarshaller.cs new file mode 100644 index 000000000000..f0cff102eb3d --- /dev/null +++ b/sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/GetBucketMetricsConfigurationResponseUnmarshaller.cs @@ -0,0 +1,126 @@ +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +/* + * Do not modify this file. This file is generated from the s3-2006-03-01.normal.json service model. + */ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Net; +using System.Text; +using System.Xml.Serialization; + +using Amazon.S3.Model; +using Amazon.Runtime; +using Amazon.Runtime.Internal; +using Amazon.Runtime.Internal.Transform; +using Amazon.Runtime.Internal.Util; + +#pragma warning disable CS0612,CS0618 +namespace Amazon.S3.Model.Internal.MarshallTransformations +{ + /// + /// Response Unmarshaller for GetBucketMetricsConfiguration operation + /// + public partial class GetBucketMetricsConfigurationResponseUnmarshaller : S3ReponseUnmarshaller + { + /// + /// Unmarshaller the response from the service to the response class. + /// + /// + /// + public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context) + { + GetBucketMetricsConfigurationResponse response = new GetBucketMetricsConfigurationResponse(); + UnmarshallResult(context,response); + + PostUnmarshallCustomization(context, response); + return response; + } + + private static void UnmarshallResult(XmlUnmarshallerContext context, GetBucketMetricsConfigurationResponse response) + { + int originalDepth = context.CurrentDepth; + int targetDepth = originalDepth + 1; + if (context.IsEmptyResponse) + { + return; + } + while (context.Read()) + { + if (context.IsStartElement || context.IsAttribute) + { + if (context.TestExpression("MetricsConfiguration", targetDepth)) + { + var unmarshaller = MetricsConfigurationUnmarshaller.Instance; + response.MetricsConfiguration = unmarshaller.Unmarshall(context); + continue; + } + } + else if (context.IsEndElement && context.CurrentDepth < originalDepth) + { + return; + } + } + return; + } + + + /// + /// Unmarshaller error response to exception. + /// + /// + /// + /// + /// + public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) + { + S3ErrorResponse errorResponse = S3ErrorResponseUnmarshaller.Instance.Unmarshall(context); + errorResponse.InnerException = innerException; + errorResponse.StatusCode = statusCode; + + var responseBodyBytes = context.GetResponseBodyBytes(); + + using (var streamCopy = new MemoryStream(responseBodyBytes)) + using (var contextCopy = new XmlUnmarshallerContext(streamCopy, false, null)) + { + } + return base.ConstructS3Exception(context, errorResponse, innerException, statusCode); + } + + partial void PostUnmarshallCustomization(XmlUnmarshallerContext context, GetBucketMetricsConfigurationResponse response); + + private static GetBucketMetricsConfigurationResponseUnmarshaller _instance = new GetBucketMetricsConfigurationResponseUnmarshaller(); + + internal static GetBucketMetricsConfigurationResponseUnmarshaller GetInstance() + { + return _instance; + } + + /// + /// Gets the singleton. + /// + public static GetBucketMetricsConfigurationResponseUnmarshaller Instance + { + get + { + return _instance; + } + } + + } +} \ No newline at end of file diff --git a/sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/MetricsConfigurationUnmarshaller.cs b/sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/MetricsConfigurationUnmarshaller.cs similarity index 53% rename from sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/MetricsConfigurationUnmarshaller.cs rename to sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/MetricsConfigurationUnmarshaller.cs index 570816708f91..4ecdd471df7c 100644 --- a/sdk/src/Services/S3/Custom/Model/Internal/MarshallTransformations/MetricsConfigurationUnmarshaller.cs +++ b/sdk/src/Services/S3/Generated/Model/Internal/MarshallTransformations/MetricsConfigurationUnmarshaller.cs @@ -12,77 +12,87 @@ * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ + +/* + * Do not modify this file. This file is generated from the s3-2006-03-01.normal.json service model. + */ +using System; using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Net; +using System.Text; +using System.Xml.Serialization; using Amazon.S3.Model; +using Amazon.Runtime; +using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; +using Amazon.Runtime.Internal.Util; +#pragma warning disable CS0612,CS0618 namespace Amazon.S3.Model.Internal.MarshallTransformations { /// - /// MetricsConfiguration Unmarshaller - /// - public class MetricsConfigurationUnmarshaller : IXmlUnmarshaller + /// Response Unmarshaller for MetricsConfiguration Object + /// + public partial class MetricsConfigurationUnmarshaller : IXmlUnmarshaller { /// /// Unmarshaller the response from the service to the response class. - /// + /// /// /// - public MetricsConfiguration Unmarshall(XmlUnmarshallerContext context) + public MetricsConfiguration Unmarshall(XmlUnmarshallerContext context) { - MetricsConfiguration response = new MetricsConfiguration(); + MetricsConfiguration unmarshalledObject = new MetricsConfiguration(); int originalDepth = context.CurrentDepth; int targetDepth = originalDepth + 1; - - if (context.IsStartOfDocument) - targetDepth += 2; - + + if (context.IsStartOfDocument) + targetDepth += 2; + while (context.Read()) { if (context.IsStartElement || context.IsAttribute) { if (context.TestExpression("Filter", targetDepth)) { - response.MetricsFilter = new MetricsFilter(){ - MetricsFilterPredicate = (MetricsPredicateListFilterUnmarshaller.Instance.Unmarshall(context))[0] - }; + var predicateList = MetricsPredicateListFilterUnmarshaller.Instance.Unmarshall(context); + unmarshalledObject.MetricsFilter = new MetricsFilter(); + unmarshalledObject.MetricsFilter.MetricsFilterPredicate = predicateList[0]; continue; } if (context.TestExpression("Id", targetDepth)) { - response.MetricsId = StringUnmarshaller.Instance.Unmarshall(context); - + var unmarshaller = StringUnmarshaller.Instance; + unmarshalledObject.MetricsId = unmarshaller.Unmarshall(context); continue; } + + XmlStructureUnmarshallCustomization(context, unmarshalledObject, targetDepth); } else if (context.IsEndElement && context.CurrentDepth < originalDepth) { - return response; + return unmarshalledObject; } - } - - - - return response; + } + return unmarshalledObject; } - private static MetricsConfigurationUnmarshaller _instance; + partial void XmlStructureUnmarshallCustomization(XmlUnmarshallerContext context, MetricsConfiguration unmarshalledObject, int targetDepth); + + private static MetricsConfigurationUnmarshaller _instance = new MetricsConfigurationUnmarshaller(); /// - /// Singleton for the unmarshaller - /// + /// Gets the singleton. + /// public static MetricsConfigurationUnmarshaller Instance { get { - if (_instance == null) - { - _instance = new MetricsConfigurationUnmarshaller(); - } return _instance; } } - } -} +} \ No newline at end of file