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

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("GroupList", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <Group, GroupUnmarshaller>(GroupUnmarshaller.Instance);
                    response.GroupList = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("NextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("RequestId", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.RequestId = unmarshaller.Unmarshall(context);
                    continue;
                }
            }
            response.Status = (int)context.ResponseData.StatusCode;

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

            listUserGroupsResponse.HttpResponse = context.HttpResponse;
            listUserGroupsResponse.Code         = context.StringValue("ListUserGroups.Code");
            listUserGroupsResponse.Message      = context.StringValue("ListUserGroups.Message");
            listUserGroupsResponse.RequestId    = context.StringValue("ListUserGroups.RequestId");

            List <ListUserGroupsResponse.ListUserGroups_DataItem> listUserGroupsResponse_data = new List <ListUserGroupsResponse.ListUserGroups_DataItem>();

            for (int i = 0; i < context.Length("ListUserGroups.Data.Length"); i++)
            {
                ListUserGroupsResponse.ListUserGroups_DataItem dataItem = new ListUserGroupsResponse.ListUserGroups_DataItem();
                dataItem.Creator           = context.StringValue("ListUserGroups.Data[" + i + "].Creator");
                dataItem.UserGroupName     = context.StringValue("ListUserGroups.Data[" + i + "].UserGroupName");
                dataItem.IsvSubId          = context.StringValue("ListUserGroups.Data[" + i + "].IsvSubId");
                dataItem.UserGroupId       = context.LongValue("ListUserGroups.Data[" + i + "].UserGroupId");
                dataItem.UserCount         = context.LongValue("ListUserGroups.Data[" + i + "].UserCount");
                dataItem.CreateTime        = context.StringValue("ListUserGroups.Data[" + i + "].CreateTime");
                dataItem.UpdateTime        = context.StringValue("ListUserGroups.Data[" + i + "].UpdateTime");
                dataItem.ParentUserGroupId = context.LongValue("ListUserGroups.Data[" + i + "].ParentUserGroupId");

                listUserGroupsResponse_data.Add(dataItem);
            }
            listUserGroupsResponse.Data = listUserGroupsResponse_data;

            return(listUserGroupsResponse);
        }