public static TimeBasedAutoScalingConfigurationUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new TimeBasedAutoScalingConfigurationUnmarshaller();
     }
     return(instance);
 }
Пример #2
0
        public DescribeTimeBasedAutoScalingResult Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonUnmarshallerContext.TokenType.Null)
            {
                return(null);
            }
            DescribeTimeBasedAutoScalingResult describeTimeBasedAutoScalingResult = new DescribeTimeBasedAutoScalingResult();

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


            return(describeTimeBasedAutoScalingResult);
        }
Пример #3
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeTimeBasedAutoScalingResponse response = new DescribeTimeBasedAutoScalingResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("TimeBasedAutoScalingConfigurations", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <TimeBasedAutoScalingConfiguration, TimeBasedAutoScalingConfigurationUnmarshaller>(
                        TimeBasedAutoScalingConfigurationUnmarshaller.GetInstance());
                    response.TimeBasedAutoScalingConfigurations = unmarshaller.Unmarshall(context);

                    continue;
                }
            }

            return(response);
        }
        private static void UnmarshallResult(JsonUnmarshallerContext context, DescribeTimeBasedAutoScalingResponse response)
        {
            int originalDepth = context.CurrentDepth;
            int targetDepth   = originalDepth + 1;

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

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

            return;
        }