class_docstr: Represents the constraints JSON file used in Amazon SageMaker Model Monitoring.
class_docstr_tok: ["Represents","the","constraints","JSON","file","used","in","Amazon","SageMaker","Model","Monitoring","."]
docstr: Sets the monitoring flags on this Constraints object.
  
  If feature-name is provided, modify the feature-level override.
  Else, modify the top-level monitoring flag.
  
  Args:
      enable_monitoring (bool): Whether to enable monitoring or not.
      feature_name (str): Sets the feature-level monitoring flag if provided. Otherwise,
          sets the file-level override.
docstr_tok: ["Sets","the","monitoring","flags","on","this","Constraints","object",".","If","feature-name","is","provided",",","modify","the","feature-level","override",".","Else",",","modify","the","top-level","monitoring","flag",".","Args",":","enable_monitoring","(","bool",")",":","Whether","to","enable","monitoring","or","not",".","feature_name","(","str",")",":","Sets","the","feature-level","monitoring","flag","if","provided",".","Otherwise",",","sets","the","file-level","override","."]
code: def set_monitoring(self, enable_monitoring, feature_name=None):
      """Sets the monitoring flags on this Constraints object.
  
      If feature-name is provided, modify the feature-level override.
      Else, modify the top-level monitoring flag.
  
      Args:
          enable_monitoring (bool): Whether to enable monitoring or not.
          feature_name (str): Sets the feature-level monitoring flag if provided. Otherwise,
              sets the file-level override.
  
      """
      monitoring_api_map = {True: "Enabled", False: "Disabled"}
      flag = monitoring_api_map[enable_monitoring]
      if feature_name is None:
          self.body_dict["monitoring_config"][
              "evaluate_constraints"
          ] = flag
      else:
          for feature in self.body_dict["features"]:
              if feature["name"] == feature_name:
                  string_constraints = feature["string_constraints"]
                  if (
                      string_constraints.get(
                          "monitoring_config_overrides"
                      )
                      is None
                  ):
                      string_constraints[
                          "monitoring_config_overrides"
                      ] = {}
                  string_constraints["monitoring_config_overrides"][
                      "evaluate_constraints"
                  ] = flag
  
imports: from __future__ import print_function, absolute_import
  import json
  import logging
  import os
  import uuid
  from botocore.exceptions import ClientError
  from sagemaker import s3
  from sagemaker.session import Session
label_desc: Use image node_id 5 for calling the Constraints obj's underlying member method code with example usage: obj.set_monitoring(enable_monitoring, feature_name) without return types