/* * 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 cloudtrail-2013-11-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.CloudTrail.Model; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Transform; using Amazon.Runtime.Internal.Util; using ThirdParty.Json.LitJson; namespace Amazon.CloudTrail.Model.Internal.MarshallTransformations { /// /// Response Unmarshaller for CreateTrail operation /// public class CreateTrailResponseUnmarshaller : JsonResponseUnmarshaller { /// /// Unmarshaller the response from the service to the response class. /// /// /// public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { CreateTrailResponse response = new CreateTrailResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("CloudWatchLogsLogGroupArn", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.CloudWatchLogsLogGroupArn = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("CloudWatchLogsRoleArn", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.CloudWatchLogsRoleArn = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("IncludeGlobalServiceEvents", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.IncludeGlobalServiceEvents = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("IsMultiRegionTrail", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.IsMultiRegionTrail = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("IsOrganizationTrail", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.IsOrganizationTrail = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("KmsKeyId", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.KmsKeyId = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("LogFileValidationEnabled", targetDepth)) { var unmarshaller = BoolUnmarshaller.Instance; response.LogFileValidationEnabled = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("Name", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.Name = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("S3BucketName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.S3BucketName = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("S3KeyPrefix", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.S3KeyPrefix = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("SnsTopicARN", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.SnsTopicARN = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("SnsTopicName", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.SnsTopicName = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("TrailARN", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.TrailARN = unmarshaller.Unmarshall(context); continue; } } return response; } /// /// Unmarshaller error response to exception. /// /// /// /// /// public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) { var errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context); errorResponse.InnerException = innerException; errorResponse.StatusCode = statusCode; var responseBodyBytes = context.GetResponseBodyBytes(); using (var streamCopy = new MemoryStream(responseBodyBytes)) using (var contextCopy = new JsonUnmarshallerContext(streamCopy, false, null)) { if (errorResponse.Code != null && errorResponse.Code.Equals("CloudTrailAccessNotEnabledException")) { return CloudTrailAccessNotEnabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("CloudTrailInvalidClientTokenIdException")) { return CloudTrailInvalidClientTokenIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("CloudWatchLogsDeliveryUnavailableException")) { return CloudWatchLogsDeliveryUnavailableExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("ConflictException")) { return ConflictExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientDependencyServiceAccessPermissionException")) { return InsufficientDependencyServiceAccessPermissionExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientEncryptionPolicyException")) { return InsufficientEncryptionPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientS3BucketPolicyException")) { return InsufficientS3BucketPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InsufficientSnsTopicPolicyException")) { return InsufficientSnsTopicPolicyExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCloudWatchLogsLogGroupArnException")) { return InvalidCloudWatchLogsLogGroupArnExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCloudWatchLogsRoleArnException")) { return InvalidCloudWatchLogsRoleArnExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidKmsKeyIdException")) { return InvalidKmsKeyIdExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterCombinationException")) { return InvalidParameterCombinationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidS3BucketNameException")) { return InvalidS3BucketNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidS3PrefixException")) { return InvalidS3PrefixExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidSnsTopicNameException")) { return InvalidSnsTopicNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTagParameterException")) { return InvalidTagParameterExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidTrailNameException")) { return InvalidTrailNameExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("KmsException")) { return KmsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("KmsKeyDisabledException")) { return KmsKeyDisabledExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("KmsKeyNotFoundException")) { return KmsKeyNotFoundExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("MaximumNumberOfTrailsExceededException")) { return MaximumNumberOfTrailsExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("NoManagementAccountSLRExistsException")) { return NoManagementAccountSLRExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("NotOrganizationMasterAccountException")) { return NotOrganizationMasterAccountExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("OperationNotPermittedException")) { return OperationNotPermittedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("OrganizationNotInAllFeaturesModeException")) { return OrganizationNotInAllFeaturesModeExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("OrganizationsNotInUseException")) { return OrganizationsNotInUseExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("S3BucketDoesNotExistException")) { return S3BucketDoesNotExistExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("TagsLimitExceededException")) { return TagsLimitExceededExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("TrailAlreadyExistsException")) { return TrailAlreadyExistsExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("TrailNotProvidedException")) { return TrailNotProvidedExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedOperationException")) { return UnsupportedOperationExceptionUnmarshaller.Instance.Unmarshall(contextCopy, errorResponse); } } return new AmazonCloudTrailException(errorResponse.Message, errorResponse.InnerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, errorResponse.StatusCode); } private static CreateTrailResponseUnmarshaller _instance = new CreateTrailResponseUnmarshaller(); internal static CreateTrailResponseUnmarshaller GetInstance() { return _instance; } /// /// Gets the singleton. /// public static CreateTrailResponseUnmarshaller Instance { get { return _instance; } } } }