createConfigurationPolicy method

Future<CreateConfigurationPolicyResponse> createConfigurationPolicy({
  1. required Policy configurationPolicy,
  2. required String name,
  3. String? description,
  4. Map<String, String>? tags,
})

Creates a configuration policy with the defined configuration. Only the Security Hub CSPM delegated administrator can invoke this operation from the home Region.

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

Parameter configurationPolicy : An object that defines how Security Hub CSPM is configured. It includes whether Security Hub CSPM is enabled or disabled, a list of enabled security standards, a list of enabled or disabled security controls, and a list of custom parameter values for specified controls. If you provide a list of security controls that are enabled in the configuration policy, Security Hub CSPM disables all other controls (including newly released controls). If you provide a list of security controls that are disabled in the configuration policy, Security Hub CSPM enables all other controls (including newly released controls).

Parameter name : The name of the configuration policy. Alphanumeric characters and the following ASCII characters are permitted: -, ., !, *, /.

Parameter description : The description of the configuration policy.

Parameter tags : User-defined tags associated with a configuration policy. For more information, see Tagging Security Hub CSPM resources in the Security Hub CSPM user guide.

Implementation

Future<CreateConfigurationPolicyResponse> createConfigurationPolicy({
  required Policy configurationPolicy,
  required String name,
  String? description,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'ConfigurationPolicy': configurationPolicy,
    'Name': name,
    if (description != null) 'Description': description,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/configurationPolicy/create',
    exceptionFnMap: _exceptionFns,
  );
  return CreateConfigurationPolicyResponse.fromJson(response);
}