updateService method

Future<UpdateServiceResponse> updateService({
  1. required String serviceArn,
  2. String? autoScalingConfigurationArn,
  3. HealthCheckConfiguration? healthCheckConfiguration,
  4. InstanceConfiguration? instanceConfiguration,
  5. NetworkConfiguration? networkConfiguration,
  6. ServiceObservabilityConfiguration? observabilityConfiguration,
  7. SourceConfiguration? sourceConfiguration,
})

Update an App Runner service. You can update the source configuration and instance configuration of the service. You can also update the ARN of the auto scaling configuration resource that's associated with the service. However, you can't change the name or the encryption configuration of the service. These can be set only when you create the service.

To update the tags applied to your service, use the separate actions TagResource and UntagResource.

This is an asynchronous operation. On a successful call, you can use the returned OperationId and the ListOperations call to track the operation's progress.

May throw InternalServiceErrorException. May throw InvalidRequestException. May throw InvalidStateException. May throw ResourceNotFoundException.

Parameter serviceArn : The Amazon Resource Name (ARN) of the App Runner service that you want to update.

Parameter autoScalingConfigurationArn : The Amazon Resource Name (ARN) of an App Runner automatic scaling configuration resource that you want to associate with the App Runner service.

Parameter healthCheckConfiguration : The settings for the health check that App Runner performs to monitor the health of the App Runner service.

Parameter instanceConfiguration : The runtime configuration to apply to instances (scaling units) of your service.

Parameter networkConfiguration : Configuration settings related to network traffic of the web application that the App Runner service runs.

Parameter observabilityConfiguration : The observability configuration of your service.

Parameter sourceConfiguration : The source configuration to apply to the App Runner service.

You can change the configuration of the code or image repository that the service uses. However, you can't switch from code to image or the other way around. This means that you must provide the same structure member of SourceConfiguration that you originally included when you created the service. Specifically, you can include either CodeRepository or ImageRepository. To update the source configuration, set the values to members of the structure that you include.

Implementation

Future<UpdateServiceResponse> updateService({
  required String serviceArn,
  String? autoScalingConfigurationArn,
  HealthCheckConfiguration? healthCheckConfiguration,
  InstanceConfiguration? instanceConfiguration,
  NetworkConfiguration? networkConfiguration,
  ServiceObservabilityConfiguration? observabilityConfiguration,
  SourceConfiguration? sourceConfiguration,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AppRunner.UpdateService'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ServiceArn': serviceArn,
      if (autoScalingConfigurationArn != null)
        'AutoScalingConfigurationArn': autoScalingConfigurationArn,
      if (healthCheckConfiguration != null)
        'HealthCheckConfiguration': healthCheckConfiguration,
      if (instanceConfiguration != null)
        'InstanceConfiguration': instanceConfiguration,
      if (networkConfiguration != null)
        'NetworkConfiguration': networkConfiguration,
      if (observabilityConfiguration != null)
        'ObservabilityConfiguration': observabilityConfiguration,
      if (sourceConfiguration != null)
        'SourceConfiguration': sourceConfiguration,
    },
  );

  return UpdateServiceResponse.fromJson(jsonResponse.body);
}