in source/networkFirewallAutomation/lib/network-firewall-manager.ts [432:490]
async updateFirewall(describeFirewallResponse: NetworkFirewall.Types.DescribeFirewallResponse, firewallPolicyArn: string) {
if (describeFirewallResponse.Firewall) {
//update firewall delete protection attribute
if (describeFirewallResponse.Firewall.DeleteProtection !== this.firewallObject.DeleteProtection) {
const response = await this.service.updateFirewallDeleteProtection({
FirewallName: this.firewallObject.FirewallName,
DeleteProtection: this.firewallObject.DeleteProtection ? this.firewallObject.DeleteProtection : false
})
Logger.log(LOG_LEVEL.INFO, 'Update firewall delete protection response: ', response)
}
//update firewall policy change protection.
if (describeFirewallResponse.Firewall.FirewallPolicyChangeProtection !== this.firewallObject.FirewallPolicyChangeProtection) {
const response = await this.service.updateFirewallPolicyChangeProtection({
FirewallName: this.firewallObject.FirewallName,
FirewallPolicyChangeProtection: this.firewallObject.FirewallPolicyChangeProtection ? this.firewallObject.FirewallPolicyChangeProtection : false
})
Logger.log(LOG_LEVEL.INFO, 'Update firewall policy change protection response: ', response)
}
//update subnet change protection.
if (describeFirewallResponse.Firewall.SubnetChangeProtection !== this.firewallObject.SubnetChangeProtection) {
const response = await this.service.updateSubnetChangeProtection({
FirewallName: this.firewallObject.FirewallName,
SubnetChangeProtection: this.firewallObject.SubnetChangeProtection ? this.firewallObject.SubnetChangeProtection : false
})
Logger.log(LOG_LEVEL.INFO, 'Update firewall policy change protection response: ', response)
}
//update firewall description
if (describeFirewallResponse.Firewall.Description !== this.firewallObject.Description) {
const response = await this.service.updateFirewallDescription({
Description: this.firewallObject.Description,
FirewallName: this.firewallObject.FirewallName
})
Logger.log(LOG_LEVEL.INFO, 'Update firewall description response: ', response)
}
//associate firewall policy arn to the firewall.
if (describeFirewallResponse.Firewall.FirewallPolicyArn !== firewallPolicyArn) {
const response = await this.service.associateFirewallPolicy({
FirewallPolicyArn: firewallPolicyArn,
FirewallName: this.firewallObject.FirewallName
})
Logger.log(LOG_LEVEL.INFO, `associate/update new firewall policy ${this.firewallObject.FirewallPolicyArn} for the firewall name: ${this.firewallObject.FirewallName} response:`, response)
}
if (this.firewallObject.Tags && describeFirewallResponse.Firewall.FirewallArn) {
const response = await this.service.tagResource({
ResourceArn: describeFirewallResponse.Firewall.FirewallArn,
Tags: this.firewallObject.Tags
})
Logger.log(LOG_LEVEL.INFO, `Update Tags for firewall ${this.firewallObject.FirewallPolicyArn} for the firewall name: ${this.firewallObject.FirewallName} response:`, response)
}
}
}