Beispiel #1
0
 public static StackConfigurationManagerUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new StackConfigurationManagerUnmarshaller();
     }
     return(instance);
 }
Beispiel #2
0
        public Stack Unmarshall(JsonUnmarshallerContext context)
        {
            Stack stack = new Stack();

            stack.Attributes = 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("StackId", targetDepth))
                    {
                        stack.StackId = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

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

                    if (context.TestExpression("Attributes", targetDepth))
                    {
                        stack.Attributes = new Dictionary <String, String>();
                        KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                        while (context.Read())
                        {
                            if (((context.IsStartArray || context.IsStartElement || context.IsLeafValue) && (context.CurrentDepth == targetDepth)) ||
                                ((context.IsKey) && (context.CurrentDepth == targetDepth + 1)))
                            {
                                KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                                stack.Attributes.Add(kvp.Key, kvp.Value);
                            }
                            else if (context.IsEndElement)
                            {
                                break;
                            }
                        }
                        continue;
                    }

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

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

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

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

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

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

                    if (context.TestExpression("ConfigurationManager", targetDepth))
                    {
                        stack.ConfigurationManager = StackConfigurationManagerUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

                    if (context.TestExpression("CustomCookbooksSource", targetDepth))
                    {
                        stack.CustomCookbooksSource = SourceUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

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

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


            return(stack);
        }
        public Stack Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }

            Stack stack = new Stack();



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

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

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

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

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

                if (context.TestExpression("Attributes", targetDepth))
                {
                    context.Read();
                    stack.Attributes = new Dictionary <String, String>();
                    KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> unmarshaller = new KeyValueUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart || token == JsonToken.ObjectStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd || token == JsonToken.ObjectEnd)
                        {
                            break;
                        }
                        KeyValuePair <string, string> kvp = unmarshaller.Unmarshall(context);
                        stack.Attributes.Add(kvp.Key, kvp.Value);
                    }
                    continue;
                }

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

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

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

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

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

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

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

                if (context.TestExpression("ConfigurationManager", targetDepth))
                {
                    context.Read();
                    stack.ConfigurationManager = StackConfigurationManagerUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

                if (context.TestExpression("CustomCookbooksSource", targetDepth))
                {
                    context.Read();
                    stack.CustomCookbooksSource = SourceUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

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

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

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


            return(stack);
        }
        public Stack Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            Stack stack = new Stack();


            int targetDepth = context.CurrentDepth;

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

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

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

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

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

                if (context.TestExpression("Attributes", targetDepth))
                {
                    var unmarshaller = new DictionaryUnmarshaller <String, String, StringUnmarshaller, StringUnmarshaller>(
                        StringUnmarshaller.GetInstance(), StringUnmarshaller.GetInstance());
                    stack.Attributes = unmarshaller.Unmarshall(context);

                    continue;
                }

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

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

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

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

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

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

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

                if (context.TestExpression("ConfigurationManager", targetDepth))
                {
                    stack.ConfigurationManager = StackConfigurationManagerUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("ChefConfiguration", targetDepth))
                {
                    stack.ChefConfiguration = ChefConfigurationUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

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

                if (context.TestExpression("CustomCookbooksSource", targetDepth))
                {
                    stack.CustomCookbooksSource = SourceUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

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

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

            return(stack);
        }