createHubContentPresignedUrls method

Future<CreateHubContentPresignedUrlsResponse> createHubContentPresignedUrls({
  1. required String hubContentName,
  2. required HubContentType hubContentType,
  3. required String hubName,
  4. PresignedUrlAccessConfig? accessConfig,
  5. String? hubContentVersion,
  6. int? maxResults,
  7. String? nextToken,
})

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.

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

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

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

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

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

Parameter maxResults : 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.

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

Implementation

Future<CreateHubContentPresignedUrlsResponse> createHubContentPresignedUrls({
  required String hubContentName,
  required HubContentType hubContentType,
  required String hubName,
  PresignedUrlAccessConfig? accessConfig,
  String? hubContentVersion,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'SageMaker.CreateHubContentPresignedUrls'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'HubContentName': hubContentName,
      'HubContentType': hubContentType.value,
      'HubName': hubName,
      if (accessConfig != null) 'AccessConfig': accessConfig,
      if (hubContentVersion != null) 'HubContentVersion': hubContentVersion,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return CreateHubContentPresignedUrlsResponse.fromJson(jsonResponse.body);
}