updateContainerAgent method
Updates the Amazon ECS container agent on a specified container instance.
Updating the Amazon ECS container agent doesn't interrupt running tasks or
services on the container instance. The process for updating the agent
differs depending on whether your container instance was launched with the
Amazon ECS-optimized AMI or another operating system.
The UpdateContainerAgent API requires an Amazon ECS-optimized
AMI or Amazon Linux AMI with the ecs-init service installed
and running. For help updating the Amazon ECS container agent on other
operating systems, see Manually
updating the Amazon ECS container agent in the Amazon Elastic
Container Service Developer Guide.
May throw AccessDeniedException.
May throw ClientException.
May throw ClusterNotFoundException.
May throw InvalidParameterException.
May throw MissingVersionException.
May throw NoUpdateAvailableException.
May throw ServerException.
May throw UpdateInProgressException.
Parameter containerInstance :
The container instance ID or full ARN entries for the container instance
where you would like to update the Amazon ECS container agent.
Parameter cluster :
The short name or full Amazon Resource Name (ARN) of the cluster that your
container instance is running on. If you do not specify a cluster, the
default cluster is assumed.
Implementation
Future<UpdateContainerAgentResponse> updateContainerAgent({
required String containerInstance,
String? cluster,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonEC2ContainerServiceV20141113.UpdateContainerAgent'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'containerInstance': containerInstance,
if (cluster != null) 'cluster': cluster,
},
);
return UpdateContainerAgentResponse.fromJson(jsonResponse.body);
}