Ejemplo n.º 1
0
 public static NetworkInterfaceUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new NetworkInterfaceUnmarshaller();
     }
     return(instance);
 }
Ejemplo n.º 2
0
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeGatewayInformationResponse response = new DescribeGatewayInformationResponse();

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

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

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

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

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

                if (context.TestExpression("GatewayNetworkInterfaces", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <NetworkInterface, NetworkInterfaceUnmarshaller>(
                        NetworkInterfaceUnmarshaller.GetInstance());
                    response.GatewayNetworkInterfaces = unmarshaller.Unmarshall(context);

                    continue;
                }

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

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

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

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

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

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

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

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

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

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

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

            return;
        }
        public DescribeGatewayInformationResult Unmarshall(JsonUnmarshallerContext context)
        {
            DescribeGatewayInformationResult describeGatewayInformationResult = new DescribeGatewayInformationResult();

            describeGatewayInformationResult.GatewayNetworkInterfaces = 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("GatewayARN", targetDepth))
                    {
                        describeGatewayInformationResult.GatewayARN = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

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

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

                    if (context.TestExpression("GatewayNetworkInterfaces", targetDepth))
                    {
                        describeGatewayInformationResult.GatewayNetworkInterfaces = new List <NetworkInterface>();
                        NetworkInterfaceUnmarshaller unmarshaller = NetworkInterfaceUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                describeGatewayInformationResult.GatewayNetworkInterfaces.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }

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

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


            return(describeGatewayInformationResult);
        }