diff --git a/clients/client-personalize/README.md b/clients/client-personalize/README.md index d4d7f99e18d4..d583f01d8f20 100644 --- a/clients/client-personalize/README.md +++ b/clients/client-personalize/README.md @@ -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) + +
+ +UpdateDataset + + +[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) +
diff --git a/clients/client-personalize/src/Personalize.ts b/clients/client-personalize/src/Personalize.ts index ae6c13d7e0f4..2021a7efd596 100644 --- a/clients/client-personalize/src/Personalize.ts +++ b/clients/client-personalize/src/Personalize.ts @@ -306,6 +306,11 @@ import { UpdateCampaignCommandInput, UpdateCampaignCommandOutput, } from "./commands/UpdateCampaignCommand"; +import { + UpdateDatasetCommand, + UpdateDatasetCommandInput, + UpdateDatasetCommandOutput, +} from "./commands/UpdateDatasetCommand"; import { UpdateMetricAttributionCommand, UpdateMetricAttributionCommandInput, @@ -383,6 +388,7 @@ const commands = { TagResourceCommand, UntagResourceCommand, UpdateCampaignCommand, + UpdateDatasetCommand, UpdateMetricAttributionCommand, UpdateRecommenderCommand, }; @@ -1362,6 +1368,17 @@ export interface Personalize { cb: (err: any, data?: UpdateCampaignCommandOutput) => void ): void; + /** + * @see {@link UpdateDatasetCommand} + */ + updateDataset(args: UpdateDatasetCommandInput, options?: __HttpHandlerOptions): Promise; + 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} */ diff --git a/clients/client-personalize/src/PersonalizeClient.ts b/clients/client-personalize/src/PersonalizeClient.ts index cec2f9c68592..ec7c1a31cba8 100644 --- a/clients/client-personalize/src/PersonalizeClient.ts +++ b/clients/client-personalize/src/PersonalizeClient.ts @@ -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, @@ -274,6 +275,7 @@ export type ServiceInputTypes = | TagResourceCommandInput | UntagResourceCommandInput | UpdateCampaignCommandInput + | UpdateDatasetCommandInput | UpdateMetricAttributionCommandInput | UpdateRecommenderCommandInput; @@ -345,6 +347,7 @@ export type ServiceOutputTypes = | TagResourceCommandOutput | UntagResourceCommandOutput | UpdateCampaignCommandOutput + | UpdateDatasetCommandOutput | UpdateMetricAttributionCommandOutput | UpdateRecommenderCommandOutput; diff --git a/clients/client-personalize/src/commands/DescribeDatasetCommand.ts b/clients/client-personalize/src/commands/DescribeDatasetCommand.ts index e5c71ad529ae..4a96ff0add33 100644 --- a/clients/client-personalize/src/commands/DescribeDatasetCommand.ts +++ b/clients/client-personalize/src/commands/DescribeDatasetCommand.ts @@ -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"), + * // }, * // }, * // }; * diff --git a/clients/client-personalize/src/commands/UpdateDatasetCommand.ts b/clients/client-personalize/src/commands/UpdateDatasetCommand.ts new file mode 100644 index 000000000000..6bbcc6454af2 --- /dev/null +++ b/clients/client-personalize/src/commands/UpdateDatasetCommand.ts @@ -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 + *

Update a dataset to replace its schema with a new or existing one. For more information, see Replacing a dataset's schema.

+ * @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) + *

Provide a valid value for the field or parameter.

+ * + * @throws {@link ResourceInUseException} (client fault) + *

The specified resource is in use.

+ * + * @throws {@link ResourceNotFoundException} (client fault) + *

Could not find the specified resource.

+ * + * @throws {@link PersonalizeServiceException} + *

Base exception class for all service exceptions from Personalize service.

+ * + */ +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, + configuration: PersonalizeClientResolvedConfig, + options?: __HttpHandlerOptions + ): Handler { + 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) => + 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 { + return de_UpdateDatasetCommand(output, context); + } + + // Start section: command_body_extra + // End section: command_body_extra +} diff --git a/clients/client-personalize/src/commands/index.ts b/clients/client-personalize/src/commands/index.ts index 3e95fecdbbd0..c2e3721815e9 100644 --- a/clients/client-personalize/src/commands/index.ts +++ b/clients/client-personalize/src/commands/index.ts @@ -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"; diff --git a/clients/client-personalize/src/models/models_0.ts b/clients/client-personalize/src/models/models_0.ts index 9f54ec0e6e4b..52536d97e731 100644 --- a/clients/client-personalize/src/models/models_0.ts +++ b/clients/client-personalize/src/models/models_0.ts @@ -1416,7 +1416,7 @@ export interface CreateSolutionRequest { performAutoML?: boolean; /** - *

The ARN of the recipe to use for model training. Only specified when + *

The ARN of the recipe to use for model training. This is required when * performAutoML is false.

*/ recipeArn?: string; @@ -1993,6 +1993,37 @@ export interface DescribeDatasetRequest { datasetArn: string | undefined; } +/** + * @public + *

Describes an update to a dataset.

+ */ +export interface DatasetUpdateSummary { + /** + *

The Amazon Resource Name (ARN) of the schema that replaced the previous schema of the dataset.

+ */ + schemaArn?: string; + + /** + *

The status of the dataset update.

+ */ + status?: string; + + /** + *

If updating a dataset fails, provides the reason why.

+ */ + failureReason?: string; + + /** + *

The creation date and time (in Unix time) of the dataset update.

+ */ + creationDateTime?: Date; + + /** + *

The last update date and time (in Unix time) of the dataset.

+ */ + lastUpdatedDateTime?: Date; +} + /** * @public *

Provides metadata for a dataset.

@@ -2059,6 +2090,11 @@ export interface Dataset { *

A time stamp that shows when the dataset was updated.

*/ lastUpdatedDateTime?: Date; + + /** + *

Describes the latest update to the dataset.

+ */ + latestDatasetUpdate?: DatasetUpdateSummary; } /** @@ -3052,7 +3088,8 @@ export interface Solution { performAutoML?: boolean; /** - *

The ARN of the recipe used to create the solution.

+ *

The ARN of the recipe used to create the solution. This is required when + * performAutoML is false.

*/ recipeArn?: string; @@ -4750,6 +4787,31 @@ export interface UpdateCampaignResponse { campaignArn?: string; } +/** + * @public + */ +export interface UpdateDatasetRequest { + /** + *

The Amazon Resource Name (ARN) of the dataset that you want to update.

+ */ + datasetArn: string | undefined; + + /** + *

The Amazon Resource Name (ARN) of the new schema you want use.

+ */ + schemaArn: string | undefined; +} + +/** + * @public + */ +export interface UpdateDatasetResponse { + /** + *

The Amazon Resource Name (ARN) of the dataset you updated.

+ */ + datasetArn?: string; +} + /** * @public */ diff --git a/clients/client-personalize/src/protocols/Aws_json1_1.ts b/clients/client-personalize/src/protocols/Aws_json1_1.ts index e276a658b038..bab3178ed62a 100644 --- a/clients/client-personalize/src/protocols/Aws_json1_1.ts +++ b/clients/client-personalize/src/protocols/Aws_json1_1.ts @@ -164,6 +164,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, @@ -212,6 +213,7 @@ import { DatasetSchema, DatasetSchemaSummary, DatasetSummary, + DatasetUpdateSummary, DataSource, DefaultContinuousHyperParameterRange, DefaultHyperParameterRanges, @@ -335,6 +337,7 @@ import { TrainingDataConfig, UntagResourceRequest, UpdateCampaignRequest, + UpdateDatasetRequest, UpdateMetricAttributionRequest, UpdateRecommenderRequest, } from "../models/models_0"; @@ -1172,6 +1175,19 @@ export const se_UpdateCampaignCommand = async ( return buildHttpRpcRequest(context, headers, "/", undefined, body); }; +/** + * serializeAws_json1_1UpdateDatasetCommand + */ +export const se_UpdateDatasetCommand = async ( + input: UpdateDatasetCommandInput, + context: __SerdeContext +): Promise<__HttpRequest> => { + const headers: __HeaderBag = sharedHeaders("UpdateDataset"); + let body: any; + body = JSON.stringify(_json(input)); + return buildHttpRpcRequest(context, headers, "/", undefined, body); +}; + /** * serializeAws_json1_1UpdateMetricAttributionCommand */ @@ -4508,6 +4524,58 @@ const de_UpdateCampaignCommandError = async ( } }; +/** + * deserializeAws_json1_1UpdateDatasetCommand + */ +export const de_UpdateDatasetCommand = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + if (output.statusCode >= 300) { + return de_UpdateDatasetCommandError(output, context); + } + const data: any = await parseBody(output.body, context); + let contents: any = {}; + contents = _json(data); + const response: UpdateDatasetCommandOutput = { + $metadata: deserializeMetadata(output), + ...contents, + }; + return response; +}; + +/** + * deserializeAws_json1_1UpdateDatasetCommandError + */ +const de_UpdateDatasetCommandError = async ( + output: __HttpResponse, + context: __SerdeContext +): Promise => { + const parsedOutput: any = { + ...output, + body: await parseErrorBody(output.body, context), + }; + const errorCode = loadRestJsonErrorCode(output, parsedOutput.body); + switch (errorCode) { + case "InvalidInputException": + case "com.amazonaws.personalize#InvalidInputException": + throw await de_InvalidInputExceptionRes(parsedOutput, context); + case "ResourceInUseException": + case "com.amazonaws.personalize#ResourceInUseException": + throw await de_ResourceInUseExceptionRes(parsedOutput, context); + case "ResourceNotFoundException": + case "com.amazonaws.personalize#ResourceNotFoundException": + throw await de_ResourceNotFoundExceptionRes(parsedOutput, context); + default: + const parsedBody = parsedOutput.body; + return throwDefaultError({ + output, + parsedBody, + errorCode, + }); + } +}; + /** * deserializeAws_json1_1UpdateMetricAttributionCommand */ @@ -5008,6 +5076,8 @@ const se_SolutionConfig = (input: SolutionConfig, context: __SerdeContext): any // se_UpdateCampaignRequest omitted. +// se_UpdateDatasetRequest omitted. + // se_UpdateMetricAttributionRequest omitted. // se_UpdateRecommenderRequest omitted. @@ -5273,6 +5343,7 @@ const de_Dataset = (output: any, context: __SerdeContext): Dataset => { datasetGroupArn: __expectString, datasetType: __expectString, lastUpdatedDateTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + latestDatasetUpdate: (_: any) => de_DatasetUpdateSummary(_, context), name: __expectString, schemaArn: __expectString, status: __expectString, @@ -5468,6 +5539,19 @@ const de_DatasetSummary = (output: any, context: __SerdeContext): DatasetSummary }) as any; }; +/** + * deserializeAws_json1_1DatasetUpdateSummary + */ +const de_DatasetUpdateSummary = (output: any, context: __SerdeContext): DatasetUpdateSummary => { + return take(output, { + creationDateTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + failureReason: __expectString, + lastUpdatedDateTime: (_: any) => __expectNonNull(__parseEpochTimestamp(__expectNumber(_))), + schemaArn: __expectString, + status: __expectString, + }) as any; +}; + // de_DataSource omitted. // de_DefaultCategoricalHyperParameterRange omitted. @@ -6316,6 +6400,8 @@ const de_SolutionVersionSummary = (output: any, context: __SerdeContext): Soluti // de_UpdateCampaignResponse omitted. +// de_UpdateDatasetResponse omitted. + // de_UpdateMetricAttributionResponse omitted. // de_UpdateRecommenderResponse omitted. diff --git a/codegen/sdk-codegen/aws-models/personalize.json b/codegen/sdk-codegen/aws-models/personalize.json index 103a4f3fca60..003175369559 100644 --- a/codegen/sdk-codegen/aws-models/personalize.json +++ b/codegen/sdk-codegen/aws-models/personalize.json @@ -323,6 +323,9 @@ { "target": "com.amazonaws.personalize#UpdateCampaign" }, + { + "target": "com.amazonaws.personalize#UpdateDataset" + }, { "target": "com.amazonaws.personalize#UpdateMetricAttribution" }, @@ -3010,7 +3013,7 @@ "recipeArn": { "target": "com.amazonaws.personalize#Arn", "traits": { - "smithy.api#documentation": "

The ARN of the recipe to use for model training. Only specified when\n performAutoML is false.

" + "smithy.api#documentation": "

The ARN of the recipe to use for model training. This is required when\n performAutoML is false.

" } }, "datasetGroupArn": { @@ -3200,6 +3203,12 @@ "traits": { "smithy.api#documentation": "

A time stamp that shows when the dataset was updated.

" } + }, + "latestDatasetUpdate": { + "target": "com.amazonaws.personalize#DatasetUpdateSummary", + "traits": { + "smithy.api#documentation": "

Describes the latest update to the dataset.

" + } } }, "traits": { @@ -3739,6 +3748,44 @@ } } }, + "com.amazonaws.personalize#DatasetUpdateSummary": { + "type": "structure", + "members": { + "schemaArn": { + "target": "com.amazonaws.personalize#Arn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the schema that replaced the previous schema of the dataset.

" + } + }, + "status": { + "target": "com.amazonaws.personalize#Status", + "traits": { + "smithy.api#documentation": "

The status of the dataset update.

" + } + }, + "failureReason": { + "target": "com.amazonaws.personalize#FailureReason", + "traits": { + "smithy.api#documentation": "

If updating a dataset fails, provides the reason why.

" + } + }, + "creationDateTime": { + "target": "com.amazonaws.personalize#Date", + "traits": { + "smithy.api#documentation": "

The creation date and time (in Unix time) of the dataset update.

" + } + }, + "lastUpdatedDateTime": { + "target": "com.amazonaws.personalize#Date", + "traits": { + "smithy.api#documentation": "

The last update date and time (in Unix time) of the dataset.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Describes an update to a dataset.

" + } + }, "com.amazonaws.personalize#Datasets": { "type": "list", "member": { @@ -7868,7 +7915,7 @@ "recipeArn": { "target": "com.amazonaws.personalize#Arn", "traits": { - "smithy.api#documentation": "

The ARN of the recipe used to create the solution.

" + "smithy.api#documentation": "

The ARN of the recipe used to create the solution. This is required when\n performAutoML is false.

" } }, "datasetGroupArn": { @@ -8701,6 +8748,66 @@ "smithy.api#output": {} } }, + "com.amazonaws.personalize#UpdateDataset": { + "type": "operation", + "input": { + "target": "com.amazonaws.personalize#UpdateDatasetRequest" + }, + "output": { + "target": "com.amazonaws.personalize#UpdateDatasetResponse" + }, + "errors": [ + { + "target": "com.amazonaws.personalize#InvalidInputException" + }, + { + "target": "com.amazonaws.personalize#ResourceInUseException" + }, + { + "target": "com.amazonaws.personalize#ResourceNotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Update a dataset to replace its schema with a new or existing one. For more information, see Replacing a dataset's schema.

", + "smithy.api#idempotent": {} + } + }, + "com.amazonaws.personalize#UpdateDatasetRequest": { + "type": "structure", + "members": { + "datasetArn": { + "target": "com.amazonaws.personalize#Arn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the dataset that you want to update.

", + "smithy.api#required": {} + } + }, + "schemaArn": { + "target": "com.amazonaws.personalize#Arn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the new schema you want use.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#input": {} + } + }, + "com.amazonaws.personalize#UpdateDatasetResponse": { + "type": "structure", + "members": { + "datasetArn": { + "target": "com.amazonaws.personalize#Arn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the dataset you updated.

" + } + } + }, + "traits": { + "smithy.api#output": {} + } + }, "com.amazonaws.personalize#UpdateMetricAttribution": { "type": "operation", "input": {