public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonIoTConfig config = new AmazonIoTConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonIoTClient client = new AmazonIoTClient(creds, config); ListThingGroupsResponse resp = new ListThingGroupsResponse(); do { ListThingGroupsRequest req = new ListThingGroupsRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListThingGroups(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.ThingGroups) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }