public static DeploymentCommandUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new DeploymentCommandUnmarshaller();
     }
     return(instance);
 }
Esempio n. 2
0
        public Deployment Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            Deployment deployment = new Deployment();



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

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

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

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

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

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

                if (context.TestExpression("Duration", targetDepth))
                {
                    context.Read();
                    deployment.Duration = IntUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

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

                if (context.TestExpression("Command", targetDepth))
                {
                    context.Read();
                    deployment.Command = DeploymentCommandUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

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

                if (context.TestExpression("InstanceIds", targetDepth))
                {
                    context.Read();
                    deployment.InstanceIds = new List <String>();
                    StringUnmarshaller unmarshaller = StringUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        deployment.InstanceIds.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

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


            return(deployment);
        }
        public Deployment Unmarshall(JsonUnmarshallerContext context)
        {
            Deployment deployment = new Deployment();

            deployment.InstanceIds = 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("DeploymentId", targetDepth))
                    {
                        deployment.DeploymentId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

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

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

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

                    if (context.TestExpression("Duration", targetDepth))
                    {
                        deployment.Duration = IntUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

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

                    if (context.TestExpression("Command", targetDepth))
                    {
                        deployment.Command = DeploymentCommandUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

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

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


            return(deployment);
        }
Esempio n. 4
0
        public Deployment Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            Deployment deployment = new Deployment();


            int targetDepth = context.CurrentDepth;

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

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

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

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

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

                if (context.TestExpression("Duration", targetDepth))
                {
                    deployment.Duration = IntUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

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

                if (context.TestExpression("Command", targetDepth))
                {
                    deployment.Command = DeploymentCommandUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

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

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

                    continue;
                }
            }

            return(deployment);
        }