BedrockAgentCoreControl / Client / list_gateway_rules

list_gateway_rules

BedrockAgentCoreControl.Client.list_gateway_rules(**kwargs)

Lists all rules for a gateway.

See also: AWS API Documentation

Request Syntax

response = client.list_gateway_rules(
    gatewayIdentifier='string',
    maxResults=123,
    nextToken='string'
)
Parameters:
  • gatewayIdentifier (string) –

    [REQUIRED]

    The identifier of the gateway to list rules for.

  • maxResults (integer) – The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.

  • nextToken (string) – The pagination token from a previous request.

Return type:

dict

Returns:

Response Syntax

{
    'gatewayRules': [
        {
            '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)
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • gatewayRules (list) –

      The list of gateway rules.

      • (dict) –

        Detailed information about a gateway rule.

        • 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 set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is 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 set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is 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 StringLike operator.

                    • operator (string) –

                      The match operator. StringEquals requires an exact match. StringLike supports 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 StringLike operator, you can use * and ? as wildcards, for example anthropic.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 set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is 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 set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is 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 set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is 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 on 5XX status codes and on the CONNECTION_ERROR, FIRST_BYTE_TIMEOUT, and UNROUTABLE errors. If you specify triggerOn, 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 as 5XX, 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 within firstByteTimeoutMilliseconds. 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_TIMEOUT error. 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 is ENABLED.

                  • 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: 5XX status codes and the CONNECTION_ERROR, FIRST_BYTE_TIMEOUT, and UNROUTABLE errors.

                        • 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 as 5XX, 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 within firstByteTimeoutMilliseconds. 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 on 5XX status codes and on the CONNECTION_ERROR, FIRST_BYTE_TIMEOUT, and UNROUTABLE errors. If you specify triggerOn, 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 as 5XX, 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 within firstByteTimeoutMilliseconds. 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_TIMEOUT error. 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 is ENABLED.

                      • 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: 5XX status codes and the CONNECTION_ERROR, FIRST_BYTE_TIMEOUT, and UNROUTABLE errors.

                            • 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 as 5XX, 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 within firstByteTimeoutMilliseconds. 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.

    • nextToken (string) –

      The pagination token to use in a subsequent request.

Exceptions