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

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("DiscoveredResourceList", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <DiscoveredResource, DiscoveredResourceUnmarshaller>(DiscoveredResourceUnmarshaller.Instance);
                    response.DiscoveredResourceList = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("NextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
예제 #2
0
        public static ListDiscoveredResourcesResponse Unmarshall(UnmarshallerContext _ctx)
        {
            ListDiscoveredResourcesResponse listDiscoveredResourcesResponse = new ListDiscoveredResourcesResponse();

            listDiscoveredResourcesResponse.HttpResponse = _ctx.HttpResponse;
            listDiscoveredResourcesResponse.RequestId    = _ctx.StringValue("ListDiscoveredResources.RequestId");

            ListDiscoveredResourcesResponse.ListDiscoveredResources_DiscoveredResourceProfiles discoveredResourceProfiles = new ListDiscoveredResourcesResponse.ListDiscoveredResources_DiscoveredResourceProfiles();
            discoveredResourceProfiles.PageNumber = _ctx.IntegerValue("ListDiscoveredResources.DiscoveredResourceProfiles.PageNumber");
            discoveredResourceProfiles.PageSize   = _ctx.IntegerValue("ListDiscoveredResources.DiscoveredResourceProfiles.PageSize");
            discoveredResourceProfiles.TotalCount = _ctx.IntegerValue("ListDiscoveredResources.DiscoveredResourceProfiles.TotalCount");

            List <ListDiscoveredResourcesResponse.ListDiscoveredResources_DiscoveredResourceProfiles.ListDiscoveredResources_DiscoveredResourceProfile> discoveredResourceProfiles_discoveredResourceProfileList = new List <ListDiscoveredResourcesResponse.ListDiscoveredResources_DiscoveredResourceProfiles.ListDiscoveredResources_DiscoveredResourceProfile>();

            for (int i = 0; i < _ctx.Length("ListDiscoveredResources.DiscoveredResourceProfiles.DiscoveredResourceProfileList.Length"); i++)
            {
                ListDiscoveredResourcesResponse.ListDiscoveredResources_DiscoveredResourceProfiles.ListDiscoveredResources_DiscoveredResourceProfile discoveredResourceProfile = new ListDiscoveredResourcesResponse.ListDiscoveredResources_DiscoveredResourceProfiles.ListDiscoveredResources_DiscoveredResourceProfile();
                discoveredResourceProfile.AccountId            = _ctx.LongValue("ListDiscoveredResources.DiscoveredResourceProfiles.DiscoveredResourceProfileList[" + i + "].AccountId");
                discoveredResourceProfile.Region               = _ctx.StringValue("ListDiscoveredResources.DiscoveredResourceProfiles.DiscoveredResourceProfileList[" + i + "].Region");
                discoveredResourceProfile.ResourceCreationTime = _ctx.LongValue("ListDiscoveredResources.DiscoveredResourceProfiles.DiscoveredResourceProfileList[" + i + "].ResourceCreationTime");
                discoveredResourceProfile.ResourceDeleted      = _ctx.IntegerValue("ListDiscoveredResources.DiscoveredResourceProfiles.DiscoveredResourceProfileList[" + i + "].ResourceDeleted");
                discoveredResourceProfile.ResourceId           = _ctx.StringValue("ListDiscoveredResources.DiscoveredResourceProfiles.DiscoveredResourceProfileList[" + i + "].ResourceId");
                discoveredResourceProfile.ResourceName         = _ctx.StringValue("ListDiscoveredResources.DiscoveredResourceProfiles.DiscoveredResourceProfileList[" + i + "].ResourceName");
                discoveredResourceProfile.ResourceStatus       = _ctx.StringValue("ListDiscoveredResources.DiscoveredResourceProfiles.DiscoveredResourceProfileList[" + i + "].ResourceStatus");
                discoveredResourceProfile.ResourceType         = _ctx.StringValue("ListDiscoveredResources.DiscoveredResourceProfiles.DiscoveredResourceProfileList[" + i + "].ResourceType");
                discoveredResourceProfile.Tags = _ctx.StringValue("ListDiscoveredResources.DiscoveredResourceProfiles.DiscoveredResourceProfileList[" + i + "].Tags");

                discoveredResourceProfiles_discoveredResourceProfileList.Add(discoveredResourceProfile);
            }
            discoveredResourceProfiles.DiscoveredResourceProfileList   = discoveredResourceProfiles_discoveredResourceProfileList;
            listDiscoveredResourcesResponse.DiscoveredResourceProfiles = discoveredResourceProfiles;

            return(listDiscoveredResourcesResponse);
        }