Skip to content

create_presigned_domain_url async

create_presigned_domain_url(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    domain_id: Optional[DomainId] = None,
    user_profile_name: Optional[UserProfileName] = None,
    session_expiration_duration_in_seconds: Optional[
        SessionExpirationDurationInSeconds
    ] = None,
    expires_in_seconds: Optional[ExpiresInSeconds] = None,
    space_name: Optional[SpaceName] = None,
    landing_uri: Optional[LandingUri] = None,
) -> CreatePresignedDomainUrlResponse

Creates a URL for a specified UserProfile in a Domain. When accessed in a web browser, the user will be automatically signed in to the domain, and granted access to all of the Apps and files associated with the Domain's Amazon Elastic File System volume. This operation can only be called when the authentication mode equals IAM.

The IAM role or user passed to this API defines the permissions to access the app. Once the presigned URL is created, no additional permission is required to access this URL. IAM authorization policies for this API are also enforced for every HTTP request and WebSocket frame that attempts to connect to the app.

You can restrict access to this API and to the URL that it returns to a list of IP addresses, Amazon VPCs or Amazon VPC Endpoints that you specify. For more information, see Connect to Amazon SageMaker AI Studio Through an Interface VPC Endpoint .

  • The URL that you get from a call to CreatePresignedDomainUrl has a default timeout of 5 minutes. You can configure this value using ExpiresInSeconds. If you try to use the URL after the timeout limit expires, you are directed to the Amazon Web Services console sign-in page.

  • The JupyterLab session default expiration time is 12 hours. You can configure this value using SessionExpirationDurationInSeconds.

Parameters:

  • domain_id (Optional[DomainId], default: None ) –

    The domain ID.

  • user_profile_name (Optional[UserProfileName], default: None ) –

    The name of the UserProfile to sign-in as.

  • session_expiration_duration_in_seconds (Optional[SessionExpirationDurationInSeconds], default: None ) –

    The session expiration duration in seconds. This value defaults to 43200.

  • expires_in_seconds (Optional[ExpiresInSeconds], default: None ) –

    The number of seconds until the pre-signed URL expires. This value defaults to 300.

  • space_name (Optional[SpaceName], default: None ) –

    The name of the space.

  • landing_uri (Optional[LandingUri], default: None ) –

    The landing page that the user is directed to when accessing the presigned URL. Using this value, users can access Studio or Studio Classic, even if it is not the default experience for the domain. The supported values are:

    • studio::relative/path: Directs users to the relative path in Studio.

    • app:JupyterServer:relative/path: Directs users to the relative path in the Studio Classic application.

    • app:JupyterLab:relative/path: Directs users to the relative path in the JupyterLab application.

    • app:RStudioServerPro:relative/path: Directs users to the relative path in the RStudio application.

    • app:CodeEditor:relative/path: Directs users to the relative path in the Code Editor, based on Code-OSS, Visual Studio Code - Open Source application.

    • app:Canvas:relative/path: Directs users to the relative path in the Canvas application.

Raises:

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def create_presigned_domain_url(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    domain_id: Optional["capo_sagemaker.types.domain_id.DomainId"] = None,
    user_profile_name: Optional[
        "capo_sagemaker.types.user_profile_name.UserProfileName"
    ] = None,
    session_expiration_duration_in_seconds: Optional[
        "capo_sagemaker.types.session_expiration_duration_in_seconds.SessionExpirationDurationInSeconds"
    ] = None,
    expires_in_seconds: Optional[
        "capo_sagemaker.types.expires_in_seconds.ExpiresInSeconds"
    ] = None,
    space_name: Optional["capo_sagemaker.types.space_name.SpaceName"] = None,
    landing_uri: Optional["capo_sagemaker.types.landing_uri.LandingUri"] = None,
) -> "capo_sagemaker.types.create_presigned_domain_url_response.CreatePresignedDomainUrlResponse":
    """<p>Creates a URL for a specified UserProfile in a Domain. When accessed in a web browser, the user will be automatically signed in to the domain, and granted access to all of the Apps and files associated with the Domain's Amazon Elastic File System volume. This operation can only be called when the authentication mode equals IAM. </p> <p>The IAM role or user passed to this API defines the permissions to access the app. Once the presigned URL is created, no additional permission is required to access this URL. IAM authorization policies for this API are also enforced for every HTTP request and WebSocket frame that attempts to connect to the app.</p> <p>You can restrict access to this API and to the URL that it returns to a list of IP addresses, Amazon VPCs or Amazon VPC Endpoints that you specify. For more information, see <a href="https://docs.aws.amazon.com/sagemaker/latest/dg/studio-interface-endpoint.html">Connect to Amazon SageMaker AI Studio Through an Interface VPC Endpoint</a> .</p> <note> <ul> <li> <p>The URL that you get from a call to <code>CreatePresignedDomainUrl</code> has a default timeout of 5 minutes. You can configure this value using <code>ExpiresInSeconds</code>. If you try to use the URL after the timeout limit expires, you are directed to the Amazon Web Services console sign-in page.</p> </li> <li> <p>The JupyterLab session default expiration time is 12 hours. You can configure this value using SessionExpirationDurationInSeconds.</p> </li> </ul> </note>

    Args:
        domain_id: <p>The domain ID.</p>
        user_profile_name: <p>The name of the UserProfile to sign-in as.</p>
        session_expiration_duration_in_seconds: <p>The session expiration duration in seconds. This value defaults to 43200.</p>
        expires_in_seconds: <p>The number of seconds until the pre-signed URL expires. This value defaults to 300.</p>
        space_name: <p>The name of the space.</p>
        landing_uri: <p>The landing page that the user is directed to when accessing the presigned URL. Using this value, users can access Studio or Studio Classic, even if it is not the default experience for the domain. The supported values are:</p> <ul> <li> <p> <code>studio::relative/path</code>: Directs users to the relative path in Studio.</p> </li> <li> <p> <code>app:JupyterServer:relative/path</code>: Directs users to the relative path in the Studio Classic application.</p> </li> <li> <p> <code>app:JupyterLab:relative/path</code>: Directs users to the relative path in the JupyterLab application.</p> </li> <li> <p> <code>app:RStudioServerPro:relative/path</code>: Directs users to the relative path in the RStudio application.</p> </li> <li> <p> <code>app:CodeEditor:relative/path</code>: Directs users to the relative path in the Code Editor, based on Code-OSS, Visual Studio Code - Open Source application.</p> </li> <li> <p> <code>app:Canvas:relative/path</code>: Directs users to the relative path in the Canvas application.</p> </li> </ul>

    Raises:
        capo_sagemaker.errors.resource_not_found.ResourceNotFound: <p>Resource being access is not found.</p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.create_presigned_domain_url_request.CreatePresignedDomainUrlRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.create_presigned_domain_url_response.CreatePresignedDomainUrlResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_presigned_domain_url

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.create_presigned_domain_url.async_create_presigned_domain_url(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreatePresignedDomainUrl")
    )
    input_: capo_sagemaker.types.create_presigned_domain_url_request.CreatePresignedDomainUrlRequest = {}
    if domain_id is not None:
        input_["domain_id"] = domain_id
    if user_profile_name is not None:
        input_["user_profile_name"] = user_profile_name
    if session_expiration_duration_in_seconds is not None:
        input_["session_expiration_duration_in_seconds"] = (
            session_expiration_duration_in_seconds
        )
    if expires_in_seconds is not None:
        input_["expires_in_seconds"] = expires_in_seconds
    if space_name is not None:
        input_["space_name"] = space_name
    if landing_uri is not None:
        input_["landing_uri"] = landing_uri

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output