Skip to content

Commit

Permalink
feat(client-personalize): This release provides ability to customers …
Browse files Browse the repository at this point in the history
…to change schema associated with their datasets in Amazon Personalize
  • Loading branch information
awstools committed Jul 13, 2023
1 parent 243007b commit 537b4b3
Show file tree
Hide file tree
Showing 9 changed files with 445 additions and 4 deletions.
8 changes: 8 additions & 0 deletions clients/client-personalize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,14 @@ UpdateCampaign

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-personalize/classes/updatecampaigncommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-personalize/interfaces/updatecampaigncommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-personalize/interfaces/updatecampaigncommandoutput.html)

</details>
<details>
<summary>
UpdateDataset
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-personalize/classes/updatedatasetcommand.html) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-personalize/interfaces/updatedatasetcommandinput.html) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-personalize/interfaces/updatedatasetcommandoutput.html)

</details>
<details>
<summary>
Expand Down
17 changes: 17 additions & 0 deletions clients/client-personalize/src/Personalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@ import {
UpdateCampaignCommandInput,
UpdateCampaignCommandOutput,
} from "./commands/UpdateCampaignCommand";
import {
UpdateDatasetCommand,
UpdateDatasetCommandInput,
UpdateDatasetCommandOutput,
} from "./commands/UpdateDatasetCommand";
import {
UpdateMetricAttributionCommand,
UpdateMetricAttributionCommandInput,
Expand Down Expand Up @@ -383,6 +388,7 @@ const commands = {
TagResourceCommand,
UntagResourceCommand,
UpdateCampaignCommand,
UpdateDatasetCommand,
UpdateMetricAttributionCommand,
UpdateRecommenderCommand,
};
Expand Down Expand Up @@ -1362,6 +1368,17 @@ export interface Personalize {
cb: (err: any, data?: UpdateCampaignCommandOutput) => void
): void;

/**
* @see {@link UpdateDatasetCommand}
*/
updateDataset(args: UpdateDatasetCommandInput, options?: __HttpHandlerOptions): Promise<UpdateDatasetCommandOutput>;
updateDataset(args: UpdateDatasetCommandInput, cb: (err: any, data?: UpdateDatasetCommandOutput) => void): void;
updateDataset(
args: UpdateDatasetCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: UpdateDatasetCommandOutput) => void
): void;

/**
* @see {@link UpdateMetricAttributionCommand}
*/
Expand Down
3 changes: 3 additions & 0 deletions clients/client-personalize/src/PersonalizeClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ import {
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
import { UpdateCampaignCommandInput, UpdateCampaignCommandOutput } from "./commands/UpdateCampaignCommand";
import { UpdateDatasetCommandInput, UpdateDatasetCommandOutput } from "./commands/UpdateDatasetCommand";
import {
UpdateMetricAttributionCommandInput,
UpdateMetricAttributionCommandOutput,
Expand Down Expand Up @@ -274,6 +275,7 @@ export type ServiceInputTypes =
| TagResourceCommandInput
| UntagResourceCommandInput
| UpdateCampaignCommandInput
| UpdateDatasetCommandInput
| UpdateMetricAttributionCommandInput
| UpdateRecommenderCommandInput;

Expand Down Expand Up @@ -345,6 +347,7 @@ export type ServiceOutputTypes =
| TagResourceCommandOutput
| UntagResourceCommandOutput
| UpdateCampaignCommandOutput
| UpdateDatasetCommandOutput
| UpdateMetricAttributionCommandOutput
| UpdateRecommenderCommandOutput;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ export interface DescribeDatasetCommandOutput extends DescribeDatasetResponse, _
* // status: "STRING_VALUE",
* // creationDateTime: new Date("TIMESTAMP"),
* // lastUpdatedDateTime: new Date("TIMESTAMP"),
* // latestDatasetUpdate: { // DatasetUpdateSummary
* // schemaArn: "STRING_VALUE",
* // status: "STRING_VALUE",
* // failureReason: "STRING_VALUE",
* // creationDateTime: new Date("TIMESTAMP"),
* // lastUpdatedDateTime: new Date("TIMESTAMP"),
* // },
* // },
* // };
*
Expand Down
150 changes: 150 additions & 0 deletions clients/client-personalize/src/commands/UpdateDatasetCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
// smithy-typescript generated code
import { EndpointParameterInstructions, getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
import { Command as $Command } from "@smithy/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@smithy/types";

import { UpdateDatasetRequest, UpdateDatasetResponse } from "../models/models_0";
import { PersonalizeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../PersonalizeClient";
import { de_UpdateDatasetCommand, se_UpdateDatasetCommand } from "../protocols/Aws_json1_1";

/**
* @public
*/
export { __MetadataBearer, $Command };
/**
* @public
*
* The input for {@link UpdateDatasetCommand}.
*/
export interface UpdateDatasetCommandInput extends UpdateDatasetRequest {}
/**
* @public
*
* The output of {@link UpdateDatasetCommand}.
*/
export interface UpdateDatasetCommandOutput extends UpdateDatasetResponse, __MetadataBearer {}

/**
* @public
* <p>Update a dataset to replace its schema with a new or existing one. For more information, see <a href="https://docs.aws.amazon.com/personalize/latest/dg/updating-dataset-schema.html">Replacing a dataset's schema</a>. </p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { PersonalizeClient, UpdateDatasetCommand } from "@aws-sdk/client-personalize"; // ES Modules import
* // const { PersonalizeClient, UpdateDatasetCommand } = require("@aws-sdk/client-personalize"); // CommonJS import
* const client = new PersonalizeClient(config);
* const input = { // UpdateDatasetRequest
* datasetArn: "STRING_VALUE", // required
* schemaArn: "STRING_VALUE", // required
* };
* const command = new UpdateDatasetCommand(input);
* const response = await client.send(command);
* // { // UpdateDatasetResponse
* // datasetArn: "STRING_VALUE",
* // };
*
* ```
*
* @param UpdateDatasetCommandInput - {@link UpdateDatasetCommandInput}
* @returns {@link UpdateDatasetCommandOutput}
* @see {@link UpdateDatasetCommandInput} for command's `input` shape.
* @see {@link UpdateDatasetCommandOutput} 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 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>
*
*/
export class UpdateDatasetCommand extends $Command<
UpdateDatasetCommandInput,
UpdateDatasetCommandOutput,
PersonalizeClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

public static getEndpointParameterInstructions(): EndpointParameterInstructions {
return {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
}

/**
* @public
*/
constructor(readonly input: UpdateDatasetCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: PersonalizeClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<UpdateDatasetCommandInput, UpdateDatasetCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
this.middlewareStack.use(getEndpointPlugin(configuration, UpdateDatasetCommand.getEndpointParameterInstructions()));

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "PersonalizeClient";
const commandName = "UpdateDatasetCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: (_: any) => _,
outputFilterSensitiveLog: (_: any) => _,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

/**
* @internal
*/
private serialize(input: UpdateDatasetCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return se_UpdateDatasetCommand(input, context);
}

/**
* @internal
*/
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<UpdateDatasetCommandOutput> {
return de_UpdateDatasetCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
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 @@ -63,5 +63,6 @@ export * from "./StopSolutionVersionCreationCommand";
export * from "./TagResourceCommand";
export * from "./UntagResourceCommand";
export * from "./UpdateCampaignCommand";
export * from "./UpdateDatasetCommand";
export * from "./UpdateMetricAttributionCommand";
export * from "./UpdateRecommenderCommand";
66 changes: 64 additions & 2 deletions clients/client-personalize/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1416,7 +1416,7 @@ export interface CreateSolutionRequest {
performAutoML?: boolean;

/**
* <p>The ARN of the recipe to use for model training. Only specified when
* <p>The ARN of the recipe to use for model training. This is required when
* <code>performAutoML</code> is false.</p>
*/
recipeArn?: string;
Expand Down Expand Up @@ -1993,6 +1993,37 @@ export interface DescribeDatasetRequest {
datasetArn: string | undefined;
}

/**
* @public
* <p>Describes an update to a dataset.</p>
*/
export interface DatasetUpdateSummary {
/**
* <p>The Amazon Resource Name (ARN) of the schema that replaced the previous schema of the dataset.</p>
*/
schemaArn?: string;

/**
* <p>The status of the dataset update. </p>
*/
status?: string;

/**
* <p>If updating a dataset fails, provides the reason why.</p>
*/
failureReason?: string;

/**
* <p>The creation date and time (in Unix time) of the dataset update.</p>
*/
creationDateTime?: Date;

/**
* <p>The last update date and time (in Unix time) of the dataset.</p>
*/
lastUpdatedDateTime?: Date;
}

/**
* @public
* <p>Provides metadata for a dataset.</p>
Expand Down Expand Up @@ -2059,6 +2090,11 @@ export interface Dataset {
* <p>A time stamp that shows when the dataset was updated.</p>
*/
lastUpdatedDateTime?: Date;

/**
* <p>Describes the latest update to the dataset.</p>
*/
latestDatasetUpdate?: DatasetUpdateSummary;
}

/**
Expand Down Expand Up @@ -3052,7 +3088,8 @@ export interface Solution {
performAutoML?: boolean;

/**
* <p>The ARN of the recipe used to create the solution.</p>
* <p>The ARN of the recipe used to create the solution. This is required when
* <code>performAutoML</code> is false.</p>
*/
recipeArn?: string;

Expand Down Expand Up @@ -4750,6 +4787,31 @@ export interface UpdateCampaignResponse {
campaignArn?: string;
}

/**
* @public
*/
export interface UpdateDatasetRequest {
/**
* <p>The Amazon Resource Name (ARN) of the dataset that you want to update.</p>
*/
datasetArn: string | undefined;

/**
* <p>The Amazon Resource Name (ARN) of the new schema you want use.</p>
*/
schemaArn: string | undefined;
}

/**
* @public
*/
export interface UpdateDatasetResponse {
/**
* <p>The Amazon Resource Name (ARN) of the dataset you updated.</p>
*/
datasetArn?: string;
}

/**
* @public
*/
Expand Down
Loading

0 comments on commit 537b4b3

Please sign in to comment.