public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonResourceGroupsConfig config = new AmazonResourceGroupsConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonResourceGroupsClient client = new AmazonResourceGroupsClient(creds, config); ListGroupResourcesResponse resp = new ListGroupResourcesResponse(); do { ListGroupResourcesRequest req = new ListGroupResourcesRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListGroupResources(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.ResourceIdentifiers) { AddObject(obj); } foreach (var obj in resp.QueryErrors) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { ListGroupResourcesResponse response = new ListGroupResourcesResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("NextToken", targetDepth)) { var unmarshaller = StringUnmarshaller.Instance; response.NextToken = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("QueryErrors", targetDepth)) { var unmarshaller = new ListUnmarshaller <QueryError, QueryErrorUnmarshaller>(QueryErrorUnmarshaller.Instance); response.QueryErrors = unmarshaller.Unmarshall(context); continue; } if (context.TestExpression("ResourceIdentifiers", targetDepth)) { var unmarshaller = new ListUnmarshaller <ResourceIdentifier, ResourceIdentifierUnmarshaller>(ResourceIdentifierUnmarshaller.Instance); response.ResourceIdentifiers = unmarshaller.Unmarshall(context); continue; } } return(response); }