createRoleAlias method

Future<CreateRoleAliasResponse> createRoleAlias({
  1. required String roleAlias,
  2. required String roleArn,
  3. int? credentialDurationSeconds,
  4. List<Tag>? tags,
})

Creates a role alias.

May throw ResourceAlreadyExistsException. May throw InvalidRequestException. May throw LimitExceededException. May throw ThrottlingException. May throw UnauthorizedException. May throw ServiceUnavailableException. May throw InternalFailureException.

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.

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 {
  ArgumentError.checkNotNull(roleAlias, 'roleAlias');
  _s.validateStringLength(
    'roleAlias',
    roleAlias,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(roleArn, 'roleArn');
  _s.validateStringLength(
    'roleArn',
    roleArn,
    20,
    2048,
    isRequired: true,
  );
  _s.validateNumRange(
    'credentialDurationSeconds',
    credentialDurationSeconds,
    900,
    3600,
  );
  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);
}