createMicrosoftAD method

Future<CreateMicrosoftADResult> createMicrosoftAD({
  1. required String name,
  2. required String password,
  3. required DirectoryVpcSettings vpcSettings,
  4. String? description,
  5. DirectoryEdition? edition,
  6. String? shortName,
  7. List<Tag>? tags,
})

Creates a Microsoft AD directory in the AWS Cloud. For more information, see AWS Managed Microsoft AD in the AWS Directory Service Admin Guide.

Before you call CreateMicrosoftAD, ensure that all of the required permissions have been explicitly granted through a policy. For details about what permissions are required to run the CreateMicrosoftAD operation, see AWS Directory Service API Permissions: Actions, Resources, and Conditions Reference.

May throw DirectoryLimitExceededException. May throw InvalidParameterException. May throw ClientException. May throw ServiceException. May throw UnsupportedOperationException.

Parameter name : The fully qualified domain name for the AWS Managed Microsoft AD directory, such as corp.example.com. This name will resolve inside your VPC only. It does not need to be publicly resolvable.

Parameter password : The password for the default administrative user named Admin.

If you need to change the password for the administrator account, you can use the ResetUserPassword API call.

Parameter vpcSettings : Contains VPC information for the CreateDirectory or CreateMicrosoftAD operation.

Parameter description : A description for the directory. This label will appear on the AWS console Directory Details page after the directory is created.

Parameter edition : AWS Managed Microsoft AD is available in two editions: Standard and Enterprise. Enterprise is the default.

Parameter shortName : The NetBIOS name for your domain, such as CORP. If you don't specify a NetBIOS name, it will default to the first part of your directory DNS. For example, CORP for the directory DNS corp.example.com.

Parameter tags : The tags to be assigned to the AWS Managed Microsoft AD directory.

Implementation

Future<CreateMicrosoftADResult> createMicrosoftAD({
  required String name,
  required String password,
  required DirectoryVpcSettings vpcSettings,
  String? description,
  DirectoryEdition? edition,
  String? shortName,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  ArgumentError.checkNotNull(password, 'password');
  ArgumentError.checkNotNull(vpcSettings, 'vpcSettings');
  _s.validateStringLength(
    'description',
    description,
    0,
    128,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DirectoryService_20150416.CreateMicrosoftAD'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      'Password': password,
      'VpcSettings': vpcSettings,
      if (description != null) 'Description': description,
      if (edition != null) 'Edition': edition.toValue(),
      if (shortName != null) 'ShortName': shortName,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateMicrosoftADResult.fromJson(jsonResponse.body);
}