class_docstr: BaseInteractiveApp is a base class for creating/accessing apps hosted on SageMaker.
docstr: Generate a presigned URL to access a user's domain / user profile.
  
  Optional state and redirect parameters can be used to to have presigned URL automatically
  redirect to a specific app and provide modifying data.
  
  Args:
      create_presigned_url_kwargs (dict): Required. This dictionary should include the
          parameters that will be used when calling create_presigned_domain_url via the boto3
          client. At a minimum, this should include the "DomainId" and "UserProfileName"
          parameters as defined by create_presigned_domain_url's documentation.
          Default: ``None``
      redirect (str): Optional. This value will be appended to the resulting presigned URL
          in the format "&redirect=<redirect parameter>". This is used to automatically
          redirect the user into a specific Studio app.
          Default: ``None``
      state (str): Optional. This value will be appended to the resulting presigned URL
          in the format "&state=<state parameter base64 encoded>". This is used to
          automatically apply a state to the given app. Should be used in conjuction with
          the redirect parameter.
          Default: ``None``
  
  Returns:
      str: A presigned URL.
docstr_tok: ["Generate","a","presigned","URL","to","access","a","user","'s","domain","\/","user","profile",".","Optional","state","and","redirect","parameters","can","be","used","to","to","have","presigned","URL","automatically","redirect","to","a","specific","app","and","provide","modifying","data",".","Args",":","create_presigned_url_kwargs","(","dict",")",":","Required",".","This","dictionary","should","include","the","parameters","that","will","be","used","when","calling","create_presigned_domain_url","via","the","boto3","client",".","At","a","minimum",",","this","should","include","the","``","DomainId","''","and","``","UserProfileName","''","parameters","as","defined","by","create_presigned_domain_url","'s","documentation",".","Default",":","``","None","``","redirect","(","str",")",":","Optional",".","This","value","will","be","appended","to","the","resulting","presigned","URL","in","the","format","``","&","redirect=","<","redirect","parameter",">","''",".","This","is","used","to","automatically","redirect","the","user","into","a","specific","Studio","app",".","Default",":","``","None","``","state","(","str",")",":","Optional",".","This","value","will","be","appended","to","the","resulting","presigned","URL","in","the","format","``","&","state=","<","state","parameter","base64","encoded",">","''",".","This","is","used","to","automatically","apply","a","state","to","the","given","app",".","Should","be","used","in","conjuction","with","the","redirect","parameter",".","Default",":","``","None","``","Returns",":","str",":","A","presigned","URL","."]
code: def _get_presigned_url(
      self,
      create_presigned_url_kwargs: dict,
      redirect: Optional[str] = None,
      state: Optional[str] = None,
  ):
      """Generate a presigned URL to access a user's domain / user profile.
  
      Optional state and redirect parameters can be used to to have presigned URL automatically
      redirect to a specific app and provide modifying data.
  
      Args:
          create_presigned_url_kwargs (dict): Required. This dictionary should include the
              parameters that will be used when calling create_presigned_domain_url via the boto3
              client. At a minimum, this should include the "DomainId" and "UserProfileName"
              parameters as defined by create_presigned_domain_url's documentation.
              Default: ``None``
          redirect (str): Optional. This value will be appended to the resulting presigned URL
              in the format "&redirect=<redirect parameter>". This is used to automatically
              redirect the user into a specific Studio app.
              Default: ``None``
          state (str): Optional. This value will be appended to the resulting presigned URL
              in the format "&state=<state parameter base64 encoded>". This is used to
              automatically apply a state to the given app. Should be used in conjuction with
              the redirect parameter.
              Default: ``None``
  
      Returns:
          str: A presigned URL.
      """
      response = self._sagemaker_client.create_presigned_domain_url(
          **create_presigned_url_kwargs
      )
      if response["ResponseMetadata"]["HTTPStatusCode"] == 200:
          url = response["AuthorizedUrl"]
      else:
          raise ValueError(
              "An invalid status code was returned when creating a presigned URL."
              f" See response for more: {response}"
          )
  
      if redirect:
          url += f"&redirect={redirect}"
  
      if state:
          url += f"&state={base64.b64encode(bytes(state, 'utf-8')).decode('utf-8')}"
  
      logger.warning(
          "A presigned domain URL was generated. This is sensitive and should not be shared with"
          " others."
      )
  
      return url
  
imports: from __future__ import absolute_import
  import abc
  import base64
  import json
  import logging
  import os
  import re
  import webbrowser
  from typing import Optional
  import boto3
  from sagemaker.session import Session, NOTEBOOK_METADATA_FILE
label_desc: Use image node_id 5 for calling the BaseInteractiveApp obj's underlying member method code with example usage: obj._get_presigned_url(create_presigned_url_kwargs, redirect, state) and returns: url