joinDomain method

Future<JoinDomainOutput> joinDomain({
  1. required String domainName,
  2. required String gatewayARN,
  3. required String password,
  4. required String userName,
  5. List<String>? domainControllers,
  6. String? organizationalUnit,
  7. int? timeoutInSeconds,
})

Adds a file gateway to an Active Directory domain. This operation is only supported for file gateways that support the SMB file protocol.

To create the gateway's computer account in an organizational unit other than the default, you must specify the organizational unit when joining the domain.

May throw InternalServerError. May throw InvalidGatewayRequestException.

Parameter domainName : The name of the domain that you want the gateway to join.

Parameter gatewayARN : The Amazon Resource Name (ARN) of the gateway. Use the ListGateways operation to return a list of gateways for your account and Amazon Web Services Region.

Parameter password : Sets the password of the user who has permission to add the gateway to the Active Directory domain.

Parameter userName : Sets the user name of user who has permission to add the gateway to the Active Directory domain. The domain user account should be enabled to join computers to the domain. For example, you can use the domain administrator account or an account with delegated permissions to join computers to the domain.

Parameter domainControllers : List of IP addresses, NetBIOS names, or host names of your domain server. If you need to specify the port number include it after the colon (“:”). For example, mydc.mydomain.com:389.

FSx File Gateway does not support IPv6.

Parameter organizationalUnit : The organizational unit (OU) is a container in an Active Directory that can hold users, groups, computers, and other OUs and this parameter specifies the OU that the gateway will join within the AD domain.

Parameter timeoutInSeconds : Specifies the time in seconds, in which the JoinDomain operation must complete. The default is 20 seconds.

Implementation

Future<JoinDomainOutput> joinDomain({
  required String domainName,
  required String gatewayARN,
  required String password,
  required String userName,
  List<String>? domainControllers,
  String? organizationalUnit,
  int? timeoutInSeconds,
}) async {
  _s.validateNumRange(
    'timeoutInSeconds',
    timeoutInSeconds,
    0,
    3600,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StorageGateway_20130630.JoinDomain'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DomainName': domainName,
      'GatewayARN': gatewayARN,
      'Password': password,
      'UserName': userName,
      if (domainControllers != null) 'DomainControllers': domainControllers,
      if (organizationalUnit != null)
        'OrganizationalUnit': organizationalUnit,
      if (timeoutInSeconds != null) 'TimeoutInSeconds': timeoutInSeconds,
    },
  );

  return JoinDomainOutput.fromJson(jsonResponse.body);
}