Example #1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            StartMigrationResponse response = new StartMigrationResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.IsStartElement)
                {
                    if (context.TestExpression("StartMigrationResult", 2))
                    {
                        UnmarshallResult(context, response);
                        continue;
                    }

                    if (context.TestExpression("ResponseMetadata", 2))
                    {
                        response.ResponseMetadata = ResponseMetadataUnmarshaller.Instance.Unmarshall(context);
                    }
                }
            }

            return(response);
        }
Example #2
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, StartMigrationResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            if (context.IsStartOfDocument)
            {
                targetDepth += 2;
            }

            while (context.ReadAtDepth(originalDepth))
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("ReplicationGroup", targetDepth))
                    {
                        var unmarshaller = ReplicationGroupUnmarshaller.Instance;
                        response.ReplicationGroup = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
            }

            return;
        }
        public static StartMigrationResponse Unmarshall(UnmarshallerContext _ctx)
        {
            StartMigrationResponse startMigrationResponse = new StartMigrationResponse();

            startMigrationResponse.HttpResponse   = _ctx.HttpResponse;
            startMigrationResponse.ErrorCode      = _ctx.StringValue("StartMigration.ErrorCode");
            startMigrationResponse.ErrorMessage   = _ctx.StringValue("StartMigration.ErrorMessage");
            startMigrationResponse.HttpStatusCode = _ctx.IntegerValue("StartMigration.HttpStatusCode");
            startMigrationResponse.RequestId      = _ctx.StringValue("StartMigration.RequestId");
            startMigrationResponse.Success        = _ctx.BooleanValue("StartMigration.Success");
            startMigrationResponse.Data           = _ctx.BooleanValue("StartMigration.Data");

            return(startMigrationResponse);
        }
Example #4
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            StartMigrationResponse response = new StartMigrationResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("migrationId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.MigrationId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("migrationStrategy", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.MigrationStrategy = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("migrationTimestamp", targetDepth))
                {
                    var unmarshaller = DateTimeUnmarshaller.Instance;
                    response.MigrationTimestamp = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("v1BotLocale", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.V1BotLocale = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("v1BotName", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.V1BotName = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("v1BotVersion", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.V1BotVersion = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("v2BotId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.V2BotId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("v2BotRole", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.V2BotRole = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }