private static void UnmarshallResult(JsonUnmarshallerContext context, CreateTrailResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("Name", targetDepth))
                {
                    context.Read();
                    response.Name = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("S3BucketName", targetDepth))
                {
                    context.Read();
                    response.S3BucketName = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("S3KeyPrefix", targetDepth))
                {
                    context.Read();
                    response.S3KeyPrefix = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("SnsTopicName", targetDepth))
                {
                    context.Read();
                    response.SnsTopicName = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("IncludeGlobalServiceEvents", targetDepth))
                {
                    context.Read();
                    response.IncludeGlobalServiceEvents = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("trail", targetDepth))
                {
                    context.Read();
                    response.Trail = TrailUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.CurrentDepth <= originalDepth)
                {
                    return;
                }
            }

            return;
        }
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            CreateTrailResponse response = new CreateTrailResponse();

            context.Read();

            UnmarshallResult(context, response);
            return(response);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        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("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("SnsTopicName", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.SnsTopicName = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        public static CreateTrailResponse Unmarshall(UnmarshallerContext context)
        {
            CreateTrailResponse createTrailResponse = new CreateTrailResponse();

            createTrailResponse.HttpResponse    = context.HttpResponse;
            createTrailResponse.RequestId       = context.StringValue("CreateTrail.RequestId");
            createTrailResponse.Name            = context.StringValue("CreateTrail.Name");
            createTrailResponse.HomeRegion      = context.StringValue("CreateTrail.HomeRegion");
            createTrailResponse.OssBucketName   = context.StringValue("CreateTrail.OssBucketName");
            createTrailResponse.OssKeyPrefix    = context.StringValue("CreateTrail.OssKeyPrefix");
            createTrailResponse.RoleName        = context.StringValue("CreateTrail.RoleName");
            createTrailResponse.SlsProjectArn   = context.StringValue("CreateTrail.SlsProjectArn");
            createTrailResponse.SlsWriteRoleArn = context.StringValue("CreateTrail.SlsWriteRoleArn");
            createTrailResponse.EventRW         = context.StringValue("CreateTrail.EventRW");

            return(createTrailResponse);
        }