/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListGraphsResponse response = new ListGraphsResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("GraphList", targetDepth)) { var unmarshaller = new ListUnmarshaller <Graph, GraphUnmarshaller>(GraphUnmarshaller.Instance); response.GraphList = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } } return(response); }
public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonDetectiveConfig config = new AmazonDetectiveConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonDetectiveClient client = new AmazonDetectiveClient(creds, config); ListGraphsResponse resp = new ListGraphsResponse(); do { ListGraphsRequest req = new ListGraphsRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListGraphs(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.GraphList) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }