From bf837dc3551b3f093fac15069418185cf6d21ea3 Mon Sep 17 00:00:00 2001 From: awstools Date: Tue, 23 Apr 2024 18:21:38 +0000 Subject: [PATCH] feat(client-bedrock-agent): Introducing the ability to create multiple data sources per knowledge base, specify S3 buckets as data sources from external accounts, and exposing levers to define the deletion behavior of the underlying vector store data. --- .../src/commands/CreateDataSourceCommand.ts | 9 ++- .../commands/CreateKnowledgeBaseCommand.ts | 2 +- .../src/commands/DeleteDataSourceCommand.ts | 2 +- .../commands/DeleteKnowledgeBaseCommand.ts | 2 +- .../src/commands/GetDataSourceCommand.ts | 7 +- .../src/commands/GetKnowledgeBaseCommand.ts | 2 +- .../src/commands/ListDataSourcesCommand.ts | 2 +- .../src/commands/ListKnowledgeBasesCommand.ts | 2 +- .../src/commands/UpdateDataSourceCommand.ts | 9 ++- .../commands/UpdateKnowledgeBaseCommand.ts | 2 +- .../src/models/models_0.ts | 46 +++++++++++++ .../src/protocols/Aws_restJson1.ts | 4 ++ .../sdk-codegen/aws-models/bedrock-agent.json | 69 +++++++++++++++++++ 13 files changed, 148 insertions(+), 10 deletions(-) diff --git a/clients/client-bedrock-agent/src/commands/CreateDataSourceCommand.ts b/clients/client-bedrock-agent/src/commands/CreateDataSourceCommand.ts index a7d2ec4010a6..9ec1f222af6b 100644 --- a/clients/client-bedrock-agent/src/commands/CreateDataSourceCommand.ts +++ b/clients/client-bedrock-agent/src/commands/CreateDataSourceCommand.ts @@ -49,8 +49,10 @@ export interface CreateDataSourceCommandOutput extends CreateDataSourceResponse, * inclusionPrefixes: [ // S3Prefixes * "STRING_VALUE", * ], + * bucketOwnerAccountId: "STRING_VALUE", * }, * }, + * dataDeletionPolicy: "RETAIN" || "DELETE", * serverSideEncryptionConfiguration: { // ServerSideEncryptionConfiguration * kmsKeyArn: "STRING_VALUE", * }, @@ -71,7 +73,7 @@ export interface CreateDataSourceCommandOutput extends CreateDataSourceResponse, * // knowledgeBaseId: "STRING_VALUE", // required * // dataSourceId: "STRING_VALUE", // required * // name: "STRING_VALUE", // required - * // status: "AVAILABLE" || "DELETING", // required + * // status: "AVAILABLE" || "DELETING" || "DELETE_UNSUCCESSFUL", // required * // description: "STRING_VALUE", * // dataSourceConfiguration: { // DataSourceConfiguration * // type: "S3", // required @@ -80,6 +82,7 @@ export interface CreateDataSourceCommandOutput extends CreateDataSourceResponse, * // inclusionPrefixes: [ // S3Prefixes * // "STRING_VALUE", * // ], + * // bucketOwnerAccountId: "STRING_VALUE", * // }, * // }, * // serverSideEncryptionConfiguration: { // ServerSideEncryptionConfiguration @@ -94,8 +97,12 @@ export interface CreateDataSourceCommandOutput extends CreateDataSourceResponse, * // }, * // }, * // }, + * // dataDeletionPolicy: "RETAIN" || "DELETE", * // createdAt: new Date("TIMESTAMP"), // required * // updatedAt: new Date("TIMESTAMP"), // required + * // failureReasons: [ // FailureReasons + * // "STRING_VALUE", + * // ], * // }, * // }; * diff --git a/clients/client-bedrock-agent/src/commands/CreateKnowledgeBaseCommand.ts b/clients/client-bedrock-agent/src/commands/CreateKnowledgeBaseCommand.ts index 6136fe89e96c..71ac5fd3b40f 100644 --- a/clients/client-bedrock-agent/src/commands/CreateKnowledgeBaseCommand.ts +++ b/clients/client-bedrock-agent/src/commands/CreateKnowledgeBaseCommand.ts @@ -181,7 +181,7 @@ export interface CreateKnowledgeBaseCommandOutput extends CreateKnowledgeBaseRes * // }, * // }, * // }, - * // status: "CREATING" || "ACTIVE" || "DELETING" || "UPDATING" || "FAILED", // required + * // status: "CREATING" || "ACTIVE" || "DELETING" || "UPDATING" || "FAILED" || "DELETE_UNSUCCESSFUL", // required * // createdAt: new Date("TIMESTAMP"), // required * // updatedAt: new Date("TIMESTAMP"), // required * // failureReasons: [ // FailureReasons diff --git a/clients/client-bedrock-agent/src/commands/DeleteDataSourceCommand.ts b/clients/client-bedrock-agent/src/commands/DeleteDataSourceCommand.ts index 40c03532fa97..e1e57ce1c86c 100644 --- a/clients/client-bedrock-agent/src/commands/DeleteDataSourceCommand.ts +++ b/clients/client-bedrock-agent/src/commands/DeleteDataSourceCommand.ts @@ -43,7 +43,7 @@ export interface DeleteDataSourceCommandOutput extends DeleteDataSourceResponse, * // { // DeleteDataSourceResponse * // knowledgeBaseId: "STRING_VALUE", // required * // dataSourceId: "STRING_VALUE", // required - * // status: "AVAILABLE" || "DELETING", // required + * // status: "AVAILABLE" || "DELETING" || "DELETE_UNSUCCESSFUL", // required * // }; * * ``` diff --git a/clients/client-bedrock-agent/src/commands/DeleteKnowledgeBaseCommand.ts b/clients/client-bedrock-agent/src/commands/DeleteKnowledgeBaseCommand.ts index d9c90adcdfae..6d629f26702f 100644 --- a/clients/client-bedrock-agent/src/commands/DeleteKnowledgeBaseCommand.ts +++ b/clients/client-bedrock-agent/src/commands/DeleteKnowledgeBaseCommand.ts @@ -41,7 +41,7 @@ export interface DeleteKnowledgeBaseCommandOutput extends DeleteKnowledgeBaseRes * const response = await client.send(command); * // { // DeleteKnowledgeBaseResponse * // knowledgeBaseId: "STRING_VALUE", // required - * // status: "CREATING" || "ACTIVE" || "DELETING" || "UPDATING" || "FAILED", // required + * // status: "CREATING" || "ACTIVE" || "DELETING" || "UPDATING" || "FAILED" || "DELETE_UNSUCCESSFUL", // required * // }; * * ``` diff --git a/clients/client-bedrock-agent/src/commands/GetDataSourceCommand.ts b/clients/client-bedrock-agent/src/commands/GetDataSourceCommand.ts index cdd30eb93288..db8ef4d079a1 100644 --- a/clients/client-bedrock-agent/src/commands/GetDataSourceCommand.ts +++ b/clients/client-bedrock-agent/src/commands/GetDataSourceCommand.ts @@ -45,7 +45,7 @@ export interface GetDataSourceCommandOutput extends GetDataSourceResponse, __Met * // knowledgeBaseId: "STRING_VALUE", // required * // dataSourceId: "STRING_VALUE", // required * // name: "STRING_VALUE", // required - * // status: "AVAILABLE" || "DELETING", // required + * // status: "AVAILABLE" || "DELETING" || "DELETE_UNSUCCESSFUL", // required * // description: "STRING_VALUE", * // dataSourceConfiguration: { // DataSourceConfiguration * // type: "S3", // required @@ -54,6 +54,7 @@ export interface GetDataSourceCommandOutput extends GetDataSourceResponse, __Met * // inclusionPrefixes: [ // S3Prefixes * // "STRING_VALUE", * // ], + * // bucketOwnerAccountId: "STRING_VALUE", * // }, * // }, * // serverSideEncryptionConfiguration: { // ServerSideEncryptionConfiguration @@ -68,8 +69,12 @@ export interface GetDataSourceCommandOutput extends GetDataSourceResponse, __Met * // }, * // }, * // }, + * // dataDeletionPolicy: "RETAIN" || "DELETE", * // createdAt: new Date("TIMESTAMP"), // required * // updatedAt: new Date("TIMESTAMP"), // required + * // failureReasons: [ // FailureReasons + * // "STRING_VALUE", + * // ], * // }, * // }; * diff --git a/clients/client-bedrock-agent/src/commands/GetKnowledgeBaseCommand.ts b/clients/client-bedrock-agent/src/commands/GetKnowledgeBaseCommand.ts index 6a65a13bae8e..f3176c5a073d 100644 --- a/clients/client-bedrock-agent/src/commands/GetKnowledgeBaseCommand.ts +++ b/clients/client-bedrock-agent/src/commands/GetKnowledgeBaseCommand.ts @@ -95,7 +95,7 @@ export interface GetKnowledgeBaseCommandOutput extends GetKnowledgeBaseResponse, * // }, * // }, * // }, - * // status: "CREATING" || "ACTIVE" || "DELETING" || "UPDATING" || "FAILED", // required + * // status: "CREATING" || "ACTIVE" || "DELETING" || "UPDATING" || "FAILED" || "DELETE_UNSUCCESSFUL", // required * // createdAt: new Date("TIMESTAMP"), // required * // updatedAt: new Date("TIMESTAMP"), // required * // failureReasons: [ // FailureReasons diff --git a/clients/client-bedrock-agent/src/commands/ListDataSourcesCommand.ts b/clients/client-bedrock-agent/src/commands/ListDataSourcesCommand.ts index c25e67d51869..20adc1f2487d 100644 --- a/clients/client-bedrock-agent/src/commands/ListDataSourcesCommand.ts +++ b/clients/client-bedrock-agent/src/commands/ListDataSourcesCommand.ts @@ -47,7 +47,7 @@ export interface ListDataSourcesCommandOutput extends ListDataSourcesResponse, _ * // knowledgeBaseId: "STRING_VALUE", // required * // dataSourceId: "STRING_VALUE", // required * // name: "STRING_VALUE", // required - * // status: "AVAILABLE" || "DELETING", // required + * // status: "AVAILABLE" || "DELETING" || "DELETE_UNSUCCESSFUL", // required * // description: "STRING_VALUE", * // updatedAt: new Date("TIMESTAMP"), // required * // }, diff --git a/clients/client-bedrock-agent/src/commands/ListKnowledgeBasesCommand.ts b/clients/client-bedrock-agent/src/commands/ListKnowledgeBasesCommand.ts index 3d6a42766f43..6f69b9fa3f3c 100644 --- a/clients/client-bedrock-agent/src/commands/ListKnowledgeBasesCommand.ts +++ b/clients/client-bedrock-agent/src/commands/ListKnowledgeBasesCommand.ts @@ -46,7 +46,7 @@ export interface ListKnowledgeBasesCommandOutput extends ListKnowledgeBasesRespo * // knowledgeBaseId: "STRING_VALUE", // required * // name: "STRING_VALUE", // required * // description: "STRING_VALUE", - * // status: "CREATING" || "ACTIVE" || "DELETING" || "UPDATING" || "FAILED", // required + * // status: "CREATING" || "ACTIVE" || "DELETING" || "UPDATING" || "FAILED" || "DELETE_UNSUCCESSFUL", // required * // updatedAt: new Date("TIMESTAMP"), // required * // }, * // ], diff --git a/clients/client-bedrock-agent/src/commands/UpdateDataSourceCommand.ts b/clients/client-bedrock-agent/src/commands/UpdateDataSourceCommand.ts index d5f59fac72d0..11cd58bd4d0c 100644 --- a/clients/client-bedrock-agent/src/commands/UpdateDataSourceCommand.ts +++ b/clients/client-bedrock-agent/src/commands/UpdateDataSourceCommand.ts @@ -49,8 +49,10 @@ export interface UpdateDataSourceCommandOutput extends UpdateDataSourceResponse, * inclusionPrefixes: [ // S3Prefixes * "STRING_VALUE", * ], + * bucketOwnerAccountId: "STRING_VALUE", * }, * }, + * dataDeletionPolicy: "RETAIN" || "DELETE", * serverSideEncryptionConfiguration: { // ServerSideEncryptionConfiguration * kmsKeyArn: "STRING_VALUE", * }, @@ -71,7 +73,7 @@ export interface UpdateDataSourceCommandOutput extends UpdateDataSourceResponse, * // knowledgeBaseId: "STRING_VALUE", // required * // dataSourceId: "STRING_VALUE", // required * // name: "STRING_VALUE", // required - * // status: "AVAILABLE" || "DELETING", // required + * // status: "AVAILABLE" || "DELETING" || "DELETE_UNSUCCESSFUL", // required * // description: "STRING_VALUE", * // dataSourceConfiguration: { // DataSourceConfiguration * // type: "S3", // required @@ -80,6 +82,7 @@ export interface UpdateDataSourceCommandOutput extends UpdateDataSourceResponse, * // inclusionPrefixes: [ // S3Prefixes * // "STRING_VALUE", * // ], + * // bucketOwnerAccountId: "STRING_VALUE", * // }, * // }, * // serverSideEncryptionConfiguration: { // ServerSideEncryptionConfiguration @@ -94,8 +97,12 @@ export interface UpdateDataSourceCommandOutput extends UpdateDataSourceResponse, * // }, * // }, * // }, + * // dataDeletionPolicy: "RETAIN" || "DELETE", * // createdAt: new Date("TIMESTAMP"), // required * // updatedAt: new Date("TIMESTAMP"), // required + * // failureReasons: [ // FailureReasons + * // "STRING_VALUE", + * // ], * // }, * // }; * diff --git a/clients/client-bedrock-agent/src/commands/UpdateKnowledgeBaseCommand.ts b/clients/client-bedrock-agent/src/commands/UpdateKnowledgeBaseCommand.ts index 9b8d0e6efe94..f1a686fc9883 100644 --- a/clients/client-bedrock-agent/src/commands/UpdateKnowledgeBaseCommand.ts +++ b/clients/client-bedrock-agent/src/commands/UpdateKnowledgeBaseCommand.ts @@ -166,7 +166,7 @@ export interface UpdateKnowledgeBaseCommandOutput extends UpdateKnowledgeBaseRes * // }, * // }, * // }, - * // status: "CREATING" || "ACTIVE" || "DELETING" || "UPDATING" || "FAILED", // required + * // status: "CREATING" || "ACTIVE" || "DELETING" || "UPDATING" || "FAILED" || "DELETE_UNSUCCESSFUL", // required * // createdAt: new Date("TIMESTAMP"), // required * // updatedAt: new Date("TIMESTAMP"), // required * // failureReasons: [ // FailureReasons diff --git a/clients/client-bedrock-agent/src/models/models_0.ts b/clients/client-bedrock-agent/src/models/models_0.ts index 22c29ab8d471..b6816c3a1b3b 100644 --- a/clients/client-bedrock-agent/src/models/models_0.ts +++ b/clients/client-bedrock-agent/src/models/models_0.ts @@ -2190,6 +2190,20 @@ export interface UpdateAgentAliasResponse { agentAlias: AgentAlias | undefined; } +/** + * @public + * @enum + */ +export const DataDeletionPolicy = { + DELETE: "DELETE", + RETAIN: "RETAIN", +} as const; + +/** + * @public + */ +export type DataDeletionPolicy = (typeof DataDeletionPolicy)[keyof typeof DataDeletionPolicy]; + /** *

Contains information about the S3 configuration of the data source.

* @public @@ -2206,6 +2220,12 @@ export interface S3DataSourceConfiguration { * @public */ inclusionPrefixes?: string[]; + + /** + *

The account ID for the owner of the S3 bucket.

+ * @public + */ + bucketOwnerAccountId?: string; } /** @@ -2358,6 +2378,12 @@ export interface CreateDataSourceRequest { */ dataSourceConfiguration: DataSourceConfiguration | undefined; + /** + *

The deletion policy for the requested data source

+ * @public + */ + dataDeletionPolicy?: DataDeletionPolicy; + /** *

Contains details about the server-side encryption for the data source.

* @public @@ -2377,6 +2403,7 @@ export interface CreateDataSourceRequest { */ export const DataSourceStatus = { AVAILABLE: "AVAILABLE", + DELETE_UNSUCCESSFUL: "DELETE_UNSUCCESSFUL", DELETING: "DELETING", } as const; @@ -2446,6 +2473,12 @@ export interface DataSource { */ vectorIngestionConfiguration?: VectorIngestionConfiguration; + /** + *

The deletion policy for the data source.

+ * @public + */ + dataDeletionPolicy?: DataDeletionPolicy; + /** *

The time at which the data source was created.

* @public @@ -2457,6 +2490,12 @@ export interface DataSource { * @public */ updatedAt: Date | undefined; + + /** + *

The details of the failure reasons related to the data source.

+ * @public + */ + failureReasons?: string[]; } /** @@ -2654,6 +2693,12 @@ export interface UpdateDataSourceRequest { */ dataSourceConfiguration: DataSourceConfiguration | undefined; + /** + *

The data deletion policy of the updated data source.

+ * @public + */ + dataDeletionPolicy?: DataDeletionPolicy; + /** *

Contains details about server-side encryption of the data source.

* @public @@ -3517,6 +3562,7 @@ export interface CreateKnowledgeBaseRequest { export const KnowledgeBaseStatus = { ACTIVE: "ACTIVE", CREATING: "CREATING", + DELETE_UNSUCCESSFUL: "DELETE_UNSUCCESSFUL", DELETING: "DELETING", FAILED: "FAILED", UPDATING: "UPDATING", diff --git a/clients/client-bedrock-agent/src/protocols/Aws_restJson1.ts b/clients/client-bedrock-agent/src/protocols/Aws_restJson1.ts index 1ff22947961c..ad5c6b0b9557 100644 --- a/clients/client-bedrock-agent/src/protocols/Aws_restJson1.ts +++ b/clients/client-bedrock-agent/src/protocols/Aws_restJson1.ts @@ -302,6 +302,7 @@ export const se_CreateDataSourceCommand = async ( body = JSON.stringify( take(input, { clientToken: [true, (_) => _ ?? generateIdempotencyToken()], + dataDeletionPolicy: [], dataSourceConfiguration: (_) => _json(_), description: [], name: [], @@ -1033,6 +1034,7 @@ export const se_UpdateDataSourceCommand = async ( let body: any; body = JSON.stringify( take(input, { + dataDeletionPolicy: [], dataSourceConfiguration: (_) => _json(_), description: [], name: [], @@ -2476,9 +2478,11 @@ const de_AgentVersionSummary = (output: any, context: __SerdeContext): AgentVers const de_DataSource = (output: any, context: __SerdeContext): DataSource => { return take(output, { createdAt: (_: any) => __expectNonNull(__parseRfc3339DateTimeWithOffset(_)), + dataDeletionPolicy: __expectString, dataSourceConfiguration: _json, dataSourceId: __expectString, description: __expectString, + failureReasons: _json, knowledgeBaseId: __expectString, name: __expectString, serverSideEncryptionConfiguration: _json, diff --git a/codegen/sdk-codegen/aws-models/bedrock-agent.json b/codegen/sdk-codegen/aws-models/bedrock-agent.json index adb0fccc6c9b..f0cc9f0f6836 100644 --- a/codegen/sdk-codegen/aws-models/bedrock-agent.json +++ b/codegen/sdk-codegen/aws-models/bedrock-agent.json @@ -1927,6 +1927,16 @@ "smithy.api#pattern": "^arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:(([0-9]{12}:custom-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}/[a-z0-9]{12})|(:foundation-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}))$" } }, + "com.amazonaws.bedrockagent#BucketOwnerAccountId": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 12, + "max": 12 + }, + "smithy.api#pattern": "^[0-9]{12}$" + } + }, "com.amazonaws.bedrockagent#ChunkingConfiguration": { "type": "structure", "members": { @@ -2437,6 +2447,12 @@ "smithy.api#required": {} } }, + "dataDeletionPolicy": { + "target": "com.amazonaws.bedrockagent#DataDeletionPolicy", + "traits": { + "smithy.api#documentation": "

The deletion policy for the requested data source

" + } + }, "serverSideEncryptionConfiguration": { "target": "com.amazonaws.bedrockagent#ServerSideEncryptionConfiguration", "traits": { @@ -2606,6 +2622,23 @@ } } }, + "com.amazonaws.bedrockagent#DataDeletionPolicy": { + "type": "enum", + "members": { + "RETAIN": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "RETAIN" + } + }, + "DELETE": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "DELETE" + } + } + } + }, "com.amazonaws.bedrockagent#DataSource": { "type": "structure", "members": { @@ -2662,6 +2695,12 @@ "smithy.api#documentation": "

Contains details about how to ingest the documents in the data source.

" } }, + "dataDeletionPolicy": { + "target": "com.amazonaws.bedrockagent#DataDeletionPolicy", + "traits": { + "smithy.api#documentation": "

The deletion policy for the data source.

" + } + }, "createdAt": { "target": "com.amazonaws.bedrockagent#DateTimestamp", "traits": { @@ -2675,6 +2714,12 @@ "smithy.api#documentation": "

The time at which the data source was last updated.

", "smithy.api#required": {} } + }, + "failureReasons": { + "target": "com.amazonaws.bedrockagent#FailureReasons", + "traits": { + "smithy.api#documentation": "

The details of the failure reasons related to the data source.

" + } } }, "traits": { @@ -2736,6 +2781,12 @@ "traits": { "smithy.api#enumValue": "DELETING" } + }, + "DELETE_UNSUCCESSFUL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "DELETE_UNSUCCESSFUL" + } } } }, @@ -4801,6 +4852,12 @@ "traits": { "smithy.api#enumValue": "FAILED" } + }, + "DELETE_UNSUCCESSFUL": { + "target": "smithy.api#Unit", + "traits": { + "smithy.api#enumValue": "DELETE_UNSUCCESSFUL" + } } } }, @@ -6435,6 +6492,12 @@ "traits": { "smithy.api#documentation": "

A list of S3 prefixes that define the object containing the data sources. For more information, see Organizing objects using prefixes.

" } + }, + "bucketOwnerAccountId": { + "target": "com.amazonaws.bedrockagent#BucketOwnerAccountId", + "traits": { + "smithy.api#documentation": "

The account ID for the owner of the S3 bucket.

" + } } }, "traits": { @@ -7502,6 +7565,12 @@ "smithy.api#required": {} } }, + "dataDeletionPolicy": { + "target": "com.amazonaws.bedrockagent#DataDeletionPolicy", + "traits": { + "smithy.api#documentation": "

The data deletion policy of the updated data source.

" + } + }, "serverSideEncryptionConfiguration": { "target": "com.amazonaws.bedrockagent#ServerSideEncryptionConfiguration", "traits": {