createGateway method
- required AuthorizerType authorizerType,
- required String name,
- required String roleArn,
- AuthorizerConfiguration? authorizerConfiguration,
- String? clientToken,
- String? description,
- ExceptionLevel? exceptionLevel,
- List<
GatewayInterceptorConfiguration> ? interceptorConfigurations, - String? kmsKeyArn,
- GatewayPolicyEngineConfiguration? policyEngineConfiguration,
- GatewayProtocolConfiguration? protocolConfiguration,
- GatewayProtocolType? protocolType,
- Map<
String, String> ? tags,
Creates a gateway for Amazon Bedrock Agent. A gateway serves as an integration point between your agent and external services.
If you specify CUSTOM_JWT as the authorizerType,
you must provide an authorizerConfiguration.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter authorizerType :
The type of authorizer to use for the gateway.
-
CUSTOM_JWT- Authorize with a bearer token. -
AWS_IAM- Authorize with your Amazon Web Services IAM credentials. -
NONE- No authorization
Parameter name :
The name of the gateway. The name must be unique within your account.
Parameter roleArn :
The Amazon Resource Name (ARN) of the IAM role that provides permissions
for the gateway to access Amazon Web Services services.
Parameter authorizerConfiguration :
The authorizer configuration for the gateway. Required if
authorizerType is CUSTOM_JWT.
Parameter clientToken :
A unique, case-sensitive identifier to ensure that the API request
completes no more than one time. If you don't specify this field, a value
is randomly generated for you. If this token matches a previous request,
the service ignores the request, but doesn't return an error. For more
information, see Ensuring
idempotency.
Parameter description :
The description of the gateway.
Parameter exceptionLevel :
The level of detail in error messages returned when invoking the gateway.
-
If the value is
DEBUG, granular exception messages are returned to help a user debug the gateway. - If the value is omitted, a generic error message is returned to the end user.
Parameter interceptorConfigurations :
A list of configuration settings for a gateway interceptor. Gateway
interceptors allow custom code to be invoked during gateway invocations.
Parameter kmsKeyArn :
The Amazon Resource Name (ARN) of the KMS key used to encrypt data
associated with the gateway.
Parameter policyEngineConfiguration :
The policy engine configuration for the gateway. A policy engine is a
collection of policies that evaluates and authorizes agent tool calls.
When associated with a gateway, the policy engine intercepts all agent
requests and determines whether to allow or deny each action based on the
defined policies.
Parameter protocolConfiguration :
The configuration settings for the protocol specified in the
protocolType parameter.
Parameter protocolType :
The protocol type for the gateway.
Parameter tags :
A map of key-value pairs to associate with the gateway as metadata tags.
Implementation
Future<CreateGatewayResponse> createGateway({
required AuthorizerType authorizerType,
required String name,
required String roleArn,
AuthorizerConfiguration? authorizerConfiguration,
String? clientToken,
String? description,
ExceptionLevel? exceptionLevel,
List<GatewayInterceptorConfiguration>? interceptorConfigurations,
String? kmsKeyArn,
GatewayPolicyEngineConfiguration? policyEngineConfiguration,
GatewayProtocolConfiguration? protocolConfiguration,
GatewayProtocolType? protocolType,
Map<String, String>? tags,
}) async {
final $payload = <String, dynamic>{
'authorizerType': authorizerType.value,
'name': name,
'roleArn': roleArn,
if (authorizerConfiguration != null)
'authorizerConfiguration': authorizerConfiguration,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
if (exceptionLevel != null) 'exceptionLevel': exceptionLevel.value,
if (interceptorConfigurations != null)
'interceptorConfigurations': interceptorConfigurations,
if (kmsKeyArn != null) 'kmsKeyArn': kmsKeyArn,
if (policyEngineConfiguration != null)
'policyEngineConfiguration': policyEngineConfiguration,
if (protocolConfiguration != null)
'protocolConfiguration': protocolConfiguration,
if (protocolType != null) 'protocolType': protocolType.value,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/gateways/',
exceptionFnMap: _exceptionFns,
);
return CreateGatewayResponse.fromJson(response);
}