public static RouteFilterPrefixUnmarshaller GetInstance()
 {
     if (instance == null)
     {
         instance = new RouteFilterPrefixUnmarshaller();
     }
     return(instance);
 }
        public VirtualInterface Unmarshall(JsonUnmarshallerContext context)
        {
            if (context.CurrentTokenType == JsonUnmarshallerContext.TokenType.Null)
            {
                return(null);
            }
            VirtualInterface virtualInterface = new VirtualInterface();

            virtualInterface.RouteFilterPrefixes = 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("OwnerAccount", targetDepth))
                    {
                        virtualInterface.OwnerAccount = StringUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

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

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

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

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

                    if (context.TestExpression("Vlan", targetDepth))
                    {
                        virtualInterface.Vlan = IntUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

                    if (context.TestExpression("Asn", targetDepth))
                    {
                        virtualInterface.Asn = IntUnmarshaller.GetInstance().Unmarshall(context);
                        continue;
                    }

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

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

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

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

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

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

                    if (context.TestExpression("RouteFilterPrefixes", targetDepth))
                    {
                        virtualInterface.RouteFilterPrefixes = new List <RouteFilterPrefix>();
                        RouteFilterPrefixUnmarshaller unmarshaller = RouteFilterPrefixUnmarshaller.GetInstance();
                        while (context.Read())
                        {
                            if ((context.IsArrayElement) && (context.CurrentDepth == targetDepth))
                            {
                                virtualInterface.RouteFilterPrefixes.Add(unmarshaller.Unmarshall(context));
                            }
                            else if (context.IsEndArray)
                            {
                                break;
                            }
                        }
                        continue;
                    }
                }
                else if (context.IsEndElement && context.CurrentDepth <= originalDepth)
                {
                    return(virtualInterface);
                }
            }


            return(virtualInterface);
        }
Exemplo n.º 3
0
        public VirtualInterface Unmarshall(JsonUnmarshallerContext context)
        {
            context.Read();
            if (context.CurrentTokenType == JsonToken.Null)
            {
                return(null);
            }
            VirtualInterface virtualInterface = new VirtualInterface();


            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("ownerAccount", targetDepth))
                {
                    virtualInterface.OwnerAccount = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("virtualInterfaceId", targetDepth))
                {
                    virtualInterface.VirtualInterfaceId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("location", targetDepth))
                {
                    virtualInterface.Location = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("connectionId", targetDepth))
                {
                    virtualInterface.ConnectionId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("virtualInterfaceType", targetDepth))
                {
                    virtualInterface.VirtualInterfaceType = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("virtualInterfaceName", targetDepth))
                {
                    virtualInterface.VirtualInterfaceName = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("vlan", targetDepth))
                {
                    virtualInterface.Vlan = IntUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("asn", targetDepth))
                {
                    virtualInterface.Asn = IntUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("authKey", targetDepth))
                {
                    virtualInterface.AuthKey = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("amazonAddress", targetDepth))
                {
                    virtualInterface.AmazonAddress = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("customerAddress", targetDepth))
                {
                    virtualInterface.CustomerAddress = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("virtualInterfaceState", targetDepth))
                {
                    virtualInterface.VirtualInterfaceState = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("customerRouterConfig", targetDepth))
                {
                    virtualInterface.CustomerRouterConfig = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("virtualGatewayId", targetDepth))
                {
                    virtualInterface.VirtualGatewayId = StringUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("routeFilterPrefixes", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <RouteFilterPrefix, RouteFilterPrefixUnmarshaller>(
                        RouteFilterPrefixUnmarshaller.GetInstance());
                    virtualInterface.RouteFilterPrefixes = unmarshaller.Unmarshall(context);

                    continue;
                }
            }

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

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

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

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

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

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

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

                if (context.TestExpression("vlan", targetDepth))
                {
                    context.Read();
                    response.Vlan = IntUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("asn", targetDepth))
                {
                    context.Read();
                    response.Asn = IntUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if (context.TestExpression("vlan", targetDepth))
                {
                    response.Vlan = IntUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

                if (context.TestExpression("asn", targetDepth))
                {
                    response.Asn = IntUnmarshaller.GetInstance().Unmarshall(context);
                    continue;
                }

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

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

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

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

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

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

                if (context.TestExpression("routeFilterPrefixes", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <RouteFilterPrefix, RouteFilterPrefixUnmarshaller>(
                        RouteFilterPrefixUnmarshaller.GetInstance());
                    response.RouteFilterPrefixes = unmarshaller.Unmarshall(context);

                    continue;
                }
            }

            return(response);
        }