enableSecurityHub method

Future<void> enableSecurityHub({
  1. ControlFindingGenerator? controlFindingGenerator,
  2. bool? enableDefaultStandards,
  3. Map<String, String>? tags,
})

Enables Security Hub CSPM for your account in the current Region or the Region you specify in the request.

When you enable Security Hub CSPM, you grant to Security Hub CSPM the permissions necessary to gather findings from other services that are integrated with Security Hub CSPM.

When you use the EnableSecurityHub operation to enable Security Hub CSPM, you also automatically enable the following standards:

  • Center for Internet Security (CIS) Amazon Web Services Foundations Benchmark v1.2.0
  • Amazon Web Services Foundational Security Best Practices
Other standards are not automatically enabled.

To opt out of automatically enabled standards, set EnableDefaultStandards to false.

After you enable Security Hub CSPM, to enable a standard, use the BatchEnableStandards operation. To disable a standard, use the BatchDisableStandards operation.

To learn more, see the setup information in the Security Hub CSPM User Guide.

May throw AccessDeniedException. May throw InternalException. May throw InvalidAccessException. May throw LimitExceededException. May throw ResourceConflictException.

Parameter controlFindingGenerator : This field, used when enabling Security Hub CSPM, specifies whether the calling account has consolidated control findings turned on. If the value for this field is set to SECURITY_CONTROL, Security Hub CSPM generates a single finding for a control check even when the check applies to multiple enabled standards.

If the value for this field is set to STANDARD_CONTROL, Security Hub CSPM generates separate findings for a control check when the check applies to multiple enabled standards.

The value for this field in a member account matches the value in the administrator account. For accounts that aren't part of an organization, the default value of this field is SECURITY_CONTROL if you enabled Security Hub CSPM on or after February 23, 2023.

Parameter enableDefaultStandards : Whether to enable the security standards that Security Hub CSPM has designated as automatically enabled. If you don't provide a value for EnableDefaultStandards, it is set to true. To not enable the automatically enabled standards, set EnableDefaultStandards to false.

Parameter tags : The tags to add to the hub resource when you enable Security Hub CSPM.

Implementation

Future<void> enableSecurityHub({
  ControlFindingGenerator? controlFindingGenerator,
  bool? enableDefaultStandards,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    if (controlFindingGenerator != null)
      'ControlFindingGenerator': controlFindingGenerator.value,
    if (enableDefaultStandards != null)
      'EnableDefaultStandards': enableDefaultStandards,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/accounts',
    exceptionFnMap: _exceptionFns,
  );
}