in aws-networkfirewall-firewall/src/main/java/software/amazon/networkfirewall/firewall/UpdateHandler.java [256:285]
private ProgressEvent<ResourceModel, CallbackContext> updateTags(ProgressEvent<ResourceModel, CallbackContext> progress) {
final TagUtils tagUtils = new TagUtils(previousStateModel.getTags(), desiredStateModel.getTags(),
handlerRequest.getPreviousResourceTags(), handlerRequest.getDesiredResourceTags());
// Untag resource: get tags to remove from firewall resource
if (tagUtils.tagsToRemove().size() > 0) {
progress = proxy.initiate("Firewall::Update-UntagResource", proxyClient, progress.getResourceModel(), callbackContext)
.translateToServiceRequest(model ->
Translator.translateToUntagRequest(model, tagUtils.tagsToRemove().keySet()))
.makeServiceCall((request, client) ->
client.injectCredentialsAndInvokeV2(request, client.client()::untagResource))
.progress();
if (progress.isFailed()) {
return progress;
}
}
// Tag resource: add tags that are added newly and update tags for which the value has been updated
if (tagUtils.tagsToAddOrUpdate().size() > 0) {
progress = proxy.initiate("Firewall::Update-TagResource", proxyClient, progress.getResourceModel(), callbackContext)
.translateToServiceRequest(model ->
Translator.translateToTagRequest(model, tagUtils.tagsToAddOrUpdate()))
.makeServiceCall((request, client) ->
client.injectCredentialsAndInvokeV2(request, client.client()::tagResource))
.progress();
}
return progress;
}