class_docstr: PhantomOutput handles all alert dispatching for Phantom
class_docstr_tok: ["PhantomOutput","handles","all","alert","dispatching","for","Phantom"]
docstr: Establish a Phantom container to write the alerts to. This checks to see
  if an appropriate containers exists first and returns the ID if so.
  
  Args:
      rule_name (str): The name of the rule that triggered the alert
      base_url (str): The base url for this Phantom instance
      headers (dict): A dictionary containing header parameters
  
  Returns:
      int: ID of the Phantom container where the alerts will be sent
          or False if there is an issue getting the container id
docstr_tok: ["Establish","a","Phantom","container","to","write","the","alerts","to",".","This","checks","to","see","if","an","appropriate","containers","exists","first","and","returns","the","ID","if","so",".","Args",":","rule_name","(","str",")",":","The","name","of","the","rule","that","triggered","the","alert","base_url","(","str",")",":","The","base","url","for","this","Phantom","instance","headers","(","dict",")",":","A","dictionary","containing","header","parameters","Returns",":","int",":","ID","of","the","Phantom","container","where","the","alerts","will","be","sent","or","False","if","there","is","an","issue","getting","the","container","id"]
code: def _setup_container(
      cls, rule_name, rule_description, base_url, headers
  ):
      """Establish a Phantom container to write the alerts to. This checks to see
      if an appropriate containers exists first and returns the ID if so.
  
      Args:
          rule_name (str): The name of the rule that triggered the alert
          base_url (str): The base url for this Phantom instance
          headers (dict): A dictionary containing header parameters
  
      Returns:
          int: ID of the Phantom container where the alerts will be sent
              or False if there is an issue getting the container id
      """
      container_url = os.path.join(base_url, cls.CONTAINER_ENDPOINT)
  
      # Check to see if there is a container already created for this rule name
      existing_id = cls._check_container_exists(
          rule_name, container_url, headers
      )
      if existing_id:
          return existing_id
  
      # Try to use the rule_description from the rule as the container description
      ph_container = {
          "name": rule_name,
          "description": rule_description,
      }
      try:
          resp = cls._post_request_retry(
              container_url, ph_container, headers, False
          )
      except OutputRequestFailure:
          return False
  
      response = resp.json()
      if not response:
          return False
  
      return response and response.get("id")
  
file_path: streamalert/streamalert/alert_processor/outputs/phantom.py
imports: from collections import OrderedDict
  import os
  from streamalert.alert_processor.helpers import compose_alert
  from streamalert.alert_processor.outputs.output_base import OutputDispatcher, OutputProperty, OutputRequestFailure, StreamAlertOutput
  from streamalert.shared.logger import get_logger
label_desc: Use image node_id 3 for calling the PhantomOutput obj's underlying member method code with example usage: obj._setup_container(cls, rule_name, rule_description, base_url, headers) and returns: unknown, existing_id, False, False