putServiceLinkedConfigurationRecorder method

Future<PutServiceLinkedConfigurationRecorderResponse> putServiceLinkedConfigurationRecorder({
  1. required String servicePrincipal,
  2. List<Tag>? tags,
})

Creates a service-linked configuration recorder that is linked to a specific Amazon Web Services service based on the ServicePrincipal you specify.

The configuration recorder's name, recordingGroup, recordingMode, and recordingScope is set by the service that is linked to the configuration recorder.

For more information and a list of supported services/service principals, see Working with the Configuration Recorder in the Config Developer Guide.

This API creates a service-linked role AWSServiceRoleForConfig in your account. The service-linked role is created only when the role does not exist in your account.

The recording scope is set by the service that is linked to the configuration recorder and determines whether you receive configuration items (CIs) in the delivery channel. If the recording scope is internal, you will not receive CIs in the delivery channel.

Tags are added at creation and cannot be updated with this operation

Use TagResource and UntagResource to update tags after creation.

May throw ConflictException. May throw InsufficientPermissionsException. May throw LimitExceededException. May throw ValidationException.

Parameter servicePrincipal : The service principal of the Amazon Web Services service for the service-linked configuration recorder that you want to create.

Parameter tags : The tags for a service-linked configuration recorder. Each tag consists of a key and an optional value, both of which you define.

Implementation

Future<PutServiceLinkedConfigurationRecorderResponse>
    putServiceLinkedConfigurationRecorder({
  required String servicePrincipal,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'StarlingDoveService.PutServiceLinkedConfigurationRecorder'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ServicePrincipal': servicePrincipal,
      if (tags != null) 'Tags': tags,
    },
  );

  return PutServiceLinkedConfigurationRecorderResponse.fromJson(
      jsonResponse.body);
}