in source/networkFirewallAutomation/lib/service/network-firewall-service.ts [243:273]
async updateLoggingConfiguration(firewallName: string, loggingConfiguration: NetworkFirewall.Types.LoggingConfiguration) {
Logger.log(LOG_LEVEL.INFO, loggingConfiguration)
let describeFirewallLoggingResponse
try {
describeFirewallLoggingResponse = await this.NetworkFirewallInstance.describeLoggingConfiguration({
FirewallName: firewallName
}).promise()
Logger.log(LOG_LEVEL.INFO, describeFirewallLoggingResponse);
//cleaning up the configuration stack currently in the firewall.
while (describeFirewallLoggingResponse.LoggingConfiguration && describeFirewallLoggingResponse.LoggingConfiguration.LogDestinationConfigs.length > 0) {
Logger.log(LOG_LEVEL.INFO, describeFirewallLoggingResponse)
if (describeFirewallLoggingResponse.LoggingConfiguration) {
describeFirewallLoggingResponse.LoggingConfiguration.LogDestinationConfigs.pop()
}
describeFirewallLoggingResponse = await this.NetworkFirewallInstance.updateLoggingConfiguration(describeFirewallLoggingResponse).promise()
}
for (let config of loggingConfiguration.LogDestinationConfigs) {
describeFirewallLoggingResponse.LoggingConfiguration?.LogDestinationConfigs.push(config)
describeFirewallLoggingResponse = await this.NetworkFirewallInstance.updateLoggingConfiguration(describeFirewallLoggingResponse).promise()
}
Logger.log(LOG_LEVEL.INFO, describeFirewallLoggingResponse)
} catch (error) {
Logger.log(LOG_LEVEL.INFO, `Failed to update firewall logging configuration`, error)
return Promise.resolve()
}
return Promise.resolve(describeFirewallLoggingResponse)
}