async createLoggingConfigurations()

in source/networkFirewallAutomation/lib/network-firewall-manager.ts [379:423]


  async createLoggingConfigurations() {
    let loggingConfiguration = []
    Logger.log(LOG_LEVEL.INFO, this.envProps)
    if (this.envProps.logType && this.envProps.logType.toUpperCase() === "ENABLEBOTH") {
      let alertConfig = {
        LogType: LogType.alert,
        LogDestinationType: '',
        LogDestination: {}
      }
      let flowConfig = {
        LogType: LogType.flow,
        LogDestinationType: '',
        LogDestination: {}
      }
      loggingConfiguration.push(alertConfig)
      loggingConfiguration.push(flowConfig)
    } else {
      let config = {
        LogType: this.envProps.logType ? this.envProps.logType.toUpperCase() : LogType.alert,
        LogDestinationType: '',
        LogDestination: {}
      }
      loggingConfiguration.push(config)
    }

    loggingConfiguration.forEach(config => {
      switch (this.envProps.logDestinationType?.toUpperCase()) {
        case "S3":
          config.LogDestinationType = "S3"
          config.LogDestination = {
            "bucketName": this.envProps.logDestination,
            "prefix": config.LogType === LogType.alert ? "alerts" : "flow"
          }
          break;
        case "CLOUDWATCHLOGS":
          config.LogDestinationType = "CloudWatchLogs"
          config.LogDestination = {
            "logGroup": this.envProps.logDestination
          }
          break;
      }
    })
    Logger.log(LOG_LEVEL.INFO, loggingConfiguration)
    return Promise.resolve(loggingConfiguration)
  }