updateService method

Future<UpdateServiceResponse> updateService({
  1. required String id,
  2. required ServiceChange service,
})

Submits a request to perform the following operations:

  • Update the TTL setting for existing DnsRecords configurations
  • Add, update, or delete HealthCheckConfig for a specified service
For public and private DNS namespaces, note the following:
  • If you omit any existing DnsRecords or HealthCheckConfig configurations from an UpdateService request, the configurations are deleted from the service.
  • If you omit an existing HealthCheckCustomConfig configuration from an UpdateService request, the configuration is not deleted from the service.
When you update settings for a service, AWS Cloud Map also updates the corresponding settings in all the records and health checks that were created by using the specified service.

May throw DuplicateRequest. May throw InvalidInput. May throw ServiceNotFound.

Parameter id : The ID of the service that you want to update.

Parameter service : A complex type that contains the new settings for the service.

Implementation

Future<UpdateServiceResponse> updateService({
  required String id,
  required ServiceChange service,
}) async {
  ArgumentError.checkNotNull(id, 'id');
  _s.validateStringLength(
    'id',
    id,
    0,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(service, 'service');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Route53AutoNaming_v20170314.UpdateService'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Id': id,
      'Service': service,
    },
  );

  return UpdateServiceResponse.fromJson(jsonResponse.body);
}