deleteServiceLinkedRole method

Future<DeleteServiceLinkedRoleResponse> deleteServiceLinkedRole({
  1. required String roleName,
})

Submits a service-linked role deletion request and returns a DeletionTaskId, which you can use to check the status of the deletion. Before you call this operation, confirm that the role has no active sessions and that any resources used by the role in the linked service are deleted. If you call this operation more than once for the same service-linked role and an earlier deletion task is not complete, then the DeletionTaskId of the earlier request is returned.

If you submit a deletion request for a service-linked role whose linked service is still accessing a resource, then the deletion task fails. If it fails, the GetServiceLinkedRoleDeletionStatus API operation returns the reason for the failure, usually including the resources that must be deleted. To delete the service-linked role, you must first remove those resources from the linked service and then submit the deletion request again. Resources are specific to the service that is linked to the role. For more information about removing resources from a service, see the AWS documentation for your service.

For more information about service-linked roles, see Roles Terms and Concepts: AWS Service-Linked Role in the IAM User Guide.

May throw NoSuchEntityException. May throw LimitExceededException. May throw ServiceFailureException.

Parameter roleName : The name of the service-linked role to be deleted.

Implementation

Future<DeleteServiceLinkedRoleResponse> deleteServiceLinkedRole({
  required String roleName,
}) async {
  ArgumentError.checkNotNull(roleName, 'roleName');
  _s.validateStringLength(
    'roleName',
    roleName,
    1,
    64,
    isRequired: true,
  );
  final $request = <String, dynamic>{};
  $request['RoleName'] = roleName;
  final $result = await _protocol.send(
    $request,
    action: 'DeleteServiceLinkedRole',
    version: '2010-05-08',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['DeleteServiceLinkedRoleRequest'],
    shapes: shapes,
    resultWrapper: 'DeleteServiceLinkedRoleResult',
  );
  return DeleteServiceLinkedRoleResponse.fromXml($result);
}