java.lang.Object
com.google.protobuf.AbstractMessageLite.Builder
com.google.protobuf.AbstractMessage.Builder<BuilderT>
com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
io.envoyproxy.envoy.extensions.filters.http.custom_response.v3.CustomResponse.Builder
All Implemented Interfaces:
com.google.protobuf.Message.Builder, com.google.protobuf.MessageLite.Builder, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, CustomResponseOrBuilder, Cloneable
Enclosing class:
CustomResponse

public static final class CustomResponse.Builder extends com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder> implements CustomResponseOrBuilder
 The filter configuration is a collection of custom response
 policies in a matcher tree. The configuration can be defined at the filter,
 virtual host or route level. The response will be matched against the most
 specific to the least specific config, till a match is found.
 
Protobuf type envoy.extensions.filters.http.custom_response.v3.CustomResponse
  • Method Summary

    Modifier and Type
    Method
    Description
    addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
     
     
     
     
    Matcher to match against the original response to select a :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>` that will override the original response.
    clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
     
    clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
     
     
    Matcher to match against the original response to select a :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>` that will override the original response.
    Matcher to match against the original response to select a :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>` that will override the original response.
    Matcher to match against the original response to select a :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>` that will override the original response.
     
    static final com.google.protobuf.Descriptors.Descriptor
     
    com.google.protobuf.Descriptors.Descriptor
     
    boolean
    Matcher to match against the original response to select a :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>` that will override the original response.
    protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
     
    final boolean
     
    Matcher to match against the original response to select a :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>` that will override the original response.
    mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
     
    mergeFrom(com.google.protobuf.Message other)
     
     
    mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
     
    Matcher to match against the original response to select a :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>` that will override the original response.
    Matcher to match against the original response to select a :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>` that will override the original response.
    setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
     
    setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
     
    setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
     

    Methods inherited from class com.google.protobuf.GeneratedMessageV3.Builder

    getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, getUnknownFieldSetBuilder, hasField, hasOneof, internalGetMapField, internalGetMapFieldReflection, internalGetMutableMapField, internalGetMutableMapFieldReflection, isClean, markClean, mergeUnknownLengthDelimitedField, mergeUnknownVarintField, newBuilderForField, onBuilt, onChanged, parseUnknownField, setUnknownFieldSetBuilder, setUnknownFieldsProto3

    Methods inherited from class com.google.protobuf.AbstractMessage.Builder

    findInitializationErrors, getInitializationErrorString, internalMergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, mergeFrom, newUninitializedMessageException, toString

    Methods inherited from class com.google.protobuf.AbstractMessageLite.Builder

    addAll, addAll, mergeDelimitedFrom, mergeDelimitedFrom, mergeFrom, newUninitializedMessageException

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.google.protobuf.Message.Builder

    mergeDelimitedFrom, mergeDelimitedFrom

    Methods inherited from interface com.google.protobuf.MessageLite.Builder

    mergeFrom

    Methods inherited from interface com.google.protobuf.MessageOrBuilder

    findInitializationErrors, getAllFields, getField, getInitializationErrorString, getOneofFieldDescriptor, getRepeatedField, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof
  • Method Details

    • getDescriptor

      public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
    • internalGetFieldAccessorTable

      protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
      Specified by:
      internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
    • clear

      public CustomResponse.Builder clear()
      Specified by:
      clear in interface com.google.protobuf.Message.Builder
      Specified by:
      clear in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      clear in class com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
    • getDescriptorForType

      public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
      Specified by:
      getDescriptorForType in interface com.google.protobuf.Message.Builder
      Specified by:
      getDescriptorForType in interface com.google.protobuf.MessageOrBuilder
      Overrides:
      getDescriptorForType in class com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
    • getDefaultInstanceForType

      public CustomResponse getDefaultInstanceForType()
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
      Specified by:
      getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder
    • build

      public CustomResponse build()
      Specified by:
      build in interface com.google.protobuf.Message.Builder
      Specified by:
      build in interface com.google.protobuf.MessageLite.Builder
    • buildPartial

      public CustomResponse buildPartial()
      Specified by:
      buildPartial in interface com.google.protobuf.Message.Builder
      Specified by:
      buildPartial in interface com.google.protobuf.MessageLite.Builder
    • clone

      public CustomResponse.Builder clone()
      Specified by:
      clone in interface com.google.protobuf.Message.Builder
      Specified by:
      clone in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      clone in class com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
    • setField

      public CustomResponse.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
      Specified by:
      setField in interface com.google.protobuf.Message.Builder
      Overrides:
      setField in class com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
    • clearField

      public CustomResponse.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
      Specified by:
      clearField in interface com.google.protobuf.Message.Builder
      Overrides:
      clearField in class com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
    • clearOneof

      public CustomResponse.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
      Specified by:
      clearOneof in interface com.google.protobuf.Message.Builder
      Overrides:
      clearOneof in class com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
    • setRepeatedField

      public CustomResponse.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
      Specified by:
      setRepeatedField in interface com.google.protobuf.Message.Builder
      Overrides:
      setRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
    • addRepeatedField

      public CustomResponse.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
      Specified by:
      addRepeatedField in interface com.google.protobuf.Message.Builder
      Overrides:
      addRepeatedField in class com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
    • mergeFrom

      public CustomResponse.Builder mergeFrom(com.google.protobuf.Message other)
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<CustomResponse.Builder>
    • mergeFrom

      public CustomResponse.Builder mergeFrom(CustomResponse other)
    • isInitialized

      public final boolean isInitialized()
      Specified by:
      isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
      Overrides:
      isInitialized in class com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
    • mergeFrom

      public CustomResponse.Builder mergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws IOException
      Specified by:
      mergeFrom in interface com.google.protobuf.Message.Builder
      Specified by:
      mergeFrom in interface com.google.protobuf.MessageLite.Builder
      Overrides:
      mergeFrom in class com.google.protobuf.AbstractMessage.Builder<CustomResponse.Builder>
      Throws:
      IOException
    • hasCustomResponseMatcher

      public boolean hasCustomResponseMatcher()
       Matcher to match against the original response to select a
       :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>`
       that will override the original response. The matching is done by matching
       against :ref:`response header values<extension_category_envoy.matching.http.input>`
       Example:
      
       .. validated-code-block:: yaml
         :type-name: xds.type.matcher.v3.Matcher
      
         matcher_list:
           matchers:
             # Apply a locally stored custom response to any 4xx response.
           - predicate:
               single_predicate:
                 input:
                   name: 4xx_response
                   typed_config:
                     "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeClassMatchInput
                 value_match:
                   exact: "4xx"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.local_response_policy.v3.LocalResponsePolicy
                   status_code: 499
                   body:
                     inline_string: "not allowed"
                   body_format:
                     json_format:
                       status: "%RESPONSE_CODE%"
                       message: "%LOCAL_REPLY_BODY%"
                   response_headers_to_add:
                   - header:
                       key: "foo"
                       value: "x-bar"
             # Redirect to different upstream if the status code is one of 502, 503 or 504.
           - predicate:
               or_matcher:
                 predicate:
                 - single_predicate:
                     input:
                       name: "502_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "502"
                 - single_predicate:
                     input:
                       name: "503_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "503"
                 - single_predicate:
                     input:
                       name: "504_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "504"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.redirect_policy.v3.RedirectPolicy
                   status_code: 299
                   uri: "https://foo.example/gateway_error"
                   response_headers_to_add:
                   - header:
                       key: "foo2"
                       value: "x-bar2"
      
       -- attention::
        The first matched policy wins. Once the response is matched, matcher
        evaluations end.
      
       Refer to :ref:`Unified Matcher API <envoy_v3_api_msg_.xds.type.matcher.v3.Matcher>`
       documentation for more information on the matcher trees.
       [#extension-category: envoy.http.custom_response]
       
      .xds.type.matcher.v3.Matcher custom_response_matcher = 1;
      Specified by:
      hasCustomResponseMatcher in interface CustomResponseOrBuilder
      Returns:
      Whether the customResponseMatcher field is set.
    • getCustomResponseMatcher

      public Matcher getCustomResponseMatcher()
       Matcher to match against the original response to select a
       :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>`
       that will override the original response. The matching is done by matching
       against :ref:`response header values<extension_category_envoy.matching.http.input>`
       Example:
      
       .. validated-code-block:: yaml
         :type-name: xds.type.matcher.v3.Matcher
      
         matcher_list:
           matchers:
             # Apply a locally stored custom response to any 4xx response.
           - predicate:
               single_predicate:
                 input:
                   name: 4xx_response
                   typed_config:
                     "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeClassMatchInput
                 value_match:
                   exact: "4xx"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.local_response_policy.v3.LocalResponsePolicy
                   status_code: 499
                   body:
                     inline_string: "not allowed"
                   body_format:
                     json_format:
                       status: "%RESPONSE_CODE%"
                       message: "%LOCAL_REPLY_BODY%"
                   response_headers_to_add:
                   - header:
                       key: "foo"
                       value: "x-bar"
             # Redirect to different upstream if the status code is one of 502, 503 or 504.
           - predicate:
               or_matcher:
                 predicate:
                 - single_predicate:
                     input:
                       name: "502_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "502"
                 - single_predicate:
                     input:
                       name: "503_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "503"
                 - single_predicate:
                     input:
                       name: "504_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "504"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.redirect_policy.v3.RedirectPolicy
                   status_code: 299
                   uri: "https://foo.example/gateway_error"
                   response_headers_to_add:
                   - header:
                       key: "foo2"
                       value: "x-bar2"
      
       -- attention::
        The first matched policy wins. Once the response is matched, matcher
        evaluations end.
      
       Refer to :ref:`Unified Matcher API <envoy_v3_api_msg_.xds.type.matcher.v3.Matcher>`
       documentation for more information on the matcher trees.
       [#extension-category: envoy.http.custom_response]
       
      .xds.type.matcher.v3.Matcher custom_response_matcher = 1;
      Specified by:
      getCustomResponseMatcher in interface CustomResponseOrBuilder
      Returns:
      The customResponseMatcher.
    • setCustomResponseMatcher

      public CustomResponse.Builder setCustomResponseMatcher(Matcher value)
       Matcher to match against the original response to select a
       :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>`
       that will override the original response. The matching is done by matching
       against :ref:`response header values<extension_category_envoy.matching.http.input>`
       Example:
      
       .. validated-code-block:: yaml
         :type-name: xds.type.matcher.v3.Matcher
      
         matcher_list:
           matchers:
             # Apply a locally stored custom response to any 4xx response.
           - predicate:
               single_predicate:
                 input:
                   name: 4xx_response
                   typed_config:
                     "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeClassMatchInput
                 value_match:
                   exact: "4xx"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.local_response_policy.v3.LocalResponsePolicy
                   status_code: 499
                   body:
                     inline_string: "not allowed"
                   body_format:
                     json_format:
                       status: "%RESPONSE_CODE%"
                       message: "%LOCAL_REPLY_BODY%"
                   response_headers_to_add:
                   - header:
                       key: "foo"
                       value: "x-bar"
             # Redirect to different upstream if the status code is one of 502, 503 or 504.
           - predicate:
               or_matcher:
                 predicate:
                 - single_predicate:
                     input:
                       name: "502_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "502"
                 - single_predicate:
                     input:
                       name: "503_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "503"
                 - single_predicate:
                     input:
                       name: "504_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "504"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.redirect_policy.v3.RedirectPolicy
                   status_code: 299
                   uri: "https://foo.example/gateway_error"
                   response_headers_to_add:
                   - header:
                       key: "foo2"
                       value: "x-bar2"
      
       -- attention::
        The first matched policy wins. Once the response is matched, matcher
        evaluations end.
      
       Refer to :ref:`Unified Matcher API <envoy_v3_api_msg_.xds.type.matcher.v3.Matcher>`
       documentation for more information on the matcher trees.
       [#extension-category: envoy.http.custom_response]
       
      .xds.type.matcher.v3.Matcher custom_response_matcher = 1;
    • setCustomResponseMatcher

      public CustomResponse.Builder setCustomResponseMatcher(Matcher.Builder builderForValue)
       Matcher to match against the original response to select a
       :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>`
       that will override the original response. The matching is done by matching
       against :ref:`response header values<extension_category_envoy.matching.http.input>`
       Example:
      
       .. validated-code-block:: yaml
         :type-name: xds.type.matcher.v3.Matcher
      
         matcher_list:
           matchers:
             # Apply a locally stored custom response to any 4xx response.
           - predicate:
               single_predicate:
                 input:
                   name: 4xx_response
                   typed_config:
                     "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeClassMatchInput
                 value_match:
                   exact: "4xx"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.local_response_policy.v3.LocalResponsePolicy
                   status_code: 499
                   body:
                     inline_string: "not allowed"
                   body_format:
                     json_format:
                       status: "%RESPONSE_CODE%"
                       message: "%LOCAL_REPLY_BODY%"
                   response_headers_to_add:
                   - header:
                       key: "foo"
                       value: "x-bar"
             # Redirect to different upstream if the status code is one of 502, 503 or 504.
           - predicate:
               or_matcher:
                 predicate:
                 - single_predicate:
                     input:
                       name: "502_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "502"
                 - single_predicate:
                     input:
                       name: "503_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "503"
                 - single_predicate:
                     input:
                       name: "504_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "504"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.redirect_policy.v3.RedirectPolicy
                   status_code: 299
                   uri: "https://foo.example/gateway_error"
                   response_headers_to_add:
                   - header:
                       key: "foo2"
                       value: "x-bar2"
      
       -- attention::
        The first matched policy wins. Once the response is matched, matcher
        evaluations end.
      
       Refer to :ref:`Unified Matcher API <envoy_v3_api_msg_.xds.type.matcher.v3.Matcher>`
       documentation for more information on the matcher trees.
       [#extension-category: envoy.http.custom_response]
       
      .xds.type.matcher.v3.Matcher custom_response_matcher = 1;
    • mergeCustomResponseMatcher

      public CustomResponse.Builder mergeCustomResponseMatcher(Matcher value)
       Matcher to match against the original response to select a
       :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>`
       that will override the original response. The matching is done by matching
       against :ref:`response header values<extension_category_envoy.matching.http.input>`
       Example:
      
       .. validated-code-block:: yaml
         :type-name: xds.type.matcher.v3.Matcher
      
         matcher_list:
           matchers:
             # Apply a locally stored custom response to any 4xx response.
           - predicate:
               single_predicate:
                 input:
                   name: 4xx_response
                   typed_config:
                     "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeClassMatchInput
                 value_match:
                   exact: "4xx"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.local_response_policy.v3.LocalResponsePolicy
                   status_code: 499
                   body:
                     inline_string: "not allowed"
                   body_format:
                     json_format:
                       status: "%RESPONSE_CODE%"
                       message: "%LOCAL_REPLY_BODY%"
                   response_headers_to_add:
                   - header:
                       key: "foo"
                       value: "x-bar"
             # Redirect to different upstream if the status code is one of 502, 503 or 504.
           - predicate:
               or_matcher:
                 predicate:
                 - single_predicate:
                     input:
                       name: "502_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "502"
                 - single_predicate:
                     input:
                       name: "503_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "503"
                 - single_predicate:
                     input:
                       name: "504_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "504"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.redirect_policy.v3.RedirectPolicy
                   status_code: 299
                   uri: "https://foo.example/gateway_error"
                   response_headers_to_add:
                   - header:
                       key: "foo2"
                       value: "x-bar2"
      
       -- attention::
        The first matched policy wins. Once the response is matched, matcher
        evaluations end.
      
       Refer to :ref:`Unified Matcher API <envoy_v3_api_msg_.xds.type.matcher.v3.Matcher>`
       documentation for more information on the matcher trees.
       [#extension-category: envoy.http.custom_response]
       
      .xds.type.matcher.v3.Matcher custom_response_matcher = 1;
    • clearCustomResponseMatcher

      public CustomResponse.Builder clearCustomResponseMatcher()
       Matcher to match against the original response to select a
       :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>`
       that will override the original response. The matching is done by matching
       against :ref:`response header values<extension_category_envoy.matching.http.input>`
       Example:
      
       .. validated-code-block:: yaml
         :type-name: xds.type.matcher.v3.Matcher
      
         matcher_list:
           matchers:
             # Apply a locally stored custom response to any 4xx response.
           - predicate:
               single_predicate:
                 input:
                   name: 4xx_response
                   typed_config:
                     "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeClassMatchInput
                 value_match:
                   exact: "4xx"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.local_response_policy.v3.LocalResponsePolicy
                   status_code: 499
                   body:
                     inline_string: "not allowed"
                   body_format:
                     json_format:
                       status: "%RESPONSE_CODE%"
                       message: "%LOCAL_REPLY_BODY%"
                   response_headers_to_add:
                   - header:
                       key: "foo"
                       value: "x-bar"
             # Redirect to different upstream if the status code is one of 502, 503 or 504.
           - predicate:
               or_matcher:
                 predicate:
                 - single_predicate:
                     input:
                       name: "502_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "502"
                 - single_predicate:
                     input:
                       name: "503_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "503"
                 - single_predicate:
                     input:
                       name: "504_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "504"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.redirect_policy.v3.RedirectPolicy
                   status_code: 299
                   uri: "https://foo.example/gateway_error"
                   response_headers_to_add:
                   - header:
                       key: "foo2"
                       value: "x-bar2"
      
       -- attention::
        The first matched policy wins. Once the response is matched, matcher
        evaluations end.
      
       Refer to :ref:`Unified Matcher API <envoy_v3_api_msg_.xds.type.matcher.v3.Matcher>`
       documentation for more information on the matcher trees.
       [#extension-category: envoy.http.custom_response]
       
      .xds.type.matcher.v3.Matcher custom_response_matcher = 1;
    • getCustomResponseMatcherBuilder

      public Matcher.Builder getCustomResponseMatcherBuilder()
       Matcher to match against the original response to select a
       :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>`
       that will override the original response. The matching is done by matching
       against :ref:`response header values<extension_category_envoy.matching.http.input>`
       Example:
      
       .. validated-code-block:: yaml
         :type-name: xds.type.matcher.v3.Matcher
      
         matcher_list:
           matchers:
             # Apply a locally stored custom response to any 4xx response.
           - predicate:
               single_predicate:
                 input:
                   name: 4xx_response
                   typed_config:
                     "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeClassMatchInput
                 value_match:
                   exact: "4xx"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.local_response_policy.v3.LocalResponsePolicy
                   status_code: 499
                   body:
                     inline_string: "not allowed"
                   body_format:
                     json_format:
                       status: "%RESPONSE_CODE%"
                       message: "%LOCAL_REPLY_BODY%"
                   response_headers_to_add:
                   - header:
                       key: "foo"
                       value: "x-bar"
             # Redirect to different upstream if the status code is one of 502, 503 or 504.
           - predicate:
               or_matcher:
                 predicate:
                 - single_predicate:
                     input:
                       name: "502_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "502"
                 - single_predicate:
                     input:
                       name: "503_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "503"
                 - single_predicate:
                     input:
                       name: "504_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "504"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.redirect_policy.v3.RedirectPolicy
                   status_code: 299
                   uri: "https://foo.example/gateway_error"
                   response_headers_to_add:
                   - header:
                       key: "foo2"
                       value: "x-bar2"
      
       -- attention::
        The first matched policy wins. Once the response is matched, matcher
        evaluations end.
      
       Refer to :ref:`Unified Matcher API <envoy_v3_api_msg_.xds.type.matcher.v3.Matcher>`
       documentation for more information on the matcher trees.
       [#extension-category: envoy.http.custom_response]
       
      .xds.type.matcher.v3.Matcher custom_response_matcher = 1;
    • getCustomResponseMatcherOrBuilder

      public MatcherOrBuilder getCustomResponseMatcherOrBuilder()
       Matcher to match against the original response to select a
       :ref:`Custom Response Policy <extension_category_envoy.http.custom_response>`
       that will override the original response. The matching is done by matching
       against :ref:`response header values<extension_category_envoy.matching.http.input>`
       Example:
      
       .. validated-code-block:: yaml
         :type-name: xds.type.matcher.v3.Matcher
      
         matcher_list:
           matchers:
             # Apply a locally stored custom response to any 4xx response.
           - predicate:
               single_predicate:
                 input:
                   name: 4xx_response
                   typed_config:
                     "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeClassMatchInput
                 value_match:
                   exact: "4xx"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.local_response_policy.v3.LocalResponsePolicy
                   status_code: 499
                   body:
                     inline_string: "not allowed"
                   body_format:
                     json_format:
                       status: "%RESPONSE_CODE%"
                       message: "%LOCAL_REPLY_BODY%"
                   response_headers_to_add:
                   - header:
                       key: "foo"
                       value: "x-bar"
             # Redirect to different upstream if the status code is one of 502, 503 or 504.
           - predicate:
               or_matcher:
                 predicate:
                 - single_predicate:
                     input:
                       name: "502_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "502"
                 - single_predicate:
                     input:
                       name: "503_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "503"
                 - single_predicate:
                     input:
                       name: "504_response"
                       typed_config:
                         "@type": type.googleapis.com/envoy.type.matcher.v3.HttpResponseStatusCodeMatchInput
                     value_match:
                       exact: "504"
             on_match:
               action:
                 name: action
                 typed_config:
                   "@type": type.googleapis.com/envoy.extensions.http.custom_response.redirect_policy.v3.RedirectPolicy
                   status_code: 299
                   uri: "https://foo.example/gateway_error"
                   response_headers_to_add:
                   - header:
                       key: "foo2"
                       value: "x-bar2"
      
       -- attention::
        The first matched policy wins. Once the response is matched, matcher
        evaluations end.
      
       Refer to :ref:`Unified Matcher API <envoy_v3_api_msg_.xds.type.matcher.v3.Matcher>`
       documentation for more information on the matcher trees.
       [#extension-category: envoy.http.custom_response]
       
      .xds.type.matcher.v3.Matcher custom_response_matcher = 1;
      Specified by:
      getCustomResponseMatcherOrBuilder in interface CustomResponseOrBuilder
    • setUnknownFields

      public final CustomResponse.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
      Specified by:
      setUnknownFields in interface com.google.protobuf.Message.Builder
      Overrides:
      setUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
    • mergeUnknownFields

      public final CustomResponse.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
      Specified by:
      mergeUnknownFields in interface com.google.protobuf.Message.Builder
      Overrides:
      mergeUnknownFields in class com.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>