updateServiceInstance method

Future<UpdateServiceInstanceOutput> updateServiceInstance({
  1. required DeploymentUpdateType deploymentType,
  2. required String name,
  3. required String serviceName,
  4. String? clientToken,
  5. String? spec,
  6. String? templateMajorVersion,
  7. String? templateMinorVersion,
})

Update a service instance.

There are a few modes for updating a service instance. The deploymentType field defines the mode.

For more information about components, see Proton components in the Proton User Guide.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter deploymentType : The deployment type. It defines the mode for updating a service instance, as follows:

NONE

In this mode, a deployment doesn't occur. Only the requested metadata parameters are updated.

CURRENT_VERSION

In this mode, the service instance is deployed and updated with the new spec that you provide. Only requested parameters are updated. Don’t include major or minor version parameters when you use this deployment type.

MINOR_VERSION

In this mode, the service instance is deployed and updated with the published, recommended (latest) minor version of the current major version in use, by default. You can also specify a different minor version of the current major version in use.

MAJOR_VERSION

In this mode, the service instance is deployed and updated with the published, recommended (latest) major and minor version of the current template, by default. You can specify a different major version that's higher than the major version in use and a minor version.

Parameter name : The name of the service instance to update.

Parameter serviceName : The name of the service that the service instance belongs to.

Parameter clientToken : The client token of the service instance to update.

Parameter spec : The formatted specification that defines the service instance update.

Parameter templateMajorVersion : The major version of the service template to update.

Parameter templateMinorVersion : The minor version of the service template to update.

Implementation

Future<UpdateServiceInstanceOutput> updateServiceInstance({
  required DeploymentUpdateType deploymentType,
  required String name,
  required String serviceName,
  String? clientToken,
  String? spec,
  String? templateMajorVersion,
  String? templateMinorVersion,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AwsProton20200720.UpdateServiceInstance'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'deploymentType': deploymentType.value,
      'name': name,
      'serviceName': serviceName,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (spec != null) 'spec': spec,
      if (templateMajorVersion != null)
        'templateMajorVersion': templateMajorVersion,
      if (templateMinorVersion != null)
        'templateMinorVersion': templateMinorVersion,
    },
  );

  return UpdateServiceInstanceOutput.fromJson(jsonResponse.body);
}