class_docstr: A class to load, modify, and display the StreamAlertCLI Config
docstr: Add a metric alarm that corresponds to a predefined metrics for clusters
  
  Args:
      alarm_info (dict): All the necessary values needed to add a CloudWatch
          metric alarm.
docstr_tok: ["Add","a","metric","alarm","that","corresponds","to","a","predefined","metrics","for","clusters","Args",":","alarm_info","(","dict",")",":","All","the","necessary","values","needed","to","add","a","CloudWatch","metric","alarm","."]
code: def _add_cluster_metric_alarm(self, alarm_info):
      """Add a metric alarm that corresponds to a predefined metrics for clusters
  
      Args:
          alarm_info (dict): All the necessary values needed to add a CloudWatch
              metric alarm.
      """
      function_name = alarm_info["function"]
  
      # Go over each of the clusters and see if enable_metrics == True and prompt
      # the user to toggle metrics on if this is False
      config_name = "{}_config".format(function_name)
      for cluster in alarm_info["clusters"]:
          function_config = self.config["clusters"][cluster][
              config_name
          ]
  
          if not function_config.get("enable_custom_metrics"):
              prompt = (
                  "Metrics are not currently enabled for the '{}' function "
                  "within the '{}' cluster. Would you like to enable metrics "
                  "for this cluster?".format(function_name, cluster)
              )
  
              if continue_prompt(message=prompt):
                  self.toggle_metrics(
                      function_name, enabled=True, clusters=[cluster]
                  )
  
              elif not continue_prompt(
                  message="Would you still like to add this alarm "
                  "even though metrics are disabled?"
              ):
                  continue
  
          metric_alarms = function_config.get(
              "custom_metric_alarms", {}
          )
  
          # Format the metric name for the cluster based metric
          # Prepend a prefix for this function and append the cluster name
          alarm_settings = alarm_info.copy()
          alarm_settings["metric_name"] = "{}-{}-{}".format(
              metrics.FUNC_PREFIXES[function_name],
              alarm_settings["metric_name"],
              cluster.upper(),
          )
  
          function_config[
              "custom_metric_alarms"
          ] = self._add_metric_alarm_config(
              alarm_settings, metric_alarms
          )
          LOGGER.info(
              "Successfully added '%s' metric alarm for the '%s' "
              "function to 'conf/clusters/%s.json'.",
              alarm_settings["alarm_name"],
              function_name,
              cluster,
          )
  
      return True
  
imports: import json
  import os
  import re
  import shutil
  import string
  import tempfile
  from streamalert.apps import StreamAlertApp
  from streamalert.shared import CLUSTERED_FUNCTIONS, config, metrics
  from streamalert.shared.logger import get_logger
  from streamalert_cli.terraform import TERRAFORM_FILES_PATH
  from streamalert_cli.apps.helpers import save_app_auth_info
  from streamalert_cli.helpers import continue_prompt
label_desc: Use image node_id 18 for calling the CLIConfig obj's underlying member method code with example usage: obj._add_cluster_metric_alarm(alarm_info) and returns: True