Exemple #1
0
        public void DeviceFarmCreateDevicePool()
        {
            #region createdevicepool-example-1470862210860

            var client   = new AmazonDeviceFarmClient();
            var response = client.CreateDevicePool(new CreateDevicePoolRequest
            {
                Name        = "MyDevicePool",                                                           // A device pool contains related devices, such as devices that run only on Android or that run only on iOS.
                Description = "My Android devices",
                ProjectArn  = "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.
                Rules       = new List <Rule> {
                }
            });

            DevicePool devicePool = response.DevicePool;

            #endregion
        }
Exemple #2
0
        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);
        }