createUserProfile method
Creates a new user profile.
Required Permissions: To use this action, an IAM user must have an attached policy that explicitly grants permissions. For more information about user permissions, see Managing User Permissions.
May throw ValidationException.
Parameter iamUserArn
:
The user's IAM ARN; this can also be a federated user's ARN.
Parameter allowSelfManagement
:
Whether users can specify their own SSH public key through the My Settings
page. For more information, see Setting
an IAM User's Public SSH Key.
Parameter sshPublicKey
:
The user's public SSH key.
Parameter sshUsername
:
The user's SSH user name. The allowable characters are a-z
, A-Z
,
0-9
, '-', and '_'. If the specified name includes other punctuation
marks, AWS OpsWorks Stacks removes them. For example, my.name
will be changed to myname
. If you do not specify an SSH user
name, AWS OpsWorks Stacks generates one from the IAM user name.
Implementation
Future<CreateUserProfileResult> createUserProfile({
required String iamUserArn,
bool? allowSelfManagement,
String? sshPublicKey,
String? sshUsername,
}) async {
ArgumentError.checkNotNull(iamUserArn, 'iamUserArn');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'OpsWorks_20130218.CreateUserProfile'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'IamUserArn': iamUserArn,
if (allowSelfManagement != null)
'AllowSelfManagement': allowSelfManagement,
if (sshPublicKey != null) 'SshPublicKey': sshPublicKey,
if (sshUsername != null) 'SshUsername': sshUsername,
},
);
return CreateUserProfileResult.fromJson(jsonResponse.body);
}