renewDomain method

Future<RenewDomainResponse> renewDomain({
  1. required int currentExpiryYear,
  2. required String domainName,
  3. int? durationInYears,
})

This operation renews a domain for the specified number of years. The cost of renewing your domain is billed to your AWS account.

We recommend that you renew your domain several weeks before the expiration date. Some TLD registries delete domains before the expiration date if you haven't renewed far enough in advance. For more information about renewing domain registration, see Renewing Registration for a Domain in the Amazon Route 53 Developer Guide.

May throw InvalidInput. May throw UnsupportedTLD. May throw DuplicateRequest. May throw TLDRulesViolation. May throw OperationLimitExceeded.

Parameter currentExpiryYear : The year when the registration for the domain is set to expire. This value must match the current expiration date for the domain.

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

Parameter durationInYears : The number of years that you want to renew the domain for. The maximum number of years depends on the top-level domain. For the range of valid values for your domain, see Domains that You Can Register with Amazon Route 53 in the Amazon Route 53 Developer Guide.

Default: 1

Implementation

Future<RenewDomainResponse> renewDomain({
  required int currentExpiryYear,
  required String domainName,
  int? durationInYears,
}) async {
  ArgumentError.checkNotNull(currentExpiryYear, 'currentExpiryYear');
  ArgumentError.checkNotNull(domainName, 'domainName');
  _s.validateStringLength(
    'domainName',
    domainName,
    0,
    255,
    isRequired: true,
  );
  _s.validateNumRange(
    'durationInYears',
    durationInYears,
    1,
    10,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Route53Domains_v20140515.RenewDomain'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CurrentExpiryYear': currentExpiryYear,
      'DomainName': domainName,
      if (durationInYears != null) 'DurationInYears': durationInYears,
    },
  );

  return RenewDomainResponse.fromJson(jsonResponse.body);
}