private string FindDevicePoolByName(string name)
        {
            var result = client.ListDevicePools(new ListDevicePoolsRequest {
                Arn = ProjectArn
            });
            var devicePool = result.DevicePools.FirstOrDefault(dp => dp.Name == name);

            if (devicePool == null)
            {
                var msg = $"DevicePool '{name}' not found";
                ReportError(msg);
                throw new Exception(msg);
            }

            return(devicePool.Arn);
        }
Exemple #2
0
        public void DeviceFarmListDevicePools()
        {
            #region to-get-information-about-device-pools-1471635745170

            var client   = new AmazonDeviceFarmClient();
            var response = client.ListDevicePools(new ListDevicePoolsRequest
            {
                Type = "PRIVATE",
                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.
            });

            List <DevicePool> devicePools = response.DevicePools;

            #endregion
        }
Exemple #3
0
        private DevicePool GetDevicePool(string projectArn, string devicePoolName)
        {
            DevicePool devicePool = null;
            string     nextToken  = null;

            do
            {
                var response = DFClient.ListDevicePools(new ListDevicePoolsRequest()
                {
                    Arn       = projectArn,
                    Type      = DevicePoolType.CURATED,
                    NextToken = nextToken
                });
                nextToken = response.NextToken;
                foreach (var dp in response.DevicePools)
                {
                    if (dp.Name == devicePoolName)
                    {
                        devicePool = dp;
                        break;
                    }
                }
            } while (devicePool == null && !string.IsNullOrEmpty(nextToken));

            if (devicePool != null)
            {
                Log.LogMessage("Found device pool named '{0}' with ARN '{1}'.", devicePoolName, devicePool.Arn);
            }
            else if (devicePoolName == DefaultDevicePoolName)
            {
                return(CreateDefaultDevicePool(projectArn));
            }
            else
            {
                throw new System.ArgumentException(string.Format("Cannot find device pool named '{0}'.", devicePoolName));
            }

            return(devicePool);
        }