Skip to content

Commit

Permalink
feat(client-sagemaker): Adds support for model references in Hub serv…
Browse files Browse the repository at this point in the history
…ice, and adds support for cross-account access of Hubs
  • Loading branch information
awstools committed Jun 20, 2024
1 parent e0f0232 commit 1048205
Show file tree
Hide file tree
Showing 39 changed files with 1,409 additions and 622 deletions.
16 changes: 16 additions & 0 deletions clients/client-sagemaker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,14 @@ CreateHub

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/sagemaker/command/CreateHubCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-sagemaker/Interface/CreateHubCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-sagemaker/Interface/CreateHubCommandOutput/)

</details>
<details>
<summary>
CreateHubContentReference
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/sagemaker/command/CreateHubContentReferenceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-sagemaker/Interface/CreateHubContentReferenceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-sagemaker/Interface/CreateHubContentReferenceCommandOutput/)

</details>
<details>
<summary>
Expand Down Expand Up @@ -889,6 +897,14 @@ DeleteHubContent

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/sagemaker/command/DeleteHubContentCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-sagemaker/Interface/DeleteHubContentCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-sagemaker/Interface/DeleteHubContentCommandOutput/)

</details>
<details>
<summary>
DeleteHubContentReference
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/sagemaker/command/DeleteHubContentReferenceCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-sagemaker/Interface/DeleteHubContentReferenceCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-sagemaker/Interface/DeleteHubContentReferenceCommandOutput/)

</details>
<details>
<summary>
Expand Down
46 changes: 46 additions & 0 deletions clients/client-sagemaker/src/SageMaker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ import {
CreateFlowDefinitionCommandOutput,
} from "./commands/CreateFlowDefinitionCommand";
import { CreateHubCommand, CreateHubCommandInput, CreateHubCommandOutput } from "./commands/CreateHubCommand";
import {
CreateHubContentReferenceCommand,
CreateHubContentReferenceCommandInput,
CreateHubContentReferenceCommandOutput,
} from "./commands/CreateHubContentReferenceCommand";
import {
CreateHumanTaskUiCommand,
CreateHumanTaskUiCommandInput,
Expand Down Expand Up @@ -386,6 +391,11 @@ import {
DeleteHubContentCommandInput,
DeleteHubContentCommandOutput,
} from "./commands/DeleteHubContentCommand";
import {
DeleteHubContentReferenceCommand,
DeleteHubContentReferenceCommandInput,
DeleteHubContentReferenceCommandOutput,
} from "./commands/DeleteHubContentReferenceCommand";
import {
DeleteHumanTaskUiCommand,
DeleteHumanTaskUiCommandInput,
Expand Down Expand Up @@ -1544,6 +1554,7 @@ const commands = {
CreateFeatureGroupCommand,
CreateFlowDefinitionCommand,
CreateHubCommand,
CreateHubContentReferenceCommand,
CreateHumanTaskUiCommand,
CreateHyperParameterTuningJobCommand,
CreateImageCommand,
Expand Down Expand Up @@ -1601,6 +1612,7 @@ const commands = {
DeleteFlowDefinitionCommand,
DeleteHubCommand,
DeleteHubContentCommand,
DeleteHubContentReferenceCommand,
DeleteHumanTaskUiCommand,
DeleteHyperParameterTuningJobCommand,
DeleteImageCommand,
Expand Down Expand Up @@ -2250,6 +2262,23 @@ export interface SageMaker {
cb: (err: any, data?: CreateHubCommandOutput) => void
): void;

/**
* @see {@link CreateHubContentReferenceCommand}
*/
createHubContentReference(
args: CreateHubContentReferenceCommandInput,
options?: __HttpHandlerOptions
): Promise<CreateHubContentReferenceCommandOutput>;
createHubContentReference(
args: CreateHubContentReferenceCommandInput,
cb: (err: any, data?: CreateHubContentReferenceCommandOutput) => void
): void;
createHubContentReference(
args: CreateHubContentReferenceCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: CreateHubContentReferenceCommandOutput) => void
): void;

/**
* @see {@link CreateHumanTaskUiCommand}
*/
Expand Down Expand Up @@ -3134,6 +3163,23 @@ export interface SageMaker {
cb: (err: any, data?: DeleteHubContentCommandOutput) => void
): void;

/**
* @see {@link DeleteHubContentReferenceCommand}
*/
deleteHubContentReference(
args: DeleteHubContentReferenceCommandInput,
options?: __HttpHandlerOptions
): Promise<DeleteHubContentReferenceCommandOutput>;
deleteHubContentReference(
args: DeleteHubContentReferenceCommandInput,
cb: (err: any, data?: DeleteHubContentReferenceCommandOutput) => void
): void;
deleteHubContentReference(
args: DeleteHubContentReferenceCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: DeleteHubContentReferenceCommandOutput) => void
): void;

/**
* @see {@link DeleteHumanTaskUiCommand}
*/
Expand Down
12 changes: 12 additions & 0 deletions clients/client-sagemaker/src/SageMakerClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ import {
CreateFlowDefinitionCommandOutput,
} from "./commands/CreateFlowDefinitionCommand";
import { CreateHubCommandInput, CreateHubCommandOutput } from "./commands/CreateHubCommand";
import {
CreateHubContentReferenceCommandInput,
CreateHubContentReferenceCommandOutput,
} from "./commands/CreateHubContentReferenceCommand";
import { CreateHumanTaskUiCommandInput, CreateHumanTaskUiCommandOutput } from "./commands/CreateHumanTaskUiCommand";
import {
CreateHyperParameterTuningJobCommandInput,
Expand Down Expand Up @@ -251,6 +255,10 @@ import {
} from "./commands/DeleteFlowDefinitionCommand";
import { DeleteHubCommandInput, DeleteHubCommandOutput } from "./commands/DeleteHubCommand";
import { DeleteHubContentCommandInput, DeleteHubContentCommandOutput } from "./commands/DeleteHubContentCommand";
import {
DeleteHubContentReferenceCommandInput,
DeleteHubContentReferenceCommandOutput,
} from "./commands/DeleteHubContentReferenceCommand";
import { DeleteHumanTaskUiCommandInput, DeleteHumanTaskUiCommandOutput } from "./commands/DeleteHumanTaskUiCommand";
import {
DeleteHyperParameterTuningJobCommandInput,
Expand Down Expand Up @@ -939,6 +947,7 @@ export type ServiceInputTypes =
| CreateFeatureGroupCommandInput
| CreateFlowDefinitionCommandInput
| CreateHubCommandInput
| CreateHubContentReferenceCommandInput
| CreateHumanTaskUiCommandInput
| CreateHyperParameterTuningJobCommandInput
| CreateImageCommandInput
Expand Down Expand Up @@ -996,6 +1005,7 @@ export type ServiceInputTypes =
| DeleteFlowDefinitionCommandInput
| DeleteHubCommandInput
| DeleteHubContentCommandInput
| DeleteHubContentReferenceCommandInput
| DeleteHumanTaskUiCommandInput
| DeleteHyperParameterTuningJobCommandInput
| DeleteImageCommandInput
Expand Down Expand Up @@ -1272,6 +1282,7 @@ export type ServiceOutputTypes =
| CreateFeatureGroupCommandOutput
| CreateFlowDefinitionCommandOutput
| CreateHubCommandOutput
| CreateHubContentReferenceCommandOutput
| CreateHumanTaskUiCommandOutput
| CreateHyperParameterTuningJobCommandOutput
| CreateImageCommandOutput
Expand Down Expand Up @@ -1329,6 +1340,7 @@ export type ServiceOutputTypes =
| DeleteFlowDefinitionCommandOutput
| DeleteHubCommandOutput
| DeleteHubContentCommandOutput
| DeleteHubContentReferenceCommandOutput
| DeleteHumanTaskUiCommandOutput
| DeleteHyperParameterTuningJobCommandOutput
| DeleteImageCommandOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export interface BatchDescribeModelPackageCommandOutput extends BatchDescribeMod
* // ModelAccessConfig: { // ModelAccessConfig
* // AcceptEula: true || false, // required
* // },
* // HubAccessConfig: { // InferenceHubAccessConfig
* // HubContentArn: "STRING_VALUE", // required
* // },
* // },
* // },
* // ProductId: "STRING_VALUE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ export interface CreateAlgorithmCommandOutput extends CreateAlgorithmOutput, __M
* ModelAccessConfig: { // ModelAccessConfig
* AcceptEula: true || false, // required
* },
* HubAccessConfig: { // InferenceHubAccessConfig
* HubContentArn: "STRING_VALUE", // required
* },
* },
* },
* ProductId: "STRING_VALUE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { commonParams } from "../endpoint/EndpointParameters";
import { CreateCodeRepositoryInput, CreateCodeRepositoryOutput } from "../models/models_0";
import { CreateCodeRepositoryInput } from "../models/models_0";
import { CreateCodeRepositoryOutput } from "../models/models_1";
import { de_CreateCodeRepositoryCommand, se_CreateCodeRepositoryCommand } from "../protocols/Aws_json1_1";
import { SageMakerClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../SageMakerClient";

Expand Down
3 changes: 0 additions & 3 deletions clients/client-sagemaker/src/commands/CreateHubCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ export interface CreateHubCommandOutput extends CreateHubResponse, __MetadataBea

/**
* <p>Create a hub.</p>
* <note>
* <p>Hub APIs are only callable through SageMaker Studio.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// smithy-typescript generated code
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { commonParams } from "../endpoint/EndpointParameters";
import { CreateHubContentReferenceRequest, CreateHubContentReferenceResponse } from "../models/models_1";
import { de_CreateHubContentReferenceCommand, se_CreateHubContentReferenceCommand } from "../protocols/Aws_json1_1";
import { SageMakerClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../SageMakerClient";

/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link CreateHubContentReferenceCommand}.
*/
export interface CreateHubContentReferenceCommandInput extends CreateHubContentReferenceRequest {}
/**
* @public
*
* The output of {@link CreateHubContentReferenceCommand}.
*/
export interface CreateHubContentReferenceCommandOutput extends CreateHubContentReferenceResponse, __MetadataBearer {}

/**
* <p>Create a hub content reference in order to add a model in the JumpStart public hub to a private hub.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { SageMakerClient, CreateHubContentReferenceCommand } from "@aws-sdk/client-sagemaker"; // ES Modules import
* // const { SageMakerClient, CreateHubContentReferenceCommand } = require("@aws-sdk/client-sagemaker"); // CommonJS import
* const client = new SageMakerClient(config);
* const input = { // CreateHubContentReferenceRequest
* HubName: "STRING_VALUE", // required
* SageMakerPublicHubContentArn: "STRING_VALUE", // required
* HubContentName: "STRING_VALUE",
* MinVersion: "STRING_VALUE",
* Tags: [ // TagList
* { // Tag
* Key: "STRING_VALUE", // required
* Value: "STRING_VALUE", // required
* },
* ],
* };
* const command = new CreateHubContentReferenceCommand(input);
* const response = await client.send(command);
* // { // CreateHubContentReferenceResponse
* // HubArn: "STRING_VALUE", // required
* // HubContentArn: "STRING_VALUE", // required
* // };
*
* ```
*
* @param CreateHubContentReferenceCommandInput - {@link CreateHubContentReferenceCommandInput}
* @returns {@link CreateHubContentReferenceCommandOutput}
* @see {@link CreateHubContentReferenceCommandInput} for command's `input` shape.
* @see {@link CreateHubContentReferenceCommandOutput} for command's `response` shape.
* @see {@link SageMakerClientResolvedConfig | config} for SageMakerClient's `config` shape.
*
* @throws {@link ResourceInUse} (client fault)
* <p>Resource being accessed is in use.</p>
*
* @throws {@link ResourceLimitExceeded} (client fault)
* <p> You have exceeded an SageMaker resource limit. For example, you might have too many
* training jobs created. </p>
*
* @throws {@link ResourceNotFound} (client fault)
* <p>Resource being access is not found.</p>
*
* @throws {@link SageMakerServiceException}
* <p>Base exception class for all service exceptions from SageMaker service.</p>
*
* @public
*/
export class CreateHubContentReferenceCommand extends $Command
.classBuilder<
CreateHubContentReferenceCommandInput,
CreateHubContentReferenceCommandOutput,
SageMakerClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep({
...commonParams,
})
.m(function (this: any, Command: any, cs: any, config: SageMakerClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("SageMaker", "CreateHubContentReference", {})
.n("SageMakerClient", "CreateHubContentReferenceCommand")
.f(void 0, void 0)
.ser(se_CreateHubContentReferenceCommand)
.de(de_CreateHubContentReferenceCommand)
.build() {}
6 changes: 6 additions & 0 deletions clients/client-sagemaker/src/commands/CreateModelCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export interface CreateModelCommandOutput extends CreateModelOutput, __MetadataB
* ModelAccessConfig: { // ModelAccessConfig
* AcceptEula: true || false, // required
* },
* HubAccessConfig: { // InferenceHubAccessConfig
* HubContentArn: "STRING_VALUE", // required
* },
* },
* },
* Environment: { // EnvironmentMap
Expand Down Expand Up @@ -103,6 +106,9 @@ export interface CreateModelCommandOutput extends CreateModelOutput, __MetadataB
* ModelAccessConfig: {
* AcceptEula: true || false, // required
* },
* HubAccessConfig: {
* HubContentArn: "STRING_VALUE", // required
* },
* },
* },
* Environment: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ export interface CreateModelPackageCommandOutput extends CreateModelPackageOutpu
* ModelAccessConfig: { // ModelAccessConfig
* AcceptEula: true || false, // required
* },
* HubAccessConfig: { // InferenceHubAccessConfig
* HubContentArn: "STRING_VALUE", // required
* },
* },
* },
* ProductId: "STRING_VALUE",
Expand Down Expand Up @@ -159,6 +162,9 @@ export interface CreateModelPackageCommandOutput extends CreateModelPackageOutpu
* ModelAccessConfig: {
* AcceptEula: true || false, // required
* },
* HubAccessConfig: {
* HubContentArn: "STRING_VALUE", // required
* },
* },
* },
* AlgorithmName: "STRING_VALUE", // required
Expand Down Expand Up @@ -269,6 +275,9 @@ export interface CreateModelPackageCommandOutput extends CreateModelPackageOutpu
* ModelAccessConfig: {
* AcceptEula: true || false, // required
* },
* HubAccessConfig: {
* HubContentArn: "STRING_VALUE", // required
* },
* },
* },
* ProductId: "STRING_VALUE",
Expand Down
3 changes: 0 additions & 3 deletions clients/client-sagemaker/src/commands/DeleteHubCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ export interface DeleteHubCommandOutput extends __MetadataBearer {}

/**
* <p>Delete a hub.</p>
* <note>
* <p>Hub APIs are only callable through SageMaker Studio.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ export interface DeleteHubContentCommandOutput extends __MetadataBearer {}

/**
* <p>Delete the contents of a hub.</p>
* <note>
* <p>Hub APIs are only callable through SageMaker Studio.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand All @@ -40,7 +37,7 @@ export interface DeleteHubContentCommandOutput extends __MetadataBearer {}
* const client = new SageMakerClient(config);
* const input = { // DeleteHubContentRequest
* HubName: "STRING_VALUE", // required
* HubContentType: "Model" || "Notebook", // required
* HubContentType: "Model" || "Notebook" || "ModelReference", // required
* HubContentName: "STRING_VALUE", // required
* HubContentVersion: "STRING_VALUE", // required
* };
Expand Down
Loading

0 comments on commit 1048205

Please sign in to comment.