updateConfigurationPolicy method

Future<UpdateConfigurationPolicyResponse> updateConfigurationPolicy({
  1. required String identifier,
  2. Policy? configurationPolicy,
  3. String? description,
  4. String? name,
  5. String? updatedReason,
})

Updates a configuration policy. 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. May throw ResourceNotFoundException.

Parameter identifier : The Amazon Resource Name (ARN) or universally unique identifier (UUID) of the configuration policy.

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).

When updating a configuration policy, provide a complete list of standards that you want to enable and a complete list of controls that you want to enable or disable. The updated configuration replaces the current configuration.

Parameter description : The description of the configuration policy.

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

Parameter updatedReason : The reason for updating the configuration policy.

Implementation

Future<UpdateConfigurationPolicyResponse> updateConfigurationPolicy({
  required String identifier,
  Policy? configurationPolicy,
  String? description,
  String? name,
  String? updatedReason,
}) async {
  final $payload = <String, dynamic>{
    if (configurationPolicy != null)
      'ConfigurationPolicy': configurationPolicy,
    if (description != null) 'Description': description,
    if (name != null) 'Name': name,
    if (updatedReason != null) 'UpdatedReason': updatedReason,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri: '/configurationPolicy/${Uri.encodeComponent(identifier)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateConfigurationPolicyResponse.fromJson(response);
}