
com.amazonaws.services.bedrockagent.AWSBedrockAgentClient Maven / Gradle / Ivy
/*
* Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.bedrockagent;
import org.w3c.dom.*;
import java.net.*;
import java.util.*;
import javax.annotation.Generated;
import org.apache.commons.logging.*;
import com.amazonaws.*;
import com.amazonaws.annotation.SdkInternalApi;
import com.amazonaws.auth.*;
import com.amazonaws.handlers.*;
import com.amazonaws.http.*;
import com.amazonaws.internal.*;
import com.amazonaws.internal.auth.*;
import com.amazonaws.metrics.*;
import com.amazonaws.regions.*;
import com.amazonaws.transform.*;
import com.amazonaws.util.*;
import com.amazonaws.protocol.json.*;
import com.amazonaws.util.AWSRequestMetrics.Field;
import com.amazonaws.annotation.ThreadSafe;
import com.amazonaws.client.AwsSyncClientParams;
import com.amazonaws.client.builder.AdvancedConfig;
import com.amazonaws.services.bedrockagent.AWSBedrockAgentClientBuilder;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.services.bedrockagent.model.*;
import com.amazonaws.services.bedrockagent.model.transform.*;
/**
* Client for accessing Agents for Amazon Bedrock. All service calls made using this client are blocking, and will not
* return until the service call completes.
*
*
* Describes the API operations for creating and managing Amazon Bedrock agents.
*
*/
@ThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class AWSBedrockAgentClient extends AmazonWebServiceClient implements AWSBedrockAgent {
/** Provider for AWS credentials. */
private final AWSCredentialsProvider awsCredentialsProvider;
private static final Log log = LogFactory.getLog(AWSBedrockAgent.class);
/** Default signing name for the service. */
private static final String DEFAULT_SIGNING_NAME = "bedrock";
/** Client configuration factory providing ClientConfigurations tailored to this client */
protected static final ClientConfigurationFactory configFactory = new ClientConfigurationFactory();
private final AdvancedConfig advancedConfig;
private static final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory = new com.amazonaws.protocol.json.SdkJsonProtocolFactory(
new JsonClientMetadata()
.withProtocolVersion("1.1")
.withSupportsCbor(false)
.withSupportsIon(false)
.withContentTypeOverride("application/json")
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ServiceQuotaExceededException").withExceptionUnmarshaller(
com.amazonaws.services.bedrockagent.model.transform.ServiceQuotaExceededExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("InternalServerException").withExceptionUnmarshaller(
com.amazonaws.services.bedrockagent.model.transform.InternalServerExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ResourceNotFoundException").withExceptionUnmarshaller(
com.amazonaws.services.bedrockagent.model.transform.ResourceNotFoundExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ValidationException").withExceptionUnmarshaller(
com.amazonaws.services.bedrockagent.model.transform.ValidationExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ThrottlingException").withExceptionUnmarshaller(
com.amazonaws.services.bedrockagent.model.transform.ThrottlingExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("AccessDeniedException").withExceptionUnmarshaller(
com.amazonaws.services.bedrockagent.model.transform.AccessDeniedExceptionUnmarshaller.getInstance()))
.addErrorMetadata(
new JsonErrorShapeMetadata().withErrorCode("ConflictException").withExceptionUnmarshaller(
com.amazonaws.services.bedrockagent.model.transform.ConflictExceptionUnmarshaller.getInstance()))
.withBaseServiceExceptionClass(com.amazonaws.services.bedrockagent.model.AWSBedrockAgentException.class));
public static AWSBedrockAgentClientBuilder builder() {
return AWSBedrockAgentClientBuilder.standard();
}
/**
* Constructs a new client to invoke service methods on Agents for Amazon Bedrock using the specified parameters.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AWSBedrockAgentClient(AwsSyncClientParams clientParams) {
this(clientParams, false);
}
/**
* Constructs a new client to invoke service methods on Agents for Amazon Bedrock using the specified parameters.
*
*
* All service calls made using this new client object are blocking, and will not return until the service call
* completes.
*
* @param clientParams
* Object providing client parameters.
*/
AWSBedrockAgentClient(AwsSyncClientParams clientParams, boolean endpointDiscoveryEnabled) {
super(clientParams);
this.awsCredentialsProvider = clientParams.getCredentialsProvider();
this.advancedConfig = clientParams.getAdvancedConfig();
init();
}
private void init() {
setServiceNameIntern(DEFAULT_SIGNING_NAME);
setEndpointPrefix(ENDPOINT_PREFIX);
// calling this.setEndPoint(...) will also modify the signer accordingly
setEndpoint("bedrock-agent.us-east-1.amazonaws.com");
HandlerChainFactory chainFactory = new HandlerChainFactory();
requestHandler2s.addAll(chainFactory.newRequestHandlerChain("/com/amazonaws/services/bedrockagent/request.handlers"));
requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/bedrockagent/request.handler2s"));
requestHandler2s.addAll(chainFactory.getGlobalHandlers());
}
/**
*
* Associates a knowledge base with an agent. If a knowledge base is associated and its indexState
is
* set to Enabled
, the agent queries the knowledge base for information to augment its response to the
* user.
*
*
* @param associateAgentKnowledgeBaseRequest
* @return Result of the AssociateAgentKnowledgeBase operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.AssociateAgentKnowledgeBase
* @see AWS API Documentation
*/
@Override
public AssociateAgentKnowledgeBaseResult associateAgentKnowledgeBase(AssociateAgentKnowledgeBaseRequest request) {
request = beforeClientExecution(request);
return executeAssociateAgentKnowledgeBase(request);
}
@SdkInternalApi
final AssociateAgentKnowledgeBaseResult executeAssociateAgentKnowledgeBase(AssociateAgentKnowledgeBaseRequest associateAgentKnowledgeBaseRequest) {
ExecutionContext executionContext = createExecutionContext(associateAgentKnowledgeBaseRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new AssociateAgentKnowledgeBaseRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(associateAgentKnowledgeBaseRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "AssociateAgentKnowledgeBase");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new AssociateAgentKnowledgeBaseResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates an agent that orchestrates interactions between foundation models, data sources, software applications,
* user conversations, and APIs to carry out tasks to help customers.
*
*
* -
*
* Specify the following fields for security purposes.
*
*
* -
*
* agentResourceRoleArn
– The Amazon Resource Name (ARN) of the role with permissions to invoke API
* operations on an agent.
*
*
* -
*
* (Optional) customerEncryptionKeyArn
– The Amazon Resource Name (ARN) of a KMS key to encrypt the
* creation of the agent.
*
*
* -
*
* (Optional) idleSessionTTLinSeconds
– Specify the number of seconds for which the agent should
* maintain session information. After this time expires, the subsequent InvokeAgent
request begins a
* new session.
*
*
*
*
* -
*
* To enable your agent to retain conversational context across multiple sessions, include a
* memoryConfiguration
object. For more information, see Configure memory.
*
*
* -
*
* To override the default prompt behavior for agent orchestration and to use advanced prompts, include a
* promptOverrideConfiguration
object. For more information, see Advanced prompts.
*
*
* -
*
* If you agent fails to be created, the response returns a list of failureReasons
alongside a list of
* recommendedActions
for you to troubleshoot.
*
*
*
*
* @param createAgentRequest
* @return Result of the CreateAgent operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.CreateAgent
* @see AWS API
* Documentation
*/
@Override
public CreateAgentResult createAgent(CreateAgentRequest request) {
request = beforeClientExecution(request);
return executeCreateAgent(request);
}
@SdkInternalApi
final CreateAgentResult executeCreateAgent(CreateAgentRequest createAgentRequest) {
ExecutionContext executionContext = createExecutionContext(createAgentRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateAgentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createAgentRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateAgent");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateAgentResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates an action group for an agent. An action group represents the actions that an agent can carry out for the
* customer by defining the APIs that an agent can call and the logic for calling them.
*
*
* To allow your agent to request the user for additional information when trying to complete a task, add an action
* group with the parentActionGroupSignature
field set to AMAZON.UserInput
.
*
*
* To allow your agent to generate, run, and troubleshoot code when trying to complete a task, add an action group
* with the parentActionGroupSignature
field set to AMAZON.CodeInterpreter
.
*
*
* You must leave the description
, apiSchema
, and actionGroupExecutor
fields
* blank for this action group. During orchestration, if your agent determines that it needs to invoke an API in an
* action group, but doesn't have enough information to complete the API request, it will invoke this action group
* instead and return an Observation
* reprompting the user for more information.
*
*
* @param createAgentActionGroupRequest
* @return Result of the CreateAgentActionGroup operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.CreateAgentActionGroup
* @see AWS API Documentation
*/
@Override
public CreateAgentActionGroupResult createAgentActionGroup(CreateAgentActionGroupRequest request) {
request = beforeClientExecution(request);
return executeCreateAgentActionGroup(request);
}
@SdkInternalApi
final CreateAgentActionGroupResult executeCreateAgentActionGroup(CreateAgentActionGroupRequest createAgentActionGroupRequest) {
ExecutionContext executionContext = createExecutionContext(createAgentActionGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateAgentActionGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createAgentActionGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateAgentActionGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new CreateAgentActionGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates an alias of an agent that can be used to deploy the agent.
*
*
* @param createAgentAliasRequest
* @return Result of the CreateAgentAlias operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.CreateAgentAlias
* @see AWS
* API Documentation
*/
@Override
public CreateAgentAliasResult createAgentAlias(CreateAgentAliasRequest request) {
request = beforeClientExecution(request);
return executeCreateAgentAlias(request);
}
@SdkInternalApi
final CreateAgentAliasResult executeCreateAgentAlias(CreateAgentAliasRequest createAgentAliasRequest) {
ExecutionContext executionContext = createExecutionContext(createAgentAliasRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateAgentAliasRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createAgentAliasRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateAgentAlias");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateAgentAliasResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a data source connector for a knowledge base.
*
*
*
* You can't change the chunkingConfiguration
after you create the data source connector.
*
*
*
* @param createDataSourceRequest
* @return Result of the CreateDataSource operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.CreateDataSource
* @see AWS
* API Documentation
*/
@Override
public CreateDataSourceResult createDataSource(CreateDataSourceRequest request) {
request = beforeClientExecution(request);
return executeCreateDataSource(request);
}
@SdkInternalApi
final CreateDataSourceResult executeCreateDataSource(CreateDataSourceRequest createDataSourceRequest) {
ExecutionContext executionContext = createExecutionContext(createDataSourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateDataSourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createDataSourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateDataSource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateDataSourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a prompt flow that you can use to send an input through various steps to yield an output. Configure
* nodes, each of which corresponds to a step of the flow, and create connections between the nodes to create paths
* to different outputs. For more information, see How it works and Create a flow in Amazon Bedrock
* in the Amazon Bedrock User Guide.
*
*
* @param createFlowRequest
* @return Result of the CreateFlow operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.CreateFlow
* @see AWS API
* Documentation
*/
@Override
public CreateFlowResult createFlow(CreateFlowRequest request) {
request = beforeClientExecution(request);
return executeCreateFlow(request);
}
@SdkInternalApi
final CreateFlowResult executeCreateFlow(CreateFlowRequest createFlowRequest) {
ExecutionContext executionContext = createExecutionContext(createFlowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateFlowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createFlowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateFlow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateFlowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates an alias of a flow for deployment. For more information, see Deploy a flow in Amazon Bedrock
* in the Amazon Bedrock User Guide.
*
*
* @param createFlowAliasRequest
* @return Result of the CreateFlowAlias operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.CreateFlowAlias
* @see AWS
* API Documentation
*/
@Override
public CreateFlowAliasResult createFlowAlias(CreateFlowAliasRequest request) {
request = beforeClientExecution(request);
return executeCreateFlowAlias(request);
}
@SdkInternalApi
final CreateFlowAliasResult executeCreateFlowAlias(CreateFlowAliasRequest createFlowAliasRequest) {
ExecutionContext executionContext = createExecutionContext(createFlowAliasRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateFlowAliasRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createFlowAliasRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateFlowAlias");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateFlowAliasResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a version of the flow that you can deploy. For more information, see Deploy a flow in Amazon Bedrock
* in the Amazon Bedrock User Guide.
*
*
* @param createFlowVersionRequest
* @return Result of the CreateFlowVersion operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.CreateFlowVersion
* @see AWS API Documentation
*/
@Override
public CreateFlowVersionResult createFlowVersion(CreateFlowVersionRequest request) {
request = beforeClientExecution(request);
return executeCreateFlowVersion(request);
}
@SdkInternalApi
final CreateFlowVersionResult executeCreateFlowVersion(CreateFlowVersionRequest createFlowVersionRequest) {
ExecutionContext executionContext = createExecutionContext(createFlowVersionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateFlowVersionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createFlowVersionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateFlowVersion");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateFlowVersionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* 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 Set up
* your data for ingestion.
*
*
*
* 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 Create a knowledge base.
*
*
*
* -
*
* Provide the name
and an optional description
.
*
*
* -
*
* Provide the Amazon Resource Name (ARN) with permissions to create a knowledge base in the roleArn
* field.
*
*
* -
*
* Provide the embedding model to use in the embeddingModelArn
field in the
* knowledgeBaseConfiguration
object.
*
*
* -
*
* Provide the configuration for your vector store in the storageConfiguration
object.
*
*
* -
*
* For an Amazon OpenSearch Service database, use the opensearchServerlessConfiguration
object. For
* more information, see Create a vector store
* in Amazon OpenSearch Service.
*
*
* -
*
* For an Amazon Aurora database, use the RdsConfiguration
object. For more information, see Create a vector store
* in Amazon Aurora.
*
*
* -
*
* For a Pinecone database, use the pineconeConfiguration
object. For more information, see Create a vector
* store in Pinecone.
*
*
* -
*
* For a Redis Enterprise Cloud database, use the redisEnterpriseCloudConfiguration
object. For more
* information, see Create a vector store
* in Redis Enterprise Cloud.
*
*
*
*
*
*
* @param createKnowledgeBaseRequest
* @return Result of the CreateKnowledgeBase operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.CreateKnowledgeBase
* @see AWS API Documentation
*/
@Override
public CreateKnowledgeBaseResult createKnowledgeBase(CreateKnowledgeBaseRequest request) {
request = beforeClientExecution(request);
return executeCreateKnowledgeBase(request);
}
@SdkInternalApi
final CreateKnowledgeBaseResult executeCreateKnowledgeBase(CreateKnowledgeBaseRequest createKnowledgeBaseRequest) {
ExecutionContext executionContext = createExecutionContext(createKnowledgeBaseRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreateKnowledgeBaseRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createKnowledgeBaseRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateKnowledgeBase");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateKnowledgeBaseResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a prompt in your prompt library that you can add to a flow. For more information, see Prompt management in Amazon
* Bedrock, Create
* a prompt using Prompt management and Prompt flows in Amazon Bedrock in the
* Amazon Bedrock User Guide.
*
*
* @param createPromptRequest
* @return Result of the CreatePrompt operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.CreatePrompt
* @see AWS API
* Documentation
*/
@Override
public CreatePromptResult createPrompt(CreatePromptRequest request) {
request = beforeClientExecution(request);
return executeCreatePrompt(request);
}
@SdkInternalApi
final CreatePromptResult executeCreatePrompt(CreatePromptRequest createPromptRequest) {
ExecutionContext executionContext = createExecutionContext(createPromptRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreatePromptRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createPromptRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreatePrompt");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreatePromptResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a static snapshot of your prompt that can be deployed to production. For more information, see Deploy prompts using
* Prompt management by creating versions in the Amazon Bedrock User Guide.
*
*
* @param createPromptVersionRequest
* @return Result of the CreatePromptVersion operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.CreatePromptVersion
* @see AWS API Documentation
*/
@Override
public CreatePromptVersionResult createPromptVersion(CreatePromptVersionRequest request) {
request = beforeClientExecution(request);
return executeCreatePromptVersion(request);
}
@SdkInternalApi
final CreatePromptVersionResult executeCreatePromptVersion(CreatePromptVersionRequest createPromptVersionRequest) {
ExecutionContext executionContext = createExecutionContext(createPromptVersionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new CreatePromptVersionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createPromptVersionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreatePromptVersion");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreatePromptVersionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes an agent.
*
*
* @param deleteAgentRequest
* @return Result of the DeleteAgent operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @sample AWSBedrockAgent.DeleteAgent
* @see AWS API
* Documentation
*/
@Override
public DeleteAgentResult deleteAgent(DeleteAgentRequest request) {
request = beforeClientExecution(request);
return executeDeleteAgent(request);
}
@SdkInternalApi
final DeleteAgentResult executeDeleteAgent(DeleteAgentRequest deleteAgentRequest) {
ExecutionContext executionContext = createExecutionContext(deleteAgentRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteAgentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteAgentRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteAgent");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteAgentResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes an action group in an agent.
*
*
* @param deleteAgentActionGroupRequest
* @return Result of the DeleteAgentActionGroup operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @sample AWSBedrockAgent.DeleteAgentActionGroup
* @see AWS API Documentation
*/
@Override
public DeleteAgentActionGroupResult deleteAgentActionGroup(DeleteAgentActionGroupRequest request) {
request = beforeClientExecution(request);
return executeDeleteAgentActionGroup(request);
}
@SdkInternalApi
final DeleteAgentActionGroupResult executeDeleteAgentActionGroup(DeleteAgentActionGroupRequest deleteAgentActionGroupRequest) {
ExecutionContext executionContext = createExecutionContext(deleteAgentActionGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteAgentActionGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteAgentActionGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteAgentActionGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DeleteAgentActionGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes an alias of an agent.
*
*
* @param deleteAgentAliasRequest
* @return Result of the DeleteAgentAlias operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.DeleteAgentAlias
* @see AWS
* API Documentation
*/
@Override
public DeleteAgentAliasResult deleteAgentAlias(DeleteAgentAliasRequest request) {
request = beforeClientExecution(request);
return executeDeleteAgentAlias(request);
}
@SdkInternalApi
final DeleteAgentAliasResult executeDeleteAgentAlias(DeleteAgentAliasRequest deleteAgentAliasRequest) {
ExecutionContext executionContext = createExecutionContext(deleteAgentAliasRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteAgentAliasRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteAgentAliasRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteAgentAlias");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteAgentAliasResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a version of an agent.
*
*
* @param deleteAgentVersionRequest
* @return Result of the DeleteAgentVersion operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @sample AWSBedrockAgent.DeleteAgentVersion
* @see AWS API Documentation
*/
@Override
public DeleteAgentVersionResult deleteAgentVersion(DeleteAgentVersionRequest request) {
request = beforeClientExecution(request);
return executeDeleteAgentVersion(request);
}
@SdkInternalApi
final DeleteAgentVersionResult executeDeleteAgentVersion(DeleteAgentVersionRequest deleteAgentVersionRequest) {
ExecutionContext executionContext = createExecutionContext(deleteAgentVersionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteAgentVersionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteAgentVersionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteAgentVersion");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteAgentVersionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a data source from a knowledge base.
*
*
* @param deleteDataSourceRequest
* @return Result of the DeleteDataSource operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @sample AWSBedrockAgent.DeleteDataSource
* @see AWS
* API Documentation
*/
@Override
public DeleteDataSourceResult deleteDataSource(DeleteDataSourceRequest request) {
request = beforeClientExecution(request);
return executeDeleteDataSource(request);
}
@SdkInternalApi
final DeleteDataSourceResult executeDeleteDataSource(DeleteDataSourceRequest deleteDataSourceRequest) {
ExecutionContext executionContext = createExecutionContext(deleteDataSourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteDataSourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteDataSourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteDataSource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteDataSourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a flow.
*
*
* @param deleteFlowRequest
* @return Result of the DeleteFlow operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @sample AWSBedrockAgent.DeleteFlow
* @see AWS API
* Documentation
*/
@Override
public DeleteFlowResult deleteFlow(DeleteFlowRequest request) {
request = beforeClientExecution(request);
return executeDeleteFlow(request);
}
@SdkInternalApi
final DeleteFlowResult executeDeleteFlow(DeleteFlowRequest deleteFlowRequest) {
ExecutionContext executionContext = createExecutionContext(deleteFlowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteFlowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteFlowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteFlow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteFlowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes an alias of a flow.
*
*
* @param deleteFlowAliasRequest
* @return Result of the DeleteFlowAlias operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @sample AWSBedrockAgent.DeleteFlowAlias
* @see AWS
* API Documentation
*/
@Override
public DeleteFlowAliasResult deleteFlowAlias(DeleteFlowAliasRequest request) {
request = beforeClientExecution(request);
return executeDeleteFlowAlias(request);
}
@SdkInternalApi
final DeleteFlowAliasResult executeDeleteFlowAlias(DeleteFlowAliasRequest deleteFlowAliasRequest) {
ExecutionContext executionContext = createExecutionContext(deleteFlowAliasRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteFlowAliasRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteFlowAliasRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteFlowAlias");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteFlowAliasResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a version of a flow.
*
*
* @param deleteFlowVersionRequest
* @return Result of the DeleteFlowVersion operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @sample AWSBedrockAgent.DeleteFlowVersion
* @see AWS API Documentation
*/
@Override
public DeleteFlowVersionResult deleteFlowVersion(DeleteFlowVersionRequest request) {
request = beforeClientExecution(request);
return executeDeleteFlowVersion(request);
}
@SdkInternalApi
final DeleteFlowVersionResult executeDeleteFlowVersion(DeleteFlowVersionRequest deleteFlowVersionRequest) {
ExecutionContext executionContext = createExecutionContext(deleteFlowVersionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteFlowVersionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteFlowVersionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteFlowVersion");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteFlowVersionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a knowledge base. Before deleting a knowledge base, you should disassociate the knowledge base from any
* agents that it is associated with by making a DisassociateAgentKnowledgeBase request.
*
*
* @param deleteKnowledgeBaseRequest
* @return Result of the DeleteKnowledgeBase operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @sample AWSBedrockAgent.DeleteKnowledgeBase
* @see AWS API Documentation
*/
@Override
public DeleteKnowledgeBaseResult deleteKnowledgeBase(DeleteKnowledgeBaseRequest request) {
request = beforeClientExecution(request);
return executeDeleteKnowledgeBase(request);
}
@SdkInternalApi
final DeleteKnowledgeBaseResult executeDeleteKnowledgeBase(DeleteKnowledgeBaseRequest deleteKnowledgeBaseRequest) {
ExecutionContext executionContext = createExecutionContext(deleteKnowledgeBaseRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeleteKnowledgeBaseRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteKnowledgeBaseRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteKnowledgeBase");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteKnowledgeBaseResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Deletes a prompt or a prompt version from the Prompt management tool. For more information, see Delete prompts from the Prompt management tool and Delete a version of a prompt from the Prompt management tool in the Amazon Bedrock User Guide.
*
*
* @param deletePromptRequest
* @return Result of the DeletePrompt operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @sample AWSBedrockAgent.DeletePrompt
* @see AWS API
* Documentation
*/
@Override
public DeletePromptResult deletePrompt(DeletePromptRequest request) {
request = beforeClientExecution(request);
return executeDeletePrompt(request);
}
@SdkInternalApi
final DeletePromptResult executeDeletePrompt(DeletePromptRequest deletePromptRequest) {
ExecutionContext executionContext = createExecutionContext(deletePromptRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DeletePromptRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deletePromptRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeletePrompt");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeletePromptResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Disassociates a knowledge base from an agent.
*
*
* @param disassociateAgentKnowledgeBaseRequest
* @return Result of the DisassociateAgentKnowledgeBase operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @sample AWSBedrockAgent.DisassociateAgentKnowledgeBase
* @see AWS API Documentation
*/
@Override
public DisassociateAgentKnowledgeBaseResult disassociateAgentKnowledgeBase(DisassociateAgentKnowledgeBaseRequest request) {
request = beforeClientExecution(request);
return executeDisassociateAgentKnowledgeBase(request);
}
@SdkInternalApi
final DisassociateAgentKnowledgeBaseResult executeDisassociateAgentKnowledgeBase(DisassociateAgentKnowledgeBaseRequest disassociateAgentKnowledgeBaseRequest) {
ExecutionContext executionContext = createExecutionContext(disassociateAgentKnowledgeBaseRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new DisassociateAgentKnowledgeBaseRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(disassociateAgentKnowledgeBaseRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociateAgentKnowledgeBase");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new DisassociateAgentKnowledgeBaseResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets information about an agent.
*
*
* @param getAgentRequest
* @return Result of the GetAgent operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.GetAgent
* @see AWS API
* Documentation
*/
@Override
public GetAgentResult getAgent(GetAgentRequest request) {
request = beforeClientExecution(request);
return executeGetAgent(request);
}
@SdkInternalApi
final GetAgentResult executeGetAgent(GetAgentRequest getAgentRequest) {
ExecutionContext executionContext = createExecutionContext(getAgentRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetAgentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getAgentRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetAgent");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetAgentResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets information about an action group for an agent.
*
*
* @param getAgentActionGroupRequest
* @return Result of the GetAgentActionGroup operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.GetAgentActionGroup
* @see AWS API Documentation
*/
@Override
public GetAgentActionGroupResult getAgentActionGroup(GetAgentActionGroupRequest request) {
request = beforeClientExecution(request);
return executeGetAgentActionGroup(request);
}
@SdkInternalApi
final GetAgentActionGroupResult executeGetAgentActionGroup(GetAgentActionGroupRequest getAgentActionGroupRequest) {
ExecutionContext executionContext = createExecutionContext(getAgentActionGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetAgentActionGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getAgentActionGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetAgentActionGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetAgentActionGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets information about an alias of an agent.
*
*
* @param getAgentAliasRequest
* @return Result of the GetAgentAlias operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.GetAgentAlias
* @see AWS
* API Documentation
*/
@Override
public GetAgentAliasResult getAgentAlias(GetAgentAliasRequest request) {
request = beforeClientExecution(request);
return executeGetAgentAlias(request);
}
@SdkInternalApi
final GetAgentAliasResult executeGetAgentAlias(GetAgentAliasRequest getAgentAliasRequest) {
ExecutionContext executionContext = createExecutionContext(getAgentAliasRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetAgentAliasRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getAgentAliasRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetAgentAlias");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetAgentAliasResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets information about a knowledge base associated with an agent.
*
*
* @param getAgentKnowledgeBaseRequest
* @return Result of the GetAgentKnowledgeBase operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.GetAgentKnowledgeBase
* @see AWS API Documentation
*/
@Override
public GetAgentKnowledgeBaseResult getAgentKnowledgeBase(GetAgentKnowledgeBaseRequest request) {
request = beforeClientExecution(request);
return executeGetAgentKnowledgeBase(request);
}
@SdkInternalApi
final GetAgentKnowledgeBaseResult executeGetAgentKnowledgeBase(GetAgentKnowledgeBaseRequest getAgentKnowledgeBaseRequest) {
ExecutionContext executionContext = createExecutionContext(getAgentKnowledgeBaseRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetAgentKnowledgeBaseRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getAgentKnowledgeBaseRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetAgentKnowledgeBase");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new GetAgentKnowledgeBaseResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets details about a version of an agent.
*
*
* @param getAgentVersionRequest
* @return Result of the GetAgentVersion operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.GetAgentVersion
* @see AWS
* API Documentation
*/
@Override
public GetAgentVersionResult getAgentVersion(GetAgentVersionRequest request) {
request = beforeClientExecution(request);
return executeGetAgentVersion(request);
}
@SdkInternalApi
final GetAgentVersionResult executeGetAgentVersion(GetAgentVersionRequest getAgentVersionRequest) {
ExecutionContext executionContext = createExecutionContext(getAgentVersionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetAgentVersionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getAgentVersionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetAgentVersion");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetAgentVersionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets information about a data source.
*
*
* @param getDataSourceRequest
* @return Result of the GetDataSource operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.GetDataSource
* @see AWS
* API Documentation
*/
@Override
public GetDataSourceResult getDataSource(GetDataSourceRequest request) {
request = beforeClientExecution(request);
return executeGetDataSource(request);
}
@SdkInternalApi
final GetDataSourceResult executeGetDataSource(GetDataSourceRequest getDataSourceRequest) {
ExecutionContext executionContext = createExecutionContext(getDataSourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetDataSourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getDataSourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetDataSource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetDataSourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Retrieves information about a flow. For more information, see Manage a flow in Amazon Bedrock
* in the Amazon Bedrock User Guide.
*
*
* @param getFlowRequest
* @return Result of the GetFlow operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.GetFlow
* @see AWS API
* Documentation
*/
@Override
public GetFlowResult getFlow(GetFlowRequest request) {
request = beforeClientExecution(request);
return executeGetFlow(request);
}
@SdkInternalApi
final GetFlowResult executeGetFlow(GetFlowRequest getFlowRequest) {
ExecutionContext executionContext = createExecutionContext(getFlowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetFlowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getFlowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetFlow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetFlowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Retrieves information about a flow. For more information, see Deploy a flow in Amazon Bedrock
* in the Amazon Bedrock User Guide.
*
*
* @param getFlowAliasRequest
* @return Result of the GetFlowAlias operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.GetFlowAlias
* @see AWS API
* Documentation
*/
@Override
public GetFlowAliasResult getFlowAlias(GetFlowAliasRequest request) {
request = beforeClientExecution(request);
return executeGetFlowAlias(request);
}
@SdkInternalApi
final GetFlowAliasResult executeGetFlowAlias(GetFlowAliasRequest getFlowAliasRequest) {
ExecutionContext executionContext = createExecutionContext(getFlowAliasRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetFlowAliasRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getFlowAliasRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetFlowAlias");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetFlowAliasResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Retrieves information about a version of a flow. For more information, see Deploy a flow in Amazon Bedrock
* in the Amazon Bedrock User Guide.
*
*
* @param getFlowVersionRequest
* @return Result of the GetFlowVersion operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.GetFlowVersion
* @see AWS
* API Documentation
*/
@Override
public GetFlowVersionResult getFlowVersion(GetFlowVersionRequest request) {
request = beforeClientExecution(request);
return executeGetFlowVersion(request);
}
@SdkInternalApi
final GetFlowVersionResult executeGetFlowVersion(GetFlowVersionRequest getFlowVersionRequest) {
ExecutionContext executionContext = createExecutionContext(getFlowVersionRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetFlowVersionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getFlowVersionRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetFlowVersion");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetFlowVersionResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets information about a ingestion job, in which a data source is added to a knowledge base.
*
*
* @param getIngestionJobRequest
* @return Result of the GetIngestionJob operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.GetIngestionJob
* @see AWS
* API Documentation
*/
@Override
public GetIngestionJobResult getIngestionJob(GetIngestionJobRequest request) {
request = beforeClientExecution(request);
return executeGetIngestionJob(request);
}
@SdkInternalApi
final GetIngestionJobResult executeGetIngestionJob(GetIngestionJobRequest getIngestionJobRequest) {
ExecutionContext executionContext = createExecutionContext(getIngestionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetIngestionJobRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getIngestionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetIngestionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetIngestionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Gets information about a knoweldge base.
*
*
* @param getKnowledgeBaseRequest
* @return Result of the GetKnowledgeBase operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.GetKnowledgeBase
* @see AWS
* API Documentation
*/
@Override
public GetKnowledgeBaseResult getKnowledgeBase(GetKnowledgeBaseRequest request) {
request = beforeClientExecution(request);
return executeGetKnowledgeBase(request);
}
@SdkInternalApi
final GetKnowledgeBaseResult executeGetKnowledgeBase(GetKnowledgeBaseRequest getKnowledgeBaseRequest) {
ExecutionContext executionContext = createExecutionContext(getKnowledgeBaseRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetKnowledgeBaseRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getKnowledgeBaseRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetKnowledgeBase");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetKnowledgeBaseResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Retrieves information about a prompt or a version of it. For more information, see View information about prompts using Prompt management and View information about a version of your prompt in the Amazon Bedrock User Guide.
*
*
* @param getPromptRequest
* @return Result of the GetPrompt operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.GetPrompt
* @see AWS API
* Documentation
*/
@Override
public GetPromptResult getPrompt(GetPromptRequest request) {
request = beforeClientExecution(request);
return executeGetPrompt(request);
}
@SdkInternalApi
final GetPromptResult executeGetPrompt(GetPromptRequest getPromptRequest) {
ExecutionContext executionContext = createExecutionContext(getPromptRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new GetPromptRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getPromptRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetPrompt");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetPromptResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Lists the action groups for an agent and information about each one.
*
*
* @param listAgentActionGroupsRequest
* @return Result of the ListAgentActionGroups operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.ListAgentActionGroups
* @see AWS API Documentation
*/
@Override
public ListAgentActionGroupsResult listAgentActionGroups(ListAgentActionGroupsRequest request) {
request = beforeClientExecution(request);
return executeListAgentActionGroups(request);
}
@SdkInternalApi
final ListAgentActionGroupsResult executeListAgentActionGroups(ListAgentActionGroupsRequest listAgentActionGroupsRequest) {
ExecutionContext executionContext = createExecutionContext(listAgentActionGroupsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListAgentActionGroupsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listAgentActionGroupsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListAgentActionGroups");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory
.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListAgentActionGroupsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Lists the aliases of an agent and information about each one.
*
*
* @param listAgentAliasesRequest
* @return Result of the ListAgentAliases operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.ListAgentAliases
* @see AWS
* API Documentation
*/
@Override
public ListAgentAliasesResult listAgentAliases(ListAgentAliasesRequest request) {
request = beforeClientExecution(request);
return executeListAgentAliases(request);
}
@SdkInternalApi
final ListAgentAliasesResult executeListAgentAliases(ListAgentAliasesRequest listAgentAliasesRequest) {
ExecutionContext executionContext = createExecutionContext(listAgentAliasesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListAgentAliasesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listAgentAliasesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListAgentAliases");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListAgentAliasesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Lists knowledge bases associated with an agent and information about each one.
*
*
* @param listAgentKnowledgeBasesRequest
* @return Result of the ListAgentKnowledgeBases operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.ListAgentKnowledgeBases
* @see AWS API Documentation
*/
@Override
public ListAgentKnowledgeBasesResult listAgentKnowledgeBases(ListAgentKnowledgeBasesRequest request) {
request = beforeClientExecution(request);
return executeListAgentKnowledgeBases(request);
}
@SdkInternalApi
final ListAgentKnowledgeBasesResult executeListAgentKnowledgeBases(ListAgentKnowledgeBasesRequest listAgentKnowledgeBasesRequest) {
ExecutionContext executionContext = createExecutionContext(listAgentKnowledgeBasesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListAgentKnowledgeBasesRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(listAgentKnowledgeBasesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListAgentKnowledgeBases");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new ListAgentKnowledgeBasesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Lists the versions of an agent and information about each version.
*
*
* @param listAgentVersionsRequest
* @return Result of the ListAgentVersions operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.ListAgentVersions
* @see AWS API Documentation
*/
@Override
public ListAgentVersionsResult listAgentVersions(ListAgentVersionsRequest request) {
request = beforeClientExecution(request);
return executeListAgentVersions(request);
}
@SdkInternalApi
final ListAgentVersionsResult executeListAgentVersions(ListAgentVersionsRequest listAgentVersionsRequest) {
ExecutionContext executionContext = createExecutionContext(listAgentVersionsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListAgentVersionsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listAgentVersionsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListAgentVersions");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListAgentVersionsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Lists the agents belonging to an account and information about each agent.
*
*
* @param listAgentsRequest
* @return Result of the ListAgents operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AWSBedrockAgent.ListAgents
* @see AWS API
* Documentation
*/
@Override
public ListAgentsResult listAgents(ListAgentsRequest request) {
request = beforeClientExecution(request);
return executeListAgents(request);
}
@SdkInternalApi
final ListAgentsResult executeListAgents(ListAgentsRequest listAgentsRequest) {
ExecutionContext executionContext = createExecutionContext(listAgentsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListAgentsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listAgentsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListAgents");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListAgentsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Lists the data sources in a knowledge base and information about each one.
*
*
* @param listDataSourcesRequest
* @return Result of the ListDataSources operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.ListDataSources
* @see AWS
* API Documentation
*/
@Override
public ListDataSourcesResult listDataSources(ListDataSourcesRequest request) {
request = beforeClientExecution(request);
return executeListDataSources(request);
}
@SdkInternalApi
final ListDataSourcesResult executeListDataSources(ListDataSourcesRequest listDataSourcesRequest) {
ExecutionContext executionContext = createExecutionContext(listDataSourcesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListDataSourcesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listDataSourcesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListDataSources");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListDataSourcesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a list of aliases for a flow.
*
*
* @param listFlowAliasesRequest
* @return Result of the ListFlowAliases operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.ListFlowAliases
* @see AWS
* API Documentation
*/
@Override
public ListFlowAliasesResult listFlowAliases(ListFlowAliasesRequest request) {
request = beforeClientExecution(request);
return executeListFlowAliases(request);
}
@SdkInternalApi
final ListFlowAliasesResult executeListFlowAliases(ListFlowAliasesRequest listFlowAliasesRequest) {
ExecutionContext executionContext = createExecutionContext(listFlowAliasesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListFlowAliasesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listFlowAliasesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListFlowAliases");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListFlowAliasesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a list of information about each flow. For more information, see Deploy a flow in Amazon Bedrock
* in the Amazon Bedrock User Guide.
*
*
* @param listFlowVersionsRequest
* @return Result of the ListFlowVersions operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.ListFlowVersions
* @see AWS
* API Documentation
*/
@Override
public ListFlowVersionsResult listFlowVersions(ListFlowVersionsRequest request) {
request = beforeClientExecution(request);
return executeListFlowVersions(request);
}
@SdkInternalApi
final ListFlowVersionsResult executeListFlowVersions(ListFlowVersionsRequest listFlowVersionsRequest) {
ExecutionContext executionContext = createExecutionContext(listFlowVersionsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListFlowVersionsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listFlowVersionsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListFlowVersions");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListFlowVersionsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a list of flows and information about each flow. For more information, see Manage a flow in Amazon Bedrock
* in the Amazon Bedrock User Guide.
*
*
* @param listFlowsRequest
* @return Result of the ListFlows operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AWSBedrockAgent.ListFlows
* @see AWS API
* Documentation
*/
@Override
public ListFlowsResult listFlows(ListFlowsRequest request) {
request = beforeClientExecution(request);
return executeListFlows(request);
}
@SdkInternalApi
final ListFlowsResult executeListFlows(ListFlowsRequest listFlowsRequest) {
ExecutionContext executionContext = createExecutionContext(listFlowsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListFlowsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listFlowsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListFlows");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListFlowsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Lists the ingestion jobs for a data source and information about each of them.
*
*
* @param listIngestionJobsRequest
* @return Result of the ListIngestionJobs operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.ListIngestionJobs
* @see AWS API Documentation
*/
@Override
public ListIngestionJobsResult listIngestionJobs(ListIngestionJobsRequest request) {
request = beforeClientExecution(request);
return executeListIngestionJobs(request);
}
@SdkInternalApi
final ListIngestionJobsResult executeListIngestionJobs(ListIngestionJobsRequest listIngestionJobsRequest) {
ExecutionContext executionContext = createExecutionContext(listIngestionJobsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListIngestionJobsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listIngestionJobsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListIngestionJobs");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListIngestionJobsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Lists the knowledge bases in an account and information about each of them.
*
*
* @param listKnowledgeBasesRequest
* @return Result of the ListKnowledgeBases operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @sample AWSBedrockAgent.ListKnowledgeBases
* @see AWS API Documentation
*/
@Override
public ListKnowledgeBasesResult listKnowledgeBases(ListKnowledgeBasesRequest request) {
request = beforeClientExecution(request);
return executeListKnowledgeBases(request);
}
@SdkInternalApi
final ListKnowledgeBasesResult executeListKnowledgeBases(ListKnowledgeBasesRequest listKnowledgeBasesRequest) {
ExecutionContext executionContext = createExecutionContext(listKnowledgeBasesRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListKnowledgeBasesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listKnowledgeBasesRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListKnowledgeBases");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListKnowledgeBasesResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Returns a list of prompts from the Prompt management tool and information about each prompt. For more
* information, see View information about prompts using Prompt management in the Amazon Bedrock User Guide.
*
*
* @param listPromptsRequest
* @return Result of the ListPrompts operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.ListPrompts
* @see AWS API
* Documentation
*/
@Override
public ListPromptsResult listPrompts(ListPromptsRequest request) {
request = beforeClientExecution(request);
return executeListPrompts(request);
}
@SdkInternalApi
final ListPromptsResult executeListPrompts(ListPromptsRequest listPromptsRequest) {
ExecutionContext executionContext = createExecutionContext(listPromptsRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListPromptsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listPromptsRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListPrompts");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListPromptsResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* List all the tags for the resource you specify.
*
*
* @param listTagsForResourceRequest
* @return Result of the ListTagsForResource operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.ListTagsForResource
* @see AWS API Documentation
*/
@Override
public ListTagsForResourceResult listTagsForResource(ListTagsForResourceRequest request) {
request = beforeClientExecution(request);
return executeListTagsForResource(request);
}
@SdkInternalApi
final ListTagsForResourceResult executeListTagsForResource(ListTagsForResourceRequest listTagsForResourceRequest) {
ExecutionContext executionContext = createExecutionContext(listTagsForResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new ListTagsForResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listTagsForResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListTagsForResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListTagsForResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Creates a DRAFT
version of the agent that can be used for internal testing.
*
*
* @param prepareAgentRequest
* @return Result of the PrepareAgent operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.PrepareAgent
* @see AWS API
* Documentation
*/
@Override
public PrepareAgentResult prepareAgent(PrepareAgentRequest request) {
request = beforeClientExecution(request);
return executePrepareAgent(request);
}
@SdkInternalApi
final PrepareAgentResult executePrepareAgent(PrepareAgentRequest prepareAgentRequest) {
ExecutionContext executionContext = createExecutionContext(prepareAgentRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new PrepareAgentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(prepareAgentRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PrepareAgent");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PrepareAgentResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Prepares the DRAFT
version of a flow so that it can be invoked. For more information, see Test a flow in Amazon Bedrock in
* the Amazon Bedrock User Guide.
*
*
* @param prepareFlowRequest
* @return Result of the PrepareFlow operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.PrepareFlow
* @see AWS API
* Documentation
*/
@Override
public PrepareFlowResult prepareFlow(PrepareFlowRequest request) {
request = beforeClientExecution(request);
return executePrepareFlow(request);
}
@SdkInternalApi
final PrepareFlowResult executePrepareFlow(PrepareFlowRequest prepareFlowRequest) {
ExecutionContext executionContext = createExecutionContext(prepareFlowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new PrepareFlowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(prepareFlowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PrepareFlow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PrepareFlowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Begins an ingestion job, in which a data source is added to a knowledge base.
*
*
* @param startIngestionJobRequest
* @return Result of the StartIngestionJob operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.StartIngestionJob
* @see AWS API Documentation
*/
@Override
public StartIngestionJobResult startIngestionJob(StartIngestionJobRequest request) {
request = beforeClientExecution(request);
return executeStartIngestionJob(request);
}
@SdkInternalApi
final StartIngestionJobResult executeStartIngestionJob(StartIngestionJobRequest startIngestionJobRequest) {
ExecutionContext executionContext = createExecutionContext(startIngestionJobRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new StartIngestionJobRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(startIngestionJobRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartIngestionJob");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StartIngestionJobResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Associate tags with a resource. For more information, see Tagging resources in the
* Amazon Bedrock User Guide.
*
*
* @param tagResourceRequest
* @return Result of the TagResource operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.TagResource
* @see AWS API
* Documentation
*/
@Override
public TagResourceResult tagResource(TagResourceRequest request) {
request = beforeClientExecution(request);
return executeTagResource(request);
}
@SdkInternalApi
final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(tagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Remove tags from a resource.
*
*
* @param untagResourceRequest
* @return Result of the UntagResource operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @sample AWSBedrockAgent.UntagResource
* @see AWS
* API Documentation
*/
@Override
public UntagResourceResult untagResource(UntagResourceRequest request) {
request = beforeClientExecution(request);
return executeUntagResource(request);
}
@SdkInternalApi
final UntagResourceResult executeUntagResource(UntagResourceRequest untagResourceRequest) {
ExecutionContext executionContext = createExecutionContext(untagResourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UntagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(untagResourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UntagResourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Updates the configuration of an agent.
*
*
* @param updateAgentRequest
* @return Result of the UpdateAgent operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.UpdateAgent
* @see AWS API
* Documentation
*/
@Override
public UpdateAgentResult updateAgent(UpdateAgentRequest request) {
request = beforeClientExecution(request);
return executeUpdateAgent(request);
}
@SdkInternalApi
final UpdateAgentResult executeUpdateAgent(UpdateAgentRequest updateAgentRequest) {
ExecutionContext executionContext = createExecutionContext(updateAgentRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateAgentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateAgentRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateAgent");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateAgentResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Updates the configuration for an action group for an agent.
*
*
* @param updateAgentActionGroupRequest
* @return Result of the UpdateAgentActionGroup operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.UpdateAgentActionGroup
* @see AWS API Documentation
*/
@Override
public UpdateAgentActionGroupResult updateAgentActionGroup(UpdateAgentActionGroupRequest request) {
request = beforeClientExecution(request);
return executeUpdateAgentActionGroup(request);
}
@SdkInternalApi
final UpdateAgentActionGroupResult executeUpdateAgentActionGroup(UpdateAgentActionGroupRequest updateAgentActionGroupRequest) {
ExecutionContext executionContext = createExecutionContext(updateAgentActionGroupRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateAgentActionGroupRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateAgentActionGroupRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateAgentActionGroup");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new UpdateAgentActionGroupResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Updates configurations for an alias of an agent.
*
*
* @param updateAgentAliasRequest
* @return Result of the UpdateAgentAlias operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.UpdateAgentAlias
* @see AWS
* API Documentation
*/
@Override
public UpdateAgentAliasResult updateAgentAlias(UpdateAgentAliasRequest request) {
request = beforeClientExecution(request);
return executeUpdateAgentAlias(request);
}
@SdkInternalApi
final UpdateAgentAliasResult executeUpdateAgentAlias(UpdateAgentAliasRequest updateAgentAliasRequest) {
ExecutionContext executionContext = createExecutionContext(updateAgentAliasRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateAgentAliasRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateAgentAliasRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateAgentAlias");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateAgentAliasResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Updates the configuration for a knowledge base that has been associated with an agent.
*
*
* @param updateAgentKnowledgeBaseRequest
* @return Result of the UpdateAgentKnowledgeBase operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @sample AWSBedrockAgent.UpdateAgentKnowledgeBase
* @see AWS API Documentation
*/
@Override
public UpdateAgentKnowledgeBaseResult updateAgentKnowledgeBase(UpdateAgentKnowledgeBaseRequest request) {
request = beforeClientExecution(request);
return executeUpdateAgentKnowledgeBase(request);
}
@SdkInternalApi
final UpdateAgentKnowledgeBaseResult executeUpdateAgentKnowledgeBase(UpdateAgentKnowledgeBaseRequest updateAgentKnowledgeBaseRequest) {
ExecutionContext executionContext = createExecutionContext(updateAgentKnowledgeBaseRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateAgentKnowledgeBaseRequestProtocolMarshaller(protocolFactory).marshall(super
.beforeMarshalling(updateAgentKnowledgeBaseRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateAgentKnowledgeBase");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false),
new UpdateAgentKnowledgeBaseResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Updates the configurations for a data source connector.
*
*
*
* You can't change the chunkingConfiguration
after you create the data source connector. Specify the
* existing chunkingConfiguration
.
*
*
*
* @param updateDataSourceRequest
* @return Result of the UpdateDataSource operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @sample AWSBedrockAgent.UpdateDataSource
* @see AWS
* API Documentation
*/
@Override
public UpdateDataSourceResult updateDataSource(UpdateDataSourceRequest request) {
request = beforeClientExecution(request);
return executeUpdateDataSource(request);
}
@SdkInternalApi
final UpdateDataSourceResult executeUpdateDataSource(UpdateDataSourceRequest updateDataSourceRequest) {
ExecutionContext executionContext = createExecutionContext(updateDataSourceRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateDataSourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateDataSourceRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateDataSource");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateDataSourceResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Modifies a flow. Include both fields that you want to keep and fields that you want to change. For more
* information, see How it
* works and Create a flow in
* Amazon Bedrock in the Amazon Bedrock User Guide.
*
*
* @param updateFlowRequest
* @return Result of the UpdateFlow operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.UpdateFlow
* @see AWS API
* Documentation
*/
@Override
public UpdateFlowResult updateFlow(UpdateFlowRequest request) {
request = beforeClientExecution(request);
return executeUpdateFlow(request);
}
@SdkInternalApi
final UpdateFlowResult executeUpdateFlow(UpdateFlowRequest updateFlowRequest) {
ExecutionContext executionContext = createExecutionContext(updateFlowRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateFlowRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateFlowRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateFlow");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata()
.withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateFlowResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Modifies the alias of a flow. Include both fields that you want to keep and ones that you want to change. For
* more information, see Deploy a
* flow in Amazon Bedrock in the Amazon Bedrock User Guide.
*
*
* @param updateFlowAliasRequest
* @return Result of the UpdateFlowAlias operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.UpdateFlowAlias
* @see AWS
* API Documentation
*/
@Override
public UpdateFlowAliasResult updateFlowAlias(UpdateFlowAliasRequest request) {
request = beforeClientExecution(request);
return executeUpdateFlowAlias(request);
}
@SdkInternalApi
final UpdateFlowAliasResult executeUpdateFlowAlias(UpdateFlowAliasRequest updateFlowAliasRequest) {
ExecutionContext executionContext = createExecutionContext(updateFlowAliasRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateFlowAliasRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateFlowAliasRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateFlowAlias");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateFlowAliasResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Updates the configuration of a knowledge base with the fields that you specify. Because all fields will be
* overwritten, you must include the same values for fields that you want to keep the same.
*
*
* You can change the following fields:
*
*
* -
*
* name
*
*
* -
*
* description
*
*
* -
*
* roleArn
*
*
*
*
* You can't change the knowledgeBaseConfiguration
or storageConfiguration
fields, so you
* must specify the same configurations as when you created the knowledge base. You can send a GetKnowledgeBase request and copy the same configurations.
*
*
* @param updateKnowledgeBaseRequest
* @return Result of the UpdateKnowledgeBase operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @sample AWSBedrockAgent.UpdateKnowledgeBase
* @see AWS API Documentation
*/
@Override
public UpdateKnowledgeBaseResult updateKnowledgeBase(UpdateKnowledgeBaseRequest request) {
request = beforeClientExecution(request);
return executeUpdateKnowledgeBase(request);
}
@SdkInternalApi
final UpdateKnowledgeBaseResult executeUpdateKnowledgeBase(UpdateKnowledgeBaseRequest updateKnowledgeBaseRequest) {
ExecutionContext executionContext = createExecutionContext(updateKnowledgeBaseRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdateKnowledgeBaseRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateKnowledgeBaseRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateKnowledgeBase");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateKnowledgeBaseResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
*
* Modifies a prompt in your prompt library. Include both fields that you want to keep and fields that you want to
* replace. For more information, see Prompt management in Amazon
* Bedrock and Edit
* prompts in your prompt library in the Amazon Bedrock User Guide.
*
*
* @param updatePromptRequest
* @return Result of the UpdatePrompt operation returned by the service.
* @throws ThrottlingException
* The number of requests exceeds the limit. Resubmit your request later.
* @throws AccessDeniedException
* The request is denied because of missing access permissions.
* @throws ValidationException
* Input validation failed. Check your request parameters and retry the request.
* @throws InternalServerException
* An internal server error occurred. Retry your request.
* @throws ResourceNotFoundException
* The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and
* try your request again.
* @throws ConflictException
* There was a conflict performing an operation.
* @throws ServiceQuotaExceededException
* The number of requests exceeds the service quota. Resubmit your request later.
* @sample AWSBedrockAgent.UpdatePrompt
* @see AWS API
* Documentation
*/
@Override
public UpdatePromptResult updatePrompt(UpdatePromptRequest request) {
request = beforeClientExecution(request);
return executeUpdatePrompt(request);
}
@SdkInternalApi
final UpdatePromptResult executeUpdatePrompt(UpdatePromptRequest updatePromptRequest) {
ExecutionContext executionContext = createExecutionContext(updatePromptRequest);
AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();
awsRequestMetrics.startEvent(Field.ClientExecuteTime);
Request request = null;
Response response = null;
try {
awsRequestMetrics.startEvent(Field.RequestMarshallTime);
try {
request = new UpdatePromptRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updatePromptRequest));
// Binds the request metrics to the current request.
request.setAWSRequestMetrics(awsRequestMetrics);
request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);
request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());
request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());
request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Bedrock Agent");
request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdatePrompt");
request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);
} finally {
awsRequestMetrics.endEvent(Field.RequestMarshallTime);
}
HttpResponseHandler> responseHandler = protocolFactory.createResponseHandler(
new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdatePromptResultJsonUnmarshaller());
response = invoke(request, responseHandler, executionContext);
return response.getAwsResponse();
} finally {
endClientExecution(awsRequestMetrics, request, response);
}
}
/**
* Returns additional metadata for a previously executed successful, request, typically used for debugging issues
* where a service isn't acting as expected. This data isn't considered part of the result data returned by an
* operation, so it's available through this separate, diagnostic interface.
*
* Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic
* information for an executed request, you should use this method to retrieve it as soon as possible after
* executing the request.
*
* @param request
* The originally executed request
*
* @return The response metadata for the specified request, or null if none is available.
*/
public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request) {
return client.getResponseMetadataForRequest(request);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private Response invoke(Request request, HttpResponseHandler> responseHandler,
ExecutionContext executionContext) {
return invoke(request, responseHandler, executionContext, null, null);
}
/**
* Normal invoke with authentication. Credentials are required and may be overriden at the request level.
**/
private Response invoke(Request request, HttpResponseHandler> responseHandler,
ExecutionContext executionContext, URI cachedEndpoint, URI uriFromEndpointTrait) {
executionContext.setCredentialsProvider(CredentialUtils.getCredentialsProvider(request.getOriginalRequest(), awsCredentialsProvider));
return doInvoke(request, responseHandler, executionContext, cachedEndpoint, uriFromEndpointTrait);
}
/**
* Invoke with no authentication. Credentials are not required and any credentials set on the client or request will
* be ignored for this operation.
**/
private Response anonymousInvoke(Request request,
HttpResponseHandler> responseHandler, ExecutionContext executionContext) {
return doInvoke(request, responseHandler, executionContext, null, null);
}
/**
* Invoke the request using the http client. Assumes credentials (or lack thereof) have been configured in the
* ExecutionContext beforehand.
**/
private Response doInvoke(Request request, HttpResponseHandler> responseHandler,
ExecutionContext executionContext, URI discoveredEndpoint, URI uriFromEndpointTrait) {
if (discoveredEndpoint != null) {
request.setEndpoint(discoveredEndpoint);
request.getOriginalRequest().getRequestClientOptions().appendUserAgent("endpoint-discovery");
} else if (uriFromEndpointTrait != null) {
request.setEndpoint(uriFromEndpointTrait);
} else {
request.setEndpoint(endpoint);
}
request.setTimeOffset(timeOffset);
HttpResponseHandler errorResponseHandler = protocolFactory.createErrorResponseHandler(new JsonErrorResponseMetadata());
return client.execute(request, responseHandler, errorResponseHandler, executionContext);
}
@com.amazonaws.annotation.SdkInternalApi
static com.amazonaws.protocol.json.SdkJsonProtocolFactory getProtocolFactory() {
return protocolFactory;
}
@Override
public void shutdown() {
super.shutdown();
}
}