createAccessKey method
Creates a new Amazon Web Services secret access key and corresponding
Amazon Web Services access key ID for the specified user. The default
status for new keys is Active.
If you do not specify a user name, IAM determines the user name implicitly based on the Amazon Web Services access key ID signing the request. This operation works for access keys under the Amazon Web Services account. Consequently, you can use this operation to manage Amazon Web Services account root user credentials. This is true even if the Amazon Web Services account has no associated users.
For information about quotas on the number of keys you can create, see IAM and STS quotas in the IAM User Guide.
May throw LimitExceededException.
May throw NoSuchEntityException.
May throw ServiceFailureException.
Parameter userName :
The name of the IAM user that the new key will belong to.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
Implementation
Future<CreateAccessKeyResponse> createAccessKey({
String? userName,
}) async {
final $request = <String, String>{
if (userName != null) 'UserName': userName,
};
final $result = await _protocol.send(
$request,
action: 'CreateAccessKey',
version: '2010-05-08',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
resultWrapper: 'CreateAccessKeyResult',
);
return CreateAccessKeyResponse.fromXml($result);
}