modifyClusterIamRoles method

Future<ModifyClusterIamRolesResult> modifyClusterIamRoles({
  1. required String clusterIdentifier,
  2. List<String>? addIamRoles,
  3. String? defaultIamRoleArn,
  4. List<String>? removeIamRoles,
})

Modifies the list of Identity and Access Management (IAM) roles that can be used by the cluster to access other Amazon Web Services services.

The maximum number of IAM roles that you can associate is subject to a quota. For more information, go to Quotas and limits in the Amazon Redshift Cluster Management Guide.

May throw ClusterNotFoundFault. May throw InvalidClusterStateFault.

Parameter clusterIdentifier : The unique identifier of the cluster for which you want to associate or disassociate IAM roles.

Parameter addIamRoles : Zero or more IAM roles to associate with the cluster. The roles must be in their Amazon Resource Name (ARN) format.

Parameter defaultIamRoleArn : The Amazon Resource Name (ARN) for the IAM role that was set as default for the cluster when the cluster was last modified.

Parameter removeIamRoles : Zero or more IAM roles in ARN format to disassociate from the cluster.

Implementation

Future<ModifyClusterIamRolesResult> modifyClusterIamRoles({
  required String clusterIdentifier,
  List<String>? addIamRoles,
  String? defaultIamRoleArn,
  List<String>? removeIamRoles,
}) async {
  final $request = <String, String>{
    'ClusterIdentifier': clusterIdentifier,
    if (addIamRoles != null)
      if (addIamRoles.isEmpty)
        'AddIamRoles': ''
      else
        for (var i1 = 0; i1 < addIamRoles.length; i1++)
          'AddIamRoles.IamRoleArn.${i1 + 1}': addIamRoles[i1],
    if (defaultIamRoleArn != null) 'DefaultIamRoleArn': defaultIamRoleArn,
    if (removeIamRoles != null)
      if (removeIamRoles.isEmpty)
        'RemoveIamRoles': ''
      else
        for (var i1 = 0; i1 < removeIamRoles.length; i1++)
          'RemoveIamRoles.IamRoleArn.${i1 + 1}': removeIamRoles[i1],
  };
  final $result = await _protocol.send(
    $request,
    action: 'ModifyClusterIamRoles',
    version: '2012-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'ModifyClusterIamRolesResult',
  );
  return ModifyClusterIamRolesResult.fromXml($result);
}