createTrust method

Future<CreateTrustResult> createTrust({
  1. required String directoryId,
  2. required String remoteDomainName,
  3. required TrustDirection trustDirection,
  4. required String trustPassword,
  5. List<String>? conditionalForwarderIpAddrs,
  6. SelectiveAuth? selectiveAuth,
  7. TrustType? trustType,
})

AWS Directory Service for Microsoft Active Directory allows you to configure trust relationships. For example, you can establish a trust between your AWS Managed Microsoft AD directory, and your existing on-premises Microsoft Active Directory. This would allow you to provide users and groups access to resources in either domain, with a single set of credentials.

This action initiates the creation of the AWS side of a trust relationship between an AWS Managed Microsoft AD directory and an external domain. You can create either a forest trust or an external trust.

May throw EntityAlreadyExistsException. May throw EntityDoesNotExistException. May throw InvalidParameterException. May throw ClientException. May throw ServiceException. May throw UnsupportedOperationException.

Parameter directoryId : The Directory ID of the AWS Managed Microsoft AD directory for which to establish the trust relationship.

Parameter remoteDomainName : The Fully Qualified Domain Name (FQDN) of the external domain for which to create the trust relationship.

Parameter trustDirection : The direction of the trust relationship.

Parameter trustPassword : The trust password. The must be the same password that was used when creating the trust relationship on the external domain.

Parameter conditionalForwarderIpAddrs : The IP addresses of the remote DNS server associated with RemoteDomainName.

Parameter selectiveAuth : Optional parameter to enable selective authentication for the trust.

Parameter trustType : The trust relationship type. Forest is the default.

Implementation

Future<CreateTrustResult> createTrust({
  required String directoryId,
  required String remoteDomainName,
  required TrustDirection trustDirection,
  required String trustPassword,
  List<String>? conditionalForwarderIpAddrs,
  SelectiveAuth? selectiveAuth,
  TrustType? trustType,
}) async {
  ArgumentError.checkNotNull(directoryId, 'directoryId');
  ArgumentError.checkNotNull(remoteDomainName, 'remoteDomainName');
  ArgumentError.checkNotNull(trustDirection, 'trustDirection');
  ArgumentError.checkNotNull(trustPassword, 'trustPassword');
  _s.validateStringLength(
    'trustPassword',
    trustPassword,
    1,
    128,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DirectoryService_20150416.CreateTrust'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DirectoryId': directoryId,
      'RemoteDomainName': remoteDomainName,
      'TrustDirection': trustDirection.toValue(),
      'TrustPassword': trustPassword,
      if (conditionalForwarderIpAddrs != null)
        'ConditionalForwarderIpAddrs': conditionalForwarderIpAddrs,
      if (selectiveAuth != null) 'SelectiveAuth': selectiveAuth.toValue(),
      if (trustType != null) 'TrustType': trustType.toValue(),
    },
  );

  return CreateTrustResult.fromJson(jsonResponse.body);
}