class_docstr: Provides convenience methods for accessing and modifying the rules table.
class_docstr_tok: ["Provides","convenience","methods","for","accessing","and","modifying","the","rules","table","."]
docstr: Mark the specified rule as staged=True or staged=False
  
  Args:
      rule_name (string): The name of the rule being staged
      stage (bool): True if this rule should be staged and False if
          this rule should be promoted out of staging.
docstr_tok: ["Mark","the","specified","rule","as","staged=True","or","staged=False","Args",":","rule_name","(","string",")",":","The","name","of","the","rule","being","staged","stage","(","bool",")",":","True","if","this","rule","should","be","staged","and","False","if","this","rule","should","be","promoted","out","of","staging","."]
code: def toggle_staged_state(self, rule_name, stage):
      """Mark the specified rule as staged=True or staged=False
  
      Args:
          rule_name (string): The name of the rule being staged
          stage (bool): True if this rule should be staged and False if
              this rule should be promoted out of staging.
      """
      if rule_name not in self.remote_rule_info:
          LOGGER.error(
              "Staging status for rule '%s' cannot be set to %s; rule does not exist",
              rule_name,
              stage,
          )
          return
  
      if self.remote_rule_info[rule_name]["Staged"] and stage:
          LOGGER.info(
              "Rule '%s' is already staged and will have its staging window updated",
              rule_name,
          )
  
      LOGGER.debug(
          "Toggling staged state for rule '%s' to: %s", rule_name, stage
      )
  
      update_expressions = ["set Staged = :staged"]
      expression_attributes = [":staged"]
      expression_values = [stage]
  
      # If staging, add some additonal staging context to the expression
      if stage:
          update_expressions.extend(
              ["StagedAt = :staged_at", "StagedUntil = :staged_until"]
          )
          expression_attributes.extend([":staged_at", ":staged_until"])
          expression_values.extend(self._staged_window())
  
      args = {
          "UpdateExpression": ",".join(update_expressions),
          "ExpressionAttributeValues": dict(
              list(zip(expression_attributes, expression_values))
          ),
      }
      args.update(self._default_dynamo_kwargs(rule_name))
  
      self._table.update_item(**args)
  
imports: from datetime import datetime, timedelta
  import boto3
  from streamalert.shared.helpers.dynamodb import ignore_conditional_failure
  from streamalert.shared.importer import import_folders
  from streamalert.shared.logger import get_logger
  from streamalert.shared.rule import Rule
label_desc: Use image node_id 12 for calling the RuleTable obj's underlying member method code with example usage: obj.toggle_staged_state(rule_name, stage) without return types