createInstanceProfile method

Future<CreateInstanceProfileResult> createInstanceProfile({
  1. required String name,
  2. String? description,
  3. List<String>? excludeAppPackagesFromCleanup,
  4. bool? packageCleanup,
  5. bool? rebootAfterUse,
})

Creates a profile that can be applied to one or more private fleet device instances.

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

Parameter name : The name of your instance profile.

Parameter description : The description of your instance profile.

Parameter excludeAppPackagesFromCleanup : An array of strings that specifies the list of app packages that should not be cleaned up from the device after a test run.

The list of packages is considered only if you set packageCleanup to true.

Parameter packageCleanup : When set to true, Device Farm removes app packages after a test run. The default value is false for private devices.

Parameter rebootAfterUse : When set to true, Device Farm reboots the instance after a test run. The default value is true.

Implementation

Future<CreateInstanceProfileResult> createInstanceProfile({
  required String name,
  String? description,
  List<String>? excludeAppPackagesFromCleanup,
  bool? packageCleanup,
  bool? rebootAfterUse,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    0,
    256,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    16384,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DeviceFarm_20150623.CreateInstanceProfile'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'name': name,
      if (description != null) 'description': description,
      if (excludeAppPackagesFromCleanup != null)
        'excludeAppPackagesFromCleanup': excludeAppPackagesFromCleanup,
      if (packageCleanup != null) 'packageCleanup': packageCleanup,
      if (rebootAfterUse != null) 'rebootAfterUse': rebootAfterUse,
    },
  );

  return CreateInstanceProfileResult.fromJson(jsonResponse.body);
}