Skip to content

Commit

Permalink
feat(client-bedrock-agent): This release adds support to stop an ongo…
Browse files Browse the repository at this point in the history
…ing ingestion job using the StopIngestionJob API in Agents for Amazon Bedrock.
  • Loading branch information
awstools committed Oct 1, 2024
1 parent cb499b9 commit ac89806
Show file tree
Hide file tree
Showing 13 changed files with 457 additions and 111 deletions.
8 changes: 8 additions & 0 deletions clients/client-bedrock-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,14 @@ StartIngestionJob

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agent/command/StartIngestionJobCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent/Interface/StartIngestionJobCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent/Interface/StartIngestionJobCommandOutput/)

</details>
<details>
<summary>
StopIngestionJob
</summary>

[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/bedrock-agent/command/StopIngestionJobCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent/Interface/StopIngestionJobCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-bedrock-agent/Interface/StopIngestionJobCommandOutput/)

</details>
<details>
<summary>
Expand Down
23 changes: 23 additions & 0 deletions clients/client-bedrock-agent/src/BedrockAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ import {
StartIngestionJobCommandInput,
StartIngestionJobCommandOutput,
} from "./commands/StartIngestionJobCommand";
import {
StopIngestionJobCommand,
StopIngestionJobCommandInput,
StopIngestionJobCommandOutput,
} from "./commands/StopIngestionJobCommand";
import { TagResourceCommand, TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import {
UntagResourceCommand,
Expand Down Expand Up @@ -304,6 +309,7 @@ const commands = {
PrepareAgentCommand,
PrepareFlowCommand,
StartIngestionJobCommand,
StopIngestionJobCommand,
TagResourceCommand,
UntagResourceCommand,
UpdateAgentCommand,
Expand Down Expand Up @@ -1049,6 +1055,23 @@ export interface BedrockAgent {
cb: (err: any, data?: StartIngestionJobCommandOutput) => void
): void;

/**
* @see {@link StopIngestionJobCommand}
*/
stopIngestionJob(
args: StopIngestionJobCommandInput,
options?: __HttpHandlerOptions
): Promise<StopIngestionJobCommandOutput>;
stopIngestionJob(
args: StopIngestionJobCommandInput,
cb: (err: any, data?: StopIngestionJobCommandOutput) => void
): void;
stopIngestionJob(
args: StopIngestionJobCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: StopIngestionJobCommandOutput) => void
): void;

/**
* @see {@link TagResourceCommand}
*/
Expand Down
3 changes: 3 additions & 0 deletions clients/client-bedrock-agent/src/BedrockAgentClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ import {
import { PrepareAgentCommandInput, PrepareAgentCommandOutput } from "./commands/PrepareAgentCommand";
import { PrepareFlowCommandInput, PrepareFlowCommandOutput } from "./commands/PrepareFlowCommand";
import { StartIngestionJobCommandInput, StartIngestionJobCommandOutput } from "./commands/StartIngestionJobCommand";
import { StopIngestionJobCommandInput, StopIngestionJobCommandOutput } from "./commands/StopIngestionJobCommand";
import { TagResourceCommandInput, TagResourceCommandOutput } from "./commands/TagResourceCommand";
import { UntagResourceCommandInput, UntagResourceCommandOutput } from "./commands/UntagResourceCommand";
import {
Expand Down Expand Up @@ -224,6 +225,7 @@ export type ServiceInputTypes =
| PrepareAgentCommandInput
| PrepareFlowCommandInput
| StartIngestionJobCommandInput
| StopIngestionJobCommandInput
| TagResourceCommandInput
| UntagResourceCommandInput
| UpdateAgentActionGroupCommandInput
Expand Down Expand Up @@ -290,6 +292,7 @@ export type ServiceOutputTypes =
| PrepareAgentCommandOutput
| PrepareFlowCommandOutput
| StartIngestionJobCommandOutput
| StopIngestionJobCommandOutput
| TagResourceCommandOutput
| UntagResourceCommandOutput
| UpdateAgentActionGroupCommandOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface CreateKnowledgeBaseCommandInput extends CreateKnowledgeBaseRequ
export interface CreateKnowledgeBaseCommandOutput extends CreateKnowledgeBaseResponse, __MetadataBearer {}

/**
* <p>Creates a knowledge base that contains data sources from which information can be queried and used by LLMs. To create a knowledge base, you must first set up your data sources and configure a supported vector store. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-setup.html">Set up your data for ingestion</a>.</p>
* <p>Creates a knowledge base. A knowledge base contains your data sources so that Large Language Models (LLMs) can use your data. To create a knowledge base, you must first set up your data sources and configure a supported vector store. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowlege-base-prereq.html">Set up a knowledge base</a>.</p>
* <note>
* <p>If you prefer to let Amazon Bedrock create and manage a vector store for you in Amazon OpenSearch Service, use the console. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/knowledge-base-create">Create a knowledge base</a>.</p>
* </note>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface GetIngestionJobCommandInput extends GetIngestionJobRequest {}
export interface GetIngestionJobCommandOutput extends GetIngestionJobResponse, __MetadataBearer {}

/**
* <p>Gets information about a ingestion job, in which a data source is added to a knowledge base.</p>
* <p>Gets information about a data ingestion job. Data sources are ingested into your knowledge base so that Large Lanaguage Models (LLMs) can use your data.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand All @@ -48,7 +48,7 @@ export interface GetIngestionJobCommandOutput extends GetIngestionJobResponse, _
* // dataSourceId: "STRING_VALUE", // required
* // ingestionJobId: "STRING_VALUE", // required
* // description: "STRING_VALUE",
* // status: "STARTING" || "IN_PROGRESS" || "COMPLETE" || "FAILED", // required
* // status: "STARTING" || "IN_PROGRESS" || "COMPLETE" || "FAILED" || "STOPPING" || "STOPPED", // required
* // statistics: { // IngestionJobStatistics
* // numberOfDocumentsScanned: Number("long"),
* // numberOfMetadataDocumentsScanned: Number("long"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface ListIngestionJobsCommandInput extends ListIngestionJobsRequest
export interface ListIngestionJobsCommandOutput extends ListIngestionJobsResponse, __MetadataBearer {}

/**
* <p>Lists the ingestion jobs for a data source and information about each of them.</p>
* <p>Lists the data ingestion jobs for a data source. The list also includes information about each job.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down Expand Up @@ -63,7 +63,7 @@ export interface ListIngestionJobsCommandOutput extends ListIngestionJobsRespons
* // dataSourceId: "STRING_VALUE", // required
* // ingestionJobId: "STRING_VALUE", // required
* // description: "STRING_VALUE",
* // status: "STARTING" || "IN_PROGRESS" || "COMPLETE" || "FAILED", // required
* // status: "STARTING" || "IN_PROGRESS" || "COMPLETE" || "FAILED" || "STOPPING" || "STOPPED", // required
* // startedAt: new Date("TIMESTAMP"), // required
* // updatedAt: new Date("TIMESTAMP"), // required
* // statistics: { // IngestionJobStatistics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface ListKnowledgeBasesCommandInput extends ListKnowledgeBasesReques
export interface ListKnowledgeBasesCommandOutput extends ListKnowledgeBasesResponse, __MetadataBearer {}

/**
* <p>Lists the knowledge bases in an account and information about each of them.</p>
* <p>Lists the knowledge bases in an account. The list also includesinformation about each knowledge base.</p>
* @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 @@ -28,7 +28,7 @@ export interface StartIngestionJobCommandInput extends StartIngestionJobRequest
export interface StartIngestionJobCommandOutput extends StartIngestionJobResponse, __MetadataBearer {}

/**
* <p>Begins an ingestion job, in which a data source is added to a knowledge base.</p>
* <p>Begins a data ingestion job. Data sources are ingested into your knowledge base so that Large Language Models (LLMs) can use your data.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand All @@ -49,7 +49,7 @@ export interface StartIngestionJobCommandOutput extends StartIngestionJobRespons
* // dataSourceId: "STRING_VALUE", // required
* // ingestionJobId: "STRING_VALUE", // required
* // description: "STRING_VALUE",
* // status: "STARTING" || "IN_PROGRESS" || "COMPLETE" || "FAILED", // required
* // status: "STARTING" || "IN_PROGRESS" || "COMPLETE" || "FAILED" || "STOPPING" || "STOPPED", // required
* // statistics: { // IngestionJobStatistics
* // numberOfDocumentsScanned: Number("long"),
* // numberOfMetadataDocumentsScanned: Number("long"),
Expand Down
132 changes: 132 additions & 0 deletions clients/client-bedrock-agent/src/commands/StopIngestionJobCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
// 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 { BedrockAgentClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../BedrockAgentClient";
import { commonParams } from "../endpoint/EndpointParameters";
import { StopIngestionJobRequest, StopIngestionJobResponse } from "../models/models_0";
import { de_StopIngestionJobCommand, se_StopIngestionJobCommand } from "../protocols/Aws_restJson1";

/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link StopIngestionJobCommand}.
*/
export interface StopIngestionJobCommandInput extends StopIngestionJobRequest {}
/**
* @public
*
* The output of {@link StopIngestionJobCommand}.
*/
export interface StopIngestionJobCommandOutput extends StopIngestionJobResponse, __MetadataBearer {}

/**
* <p>Stops a currently running data ingestion job. You can send a <code>StartIngestionJob</code> request again to ingest the rest of your data when you are ready.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { BedrockAgentClient, StopIngestionJobCommand } from "@aws-sdk/client-bedrock-agent"; // ES Modules import
* // const { BedrockAgentClient, StopIngestionJobCommand } = require("@aws-sdk/client-bedrock-agent"); // CommonJS import
* const client = new BedrockAgentClient(config);
* const input = { // StopIngestionJobRequest
* knowledgeBaseId: "STRING_VALUE", // required
* dataSourceId: "STRING_VALUE", // required
* ingestionJobId: "STRING_VALUE", // required
* };
* const command = new StopIngestionJobCommand(input);
* const response = await client.send(command);
* // { // StopIngestionJobResponse
* // ingestionJob: { // IngestionJob
* // knowledgeBaseId: "STRING_VALUE", // required
* // dataSourceId: "STRING_VALUE", // required
* // ingestionJobId: "STRING_VALUE", // required
* // description: "STRING_VALUE",
* // status: "STARTING" || "IN_PROGRESS" || "COMPLETE" || "FAILED" || "STOPPING" || "STOPPED", // required
* // statistics: { // IngestionJobStatistics
* // numberOfDocumentsScanned: Number("long"),
* // numberOfMetadataDocumentsScanned: Number("long"),
* // numberOfNewDocumentsIndexed: Number("long"),
* // numberOfModifiedDocumentsIndexed: Number("long"),
* // numberOfMetadataDocumentsModified: Number("long"),
* // numberOfDocumentsDeleted: Number("long"),
* // numberOfDocumentsFailed: Number("long"),
* // },
* // failureReasons: [ // FailureReasons
* // "STRING_VALUE",
* // ],
* // startedAt: new Date("TIMESTAMP"), // required
* // updatedAt: new Date("TIMESTAMP"), // required
* // },
* // };
*
* ```
*
* @param StopIngestionJobCommandInput - {@link StopIngestionJobCommandInput}
* @returns {@link StopIngestionJobCommandOutput}
* @see {@link StopIngestionJobCommandInput} for command's `input` shape.
* @see {@link StopIngestionJobCommandOutput} for command's `response` shape.
* @see {@link BedrockAgentClientResolvedConfig | config} for BedrockAgentClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>The request is denied because of missing access permissions.</p>
*
* @throws {@link ConflictException} (client fault)
* <p>There was a conflict performing an operation.</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>An internal server error occurred. Retry your request.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The number of requests exceeds the limit. Resubmit your request later.</p>
*
* @throws {@link ValidationException} (client fault)
* <p>Input validation failed. Check your request parameters and retry the request.</p>
*
* @throws {@link BedrockAgentServiceException}
* <p>Base exception class for all service exceptions from BedrockAgent service.</p>
*
* @public
*/
export class StopIngestionJobCommand extends $Command
.classBuilder<
StopIngestionJobCommandInput,
StopIngestionJobCommandOutput,
BedrockAgentClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep(commonParams)
.m(function (this: any, Command: any, cs: any, config: BedrockAgentClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("AmazonBedrockAgentBuildTimeLambda", "StopIngestionJob", {})
.n("BedrockAgentClient", "StopIngestionJobCommand")
.f(void 0, void 0)
.ser(se_StopIngestionJobCommand)
.de(de_StopIngestionJobCommand)
.build() {
/** @internal type navigation helper, not in runtime. */
protected declare static __types: {
api: {
input: StopIngestionJobRequest;
output: StopIngestionJobResponse;
};
sdk: {
input: StopIngestionJobCommandInput;
output: StopIngestionJobCommandOutput;
};
};
}
1 change: 1 addition & 0 deletions clients/client-bedrock-agent/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export * from "./ListTagsForResourceCommand";
export * from "./PrepareAgentCommand";
export * from "./PrepareFlowCommand";
export * from "./StartIngestionJobCommand";
export * from "./StopIngestionJobCommand";
export * from "./TagResourceCommand";
export * from "./UntagResourceCommand";
export * from "./UpdateAgentActionGroupCommand";
Expand Down
Loading

0 comments on commit ac89806

Please sign in to comment.