0

我正在尝试使用 C# 中的 AWS DeviceFarm sdk 为项目创建设备池。我使用以下命令:

var createDevicePoolResponse = client.CreateDevicePool (new CreateDevicePoolRequest {
            Name = "CustomDevicePool",
            ProjectArn = projectArn,
            Rules = new List<Rule> { 
                new Rule { 
                    Attribute = DeviceAttribute.ARN,
                    Operator = RuleOperator.EQUALS_TO,
                    Value = "arn:aws:devicefarm:us-west-2::device:577DC08D6B964346B86610CFF090CD59"
                }
            }
        });

它思考了大约一分钟,然后我收到以下异常:

使用错误代码 InternalFailure 和 Http 状态代码 InternalServerError 发出请求时出错。服务未返回更多错误信息。

ProjectArn 有效。我也尝试了不同的规则,每次都得到相同的错误。

4

1 回答 1

0

弄清楚了。值需要用方括号括起来,像这样

var createDevicePoolResponse = client.CreateDevicePool (new CreateDevicePoolRequest {
                Name = "CustomDevicePool",
                ProjectArn = projectArn,
                Rules = new List<Rule> { 
                    new Rule { 
                        Attribute = DeviceAttribute.ARN,
                        Operator = RuleOperator.IN,
                        Value = "[\"arn:aws:devicefarm:us-west-2::device:D45C750161314335924CE0B9B7D2558E\"]"
                    }
                }
            });
于 2016-03-01T23:50:24.183 回答