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. List<String>? conditionalForwarderIpv6Addrs,
  7. SelectiveAuth? selectiveAuth,
  8. TrustType? trustType,
})

Directory Service for Microsoft Active Directory allows you to configure trust relationships. For example, you can establish a trust between your Managed Microsoft AD directory, and your existing self-managed 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 Amazon Web Services side of a trust relationship between an Managed Microsoft AD directory and an external domain. You can create either a forest trust or an external trust.

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

Parameter directoryId : The Directory ID of the 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 trust password 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 conditionalForwarderIpv6Addrs : The IPv6 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,
  List<String>? conditionalForwarderIpv6Addrs,
  SelectiveAuth? selectiveAuth,
  TrustType? trustType,
}) async {
  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.value,
      'TrustPassword': trustPassword,
      if (conditionalForwarderIpAddrs != null)
        'ConditionalForwarderIpAddrs': conditionalForwarderIpAddrs,
      if (conditionalForwarderIpv6Addrs != null)
        'ConditionalForwarderIpv6Addrs': conditionalForwarderIpv6Addrs,
      if (selectiveAuth != null) 'SelectiveAuth': selectiveAuth.value,
      if (trustType != null) 'TrustType': trustType.value,
    },
  );

  return CreateTrustResult.fromJson(jsonResponse.body);
}