Beispiel #1
0
        public EnvironmentResourceDescription Unmarshall(UnmarshallerContext context)
        {
            EnvironmentResourceDescription environmentResourceDescription = new EnvironmentResourceDescription();
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

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

                        continue;
                    }
                    if (context.TestExpression("AutoScalingGroups/member", targetDepth))
                    {
                        environmentResourceDescription.AutoScalingGroups.Add(AutoScalingGroupUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("Instances/member", targetDepth))
                    {
                        environmentResourceDescription.Instances.Add(InstanceUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("LaunchConfigurations/member", targetDepth))
                    {
                        environmentResourceDescription.LaunchConfigurations.Add(LaunchConfigurationUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("LoadBalancers/member", targetDepth))
                    {
                        environmentResourceDescription.LoadBalancers.Add(LoadBalancerUnmarshaller.GetInstance().Unmarshall(context));

                        continue;
                    }
                    if (context.TestExpression("Triggers/member", targetDepth))
                    {
                        environmentResourceDescription.Triggers.Add(TriggerUnmarshaller.GetInstance().Unmarshall(context));

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

            return(environmentResourceDescription);
        }
Beispiel #2
0
        public static AutoScalingGroupUnmarshaller GetInstance()
        {
            if (instance == null)
            {
                instance = new AutoScalingGroupUnmarshaller();
            }

            return(instance);
        }