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

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("CaptureTime", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.CaptureTime = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("Entries", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Dictionary <string, string>, DictionaryUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller> >(new DictionaryUnmarshaller <string, string, StringUnmarshaller, StringUnmarshaller>(StringUnmarshaller.Instance, StringUnmarshaller.Instance));
                    response.Entries = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("InstanceId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.InstanceId = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("NextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("SchemaVersion", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.SchemaVersion = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("TypeName", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.TypeName = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Пример #2
0
        public static ListInventoryEntriesResponse Unmarshall(UnmarshallerContext context)
        {
            ListInventoryEntriesResponse listInventoryEntriesResponse = new ListInventoryEntriesResponse();

            listInventoryEntriesResponse.HttpResponse  = context.HttpResponse;
            listInventoryEntriesResponse.RequestId     = context.StringValue("ListInventoryEntries.RequestId");
            listInventoryEntriesResponse.NextToken     = context.StringValue("ListInventoryEntries.NextToken");
            listInventoryEntriesResponse.InstanceId    = context.StringValue("ListInventoryEntries.InstanceId");
            listInventoryEntriesResponse.CaptureTime   = context.StringValue("ListInventoryEntries.CaptureTime");
            listInventoryEntriesResponse.TypeName      = context.StringValue("ListInventoryEntries.TypeName");
            listInventoryEntriesResponse.SchemaVersion = context.StringValue("ListInventoryEntries.SchemaVersion");
            listInventoryEntriesResponse.MaxResults    = context.IntegerValue("ListInventoryEntries.MaxResults");

            List <Dictionary <string, string> > listInventoryEntriesResponse_entries = new List <Dictionary <string, string> >();

            for (int i = 0; i < context.Length("ListInventoryEntries.Entries.Length"); i++)
            {
                Dictionary <string, string> tmp = new Dictionary <string, string>()
                {
                };
                foreach (var _item in context.ResponseDictionary)
                {
                    string prefix = "ListInventoryEntries.Entries[" + i + "].";
                    if (_item.Key.IndexOf(prefix) == 0)
                    {
                        tmp.Add(_item.Key.Substring(prefix.Length), _item.Value);
                    }
                }
                if (tmp.Count > 0)
                {
                    listInventoryEntriesResponse_entries.Add(tmp);
                }
            }
            listInventoryEntriesResponse.Entries = listInventoryEntriesResponse_entries;

            return(listInventoryEntriesResponse);
        }