Skip to content

create_hub_content_presigned_urls

create_hub_content_presigned_urls(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    hub_name: Optional[HubNameOrArn] = None,
    hub_content_type: Optional[HubContentType] = None,
    hub_content_name: Optional[HubContentName] = None,
    hub_content_version: Optional[HubContentVersion] = None,
    access_config: Optional[PresignedUrlAccessConfig] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> CreateHubContentPresignedUrlsResponse

Creates presigned URLs for accessing hub content artifacts. This operation generates time-limited, secure URLs that allow direct download of model artifacts and associated files from Amazon SageMaker hub content, including gated models that require end-user license agreement acceptance.

Parameters:

  • hub_name (Optional[HubNameOrArn], default: None ) –

    The name or Amazon Resource Name (ARN) of the hub that contains the content. For public content, use SageMakerPublicHub.

  • hub_content_type (Optional[HubContentType], default: None ) –

    The type of hub content to access. Valid values include Model, Notebook, and ModelReference.

  • hub_content_name (Optional[HubContentName], default: None ) –

    The name of the hub content for which to generate presigned URLs. This identifies the specific model or content within the hub.

  • hub_content_version (Optional[HubContentVersion], default: None ) –

    The version of the hub content. If not specified, the latest version is used.

  • access_config (Optional[PresignedUrlAccessConfig], default: None ) –

    Configuration settings for accessing the hub content, including end-user license agreement acceptance for gated models and expected S3 URL validation.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of presigned URLs to return in the response. Default value is 100. Large models may contain hundreds of files, requiring pagination to retrieve all URLs.

  • next_token (Optional[NextToken], default: None ) –

    A token for pagination. Use this token to retrieve the next set of presigned URLs when the response is truncated.

Raises:

Source code in docs_src/capo_sagemaker/_services/sage_maker.py
def create_hub_content_presigned_urls(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    hub_name: Optional["capo_sagemaker.types.hub_name_or_arn.HubNameOrArn"] = None,
    hub_content_type: Optional[
        "capo_sagemaker.types.hub_content_type.HubContentType"
    ] = None,
    hub_content_name: Optional[
        "capo_sagemaker.types.hub_content_name.HubContentName"
    ] = None,
    hub_content_version: Optional[
        "capo_sagemaker.types.hub_content_version.HubContentVersion"
    ] = None,
    access_config: Optional[
        "capo_sagemaker.types.presigned_url_access_config.PresignedUrlAccessConfig"
    ] = None,
    max_results: Optional["capo_sagemaker.types.max_results.MaxResults"] = None,
    next_token: Optional["capo_sagemaker.types.next_token.NextToken"] = None,
) -> "capo_sagemaker.types.create_hub_content_presigned_urls_response.CreateHubContentPresignedUrlsResponse":
    """<p>Creates presigned URLs for accessing hub content artifacts. This operation generates time-limited, secure URLs that allow direct download of model artifacts and associated files from Amazon SageMaker hub content, including gated models that require end-user license agreement acceptance.</p>

    Args:
        hub_name: <p>The name or Amazon Resource Name (ARN) of the hub that contains the content. For public content, use <code>SageMakerPublicHub</code>.</p>
        hub_content_type: <p>The type of hub content to access. Valid values include <code>Model</code>, <code>Notebook</code>, and <code>ModelReference</code>.</p>
        hub_content_name: <p>The name of the hub content for which to generate presigned URLs. This identifies the specific model or content within the hub.</p>
        hub_content_version: <p>The version of the hub content. If not specified, the latest version is used.</p>
        access_config: <p>Configuration settings for accessing the hub content, including end-user license agreement acceptance for gated models and expected S3 URL validation.</p>
        max_results: <p>The maximum number of presigned URLs to return in the response. Default value is 100. Large models may contain hundreds of files, requiring pagination to retrieve all URLs.</p>
        next_token: <p> A token for pagination. Use this token to retrieve the next set of presigned URLs when the response is truncated.</p>

    Raises:
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.create_hub_content_presigned_urls_request.CreateHubContentPresignedUrlsRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.create_hub_content_presigned_urls_response.CreateHubContentPresignedUrlsResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.create_hub_content_presigned_urls

        output, http_response = (
            capo_sagemaker._operations.sage_maker.create_hub_content_presigned_urls.create_hub_content_presigned_urls(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateHubContentPresignedUrls")
    )
    input_: capo_sagemaker.types.create_hub_content_presigned_urls_request.CreateHubContentPresignedUrlsRequest = {}
    if hub_name is not None:
        input_["hub_name"] = hub_name
    if hub_content_type is not None:
        input_["hub_content_type"] = hub_content_type
    if hub_content_name is not None:
        input_["hub_content_name"] = hub_content_name
    if hub_content_version is not None:
        input_["hub_content_version"] = hub_content_version
    if access_config is not None:
        input_["access_config"] = access_config
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output