public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems) { AmazonDeviceFarmConfig config = new AmazonDeviceFarmConfig(); config.RegionEndpoint = region; ConfigureClient(config); AmazonDeviceFarmClient client = new AmazonDeviceFarmClient(creds, config); ListDevicesResponse resp = new ListDevicesResponse(); do { ListDevicesRequest req = new ListDevicesRequest { NextToken = resp.NextToken }; resp = client.ListDevices(req); CheckError(resp.HttpStatusCode, "200"); foreach (var obj in resp.Devices) { AddObject(obj); } }while (!string.IsNullOrEmpty(resp.NextToken)); }
public void DeviceFarmListDevices() { #region to-get-information-about-devices-1471641699344 var client = new AmazonDeviceFarmClient(); var response = client.ListDevices(new ListDevicesRequest { Arn = "arn:aws:devicefarm:us-west-2:123456789101:project:EXAMPLE-GUID-123-456" // You can get the project ARN by using the list-projects CLI command. }); #endregion }
private DevicePool CreateDefaultDevicePool(string projectArn) { Log.LogMessage("Creating device pool {0}.", DefaultDevicePoolName); string nextToken = null; List <Device> devices = new List <Device>(); do { var resp = DFClient.ListDevices(new ListDevicesRequest() { NextToken = nextToken }); nextToken = resp.NextToken; devices.AddRange(resp.Devices); } while (nextToken != null); List <string> deviceArns = new List <string>(); foreach (var device in devices) { if (DefaultDevices.ContainsKey(device.Name) && DefaultDevices[device.Name] == device.Os) { deviceArns.Add('"' + device.Arn + '"'); } } Rule rule = new Rule() { Attribute = DeviceAttribute.ARN, Operator = RuleOperator.IN, Value = "[" + string.Join(",", deviceArns) + "]" }; DevicePool devicePool = DFClient.CreateDevicePool(new CreateDevicePoolRequest() { ProjectArn = projectArn, Name = DefaultDevicePoolName, Rules = new List <Rule>() { rule } }).DevicePool; return(devicePool); }