|
| 1 | +// smithy-typescript generated code |
| 2 | +import { getEndpointPlugin } from "@smithy/middleware-endpoint"; |
| 3 | +import { Command as $Command } from "@smithy/smithy-client"; |
| 4 | +import type { MetadataBearer as __MetadataBearer } from "@smithy/types"; |
| 5 | + |
| 6 | +import type { |
| 7 | + BedrockAgentCoreClientResolvedConfig, |
| 8 | + ServiceInputTypes, |
| 9 | + ServiceOutputTypes, |
| 10 | +} from "../BedrockAgentCoreClient"; |
| 11 | +import { commonParams } from "../endpoint/EndpointParameters"; |
| 12 | +import type { InvokeBrowserRequest, InvokeBrowserResponse } from "../models/models_0"; |
| 13 | +import { InvokeBrowser$ } from "../schemas/schemas_0"; |
| 14 | + |
| 15 | +/** |
| 16 | + * @public |
| 17 | + */ |
| 18 | +export type { __MetadataBearer }; |
| 19 | +export { $Command }; |
| 20 | +/** |
| 21 | + * @public |
| 22 | + * |
| 23 | + * The input for {@link InvokeBrowserCommand}. |
| 24 | + */ |
| 25 | +export interface InvokeBrowserCommandInput extends InvokeBrowserRequest {} |
| 26 | +/** |
| 27 | + * @public |
| 28 | + * |
| 29 | + * The output of {@link InvokeBrowserCommand}. |
| 30 | + */ |
| 31 | +export interface InvokeBrowserCommandOutput extends InvokeBrowserResponse, __MetadataBearer {} |
| 32 | + |
| 33 | +/** |
| 34 | + * <p>Invokes an operating system-level action on a browser session in Amazon Bedrock AgentCore. This operation provides direct OS-level control over browser sessions, enabling mouse actions, keyboard input, and screenshots that the WebSocket-based Chrome DevTools Protocol (CDP) cannot handle — such as interacting with print dialogs, context menus, and JavaScript alerts.</p> <p>You send a request with exactly one action in the <code>BrowserAction</code> union, and receive a corresponding result in the <code>BrowserActionResult</code> union.</p> <p>The following operations are related to <code>InvokeBrowser</code>:</p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_StartBrowserSession.html">StartBrowserSession</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_GetBrowserSession.html">GetBrowserSession</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_StopBrowserSession.html">StopBrowserSession</a> </p> </li> </ul> |
| 35 | + * @example |
| 36 | + * Use a bare-bones client and the command you need to make an API call. |
| 37 | + * ```javascript |
| 38 | + * import { BedrockAgentCoreClient, InvokeBrowserCommand } from "@aws-sdk/client-bedrock-agentcore"; // ES Modules import |
| 39 | + * // const { BedrockAgentCoreClient, InvokeBrowserCommand } = require("@aws-sdk/client-bedrock-agentcore"); // CommonJS import |
| 40 | + * // import type { BedrockAgentCoreClientConfig } from "@aws-sdk/client-bedrock-agentcore"; |
| 41 | + * const config = {}; // type is BedrockAgentCoreClientConfig |
| 42 | + * const client = new BedrockAgentCoreClient(config); |
| 43 | + * const input = { // InvokeBrowserRequest |
| 44 | + * browserIdentifier: "STRING_VALUE", // required |
| 45 | + * sessionId: "STRING_VALUE", // required |
| 46 | + * action: { // BrowserAction Union: only one key present |
| 47 | + * mouseClick: { // MouseClickArguments |
| 48 | + * x: Number("int"), // required |
| 49 | + * y: Number("int"), // required |
| 50 | + * button: "LEFT" || "RIGHT" || "MIDDLE", |
| 51 | + * clickCount: Number("int"), |
| 52 | + * }, |
| 53 | + * mouseMove: { // MouseMoveArguments |
| 54 | + * x: Number("int"), // required |
| 55 | + * y: Number("int"), // required |
| 56 | + * }, |
| 57 | + * mouseDrag: { // MouseDragArguments |
| 58 | + * endX: Number("int"), // required |
| 59 | + * endY: Number("int"), // required |
| 60 | + * startX: Number("int"), // required |
| 61 | + * startY: Number("int"), // required |
| 62 | + * button: "LEFT" || "RIGHT" || "MIDDLE", |
| 63 | + * }, |
| 64 | + * mouseScroll: { // MouseScrollArguments |
| 65 | + * x: Number("int"), // required |
| 66 | + * y: Number("int"), // required |
| 67 | + * deltaX: Number("int"), |
| 68 | + * deltaY: Number("int"), |
| 69 | + * }, |
| 70 | + * keyType: { // KeyTypeArguments |
| 71 | + * text: "STRING_VALUE", // required |
| 72 | + * }, |
| 73 | + * keyPress: { // KeyPressArguments |
| 74 | + * key: "STRING_VALUE", // required |
| 75 | + * presses: Number("int"), |
| 76 | + * }, |
| 77 | + * keyShortcut: { // KeyShortcutArguments |
| 78 | + * keys: [ // KeyList // required |
| 79 | + * "STRING_VALUE", |
| 80 | + * ], |
| 81 | + * }, |
| 82 | + * screenshot: { // ScreenshotArguments |
| 83 | + * format: "PNG", |
| 84 | + * }, |
| 85 | + * }, |
| 86 | + * }; |
| 87 | + * const command = new InvokeBrowserCommand(input); |
| 88 | + * const response = await client.send(command); |
| 89 | + * // { // InvokeBrowserResponse |
| 90 | + * // result: { // BrowserActionResult Union: only one key present |
| 91 | + * // mouseClick: { // MouseClickResult |
| 92 | + * // status: "SUCCESS" || "FAILED", // required |
| 93 | + * // error: "STRING_VALUE", |
| 94 | + * // }, |
| 95 | + * // mouseMove: { // MouseMoveResult |
| 96 | + * // status: "SUCCESS" || "FAILED", // required |
| 97 | + * // error: "STRING_VALUE", |
| 98 | + * // }, |
| 99 | + * // mouseDrag: { // MouseDragResult |
| 100 | + * // status: "SUCCESS" || "FAILED", // required |
| 101 | + * // error: "STRING_VALUE", |
| 102 | + * // }, |
| 103 | + * // mouseScroll: { // MouseScrollResult |
| 104 | + * // status: "SUCCESS" || "FAILED", // required |
| 105 | + * // error: "STRING_VALUE", |
| 106 | + * // }, |
| 107 | + * // keyType: { // KeyTypeResult |
| 108 | + * // status: "SUCCESS" || "FAILED", // required |
| 109 | + * // error: "STRING_VALUE", |
| 110 | + * // }, |
| 111 | + * // keyPress: { // KeyPressResult |
| 112 | + * // status: "SUCCESS" || "FAILED", // required |
| 113 | + * // error: "STRING_VALUE", |
| 114 | + * // }, |
| 115 | + * // keyShortcut: { // KeyShortcutResult |
| 116 | + * // status: "SUCCESS" || "FAILED", // required |
| 117 | + * // error: "STRING_VALUE", |
| 118 | + * // }, |
| 119 | + * // screenshot: { // ScreenshotResult |
| 120 | + * // status: "SUCCESS" || "FAILED", // required |
| 121 | + * // error: "STRING_VALUE", |
| 122 | + * // data: new Uint8Array(), |
| 123 | + * // }, |
| 124 | + * // }, |
| 125 | + * // sessionId: "STRING_VALUE", // required |
| 126 | + * // }; |
| 127 | + * |
| 128 | + * ``` |
| 129 | + * |
| 130 | + * @param InvokeBrowserCommandInput - {@link InvokeBrowserCommandInput} |
| 131 | + * @returns {@link InvokeBrowserCommandOutput} |
| 132 | + * @see {@link InvokeBrowserCommandInput} for command's `input` shape. |
| 133 | + * @see {@link InvokeBrowserCommandOutput} for command's `response` shape. |
| 134 | + * @see {@link BedrockAgentCoreClientResolvedConfig | config} for BedrockAgentCoreClient's `config` shape. |
| 135 | + * |
| 136 | + * @throws {@link AccessDeniedException} (client fault) |
| 137 | + * <p>The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.</p> |
| 138 | + * |
| 139 | + * @throws {@link InternalServerException} (server fault) |
| 140 | + * <p>The exception that occurs when the service encounters an unexpected internal error. This is a temporary condition that will resolve itself with retries. We recommend implementing exponential backoff retry logic in your application.</p> |
| 141 | + * |
| 142 | + * @throws {@link ResourceNotFoundException} (client fault) |
| 143 | + * <p>The exception that occurs when the specified resource does not exist. This can happen when using an invalid identifier or when trying to access a resource that has been deleted.</p> |
| 144 | + * |
| 145 | + * @throws {@link ServiceQuotaExceededException} (client fault) |
| 146 | + * <p>The exception that occurs when the request would cause a service quota to be exceeded. Review your service quotas and either reduce your request rate or request a quota increase.</p> |
| 147 | + * |
| 148 | + * @throws {@link ThrottlingException} (client fault) |
| 149 | + * <p>The exception that occurs when the request was denied due to request throttling. This happens when you exceed the allowed request rate for an operation. Reduce the frequency of requests or implement exponential backoff retry logic in your application.</p> |
| 150 | + * |
| 151 | + * @throws {@link ValidationException} (client fault) |
| 152 | + * <p>The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.</p> |
| 153 | + * |
| 154 | + * @throws {@link BedrockAgentCoreServiceException} |
| 155 | + * <p>Base exception class for all service exceptions from BedrockAgentCore service.</p> |
| 156 | + * |
| 157 | + * |
| 158 | + * @public |
| 159 | + */ |
| 160 | +export class InvokeBrowserCommand extends $Command |
| 161 | + .classBuilder< |
| 162 | + InvokeBrowserCommandInput, |
| 163 | + InvokeBrowserCommandOutput, |
| 164 | + BedrockAgentCoreClientResolvedConfig, |
| 165 | + ServiceInputTypes, |
| 166 | + ServiceOutputTypes |
| 167 | + >() |
| 168 | + .ep(commonParams) |
| 169 | + .m(function (this: any, Command: any, cs: any, config: BedrockAgentCoreClientResolvedConfig, o: any) { |
| 170 | + return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())]; |
| 171 | + }) |
| 172 | + .s("AmazonBedrockAgentCore", "InvokeBrowser", {}) |
| 173 | + .n("BedrockAgentCoreClient", "InvokeBrowserCommand") |
| 174 | + .sc(InvokeBrowser$) |
| 175 | + .build() { |
| 176 | + /** @internal type navigation helper, not in runtime. */ |
| 177 | + protected declare static __types: { |
| 178 | + api: { |
| 179 | + input: InvokeBrowserRequest; |
| 180 | + output: InvokeBrowserResponse; |
| 181 | + }; |
| 182 | + sdk: { |
| 183 | + input: InvokeBrowserCommandInput; |
| 184 | + output: InvokeBrowserCommandOutput; |
| 185 | + }; |
| 186 | + }; |
| 187 | +} |
0 commit comments