BedrockAgentCoreControl / Client / get_gateway_rule
get_gateway_rule¶
- BedrockAgentCoreControl.Client.get_gateway_rule(**kwargs)¶
Retrieves detailed information about a specific gateway rule.
See also: AWS API Documentation
Request Syntax
response = client.get_gateway_rule( gatewayIdentifier='string', ruleId='string' )
- Parameters:
gatewayIdentifier (string) –
[REQUIRED]
The identifier of the gateway containing the rule.
ruleId (string) –
[REQUIRED]
The unique identifier of the rule to retrieve.
- Return type:
dict
- Returns:
Response Syntax
{ 'ruleId': 'string', 'gatewayArn': 'string', 'priority': 123, 'conditions': [ { 'matchPrincipals': { 'anyOf': [ { 'iamPrincipal': { 'arn': 'string', 'operator': 'StringEquals'|'StringLike' } }, ] }, 'matchPaths': { 'anyOf': [ 'string', ] }, 'matchModels': { 'anyOf': [ { 'value': 'string', 'operator': 'StringEquals'|'StringLike' }, ] } }, ], 'actions': [ { 'configurationBundle': { 'staticOverride': { 'bundleArn': 'string', 'bundleVersion': 'string' }, 'weightedOverride': { 'trafficSplit': [ { 'name': 'string', 'weight': 123, 'configurationBundle': { 'bundleArn': 'string', 'bundleVersion': 'string' }, 'description': 'string', 'metadata': { 'string': 'string' } }, ] } }, 'routeToTarget': { 'staticRoute': { 'targetName': 'string', 'model': 'string', 'fallback': { 'triggerOn': { 'statusCodes': [ 'string', ], 'errors': [ 'CONNECTION_ERROR'|'FIRST_BYTE_TIMEOUT'|'UNROUTABLE', ] }, 'firstByteTimeoutMilliseconds': 123, 'circuitBreaker': { 'mode': 'ENABLED'|'DISABLED' }, 'targetFallback': [ { 'targetName': 'string', 'model': 'string', 'triggerOn': { 'statusCodes': [ 'string', ], 'errors': [ 'CONNECTION_ERROR'|'FIRST_BYTE_TIMEOUT'|'UNROUTABLE', ] }, 'firstByteTimeoutMilliseconds': 123 }, ] } }, 'weightedRoute': { 'trafficSplit': [ { 'targetName': 'string', 'model': 'string', 'fallback': { 'triggerOn': { 'statusCodes': [ 'string', ], 'errors': [ 'CONNECTION_ERROR'|'FIRST_BYTE_TIMEOUT'|'UNROUTABLE', ] }, 'firstByteTimeoutMilliseconds': 123, 'circuitBreaker': { 'mode': 'ENABLED'|'DISABLED' }, 'targetFallback': [ { 'targetName': 'string', 'model': 'string', 'triggerOn': { 'statusCodes': [ 'string', ], 'errors': [ 'CONNECTION_ERROR'|'FIRST_BYTE_TIMEOUT'|'UNROUTABLE', ] }, 'firstByteTimeoutMilliseconds': 123 }, ] }, 'name': 'string', 'weight': 123, 'description': 'string', 'metadata': { 'string': 'string' } }, ] } } }, ], 'description': 'string', 'createdAt': datetime(2015, 1, 1), 'status': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING', 'system': { 'managedBy': 'string' }, 'updatedAt': datetime(2015, 1, 1) }
Response Structure
(dict) –
Create response excludes updatedAt (redundant on create). Get/Update responses include it via their own output structures.
ruleId (string) –
The unique identifier of the gateway rule.
gatewayArn (string) –
The Amazon Resource Name (ARN) of the gateway that the rule belongs to.
priority (integer) –
The priority of the rule. Rules are evaluated in order of priority, with lower numbers evaluated first.
conditions (list) –
The conditions that must be met for the rule to apply.
(dict) –
A condition that determines when a gateway rule applies. Conditions can match on principals, request paths, or the requested model.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
matchPrincipals,matchPaths,matchModels. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
matchPrincipals (dict) –
A condition that matches on the identity of the caller making the request.
anyOf (list) –
A list of principal entries. The condition is met if any of the entries match the caller’s identity.
(dict) –
Union for principal matching. Currently supports IAM principal ARN glob matching.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
iamPrincipal. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
iamPrincipal (dict) –
An IAM principal to match against, specified by ARN.
arn (string) –
The Amazon Resource Name (ARN) of the IAM principal. Supports user, role, and assumed-role ARNs. Wildcards can be used with the
StringLikeoperator.operator (string) –
The match operator.
StringEqualsrequires an exact match.StringLikesupports wildcard patterns using*and?.
matchPaths (dict) –
A condition that matches on the request path.
anyOf (list) –
A list of path patterns. The condition is met if the request path matches any of the patterns.
(string) –
matchModels (dict) –
A condition that matches on the model requested in an inference request.
anyOf (list) –
A list of model entries. The condition is met if the requested model matches any of the entries.
(dict) –
A model ID or pattern to match against the requested model, and the operator to use for the comparison.
value (string) –
The model ID or pattern to match. With the
StringLikeoperator, you can use*and?as wildcards, for exampleanthropic.claude-*.operator (string) –
The operator to use when comparing the requested model to the value:
StringEquals– Requires an exact match.StringLike– Supports wildcard patterns using*and?. This is the default.
actions (list) –
The actions to take when the rule conditions are met.
(dict) –
An action to take when a gateway rule’s conditions are met.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
configurationBundle,routeToTarget. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
configurationBundle (dict) –
An action that applies a configuration bundle override to the request.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
staticOverride,weightedOverride. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
staticOverride (dict) –
A static configuration bundle override that applies a single bundle version to all matching requests.
bundleArn (string) –
The Amazon Resource Name (ARN) of the configuration bundle to apply.
bundleVersion (string) –
The version of the configuration bundle to apply.
weightedOverride (dict) –
A weighted configuration bundle override that splits traffic between multiple bundle versions based on configured weights.
trafficSplit (list) –
The traffic split entries defining how traffic is distributed between configuration bundle versions.
(dict) –
An entry in a traffic split configuration, defining a named variant with a weight and configuration bundle reference.
name (string) –
The name of this traffic split variant.
weight (integer) –
The percentage of traffic to route to this variant. Weights across all entries must sum to 100.
configurationBundle (dict) –
The configuration bundle reference for this variant.
bundleArn (string) –
The Amazon Resource Name (ARN) of the configuration bundle.
bundleVersion (string) –
The version of the configuration bundle.
description (string) –
The description of this traffic split variant.
metadata (dict) –
Key-value metadata associated with this traffic split variant.
(string) –
(string) –
routeToTarget (dict) –
An action that routes the request to a specific target.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
staticRoute,weightedRoute. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBERas the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBERis as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
staticRoute (dict) –
A static route that sends all matching requests to a single target.
targetName (string) –
The name of the target to route requests to.
model (string) –
The model ID to send to the target. Supported only for inference targets. If you don’t specify a model, the gateway sends the model from the original request.
fallback (dict) –
The fallback configuration for this route. Supported only for inference targets.
triggerOn (dict) –
The status codes and errors from the route’s target that cause the gateway to send the request to the first fallback target. If you omit
triggerOn, the gateway falls back on5XXstatus codes and on theCONNECTION_ERROR,FIRST_BYTE_TIMEOUT, andUNROUTABLEerrors. If you specifytriggerOn, only the status codes and errors that you list trigger a fallback.statusCodes (list) –
The HTTP status codes returned by the target that trigger a fallback. You can specify the following:
An exact status code – A three-digit code, such as
429.A class of status codes – The first digit followed by
XX, such as5XX, which matches every code from 500 to 599.
Only 4XX and 5XX codes are supported. Throttling by the gateway itself doesn’t trigger a fallback.
(string) –
errors (list) –
The errors that trigger a fallback. You can specify the following:
CONNECTION_ERROR– The gateway couldn’t connect to the target because the connection was refused, reset, or timed out. The request didn’t reach the target.FIRST_BYTE_TIMEOUT– The target accepted the connection but didn’t return the first byte of the response withinfirstByteTimeoutMilliseconds. The gateway abandons the request before any of the response reaches you.UNROUTABLE– The gateway couldn’t route the request to the target, for example because the target doesn’t exist or doesn’t support the request path. These errors don’t count toward the circuit breaker.
(string) –
firstByteTimeoutMilliseconds (integer) –
The maximum time, in milliseconds, from sending the request to the route’s target until the first byte of the response body arrives. If the time expires, the gateway abandons the request and treats it as a
FIRST_BYTE_TIMEOUTerror. If you don’t specify a value, no timeout is enforced.circuitBreaker (dict) –
Specifies whether the gateway temporarily stops sending your requests to a failing target. The circuit breaker tracks each combination of target and model separately. With the circuit breaker enabled, the gateway skips one or more targets and models that fail repeatedly, and your requests go to the next target in the chain. The gateway always tries the last remaining target in the chain. The gateway enables the circuit breaker by default.
mode (string) –
Specifies whether you want the circuit breaker turned on. To turn it off, set this value to
DISABLED. The default isENABLED.
targetFallback (list) –
The ordered list of fallback targets. The gateway tries each target in order until a response doesn’t match that target’s triggers, and returns that response to the caller. If every target fails, the gateway returns the last response. You can specify up to two fallback targets. Each combination of target and model, including the route’s target, can appear only once.
(dict) –
Specifies a target to send the request to when the previous target in the fallback chain fails. Includes the target name, the model to send, and the conditions that trigger a fallback from this target to the next one.
targetName (string) –
The name of the gateway target to fall back to. The target must be an inference target.
model (string) –
The model ID to send to this fallback target. If you don’t specify a model, the gateway sends the model from the original request.
triggerOn (dict) –
The status codes and errors from this target that cause the gateway to send the request to the next fallback target. This setting isn’t inherited from the route. If you omit it, the gateway uses the default triggers:
5XXstatus codes and theCONNECTION_ERROR,FIRST_BYTE_TIMEOUT, andUNROUTABLEerrors.statusCodes (list) –
The HTTP status codes returned by the target that trigger a fallback. You can specify the following:
An exact status code – A three-digit code, such as
429.A class of status codes – The first digit followed by
XX, such as5XX, which matches every code from 500 to 599.
Only 4XX and 5XX codes are supported. Throttling by the gateway itself doesn’t trigger a fallback.
(string) –
errors (list) –
The errors that trigger a fallback. You can specify the following:
CONNECTION_ERROR– The gateway couldn’t connect to the target because the connection was refused, reset, or timed out. The request didn’t reach the target.FIRST_BYTE_TIMEOUT– The target accepted the connection but didn’t return the first byte of the response withinfirstByteTimeoutMilliseconds. The gateway abandons the request before any of the response reaches you.UNROUTABLE– The gateway couldn’t route the request to the target, for example because the target doesn’t exist or doesn’t support the request path. These errors don’t count toward the circuit breaker.
(string) –
firstByteTimeoutMilliseconds (integer) –
The maximum time, in milliseconds, from sending the request to this target until the first byte of the response body arrives. This setting isn’t inherited from the route. If you don’t specify a value, no timeout is enforced.
weightedRoute (dict) –
A weighted route that splits traffic between multiple targets.
trafficSplit (list) –
The traffic split entries defining how traffic is distributed between targets.
(dict) –
An entry in a target traffic split configuration.
targetName (string) –
The name of the target to route traffic to.
model (string) –
The model ID to send to the target for this variant. Supported only for inference targets. If you don’t specify a model, the gateway sends the model from the original request.
fallback (dict) –
The fallback configuration for this variant. Supported only for inference targets.
triggerOn (dict) –
The status codes and errors from the route’s target that cause the gateway to send the request to the first fallback target. If you omit
triggerOn, the gateway falls back on5XXstatus codes and on theCONNECTION_ERROR,FIRST_BYTE_TIMEOUT, andUNROUTABLEerrors. If you specifytriggerOn, only the status codes and errors that you list trigger a fallback.statusCodes (list) –
The HTTP status codes returned by the target that trigger a fallback. You can specify the following:
An exact status code – A three-digit code, such as
429.A class of status codes – The first digit followed by
XX, such as5XX, which matches every code from 500 to 599.
Only 4XX and 5XX codes are supported. Throttling by the gateway itself doesn’t trigger a fallback.
(string) –
errors (list) –
The errors that trigger a fallback. You can specify the following:
CONNECTION_ERROR– The gateway couldn’t connect to the target because the connection was refused, reset, or timed out. The request didn’t reach the target.FIRST_BYTE_TIMEOUT– The target accepted the connection but didn’t return the first byte of the response withinfirstByteTimeoutMilliseconds. The gateway abandons the request before any of the response reaches you.UNROUTABLE– The gateway couldn’t route the request to the target, for example because the target doesn’t exist or doesn’t support the request path. These errors don’t count toward the circuit breaker.
(string) –
firstByteTimeoutMilliseconds (integer) –
The maximum time, in milliseconds, from sending the request to the route’s target until the first byte of the response body arrives. If the time expires, the gateway abandons the request and treats it as a
FIRST_BYTE_TIMEOUTerror. If you don’t specify a value, no timeout is enforced.circuitBreaker (dict) –
Specifies whether the gateway temporarily stops sending your requests to a failing target. The circuit breaker tracks each combination of target and model separately. With the circuit breaker enabled, the gateway skips one or more targets and models that fail repeatedly, and your requests go to the next target in the chain. The gateway always tries the last remaining target in the chain. The gateway enables the circuit breaker by default.
mode (string) –
Specifies whether you want the circuit breaker turned on. To turn it off, set this value to
DISABLED. The default isENABLED.
targetFallback (list) –
The ordered list of fallback targets. The gateway tries each target in order until a response doesn’t match that target’s triggers, and returns that response to the caller. If every target fails, the gateway returns the last response. You can specify up to two fallback targets. Each combination of target and model, including the route’s target, can appear only once.
(dict) –
Specifies a target to send the request to when the previous target in the fallback chain fails. Includes the target name, the model to send, and the conditions that trigger a fallback from this target to the next one.
targetName (string) –
The name of the gateway target to fall back to. The target must be an inference target.
model (string) –
The model ID to send to this fallback target. If you don’t specify a model, the gateway sends the model from the original request.
triggerOn (dict) –
The status codes and errors from this target that cause the gateway to send the request to the next fallback target. This setting isn’t inherited from the route. If you omit it, the gateway uses the default triggers:
5XXstatus codes and theCONNECTION_ERROR,FIRST_BYTE_TIMEOUT, andUNROUTABLEerrors.statusCodes (list) –
The HTTP status codes returned by the target that trigger a fallback. You can specify the following:
An exact status code – A three-digit code, such as
429.A class of status codes – The first digit followed by
XX, such as5XX, which matches every code from 500 to 599.
Only 4XX and 5XX codes are supported. Throttling by the gateway itself doesn’t trigger a fallback.
(string) –
errors (list) –
The errors that trigger a fallback. You can specify the following:
CONNECTION_ERROR– The gateway couldn’t connect to the target because the connection was refused, reset, or timed out. The request didn’t reach the target.FIRST_BYTE_TIMEOUT– The target accepted the connection but didn’t return the first byte of the response withinfirstByteTimeoutMilliseconds. The gateway abandons the request before any of the response reaches you.UNROUTABLE– The gateway couldn’t route the request to the target, for example because the target doesn’t exist or doesn’t support the request path. These errors don’t count toward the circuit breaker.
(string) –
firstByteTimeoutMilliseconds (integer) –
The maximum time, in milliseconds, from sending the request to this target until the first byte of the response body arrives. This setting isn’t inherited from the route. If you don’t specify a value, no timeout is enforced.
name (string) –
The name of this traffic split variant.
weight (integer) –
The percentage of traffic to route to this variant.
description (string) –
The description of this traffic split variant.
metadata (dict) –
Key-value metadata associated with this traffic split variant.
(string) –
(string) –
description (string) –
The description of the gateway rule.
createdAt (datetime) –
The timestamp when the rule was created.
status (string) –
The current status of the rule.
system (dict) –
System-managed metadata for rules created by automated processes.
managedBy (string) –
The identifier of the system or process that manages this rule.
updatedAt (datetime) –
The timestamp when the rule was last updated.
Exceptions
BedrockAgentCoreControl.Client.exceptions.ValidationExceptionBedrockAgentCoreControl.Client.exceptions.AccessDeniedExceptionBedrockAgentCoreControl.Client.exceptions.ResourceNotFoundExceptionBedrockAgentCoreControl.Client.exceptions.ThrottlingExceptionBedrockAgentCoreControl.Client.exceptions.InternalServerException