Skip to content

/AWS1/CL_SGM=>CREATEHUBCONTENTPRESIGURLS()

About CreateHubContentPresignedUrls

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.

Method Signature

IMPORTING

Required arguments:

iv_hubname TYPE /AWS1/SGMHUBNAMEORARN /AWS1/SGMHUBNAMEORARN

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

iv_hubcontenttype TYPE /AWS1/SGMHUBCONTENTTYPE /AWS1/SGMHUBCONTENTTYPE

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

iv_hubcontentname TYPE /AWS1/SGMHUBCONTENTNAME /AWS1/SGMHUBCONTENTNAME

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

Optional arguments:

iv_hubcontentversion TYPE /AWS1/SGMHUBCONTENTVERSION /AWS1/SGMHUBCONTENTVERSION

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

io_accessconfig TYPE REF TO /AWS1/CL_SGMPRESIGURLACCESSCFG /AWS1/CL_SGMPRESIGURLACCESSCFG

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

iv_maxresults TYPE /AWS1/SGMMAXRESULTS /AWS1/SGMMAXRESULTS

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.

iv_nexttoken TYPE /AWS1/SGMNEXTTOKEN /AWS1/SGMNEXTTOKEN

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

RETURNING

oo_output TYPE REF TO /aws1/cl_sgmcrehubcontpsgnur01 /AWS1/CL_SGMCREHUBCONTPSGNUR01

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_sgm~createhubcontentpresigurls(
  io_accessconfig = new /aws1/cl_sgmpresigurlaccesscfg(
    iv_accepteula = ABAP_TRUE
    iv_expecteds3url = |string|
  )
  iv_hubcontentname = |string|
  iv_hubcontenttype = |string|
  iv_hubcontentversion = |string|
  iv_hubname = |string|
  iv_maxresults = 123
  iv_nexttoken = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_authorizedurlconfigs( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_longs3uri = lo_row_1->get_url( ).
      lv_localpath = lo_row_1->get_localpath( ).
    ENDIF.
  ENDLOOP.
  lv_nexttoken = lo_result->get_nexttoken( ).
ENDIF.