class_docstr: Class for creating/accessing a DetailProfiler app hosted on SageMaker.
class_docstr_tok: ["Class","for","creating\/accessing","a","DetailProfiler","app","hosted","on","SageMaker","."]
docstr: Validate studio domain id and user profile
  
  Get and validate studio domain id and user profile
  from NOTEBOOK_METADATA_FILE in studio environment.
  
  Set _valid_domain_and_user to True if validation succeeded.
docstr_tok: ["Validate","studio","domain","id","and","user","profile","Get","and","validate","studio","domain","id","and","user","profile","from","NOTEBOOK_METADATA_FILE","in","studio","environment",".","Set","_valid_domain_and_user","to","True","if","validation","succeeded","."]
code: def _get_domain_and_user(self):
      """Validate studio domain id and user profile
  
      Get and validate studio domain id and user profile
      from NOTEBOOK_METADATA_FILE in studio environment.
  
      Set _valid_domain_and_user to True if validation succeeded.
      """
      if not os.path.isfile(NOTEBOOK_METADATA_FILE):
          return
  
      with open(NOTEBOOK_METADATA_FILE, "rb") as f:
          metadata = json.loads(f.read())
          self._domain_id = metadata.get("DomainId")
          self._user_profile_name = metadata.get("UserProfileName")
          if (
              self._validate_domain_id() is True
              and self._validate_user_profile_name() is True
          ):
              self._valid_domain_and_user = True
          else:
              logger.warning(
                  "NOTEBOOK_METADATA_FILE detected but failed to get"
                  "valid domain and user from it."
              )
  
file_path: sagemaker-python-sdk/src/sagemaker/interactive_apps/detail_profiler_app.py
imports: from __future__ import absolute_import
  import json
  import logging
  import os
  import re
  from typing import Optional
  from sagemaker.session import Session, NOTEBOOK_METADATA_FILE
label_desc: Use image node_id 5 for calling the DetailProfilerApp obj's underlying member method code with example usage: obj._get_domain_and_user() without return types