async describeRuleGroup()

in source/networkFirewallAutomation/lib/service/network-firewall-service.ts [105:128]


  async describeRuleGroup(RuleGroupName: string, Type: string): Promise<NetworkFirewall.DescribeRuleGroupResponse | void> {
    do {
      try {
        Logger.log(LOG_LEVEL.INFO, `Describing Rule Group: ${RuleGroupName} | Type: ${Type}`)
        const response = await this.NetworkFirewallInstance.describeRuleGroup({
          RuleGroupName: RuleGroupName,
          Type: Type
        }
        ).promise()
        return Promise.resolve(response)
      } catch (error) {
        Logger.log(LOG_LEVEL.INFO, JSON.stringify(error))
        if (error.message === "ThrottlingException") {
          this.count++ //increment the count
          Logger.log(LOG_LEVEL.INFO, `Caught throttling exception, trying count: ${this.count}`)
        }
        if (error.code === "ResourceNotFoundException") {
          Logger.log(LOG_LEVEL.INFO, "Rule Group Not Found.")
          return Promise.resolve()
        }
        return Promise.reject(error)
      }
    } while (this.count == Count.minRetry)
  }