associateFileSystemAliases method

Future<AssociateFileSystemAliasesResponse> associateFileSystemAliases({
  1. required List<String> aliases,
  2. required String fileSystemId,
  3. String? clientRequestToken,
})

Use this action to associate one or more Domain Name Server (DNS) aliases with an existing Amazon FSx for Windows File Server file system. A file systen can have a maximum of 50 DNS aliases associated with it at any one time. If you try to associate a DNS alias that is already associated with the file system, FSx takes no action on that alias in the request. For more information, see Working with DNS Aliases and Walkthrough 5: Using DNS aliases to access your file system, including additional steps you must take to be able to access your file system using a DNS alias.

The system response shows the DNS aliases that Amazon FSx is attempting to associate with the file system. Use the API operation to monitor the status of the aliases Amazon FSx is associating with the file system.

May throw BadRequest. May throw FileSystemNotFound. May throw InternalServerError.

Parameter aliases : An array of one or more DNS alias names to associate with the file system. The alias name has to comply with the following formatting requirements:

  • Formatted as a fully-qualified domain name (FQDN), hostname.domain , for example, accounting.corp.example.com.
  • Can contain alphanumeric characters and the hyphen (-).
  • Cannot start or end with a hyphen.
  • Can start with a numeric.
For DNS alias names, Amazon FSx stores alphabetic characters as lowercase letters (a-z), regardless of how you specify them: as uppercase letters, lowercase letters, or the corresponding letters in escape codes.

Parameter fileSystemId : Specifies the file system with which you want to associate one or more DNS aliases.

Implementation

Future<AssociateFileSystemAliasesResponse> associateFileSystemAliases({
  required List<String> aliases,
  required String fileSystemId,
  String? clientRequestToken,
}) async {
  ArgumentError.checkNotNull(aliases, 'aliases');
  ArgumentError.checkNotNull(fileSystemId, 'fileSystemId');
  _s.validateStringLength(
    'fileSystemId',
    fileSystemId,
    11,
    21,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    63,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSSimbaAPIService_v20180301.AssociateFileSystemAliases'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Aliases': aliases,
      'FileSystemId': fileSystemId,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
    },
  );

  return AssociateFileSystemAliasesResponse.fromJson(jsonResponse.body);
}