Skip to content

Commit

Permalink
feat(client-personalize): This releases ability to update automatic t…
Browse files Browse the repository at this point in the history
…raining scheduler for customer solutions
  • Loading branch information
awstools committed Aug 29, 2024
1 parent 3a7b177 commit 238987e
Show file tree
Hide file tree
Showing 10 changed files with 478 additions and 27 deletions.
8 changes: 8 additions & 0 deletions clients/client-personalize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -764,3 +764,11 @@ UpdateRecommender
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/personalize/command/UpdateRecommenderCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-personalize/Interface/UpdateRecommenderCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-personalize/Interface/UpdateRecommenderCommandOutput/)

</details>
<details>
<summary>
UpdateSolution
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/personalize/command/UpdateSolutionCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-personalize/Interface/UpdateSolutionCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-personalize/Interface/UpdateSolutionCommandOutput/)

</details>
20 changes: 20 additions & 0 deletions clients/client-personalize/src/Personalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,11 @@ import {
UpdateRecommenderCommandInput,
UpdateRecommenderCommandOutput,
} from "./commands/UpdateRecommenderCommand";
import {
UpdateSolutionCommand,
UpdateSolutionCommandInput,
UpdateSolutionCommandOutput,
} from "./commands/UpdateSolutionCommand";
import { PersonalizeClient, PersonalizeClientConfig } from "./PersonalizeClient";

const commands = {
Expand Down Expand Up @@ -409,6 +414,7 @@ const commands = {
UpdateDatasetCommand,
UpdateMetricAttributionCommand,
UpdateRecommenderCommand,
UpdateSolutionCommand,
};

export interface Personalize {
Expand Down Expand Up @@ -1499,6 +1505,20 @@ export interface Personalize {
options: __HttpHandlerOptions,
cb: (err: any, data?: UpdateRecommenderCommandOutput) => void
): void;

/**
* @see {@link UpdateSolutionCommand}
*/
updateSolution(
args: UpdateSolutionCommandInput,
options?: __HttpHandlerOptions
): Promise<UpdateSolutionCommandOutput>;
updateSolution(args: UpdateSolutionCommandInput, cb: (err: any, data?: UpdateSolutionCommandOutput) => void): void;
updateSolution(
args: UpdateSolutionCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: UpdateSolutionCommandOutput) => void
): void;
}

/**
Expand Down
7 changes: 5 additions & 2 deletions clients/client-personalize/src/PersonalizeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ import {
UpdateMetricAttributionCommandOutput,
} from "./commands/UpdateMetricAttributionCommand";
import { UpdateRecommenderCommandInput, UpdateRecommenderCommandOutput } from "./commands/UpdateRecommenderCommand";
import { UpdateSolutionCommandInput, UpdateSolutionCommandOutput } from "./commands/UpdateSolutionCommand";
import {
ClientInputEndpointParameters,
ClientResolvedEndpointParameters,
Expand Down Expand Up @@ -297,7 +298,8 @@ export type ServiceInputTypes =
| UpdateCampaignCommandInput
| UpdateDatasetCommandInput
| UpdateMetricAttributionCommandInput
| UpdateRecommenderCommandInput;
| UpdateRecommenderCommandInput
| UpdateSolutionCommandInput;

/**
* @public
Expand Down Expand Up @@ -372,7 +374,8 @@ export type ServiceOutputTypes =
| UpdateCampaignCommandOutput
| UpdateDatasetCommandOutput
| UpdateMetricAttributionCommandOutput
| UpdateRecommenderCommandOutput;
| UpdateRecommenderCommandOutput
| UpdateSolutionCommandOutput;

/**
* @public
Expand Down
13 changes: 10 additions & 3 deletions clients/client-personalize/src/commands/CreateSolutionCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ export interface CreateSolutionCommandOutput extends CreateSolutionResponse, __M

/**
* <important>
* <p>After you create a solution, you can’t change its configuration. By default, all new solutions use automatic training. With automatic training, you incur training costs while
* your solution is active. You can't stop automatic training for a solution. To avoid unnecessary costs, make sure to delete the solution when you are finished. For information about training
* <p>By default, all new solutions use automatic training. With automatic training, you incur training costs while
* your solution is active. To avoid unnecessary costs, when you are finished you can
* <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_UpdateSolution.html">update the solution</a> to turn off automatic training.
* For information about training
* costs, see <a href="https://aws.amazon.com/personalize/pricing/">Amazon Personalize pricing</a>.</p>
* </important>
* <p>Creates the configuration for training a model (creating a solution version). This configuration
Expand All @@ -39,7 +41,7 @@ export interface CreateSolutionCommandOutput extends CreateSolutionResponse, __M
* </p>
* <p>
* By default, new solutions use automatic training to create solution versions every 7 days. You can change the training frequency.
* Automatic solution version creation starts one hour after the solution is ACTIVE. If you manually create a solution version within
* Automatic solution version creation starts within one hour after the solution is ACTIVE. If you manually create a solution version within
* the hour, the solution skips the first automatic training. For more information,
* see <a href="https://docs.aws.amazon.com/personalize/latest/dg/solution-config-auto-training.html">Configuring automatic training</a>.</p>
* <p>
Expand Down Expand Up @@ -78,6 +80,11 @@ export interface CreateSolutionCommandOutput extends CreateSolutionResponse, __M
* <ul>
* <li>
* <p>
* <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_UpdateSolution.html">UpdateSolution</a>
* </p>
* </li>
* <li>
* <p>
* <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_ListSolutions.html">ListSolutions</a>
* </p>
* </li>
Expand Down
12 changes: 12 additions & 0 deletions clients/client-personalize/src/commands/DescribeSolutionCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@ export interface DescribeSolutionCommandOutput extends DescribeSolutionResponse,
* // lastUpdatedDateTime: new Date("TIMESTAMP"),
* // failureReason: "STRING_VALUE",
* // },
* // latestSolutionUpdate: { // SolutionUpdateSummary
* // solutionUpdateConfig: { // SolutionUpdateConfig
* // autoTrainingConfig: {
* // schedulingExpression: "STRING_VALUE",
* // },
* // },
* // status: "STRING_VALUE",
* // performAutoTraining: true || false,
* // creationDateTime: new Date("TIMESTAMP"),
* // lastUpdatedDateTime: new Date("TIMESTAMP"),
* // failureReason: "STRING_VALUE",
* // },
* // },
* // };
*
Expand Down
109 changes: 109 additions & 0 deletions clients/client-personalize/src/commands/UpdateSolutionCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// 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 { UpdateSolutionRequest, UpdateSolutionResponse } from "../models/models_0";
import { PersonalizeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../PersonalizeClient";
import { de_UpdateSolutionCommand, se_UpdateSolutionCommand } from "../protocols/Aws_json1_1";

/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link UpdateSolutionCommand}.
*/
export interface UpdateSolutionCommandInput extends UpdateSolutionRequest {}
/**
* @public
*
* The output of {@link UpdateSolutionCommand}.
*/
export interface UpdateSolutionCommandOutput extends UpdateSolutionResponse, __MetadataBearer {}

/**
* <p>Updates an Amazon Personalize solution to use a different automatic training configuration. When you update a solution,
* you can change whether the solution uses
* automatic training, and you can change the training frequency. For more information about updating a solution, see
* <a href="https://docs.aws.amazon.com/personalize/latest/dg/updating-solution.html">Updating a solution</a>.</p>
* <p>A solution update can be in one of the
* following states:</p>
* <p>CREATE PENDING > CREATE IN_PROGRESS > ACTIVE -or- CREATE FAILED</p>
* <p>To get the status of a solution update, call the
* <a href="https://docs.aws.amazon.com/personalize/latest/dg/API_DescribeSolution.html">DescribeSolution</a> API operation and find the status
* in the <code>latestSolutionUpdate</code>. </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { PersonalizeClient, UpdateSolutionCommand } from "@aws-sdk/client-personalize"; // ES Modules import
* // const { PersonalizeClient, UpdateSolutionCommand } = require("@aws-sdk/client-personalize"); // CommonJS import
* const client = new PersonalizeClient(config);
* const input = { // UpdateSolutionRequest
* solutionArn: "STRING_VALUE", // required
* performAutoTraining: true || false,
* solutionUpdateConfig: { // SolutionUpdateConfig
* autoTrainingConfig: { // AutoTrainingConfig
* schedulingExpression: "STRING_VALUE",
* },
* },
* };
* const command = new UpdateSolutionCommand(input);
* const response = await client.send(command);
* // { // UpdateSolutionResponse
* // solutionArn: "STRING_VALUE",
* // };
*
* ```
*
* @param UpdateSolutionCommandInput - {@link UpdateSolutionCommandInput}
* @returns {@link UpdateSolutionCommandOutput}
* @see {@link UpdateSolutionCommandInput} for command's `input` shape.
* @see {@link UpdateSolutionCommandOutput} for command's `response` shape.
* @see {@link PersonalizeClientResolvedConfig | config} for PersonalizeClient's `config` shape.
*
* @throws {@link InvalidInputException} (client fault)
* <p>Provide a valid value for the field or parameter.</p>
*
* @throws {@link LimitExceededException} (client fault)
* <p>The limit on the number of requests per second has been exceeded.</p>
*
* @throws {@link ResourceInUseException} (client fault)
* <p>The specified resource is in use.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>Could not find the specified resource.</p>
*
* @throws {@link PersonalizeServiceException}
* <p>Base exception class for all service exceptions from Personalize service.</p>
*
* @public
*/
export class UpdateSolutionCommand extends $Command
.classBuilder<
UpdateSolutionCommandInput,
UpdateSolutionCommandOutput,
PersonalizeClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep({
...commonParams,
})
.m(function (this: any, Command: any, cs: any, config: PersonalizeClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("AmazonPersonalize", "UpdateSolution", {})
.n("PersonalizeClient", "UpdateSolutionCommand")
.f(void 0, void 0)
.ser(se_UpdateSolutionCommand)
.de(de_UpdateSolutionCommand)
.build() {}
1 change: 1 addition & 0 deletions clients/client-personalize/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ export * from "./UpdateCampaignCommand";
export * from "./UpdateDatasetCommand";
export * from "./UpdateMetricAttributionCommand";
export * from "./UpdateRecommenderCommand";
export * from "./UpdateSolutionCommand";
Loading

0 comments on commit 238987e

Please sign in to comment.