checkDomainAvailability method

Future<CheckDomainAvailabilityResponse> checkDomainAvailability({
  1. required String domainName,
  2. String? idnLangCode,
})

This operation checks the availability of one domain name. Note that if the availability status of a domain is pending, you must submit another request to determine the availability of the domain name.

May throw InvalidInput. May throw UnsupportedTLD.

Parameter domainName : The name of the domain that you want to get availability for. The top-level domain (TLD), such as .com, must be a TLD that Route 53 supports. For a list of supported TLDs, see Domains that You Can Register with Amazon Route 53 in the Amazon Route 53 Developer Guide.

The domain name can contain only the following characters:

  • Letters a through z. Domain names are not case sensitive.
  • Numbers 0 through 9.
  • Hyphen (-). You can't specify a hyphen at the beginning or end of a label.
  • Period (.) to separate the labels in the name, such as the . in example.com.
Internationalized domain names are not supported for some top-level domains. To determine whether the TLD that you want to use supports internationalized domain names, see Domains that You Can Register with Amazon Route 53. For more information, see Formatting Internationalized Domain Names.

Parameter idnLangCode : Reserved for future use.

Implementation

Future<CheckDomainAvailabilityResponse> checkDomainAvailability({
  required String domainName,
  String? idnLangCode,
}) async {
  ArgumentError.checkNotNull(domainName, 'domainName');
  _s.validateStringLength(
    'domainName',
    domainName,
    0,
    255,
    isRequired: true,
  );
  _s.validateStringLength(
    'idnLangCode',
    idnLangCode,
    0,
    3,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Route53Domains_v20140515.CheckDomainAvailability'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DomainName': domainName,
      if (idnLangCode != null) 'IdnLangCode': idnLangCode,
    },
  );

  return CheckDomainAvailabilityResponse.fromJson(jsonResponse.body);
}