diff --git a/sample/sagemaker/2017-07-24/service-2.json b/sample/sagemaker/2017-07-24/service-2.json index 8460768..e7d5609 100644 --- a/sample/sagemaker/2017-07-24/service-2.json +++ b/sample/sagemaker/2017-07-24/service-2.json @@ -4070,6 +4070,34 @@ ], "documentation":"

Update a hub.

" }, + "UpdateHubContent":{ + "name":"UpdateHubContent", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"UpdateHubContentRequest"}, + "output":{"shape":"UpdateHubContentResponse"}, + "errors":[ + {"shape":"ResourceNotFound"}, + {"shape":"ResourceInUse"} + ], + "documentation":"

Updates SageMaker hub content (either a Model or Notebook resource).

You can update the metadata that describes the resource. In addition to the required request fields, specify at least one of the following fields to update:

For more information about hubs, see Private curated hubs for foundation model access control in JumpStart.

If you want to update a ModelReference resource in your hub, use the UpdateHubContentResource API instead.

" + }, + "UpdateHubContentReference":{ + "name":"UpdateHubContentReference", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"UpdateHubContentReferenceRequest"}, + "output":{"shape":"UpdateHubContentReferenceResponse"}, + "errors":[ + {"shape":"ResourceNotFound"}, + {"shape":"ResourceInUse"} + ], + "documentation":"

Updates the contents of a SageMaker hub for a ModelReference resource. A ModelReference allows you to access public SageMaker JumpStart models from within your private hub.

When using this API, you can update the MinVersion field for additional flexibility in the model version. You shouldn't update any additional fields when using this API, because the metadata in your private hub should match the public JumpStart model's metadata.

If you want to update a Model or Notebook resource in your hub, use the UpdateHubContent API instead.

For more information about adding model references to your hub, see Add models to a private hub.

" + }, "UpdateImage":{ "name":"UpdateImage", "http":{ @@ -15561,6 +15589,10 @@ "CreationTime":{ "shape":"Timestamp", "documentation":"

The date and time that hub content was created.

" + }, + "LastModifiedTime":{ + "shape":"Timestamp", + "documentation":"

The last modified time of the hub content.

" } } }, @@ -21148,6 +21180,17 @@ "min":0 }, "Horovod":{"type":"boolean"}, + "HubAccessConfig":{ + "type":"structure", + "required":["HubContentArn"], + "members":{ + "HubContentArn":{ + "shape":"HubContentArn", + "documentation":"

The ARN of your private model hub content. This should be a ModelReference resource type that points to a SageMaker JumpStart public hub model.

" + } + }, + "documentation":"

The configuration for a private hub model reference that points to a public SageMaker JumpStart model.

For more information about private hubs, see Private curated hubs for foundation model access control in JumpStart.

" + }, "HubArn":{ "type":"string", "max":255, @@ -21299,7 +21342,8 @@ "type":"string", "enum":[ "Supported", - "Deprecated" + "Deprecated", + "Restricted" ] }, "HubContentType":{ @@ -22637,6 +22681,10 @@ "shape":"HubContentDocument", "documentation":"

The hub content document that describes information about the hub content such as type, associated containers, scripts, and more.

" }, + "SupportStatus":{ + "shape":"HubContentSupportStatus", + "documentation":"

The status of the hub content resource.

" + }, "HubContentSearchKeywords":{ "shape":"HubContentSearchKeywordList", "documentation":"

The searchable keywords of the hub content.

" @@ -35962,6 +36010,11 @@ "InstanceGroupNames":{ "shape":"InstanceGroupNames", "documentation":"

A list of names of instance groups that get data from the S3 data source.

" + }, + "ModelAccessConfig":{"shape":"ModelAccessConfig"}, + "HubAccessConfig":{ + "shape":"HubAccessConfig", + "documentation":"

The configuration for a private hub model reference that points to a SageMaker JumpStart public hub model.

" } }, "documentation":"

Describes the S3 data source.

Your input bucket must be in the same Amazon Web Services region as your training job.

" @@ -40811,6 +40864,113 @@ } } }, + "UpdateHubContentReferenceRequest":{ + "type":"structure", + "required":[ + "HubName", + "HubContentName", + "HubContentType" + ], + "members":{ + "HubName":{ + "shape":"HubNameOrArn", + "documentation":"

The name of the SageMaker hub that contains the hub content you want to update. You can optionally use the hub ARN instead.

" + }, + "HubContentName":{ + "shape":"HubContentName", + "documentation":"

The name of the hub content resource that you want to update.

" + }, + "HubContentType":{ + "shape":"HubContentType", + "documentation":"

The content type of the resource that you want to update. Only specify a ModelReference resource for this API. To update a Model or Notebook resource, use the UpdateHubContent API instead.

" + }, + "MinVersion":{ + "shape":"HubContentVersion", + "documentation":"

The minimum hub content version of the referenced model that you want to use. The minimum version must be older than the latest available version of the referenced model. To support all versions of a model, set the value to 1.0.0.

" + } + } + }, + "UpdateHubContentReferenceResponse":{ + "type":"structure", + "required":[ + "HubArn", + "HubContentArn" + ], + "members":{ + "HubArn":{ + "shape":"HubArn", + "documentation":"

The ARN of the private model hub that contains the updated hub content.

" + }, + "HubContentArn":{ + "shape":"HubContentArn", + "documentation":"

The ARN of the hub content resource that was updated.

" + } + } + }, + "UpdateHubContentRequest":{ + "type":"structure", + "required":[ + "HubName", + "HubContentName", + "HubContentType", + "HubContentVersion" + ], + "members":{ + "HubName":{ + "shape":"HubNameOrArn", + "documentation":"

The name of the SageMaker hub that contains the hub content you want to update. You can optionally use the hub ARN instead.

" + }, + "HubContentName":{ + "shape":"HubContentName", + "documentation":"

The name of the hub content resource that you want to update.

" + }, + "HubContentType":{ + "shape":"HubContentType", + "documentation":"

The content type of the resource that you want to update. Only specify a Model or Notebook resource for this API. To update a ModelReference, use the UpdateHubContentReference API instead.

" + }, + "HubContentVersion":{ + "shape":"HubContentVersion", + "documentation":"

The hub content version that you want to update. For example, if you have two versions of a resource in your hub, you can update the second version.

" + }, + "HubContentDisplayName":{ + "shape":"HubContentDisplayName", + "documentation":"

The display name of the hub content.

" + }, + "HubContentDescription":{ + "shape":"HubContentDescription", + "documentation":"

The description of the hub content.

" + }, + "HubContentMarkdown":{ + "shape":"HubContentMarkdown", + "documentation":"

A string that provides a description of the hub content. This string can include links, tables, and standard markdown formatting.

" + }, + "HubContentSearchKeywords":{ + "shape":"HubContentSearchKeywordList", + "documentation":"

The searchable keywords of the hub content.

" + }, + "SupportStatus":{ + "shape":"HubContentSupportStatus", + "documentation":"

Indicates the current status of the hub content resource.

" + } + } + }, + "UpdateHubContentResponse":{ + "type":"structure", + "required":[ + "HubArn", + "HubContentArn" + ], + "members":{ + "HubArn":{ + "shape":"HubArn", + "documentation":"

The ARN of the private model hub that contains the updated hub content.

" + }, + "HubContentArn":{ + "shape":"HubContentArn", + "documentation":"

The ARN of the hub content resource that was updated.

" + } + } + }, "UpdateHubRequest":{ "type":"structure", "required":["HubName"], diff --git a/src/sagemaker_core/main/code_injection/shape_dag.py b/src/sagemaker_core/main/code_injection/shape_dag.py index ef2c634..a2fbf5c 100644 --- a/src/sagemaker_core/main/code_injection/shape_dag.py +++ b/src/sagemaker_core/main/code_injection/shape_dag.py @@ -4712,6 +4712,7 @@ {"name": "HubContentStatus", "shape": "HubContentStatus", "type": "string"}, {"name": "FailureReason", "shape": "FailureReason", "type": "string"}, {"name": "CreationTime", "shape": "Timestamp", "type": "timestamp"}, + {"name": "LastModifiedTime", "shape": "Timestamp", "type": "timestamp"}, ], "type": "structure", }, @@ -7024,6 +7025,10 @@ "value_shape": "ConfigValue", "value_type": "string", }, + "HubAccessConfig": { + "members": [{"name": "HubContentArn", "shape": "HubContentArn", "type": "string"}], + "type": "structure", + }, "HubContentDependency": { "members": [ {"name": "DependencyOriginPath", "shape": "DependencyOriginPath", "type": "string"}, @@ -7659,6 +7664,7 @@ {"name": "HubContentDescription", "shape": "HubContentDescription", "type": "string"}, {"name": "HubContentMarkdown", "shape": "HubContentMarkdown", "type": "string"}, {"name": "HubContentDocument", "shape": "HubContentDocument", "type": "string"}, + {"name": "SupportStatus", "shape": "HubContentSupportStatus", "type": "string"}, { "name": "HubContentSearchKeywords", "shape": "HubContentSearchKeywordList", @@ -13182,6 +13188,8 @@ {"name": "S3DataDistributionType", "shape": "S3DataDistribution", "type": "string"}, {"name": "AttributeNames", "shape": "AttributeNames", "type": "list"}, {"name": "InstanceGroupNames", "shape": "InstanceGroupNames", "type": "list"}, + {"name": "ModelAccessConfig", "shape": "ModelAccessConfig", "type": "structure"}, + {"name": "HubAccessConfig", "shape": "HubAccessConfig", "type": "structure"}, ], "type": "structure", }, @@ -14991,6 +14999,47 @@ ], "type": "structure", }, + "UpdateHubContentReferenceRequest": { + "members": [ + {"name": "HubName", "shape": "HubNameOrArn", "type": "string"}, + {"name": "HubContentName", "shape": "HubContentName", "type": "string"}, + {"name": "HubContentType", "shape": "HubContentType", "type": "string"}, + {"name": "MinVersion", "shape": "HubContentVersion", "type": "string"}, + ], + "type": "structure", + }, + "UpdateHubContentReferenceResponse": { + "members": [ + {"name": "HubArn", "shape": "HubArn", "type": "string"}, + {"name": "HubContentArn", "shape": "HubContentArn", "type": "string"}, + ], + "type": "structure", + }, + "UpdateHubContentRequest": { + "members": [ + {"name": "HubName", "shape": "HubNameOrArn", "type": "string"}, + {"name": "HubContentName", "shape": "HubContentName", "type": "string"}, + {"name": "HubContentType", "shape": "HubContentType", "type": "string"}, + {"name": "HubContentVersion", "shape": "HubContentVersion", "type": "string"}, + {"name": "HubContentDisplayName", "shape": "HubContentDisplayName", "type": "string"}, + {"name": "HubContentDescription", "shape": "HubContentDescription", "type": "string"}, + {"name": "HubContentMarkdown", "shape": "HubContentMarkdown", "type": "string"}, + { + "name": "HubContentSearchKeywords", + "shape": "HubContentSearchKeywordList", + "type": "list", + }, + {"name": "SupportStatus", "shape": "HubContentSupportStatus", "type": "string"}, + ], + "type": "structure", + }, + "UpdateHubContentResponse": { + "members": [ + {"name": "HubArn", "shape": "HubArn", "type": "string"}, + {"name": "HubContentArn", "shape": "HubContentArn", "type": "string"}, + ], + "type": "structure", + }, "UpdateHubRequest": { "members": [ {"name": "HubName", "shape": "HubNameOrArn", "type": "string"}, diff --git a/src/sagemaker_core/main/resources.py b/src/sagemaker_core/main/resources.py index 9853952..80b2c18 100644 --- a/src/sagemaker_core/main/resources.py +++ b/src/sagemaker_core/main/resources.py @@ -12221,6 +12221,7 @@ class HubContent(Base): hub_content_search_keywords: The searchable keywords for the hub content. hub_content_dependencies: The location of any dependencies that the hub content has, such as scripts, model artifacts, datasets, or notebooks. failure_reason: The failure reason if importing hub content failed. + last_modified_time: The last modified time of the hub content. """ @@ -12242,6 +12243,7 @@ class HubContent(Base): hub_content_status: Optional[str] = Unassigned() failure_reason: Optional[str] = Unassigned() creation_time: Optional[datetime.datetime] = Unassigned() + last_modified_time: Optional[datetime.datetime] = Unassigned() hub_name: Optional[str] = Unassigned() def get_name(self) -> str: @@ -12360,6 +12362,63 @@ def refresh( transform(response, "DescribeHubContentResponse", self) return self + @Base.add_validate_call + def update( + self, + hub_content_type: str, + hub_content_version: str, + hub_content_display_name: Optional[str] = Unassigned(), + hub_content_description: Optional[str] = Unassigned(), + hub_content_markdown: Optional[str] = Unassigned(), + hub_content_search_keywords: Optional[List[str]] = Unassigned(), + support_status: Optional[str] = Unassigned(), + ) -> Optional["HubContent"]: + """ + Update a HubContent resource + + Returns: + The HubContent resource. + + Raises: + botocore.exceptions.ClientError: This exception is raised for AWS service related errors. + The error message and error code can be parsed from the exception as follows: + ``` + try: + # AWS service call here + except botocore.exceptions.ClientError as e: + error_message = e.response['Error']['Message'] + error_code = e.response['Error']['Code'] + ``` + ResourceInUse: Resource being accessed is in use. + ResourceNotFound: Resource being access is not found. + """ + + logger.info("Updating hub_content resource.") + client = Base.get_sagemaker_client() + + operation_input_args = { + "HubName": self.hub_name, + "HubContentName": self.hub_content_name, + "HubContentType": hub_content_type, + "HubContentVersion": hub_content_version, + "HubContentDisplayName": hub_content_display_name, + "HubContentDescription": hub_content_description, + "HubContentMarkdown": hub_content_markdown, + "HubContentSearchKeywords": hub_content_search_keywords, + "SupportStatus": support_status, + } + logger.debug(f"Input request: {operation_input_args}") + # serialize the input request + operation_input_args = serialize(operation_input_args) + logger.debug(f"Serialized input request: {operation_input_args}") + + # create the resource + response = client.update_hub_content(**operation_input_args) + logger.debug(f"Response: {response}") + self.refresh() + + return self + @Base.add_validate_call def delete( self, @@ -12400,7 +12459,7 @@ def delete( @Base.add_validate_call def wait_for_status( self, - target_status: Literal["Supported", "Deprecated"], + target_status: Literal["Supported", "Deprecated", "Restricted"], poll: int = 5, timeout: Optional[int] = None, ) -> None: @@ -12461,6 +12520,7 @@ def load( hub_content_display_name: Optional[str] = Unassigned(), hub_content_description: Optional[str] = Unassigned(), hub_content_markdown: Optional[str] = Unassigned(), + support_status: Optional[str] = Unassigned(), hub_content_search_keywords: Optional[List[str]] = Unassigned(), tags: Optional[List[Tag]] = Unassigned(), session: Optional[Session] = None, @@ -12479,6 +12539,7 @@ def load( hub_content_display_name: The display name of the hub content to import. hub_content_description: A description of the hub content to import. hub_content_markdown: A string that provides a description of the hub content. This string can include links, tables, and standard markdown formating. + support_status: The status of the hub content resource. hub_content_search_keywords: The searchable keywords of the hub content. tags: Any tags associated with the hub content. session: Boto3 session. @@ -12517,6 +12578,7 @@ def load( "HubContentDescription": hub_content_description, "HubContentMarkdown": hub_content_markdown, "HubContentDocument": hub_content_document, + "SupportStatus": support_status, "HubContentSearchKeywords": hub_content_search_keywords, "Tags": tags, } @@ -12714,6 +12776,56 @@ def create( transformed_response = transform(response, "CreateHubContentReferenceResponse") return cls(**operation_input_args, **transformed_response) + @Base.add_validate_call + def update( + self, + hub_content_type: str, + min_version: Optional[str] = Unassigned(), + ) -> Optional["HubContentReference"]: + """ + Update a HubContentReference resource + + Parameters: + hub_content_type: The content type of the resource that you want to update. Only specify a ModelReference resource for this API. To update a Model or Notebook resource, use the UpdateHubContent API instead. + + Returns: + The HubContentReference resource. + + Raises: + botocore.exceptions.ClientError: This exception is raised for AWS service related errors. + The error message and error code can be parsed from the exception as follows: + ``` + try: + # AWS service call here + except botocore.exceptions.ClientError as e: + error_message = e.response['Error']['Message'] + error_code = e.response['Error']['Code'] + ``` + ResourceInUse: Resource being accessed is in use. + ResourceNotFound: Resource being access is not found. + """ + + logger.info("Updating hub_content_reference resource.") + client = Base.get_sagemaker_client() + + operation_input_args = { + "HubName": self.hub_name, + "HubContentName": self.hub_content_name, + "HubContentType": hub_content_type, + "MinVersion": min_version, + } + logger.debug(f"Input request: {operation_input_args}") + # serialize the input request + operation_input_args = serialize(operation_input_args) + logger.debug(f"Serialized input request: {operation_input_args}") + + # create the resource + response = client.update_hub_content_reference(**operation_input_args) + logger.debug(f"Response: {response}") + self.refresh() + + return self + @Base.add_validate_call def delete( self, diff --git a/src/sagemaker_core/main/shapes.py b/src/sagemaker_core/main/shapes.py index ddcc9bb..a56c3aa 100644 --- a/src/sagemaker_core/main/shapes.py +++ b/src/sagemaker_core/main/shapes.py @@ -835,6 +835,19 @@ class AlgorithmSummary(Base): algorithm_description: Optional[str] = Unassigned() +class HubAccessConfig(Base): + """ + HubAccessConfig + The configuration for a private hub model reference that points to a public SageMaker JumpStart model. For more information about private hubs, see Private curated hubs for foundation model access control in JumpStart. + + Attributes + ---------------------- + hub_content_arn: The ARN of your private model hub content. This should be a ModelReference resource type that points to a SageMaker JumpStart public hub model. + """ + + hub_content_arn: str + + class S3DataSource(Base): """ S3DataSource @@ -847,6 +860,8 @@ class S3DataSource(Base): s3_data_distribution_type: If you want SageMaker to replicate the entire dataset on each ML compute instance that is launched for model training, specify FullyReplicated. If you want SageMaker to replicate a subset of data on each ML compute instance that is launched for model training, specify ShardedByS3Key. If there are n ML compute instances launched for a training job, each instance gets approximately 1/n of the number of S3 objects. In this case, model training on each machine uses only the subset of training data. Don't choose more ML compute instances for training than available S3 objects. If you do, some nodes won't get any data and you will pay for nodes that aren't getting any training data. This applies in both File and Pipe modes. Keep this in mind when developing algorithms. In distributed training, where you use multiple ML compute EC2 instances, you might choose ShardedByS3Key. If the algorithm requires copying training data to the ML storage volume (when TrainingInputMode is set to File), this copies 1/n of the number of objects. attribute_names: A list of one or more attribute names to use that are found in a specified augmented manifest file. instance_group_names: A list of names of instance groups that get data from the S3 data source. + model_access_config + hub_access_config: The configuration for a private hub model reference that points to a SageMaker JumpStart public hub model. """ s3_data_type: str @@ -854,6 +869,8 @@ class S3DataSource(Base): s3_data_distribution_type: Optional[str] = Unassigned() attribute_names: Optional[List[str]] = Unassigned() instance_group_names: Optional[List[str]] = Unassigned() + model_access_config: Optional[ModelAccessConfig] = Unassigned() + hub_access_config: Optional[HubAccessConfig] = Unassigned() class FileSystemDataSource(Base): diff --git a/src/sagemaker_core/tools/api_coverage.json b/src/sagemaker_core/tools/api_coverage.json index 833ea34..860edc8 100644 --- a/src/sagemaker_core/tools/api_coverage.json +++ b/src/sagemaker_core/tools/api_coverage.json @@ -1 +1 @@ -{"SupportedAPIs": 359, "UnsupportedAPIs": 6} \ No newline at end of file +{"SupportedAPIs": 361, "UnsupportedAPIs": 6} \ No newline at end of file