如何在AWS Device Farm CLI的设备池中添加单个设备?

时间:2018-07-29 10:32:34

标签: amazon-web-services aws-cli aws-device-farm

我正在使用AWS CLI安排项目构建。 我已经使用设备池(所有Android设备)使用AWS CLI成功执行了测试案例

现在我只希望设备池中有一个设备,所以我试图获取设备ARN。

使用以下方法获取项目下所有设备的ARN:

aws devicefarm list-devices --arn arn:aws:devicefarm:us-west-2:871290565691:project:8edf9575-3290-45f6-90d0-cb36edc0c2c0

我尝试了以下命令,以便仅为一个设备(Google Pixel2 8.1)创建设备池:

aws devicefarm create-device-pool --project-arn arn:aws:devicefarm:us-west-2:871290565691:project:8edf9575-3290-45f6-90d0-cb36edc0c2c0 --name pixel2_81 --rules '[{"attribute": "INSTANCE_ARN", "operator": "IN", "value": "[arn:aws:devicefarm:us-west-2::device:4B2B87829E99484DBCD853D82A883BF5]"}]'

aws devicefarm create-device-pool --project-arn arn:aws:devicefarm:us-west-2:871290565691:project:8edf9575-3290-45f6-90d0-cb36edc0c2c0 --name pixel2_81 --rules '[{"attribute": "INSTANCE_ARN", "operator": "EQUALS", "value": "arn:aws:devicefarm:us-west-2::device:4B2B87829E99484DBCD853D82A883BF5"}]'

aws devicefarm create-device-pool --project-arn arn:aws:devicefarm:us-west-2:871290565691:project:8edf9575-3290-45f6-90d0-cb36edc0c2c0 --name pixel2_81 --rules '[{"attribute": "INSTANCE_ARN", "operator": "EQUALS", "value": "\"arn:aws:devicefarm:us-west-2::device:4B2B87829E99484DBCD853D82A883BF5\""}]'

aws devicefarm create-device-pool --project-arn arn:aws:devicefarm:us-west-2:871290565691:project:8edf9575-3290-45f6-90d0-cb36edc0c2c0 --name pixel2_81 --rules '[{"attribute": "ARN", "operator": "IN", "value": "[arn:aws:devicefarm:us-west-2::device:4B2B87829E99484DBCD853D82A883BF5]"}]'

aws devicefarm create-device-pool --project-arn arn:aws:devicefarm:us-west-2:871290565691:project:8edf9575-3290-45f6-90d0-cb36edc0c2c0 --name pixel2_81 --rules '[{"attribute": "ARN", "operator": "EQUALS", "value": "arn:aws:devicefarm:us-west-2::device:4B2B87829E99484DBCD853D82A883BF5"}]'

aws devicefarm create-device-pool --project-arn arn:aws:devicefarm:us-west-2:871290565691:project:8edf9575-3290-45f6-90d0-cb36edc0c2c0 --name pixel2_81 --rules '[{"attribute": "ARN", "operator": "EQUALS", "value": "\"arn:aws:devicefarm:us-west-2::device:4B2B87829E99484DBCD853D82A883BF5\""}]'

但是他们都给出了相同的错误:

  

调用CreateDevicePool操作时发生错误(ArgumentException):无效的请求,请检查arn和设备池规则

我想我在这里缺少小东西。

真的很感谢您的帮助,或者请提供另一种方法为单个Google Pixel2 8.1设备创建设备池。

谢谢。

2 个答案:

答案 0 :(得分:3)

这是我的笔记中的示例,但不适用于Google像素。但是,可以使用list devices API

找到其arn。

单个设备

aws devicefarm create-device-pool --project-arn arn:aws:devicefarm:us-west-2:111122223333:project:fb906e56-a39f-4976-9583-8c520bb534cb --name testOfCli --rules '[{"attribute": "ARN","operator":"IN","value":"[\"arn:aws:devicefarm:us-west-2::device:B494940EA8AA4DA4B4DC45CE4E47D760\"]"}]' --region us-west-2

高度

-詹姆斯

答案 1 :(得分:0)

根据James提供更详细的答案。

aws devicefarm create-device-pool --project-arn arn:aws:devicefarm:us-west-2: 111122223333:project:bb8c132f-9c75-4ac2-98fc-59c5e71adbbd --name pixel2_81 --rules '[{"attribute": "ARN","operator":"IN","value":"[\"arn:aws:devicefarm:us-west-2::device:4B2B87829E99484DBCD853D82A883BF5\"]"}]' --region us-west-2