示例#1
0
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            TestInvokeAuthorizerResponse response = new TestInvokeAuthorizerResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("authorization", targetDepth))
                {
                    var unmarshaller = new DictionaryUnmarshaller <string, List <string>, StringUnmarshaller, ListUnmarshaller <string, StringUnmarshaller> >(StringUnmarshaller.Instance, new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.Instance));
                    response.Authorization = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("claims", targetDepth))
                {
                    var unmarshaller = new DictionaryUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance);
                    response.Claims = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("clientStatus", targetDepth))
                {
                    var unmarshaller = IntUnmarshaller.Instance;
                    response.ClientStatus = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("latency", targetDepth))
                {
                    var unmarshaller = LongUnmarshaller.Instance;
                    response.Latency = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("log", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Log = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("policy", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.Policy = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("principalId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.PrincipalId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            TestInvokeAuthorizerResponse response = new TestInvokeAuthorizerResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("disconnectAfterInSeconds", targetDepth))
                {
                    var unmarshaller = IntUnmarshaller.Instance;
                    response.DisconnectAfterInSeconds = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("isAuthenticated", targetDepth))
                {
                    var unmarshaller = BoolUnmarshaller.Instance;
                    response.IsAuthenticated = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("policyDocuments", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <string, StringUnmarshaller>(StringUnmarshaller.Instance);
                    response.PolicyDocuments = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("principalId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.PrincipalId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("refreshAfterInSeconds", targetDepth))
                {
                    var unmarshaller = IntUnmarshaller.Instance;
                    response.RefreshAfterInSeconds = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }