public static StepDetailUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new StepDetailUnmarshaller();
     }
     return(instance);
 }
        public JobFlowDetail Unmarshall(XmlUnmarshallerContext context)
        {
            JobFlowDetail jobFlowDetail = new JobFlowDetail();
            int           originalDepth = context.CurrentDepth;
            int           targetDepth   = originalDepth + 1;

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

            while (context.Read())
            {
                if (context.IsStartElement || context.IsAttribute)
                {
                    if (context.TestExpression("JobFlowId", targetDepth))
                    {
                        jobFlowDetail.JobFlowId = StringUnmarshaller.GetInstance().Unmarshall(context);

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

                        continue;
                    }
                    if (context.TestExpression("LogUri", targetDepth))
                    {
                        jobFlowDetail.LogUri = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("AmiVersion", targetDepth))
                    {
                        jobFlowDetail.AmiVersion = StringUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("ExecutionStatusDetail", targetDepth))
                    {
                        jobFlowDetail.ExecutionStatusDetail = JobFlowExecutionStatusDetailUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Instances", targetDepth))
                    {
                        jobFlowDetail.Instances = JobFlowInstancesDetailUnmarshaller.GetInstance().Unmarshall(context);

                        continue;
                    }
                    if (context.TestExpression("Steps/member", targetDepth))
                    {
                        jobFlowDetail.Steps.Add(StepDetailUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("BootstrapActions/member", targetDepth))
                    {
                        jobFlowDetail.BootstrapActions.Add(BootstrapActionDetailUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("SupportedProducts/member", targetDepth))
                    {
                        jobFlowDetail.SupportedProducts.Add(StringUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth < originalDepth)
                {
                    return(jobFlowDetail);
                }
            }



            return(jobFlowDetail);
        }
Example #3
0
        public JobFlowDetail Unmarshall(JsonUnmarshallerContext context)
        {
            JobFlowDetail jobFlowDetail = new JobFlowDetail();

            jobFlowDetail.Steps             = null;
            jobFlowDetail.BootstrapActions  = null;
            jobFlowDetail.SupportedProducts = null;

            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if ((context.IsKey) && (context.CurrentDepth == targetDepth))
                {
                    context.Read();
                    context.Read();

                    if (context.TestExpression("JobFlowId", targetDepth))
                    {
                        jobFlowDetail.JobFlowId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

                    if (context.TestExpression("LogUri", targetDepth))
                    {
                        jobFlowDetail.LogUri = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("AmiVersion", targetDepth))
                    {
                        jobFlowDetail.AmiVersion = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("ExecutionStatusDetail", targetDepth))
                    {
                        jobFlowDetail.ExecutionStatusDetail = JobFlowExecutionStatusDetailUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Instances", targetDepth))
                    {
                        jobFlowDetail.Instances = JobFlowInstancesDetailUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Steps", targetDepth))
                    {
                        jobFlowDetail.Steps = new List <StepDetail>();
                        StepDetailUnmarshaller unmarshaller = StepDetailUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                jobFlowDetail.Steps.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("BootstrapActions", targetDepth))
                    {
                        jobFlowDetail.BootstrapActions = new List <BootstrapActionDetail>();
                        BootstrapActionDetailUnmarshaller unmarshaller = BootstrapActionDetailUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                jobFlowDetail.BootstrapActions.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("SupportedProducts", targetDepth))
                    {
                        jobFlowDetail.SupportedProducts = new List <String>();
                        StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                jobFlowDetail.SupportedProducts.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

                    if (context.TestExpression("VisibleToAllUsers", targetDepth))
                    {
                        jobFlowDetail.VisibleToAllUsers = BoolUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("JobFlowRole", targetDepth))
                    {
                        jobFlowDetail.JobFlowRole = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(jobFlowDetail);
                }
            }


            return(jobFlowDetail);
        }
Example #4
0
        public JobFlowDetail Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            JobFlowDetail jobFlowDetail = new JobFlowDetail();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("JobFlowId", targetDepth))
                {
                    jobFlowDetail.JobFlowId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

                if (context.TestExpression("LogUri", targetDepth))
                {
                    jobFlowDetail.LogUri = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("AmiVersion", targetDepth))
                {
                    jobFlowDetail.AmiVersion = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("ExecutionStatusDetail", targetDepth))
                {
                    jobFlowDetail.ExecutionStatusDetail = JobFlowExecutionStatusDetailUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("Instances", targetDepth))
                {
                    jobFlowDetail.Instances = JobFlowInstancesDetailUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("Steps", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <StepDetail, StepDetailUnmarshaller>(
                        StepDetailUnmarshaller.GetInstance());
                    jobFlowDetail.Steps = unmarshaller.Unmarshall(context);

                    continue;
                }

                if (context.TestExpression("BootstrapActions", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <BootstrapActionDetail, BootstrapActionDetailUnmarshaller>(
                        BootstrapActionDetailUnmarshaller.GetInstance());
                    jobFlowDetail.BootstrapActions = unmarshaller.Unmarshall(context);

                    continue;
                }

                if (context.TestExpression("SupportedProducts", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <String, StringUnmarshaller>(
                        StringUnmarshaller.GetInstance());
                    jobFlowDetail.SupportedProducts = unmarshaller.Unmarshall(context);

                    continue;
                }

                if (context.TestExpression("VisibleToAllUsers", targetDepth))
                {
                    jobFlowDetail.VisibleToAllUsers = BoolUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("JobFlowRole", targetDepth))
                {
                    jobFlowDetail.JobFlowRole = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }
            }

            return(jobFlowDetail);
        }