getRoleCredentials method
Returns the STS short-term credentials for a given role name that is assigned to the user.
May throw InvalidRequestException. May throw UnauthorizedException. May throw TooManyRequestsException. May throw ResourceNotFoundException.
Parameter accessToken
:
The token issued by the CreateToken
API call. For more
information, see CreateToken
in the AWS SSO OIDC API Reference Guide.
Parameter accountId
:
The identifier for the AWS account that is assigned to the user.
Parameter roleName
:
The friendly name of the role that is assigned to the user.
Implementation
Future<GetRoleCredentialsResponse> getRoleCredentials({
required String accessToken,
required String accountId,
required String roleName,
}) async {
ArgumentError.checkNotNull(accessToken, 'accessToken');
ArgumentError.checkNotNull(accountId, 'accountId');
ArgumentError.checkNotNull(roleName, 'roleName');
final headers = <String, String>{
'x-amz-sso_bearer_token': accessToken.toString(),
};
final $query = <String, List<String>>{
'account_id': [accountId],
'role_name': [roleName],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri: '/federation/credentials',
signed: false,
queryParams: $query,
headers: headers,
exceptionFnMap: _exceptionFns,
);
return GetRoleCredentialsResponse.fromJson(response);
}