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); ListThingsResponse resp = new ListThingsResponse(); do { ListThingsRequest req = new ListThingsRequest { NextToken = resp.NextToken , MaxResults = maxItems }; resp = client.ListThings(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Things) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public static void ClassInitialize(TestContext testContext) { Client = new AmazonIotDataClient("https://data.iot.us-east-1.amazonaws.com/"); using (var iotClient = new AmazonIoTClient()) { var things = iotClient.ListThings().Things; var firstThing = things.FirstOrDefault(); if (firstThing == null) { THING_NAME = "dotnettest" + DateTime.UtcNow.ToFileTime(); iotClient.CreateThing(new CreateThingRequest { ThingName = THING_NAME }); CREATED_THING_NAME = THING_NAME; } else { THING_NAME = firstThing.ThingName; } } }