updateDevicePool method

Future<UpdateDevicePoolResult> updateDevicePool({
  1. required String arn,
  2. bool? clearMaxDevices,
  3. String? description,
  4. int? maxDevices,
  5. String? name,
  6. List<Rule>? rules,
})

Modifies the name, description, and rules in a device pool given the attributes and the pool ARN. Rule updates are all-or-nothing, meaning they can only be updated as a whole (or not at all).

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

Parameter arn : The Amazon Resource Name (ARN) of the Device Farm device pool to update.

Parameter clearMaxDevices : Sets whether the maxDevices parameter applies to your device pool. If you set this parameter to true, the maxDevices parameter does not apply, and Device Farm does not limit the number of devices that it adds to your device pool. In this case, Device Farm adds all available devices that meet the criteria specified in the rules parameter.

If you use this parameter in your request, you cannot use the maxDevices parameter in the same request.

Parameter description : A description of the device pool to update.

Parameter maxDevices : The number of devices that Device Farm can add to your device pool. Device Farm adds devices that are available and that 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.

If you use this parameter in your request, you cannot use the clearMaxDevices parameter in the same request.

Parameter name : A string that represents the name of the device pool to update.

Parameter rules : Represents the rules to modify for the device pool. Updating rules is optional. If you update rules for your request, the update replaces the existing rules.

Implementation

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

  return UpdateDevicePoolResult.fromJson(jsonResponse.body);
}