createDevicePool method

Future<CreateDevicePoolResult> createDevicePool({
  1. required String name,
  2. required String projectArn,
  3. required List<Rule> rules,
  4. String? description,
  5. int? maxDevices,
})

Creates a device pool.

May throw ArgumentException. May throw NotFoundException. May throw LimitExceededException. May throw ServiceAccountException.

Parameter name : The device pool's name.

Parameter projectArn : The ARN of the project for the device pool.

Parameter rules : The device pool's rules.

Parameter description : The device pool's description.

Parameter maxDevices : The number of devices that Device Farm can add to your device pool. Device Farm adds devices that are available and meet the criteria that you assign for the rules parameter. Depending on how many devices meet these constraints, your device pool might contain fewer devices than the value for this parameter.

By specifying the maximum number of devices, you can control the costs that you incur by running tests.

Implementation

Future<CreateDevicePoolResult> createDevicePool({
  required String name,
  required String projectArn,
  required List<Rule> rules,
  String? description,
  int? maxDevices,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    0,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(projectArn, 'projectArn');
  _s.validateStringLength(
    'projectArn',
    projectArn,
    32,
    1011,
    isRequired: true,
  );
  ArgumentError.checkNotNull(rules, 'rules');
  _s.validateStringLength(
    'description',
    description,
    0,
    16384,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DeviceFarm_20150623.CreateDevicePool'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'name': name,
      'projectArn': projectArn,
      'rules': rules,
      if (description != null) 'description': description,
      if (maxDevices != null) 'maxDevices': maxDevices,
    },
  );

  return CreateDevicePoolResult.fromJson(jsonResponse.body);
}