createPentest method

Future<CreatePentestOutput> createPentest({
  1. required String agentSpaceId,
  2. required String title,
  3. Assets? assets,
  4. CodeRemediationStrategy? codeRemediationStrategy,
  5. List<RiskType>? excludeRiskTypes,
  6. CloudWatchLog? logConfig,
  7. NetworkTrafficConfig? networkTrafficConfig,
  8. String? serviceRole,
  9. VpcConfig? vpcConfig,
})

Creates a new pentest configuration in an agent space. A pentest defines the security test parameters, including target assets, risk type exclusions, and logging configuration.

Parameter agentSpaceId : The unique identifier of the agent space to create the pentest in.

Parameter title : The title of the pentest.

Parameter assets : The assets to include in the pentest, such as endpoints, actors, documents, and source code.

Parameter codeRemediationStrategy : The code remediation strategy for the pentest. Valid values are AUTOMATIC and DISABLED.

Parameter excludeRiskTypes : The list of risk types to exclude from the pentest.

Parameter logConfig : The CloudWatch Logs configuration for the pentest.

Parameter networkTrafficConfig : The network traffic configuration for the pentest, including custom headers and traffic rules.

Parameter serviceRole : The IAM service role to use for the pentest.

Parameter vpcConfig : The VPC configuration for the pentest.

Implementation

Future<CreatePentestOutput> createPentest({
  required String agentSpaceId,
  required String title,
  Assets? assets,
  CodeRemediationStrategy? codeRemediationStrategy,
  List<RiskType>? excludeRiskTypes,
  CloudWatchLog? logConfig,
  NetworkTrafficConfig? networkTrafficConfig,
  String? serviceRole,
  VpcConfig? vpcConfig,
}) async {
  final $payload = <String, dynamic>{
    'agentSpaceId': agentSpaceId,
    'title': title,
    if (assets != null) 'assets': assets,
    if (codeRemediationStrategy != null)
      'codeRemediationStrategy': codeRemediationStrategy.value,
    if (excludeRiskTypes != null)
      'excludeRiskTypes': excludeRiskTypes.map((e) => e.value).toList(),
    if (logConfig != null) 'logConfig': logConfig,
    if (networkTrafficConfig != null)
      'networkTrafficConfig': networkTrafficConfig,
    if (serviceRole != null) 'serviceRole': serviceRole,
    if (vpcConfig != null) 'vpcConfig': vpcConfig,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/CreatePentest',
    exceptionFnMap: _exceptionFns,
  );
  return CreatePentestOutput.fromJson(response);
}