updateContainerService method

Future<UpdateContainerServiceResult> updateContainerService({
  1. required String serviceName,
  2. bool? isDisabled,
  3. ContainerServicePowerName? power,
  4. Map<String, List<String>>? publicDomainNames,
  5. int? scale,
})

Updates the configuration of your Amazon Lightsail container service, such as its power, scale, and public domain names.

May throw ServiceException. May throw InvalidInputException. May throw NotFoundException. May throw AccessDeniedException. May throw UnauthenticatedException.

Parameter serviceName : The name of the container service to update.

Parameter isDisabled : A Boolean value to indicate whether the container service is disabled.

Parameter power : The power for the container service.

The power specifies the amount of memory, vCPUs, and base monthly cost of each node of the container service. The power and scale of a container service makes up its configured capacity. To determine the monthly price of your container service, multiply the base price of the power with the scale (the number of nodes) of the service.

Use the GetContainerServicePowers action to view the specifications of each power option.

Parameter publicDomainNames : The public domain names to use with the container service, such as example.com and www.example.com.

You can specify up to four public domain names for a container service. The domain names that you specify are used when you create a deployment with a container configured as the public endpoint of your container service.

If you don't specify public domain names, then you can use the default domain of the container service. You can specify public domain names using a string to array map as shown in the example later on this page.

Parameter scale : The scale for the container service.

The scale specifies the allocated compute nodes of the container service. The power and scale of a container service makes up its configured capacity. To determine the monthly price of your container service, multiply the base price of the power with the scale (the number of nodes) of the service.

Implementation

Future<UpdateContainerServiceResult> updateContainerService({
  required String serviceName,
  bool? isDisabled,
  ContainerServicePowerName? power,
  Map<String, List<String>>? publicDomainNames,
  int? scale,
}) async {
  ArgumentError.checkNotNull(serviceName, 'serviceName');
  _s.validateStringLength(
    'serviceName',
    serviceName,
    1,
    63,
    isRequired: true,
  );
  _s.validateNumRange(
    'scale',
    scale,
    1,
    20,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Lightsail_20161128.UpdateContainerService'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'serviceName': serviceName,
      if (isDisabled != null) 'isDisabled': isDisabled,
      if (power != null) 'power': power.toValue(),
      if (publicDomainNames != null) 'publicDomainNames': publicDomainNames,
      if (scale != null) 'scale': scale,
    },
  );

  return UpdateContainerServiceResult.fromJson(jsonResponse.body);
}