deregisterInstance method

Future<DeregisterInstanceResponse> deregisterInstance({
  1. required String instanceId,
  2. required String serviceId,
})

Deletes the Amazon Route 53 DNS records and health check, if any, that AWS Cloud Map created for the specified instance.

May throw DuplicateRequest. May throw InvalidInput. May throw InstanceNotFound. May throw ResourceInUse. May throw ServiceNotFound.

Parameter instanceId : The value that you specified for Id in the RegisterInstance request.

Parameter serviceId : The ID of the service that the instance is associated with.

Implementation

Future<DeregisterInstanceResponse> deregisterInstance({
  required String instanceId,
  required String serviceId,
}) async {
  ArgumentError.checkNotNull(instanceId, 'instanceId');
  _s.validateStringLength(
    'instanceId',
    instanceId,
    0,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(serviceId, 'serviceId');
  _s.validateStringLength(
    'serviceId',
    serviceId,
    0,
    64,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Route53AutoNaming_v20170314.DeregisterInstance'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'InstanceId': instanceId,
      'ServiceId': serviceId,
    },
  );

  return DeregisterInstanceResponse.fromJson(jsonResponse.body);
}