static_resources:
  listeners:
  - address:
      socket_address:
        address: 0.0.0.0
        port_value: 8000
    filter_chains:
    - filters:
      - name: "http"
        typed_config:
          "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
          codec_type: HTTP2
          stat_prefix: "config_test"
          route_config:
            name: "route_config_0"
            virtual_hosts:
            - name: "integration"
              domains: ["*"]
              routes:
              - match:
                  prefix: "/"
                route:
                  cluster: "cluster_0"
          http_filters:
          - name: "envoy.filters.http.rate_limit_quota"
            typed_config:
              "@type": type.googleapis.com/net.envoy.source.extensions.filters.http.metadata.RateLimitQuotaFilterConfig
            rlqs_server:
              envoy_grpc:
                cluster_name: rate_limit_quota_service
              domain: "acme-services"
              matcher:
                matcher_list:
                  matchers:
                  - predicate:
                    - single_predicate:
                        input:
                          name: request-headers
                          typed_config:
                            "@type": type.googleapis.com/envoy.type.matcher.v3.HttpRequestHeaderMatchInput
                            header_name: deployment
                        value_match:
                          exact: prod
                    on_match:
                      action:
                        name: prod-bucket
                        typed_config:
                          "@type": type.googleapis.com/envoy.extensions.filters.http.rate_limit_quota.v3.RateLimitQuotaBucketSettings
                          bucket_id_builder:
                            bucket_id_builder:
                              "name":
                                string_value: "prod-rate-limit-quota"
                          reporting_interval: 60s
                          no_assignment_behavior:
                            blanket_rule: ALLOW_ALL
                  - predicate:
                    - single_predicate:
                        input:
                          name: request-headers
                          typed_config:
                            "@type": type.googleapis.com/envoy.type.matcher.v3.HttpRequestHeaderMatchInput
                            header_name: deployment
                        value_match:
                          exact: staging
                    on_match:
                      action:
                        name: staging-bucket
                        typed_config:
                          "@type": type.googleapis.com/envoy.extensions.filters.http.rate_limit_quota.v3.RateLimitQuotaBucketSettings
                          bucket_id_builder:
                            bucket_id_builder:
                              "name":
                                string_value: "staging-rate-limit-quota"
                          reporting_interval: 60s
                          no_assignment_behavior:
                            blanket_rule: DENY_ALL
                # The "catch all" bucket settings
                on_no_match:
                  action:
                    name: default-bucket
                    typed_config:
                      "@type": type.googleapis.com/envoy.extensions.filters.http.rate_limit_quota.v3.RateLimitQuotaBucketSettings
                      bucket_id_builder:
                        bucket_id_builder:
                          "name":
                            string_value: "default-rate-limit-quota"
                      reporting_interval: 60s
                      deny_response_settings:
                        http_status_code: 429
                      no_assignment_behavior:
                        blanket_rule: ALLOW_ALL
                      expired_assignment_behavior:
                        fallback_rate_limit:
                          requests_per_time_unit:
                            requests_per_time_unit: 1000
                            time_unit: 1s
          http_filters:
          - name: envoy.filters.http.router
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
  clusters:
  - name: cluster_0
    # Cluster for fake destination service which has typed metadata that contains the audience information.
    load_assignment:
      cluster_name: cluster_0
      endpoints:
      - lb_endpoints:
        - endpoint:
            address:
              socket_address:
                address: 0.0.0.0
                port_value: 8000
    typed_extension_protocol_options:
      envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
        "@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
        explicit_http_config:
          http2_protocol_options:
            {}
