updateTrafficPolicyInstance method

Future<UpdateTrafficPolicyInstanceResponse> updateTrafficPolicyInstance({
  1. required String id,
  2. required int ttl,
  3. required String trafficPolicyId,
  4. required int trafficPolicyVersion,
})

Updates the resource record sets in a specified hosted zone that were created based on the settings in a specified traffic policy version.

When you update a traffic policy instance, Amazon Route 53 continues to respond to DNS queries for the root resource record set name (such as example.com) while it replaces one group of resource record sets with another. Route 53 performs the following operations:

  1. Route 53 creates a new group of resource record sets based on the specified traffic policy. This is true regardless of how significant the differences are between the existing resource record sets and the new resource record sets.
  2. When all of the new resource record sets have been created, Route 53 starts to respond to DNS queries for the root resource record set name (such as example.com) by using the new resource record sets.
  3. Route 53 deletes the old group of resource record sets that are associated with the root resource record set name.

May throw InvalidInput. May throw NoSuchTrafficPolicy. May throw NoSuchTrafficPolicyInstance. May throw PriorRequestNotComplete. May throw ConflictingTypes.

Parameter id : The ID of the traffic policy instance that you want to update.

Parameter ttl : The TTL that you want Amazon Route 53 to assign to all of the updated resource record sets.

Parameter trafficPolicyId : The ID of the traffic policy that you want Amazon Route 53 to use to update resource record sets for the specified traffic policy instance.

Parameter trafficPolicyVersion : The version of the traffic policy that you want Amazon Route 53 to use to update resource record sets for the specified traffic policy instance.

Implementation

Future<UpdateTrafficPolicyInstanceResponse> updateTrafficPolicyInstance({
  required String id,
  required int ttl,
  required String trafficPolicyId,
  required int trafficPolicyVersion,
}) async {
  ArgumentError.checkNotNull(id, 'id');
  _s.validateStringLength(
    'id',
    id,
    1,
    36,
    isRequired: true,
  );
  ArgumentError.checkNotNull(ttl, 'ttl');
  _s.validateNumRange(
    'ttl',
    ttl,
    0,
    2147483647,
    isRequired: true,
  );
  ArgumentError.checkNotNull(trafficPolicyId, 'trafficPolicyId');
  _s.validateStringLength(
    'trafficPolicyId',
    trafficPolicyId,
    1,
    36,
    isRequired: true,
  );
  ArgumentError.checkNotNull(trafficPolicyVersion, 'trafficPolicyVersion');
  _s.validateNumRange(
    'trafficPolicyVersion',
    trafficPolicyVersion,
    1,
    1000,
    isRequired: true,
  );
  final $result = await _protocol.send(
    method: 'POST',
    requestUri:
        '/2013-04-01/trafficpolicyinstance/${Uri.encodeComponent(id)}',
    payload: UpdateTrafficPolicyInstanceRequest(
            id: id,
            ttl: ttl,
            trafficPolicyId: trafficPolicyId,
            trafficPolicyVersion: trafficPolicyVersion)
        .toXml(
      'UpdateTrafficPolicyInstanceRequest',
      attributes: [
        _s.XmlAttribute(_s.XmlName('xmlns'),
            'https://route53.amazonaws.com/doc/2013-04-01/'),
      ],
    ),
    exceptionFnMap: _exceptionFns,
  );
  return UpdateTrafficPolicyInstanceResponse.fromXml($result.body);
}