public static LoadBasedAutoScalingConfigurationUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new LoadBasedAutoScalingConfigurationUnmarshaller();
     }
     return(instance);
 }
Exemplo n.º 2
0
        public DescribeLoadBasedAutoScalingResult Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonUnmarshallerContext.TokenType.Null)
            {
                return(null);
            }
            DescribeLoadBasedAutoScalingResult describeLoadBasedAutoScalingResult = new DescribeLoadBasedAutoScalingResult();

            describeLoadBasedAutoScalingResult.LoadBasedAutoScalingConfigurations = 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("LoadBasedAutoScalingConfigurations", targetDepth))
                    {
                        describeLoadBasedAutoScalingResult.LoadBasedAutoScalingConfigurations = new List <LoadBasedAutoScalingConfiguration>();
                        LoadBasedAutoScalingConfigurationUnmarshaller unmarshaller = LoadBasedAutoScalingConfigurationUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                describeLoadBasedAutoScalingResult.LoadBasedAutoScalingConfigurations.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(describeLoadBasedAutoScalingResult);
                }
            }


            return(describeLoadBasedAutoScalingResult);
        }
Exemplo n.º 3
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeLoadBasedAutoScalingResponse response = new DescribeLoadBasedAutoScalingResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("LoadBasedAutoScalingConfigurations", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <LoadBasedAutoScalingConfiguration, LoadBasedAutoScalingConfigurationUnmarshaller>(
                        LoadBasedAutoScalingConfigurationUnmarshaller.GetInstance());
                    response.LoadBasedAutoScalingConfigurations = unmarshaller.Unmarshall(context);

                    continue;
                }
            }

            return(response);
        }
Exemplo n.º 4
0
        private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeLoadBasedAutoScalingResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

            while (context.Read())
            {
                if (context.TestExpression("LoadBasedAutoScalingConfigurations", targetDepth))
                {
                    context.Read();
                    response.LoadBasedAutoScalingConfigurations = new List <LoadBasedAutoScalingConfiguration>();
                    LoadBasedAutoScalingConfigurationUnmarshaller unmarshaller = LoadBasedAutoScalingConfigurationUnmarshaller.GetInstance();
                    while (context.Read())
                    {
                        JsonToken token = context.CurrentTokenType;
                        if (token == JsonToken.ArrayStart)
                        {
                            continue;
                        }
                        if (token == JsonToken.ArrayEnd)
                        {
                            break;
                        }
                        response.LoadBasedAutoScalingConfigurations.Add(unmarshaller.Unmarshall(context));
                    }
                    continue;
                }

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

            return;
        }