createRoleAlias method
Creates a role alias.
Requires permission to access the CreateRoleAlias action.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw LimitExceededException.
May throw ResourceAlreadyExistsException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
May throw UnauthorizedException.
Parameter roleAlias :
The role alias that points to a role ARN. This allows you to change the
role without having to update the device.
Parameter roleArn :
The role ARN.
Parameter credentialDurationSeconds :
How long (in seconds) the credentials will be valid. The default value is
3,600 seconds.
This value must be less than or equal to the maximum session duration of the IAM role that the role alias references.
Parameter tags :
Metadata which can be used to manage the role alias.
For the CLI command-line parameter use format: &&tags "key1=value1&key2=value2..."
For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."
Implementation
Future<CreateRoleAliasResponse> createRoleAlias({
required String roleAlias,
required String roleArn,
int? credentialDurationSeconds,
List<Tag>? tags,
}) async {
_s.validateNumRange(
'credentialDurationSeconds',
credentialDurationSeconds,
900,
43200,
);
final $payload = <String, dynamic>{
'roleArn': roleArn,
if (credentialDurationSeconds != null)
'credentialDurationSeconds': credentialDurationSeconds,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/role-aliases/${Uri.encodeComponent(roleAlias)}',
exceptionFnMap: _exceptionFns,
);
return CreateRoleAliasResponse.fromJson(response);
}