class_docstr: Represents the constraint violations JSON file used in Amazon SageMaker Model Monitoring.
class_docstr_tok: ["Represents","the","constraint","violations","JSON","file","used","in","Amazon","SageMaker","Model","Monitoring","."]
docstr: Generates a ConstraintViolations object from an s3 uri.
  
  Args:
      constraint_violations_file_s3_uri (str): The uri of the constraint violations JSON file.
      kms_key (str): The kms key to be used to decrypt the file in S3.
      sagemaker_session (sagemaker.session.Session): A SageMaker Session
          object, used for SageMaker interactions (default: None). If not
          specified, one is created using the default AWS configuration
          chain.
  
  Returns:
      sagemaker.model_monitor.ConstraintViolations: The instance of ConstraintViolations
          generated from the s3 uri.
docstr_tok: ["Generates","a","ConstraintViolations","object","from","an","s3","uri",".","Args",":","constraint_violations_file_s3_uri","(","str",")",":","The","uri","of","the","constraint","violations","JSON","file",".","kms_key","(","str",")",":","The","kms","key","to","be","used","to","decrypt","the","file","in","S3",".","sagemaker_session","(","sagemaker.session.Session",")",":","A","SageMaker","Session","object",",","used","for","SageMaker","interactions","(","default",":","None",")",".","If","not","specified",",","one","is","created","using","the","default","AWS","configuration","chain",".","Returns",":","sagemaker.model_monitor.ConstraintViolations",":","The","instance","of","ConstraintViolations","generated","from","the","s3","uri","."]
code: def from_s3_uri(
      cls,
      constraint_violations_file_s3_uri,
      kms_key=None,
      sagemaker_session=None,
  ):
      """Generates a ConstraintViolations object from an s3 uri.
  
      Args:
          constraint_violations_file_s3_uri (str): The uri of the constraint violations JSON file.
          kms_key (str): The kms key to be used to decrypt the file in S3.
          sagemaker_session (sagemaker.session.Session): A SageMaker Session
              object, used for SageMaker interactions (default: None). If not
              specified, one is created using the default AWS configuration
              chain.
  
      Returns:
          sagemaker.model_monitor.ConstraintViolations: The instance of ConstraintViolations
              generated from the s3 uri.
  
      """
      try:
          body_dict = json.loads(
              s3.S3Downloader.read_file(
                  s3_uri=constraint_violations_file_s3_uri,
                  sagemaker_session=sagemaker_session,
              )
          )
      except ClientError as error:
          print(
              "\nCould not retrieve constraints file at location '{}'. "
              "To manually retrieve ConstraintViolations object from a given uri, "
              "use 'my_model_monitor.constraints(my_s3_uri)' or "
              "'ConstraintViolations.from_s3_uri(my_s3_uri)'".format(
                  constraint_violations_file_s3_uri
              )
          )
          raise error
  
      return cls(
          body_dict=body_dict,
          constraint_violations_file_s3_uri=constraint_violations_file_s3_uri,
          kms_key=kms_key,
      )
  
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 2 for calling the ConstraintViolations obj's underlying member method code with example usage: obj.from_s3_uri(cls, constraint_violations_file_s3_uri, kms_key, sagemaker_session) and returns: cls