createProject method

Future<CreateProjectResult> createProject({
  1. required String name,
  2. int? defaultJobTimeoutMinutes,
  3. List<EnvironmentVariable>? environmentVariables,
  4. String? executionRoleArn,
  5. VpcConfig? vpcConfig,
})

Creates a project.

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

Parameter name : The project's name.

Parameter defaultJobTimeoutMinutes : Sets the execution timeout value (in minutes) for a project. All test runs in this project use the specified execution timeout value unless overridden when scheduling a run.

Parameter environmentVariables : A set of environment variables which are used by default for all runs in the project. These environment variables are applied to the test run during the execution of a test spec file.

For more information about using test spec files, please see Custom test environments in AWS Device Farm.

Parameter executionRoleArn : An IAM role to be assumed by the test host for all runs in the project.

Parameter vpcConfig : The VPC security groups and subnets that are attached to a project.

Implementation

Future<CreateProjectResult> createProject({
  required String name,
  int? defaultJobTimeoutMinutes,
  List<EnvironmentVariable>? environmentVariables,
  String? executionRoleArn,
  VpcConfig? vpcConfig,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DeviceFarm_20150623.CreateProject'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'name': name,
      if (defaultJobTimeoutMinutes != null)
        'defaultJobTimeoutMinutes': defaultJobTimeoutMinutes,
      if (environmentVariables != null)
        'environmentVariables': environmentVariables,
      if (executionRoleArn != null) 'executionRoleArn': executionRoleArn,
      if (vpcConfig != null) 'vpcConfig': vpcConfig,
    },
  );

  return CreateProjectResult.fromJson(jsonResponse.body);
}