Ejemplo n.º 1
0
 public static ChefConfigurationUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new ChefConfigurationUnmarshaller();
     }
     return(instance);
 }
Ejemplo n.º 2
0
        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);
        }