getClusterSessionCredentials method

Future<GetClusterSessionCredentialsOutput> getClusterSessionCredentials({
  1. required String clusterId,
  2. String? executionRoleArn,
})

Provides temporary, HTTP basic credentials that are associated with a given runtime IAM role and used by a cluster with fine-grained access control activated. You can use these credentials to connect to cluster endpoints that support username and password authentication.

May throw InternalServerError. May throw InvalidRequestException.

Parameter clusterId : The unique identifier of the cluster.

Parameter executionRoleArn : The Amazon Resource Name (ARN) of the runtime role for interactive workload submission on the cluster. The runtime role can be a cross-account IAM role. The runtime role ARN is a combination of account ID, role name, and role type using the following format: arn:partition:service:region:account:resource.

Implementation

Future<GetClusterSessionCredentialsOutput> getClusterSessionCredentials({
  required String clusterId,
  String? executionRoleArn,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'ElasticMapReduce.GetClusterSessionCredentials'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClusterId': clusterId,
      if (executionRoleArn != null) 'ExecutionRoleArn': executionRoleArn,
    },
  );

  return GetClusterSessionCredentialsOutput.fromJson(jsonResponse.body);
}