Пример #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)
        {
            ModifyScheduledActionResponse response = new ModifyScheduledActionResponse();

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

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

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

            return(response);
        }
Пример #2
0
        private static void UnmarshallResult(XmlUnmarshallerContext context, ModifyScheduledActionResponse 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("EndTime", targetDepth))
                    {
                        var unmarshaller = DateTimeUnmarshaller.Instance;
                        response.EndTime = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("IamRole", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.IamRole = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("NextInvocations/ScheduledActionTime", targetDepth))
                    {
                        var unmarshaller = DateTimeUnmarshaller.Instance;
                        var item         = unmarshaller.Unmarshall(context);
                        response.NextInvocations.Add(item);
                        continue;
                    }
                    if (context.TestExpression("Schedule", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.Schedule = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ScheduledActionDescription", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.ScheduledActionDescription = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("ScheduledActionName", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.ScheduledActionName = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("StartTime", targetDepth))
                    {
                        var unmarshaller = DateTimeUnmarshaller.Instance;
                        response.StartTime = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("State", targetDepth))
                    {
                        var unmarshaller = StringUnmarshaller.Instance;
                        response.State = unmarshaller.Unmarshall(context);
                        continue;
                    }
                    if (context.TestExpression("TargetAction", targetDepth))
                    {
                        var unmarshaller = ScheduledActionTypeUnmarshaller.Instance;
                        response.TargetAction = unmarshaller.Unmarshall(context);
                        continue;
                    }
                }
            }

            return;
        }