updateContainerAssociation method

Future<UpdateContainerAssociationResponse> updateContainerAssociation({
  1. required List<ContainerMonitoringConfiguration> containerMonitoringConfigurations,
  2. required ContainerMonitoringType type,
  3. required String updateToken,
  4. String? containerAssociationArn,
  5. String? containerAssociationName,
  6. String? description,
  7. List<Tag>? tags,
})

Updates the monitoring configurations and description of a container association. You can't change the container type after creation. Provide an update token to enable optimistic concurrency control.

May throw InternalServerError. May throw InvalidRequestException. May throw InvalidTokenException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter containerMonitoringConfigurations : The updated monitoring configurations for the container association. Each configuration specifies an Amazon ECS or Amazon EKS cluster to monitor and optional attribute filters.

Parameter type : The container type. This value must match the existing type and can't be changed. Valid values:

  • ECS - Amazon Elastic Container Service
  • EKS - Amazon Elastic Kubernetes Service

Parameter updateToken : A token used for optimistic locking. Network Firewall returns a token to your requests that access the container association. The token marks the state of the container association resource at the time of the request.

To make changes to the container association, you provide the token in your request. Network Firewall uses the token to ensure that the container association hasn't changed since you last retrieved it. If it has changed, the operation fails with an InvalidTokenException. If this happens, retrieve the container association again to get a current copy of it with a current token. Reapply your changes as needed, then try the operation again using the new token.

Parameter containerAssociationArn : The Amazon Resource Name (ARN) of the container association.

You must specify the ARN or the name, and you can specify both.

Parameter containerAssociationName : The descriptive name of the container association.

You must specify the ARN or the name, and you can specify both.

Parameter description : A description of the container association. When omitted, the existing description remains unchanged. To clear the description, pass an empty string.

Parameter tags : The key:value pairs to associate with the resource.

Implementation

Future<UpdateContainerAssociationResponse> updateContainerAssociation({
  required List<ContainerMonitoringConfiguration>
      containerMonitoringConfigurations,
  required ContainerMonitoringType type,
  required String updateToken,
  String? containerAssociationArn,
  String? containerAssociationName,
  String? description,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'NetworkFirewall_20201112.UpdateContainerAssociation'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ContainerMonitoringConfigurations': containerMonitoringConfigurations,
      'Type': type.value,
      'UpdateToken': updateToken,
      if (containerAssociationArn != null)
        'ContainerAssociationArn': containerAssociationArn,
      if (containerAssociationName != null)
        'ContainerAssociationName': containerAssociationName,
      if (description != null) 'Description': description,
      if (tags != null) 'Tags': tags,
    },
  );

  return UpdateContainerAssociationResponse.fromJson(jsonResponse.body);
}