Class CustomResponse

  • All Implemented Interfaces:
    com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, CustomResponseOrBuilder, Serializable

    public final class CustomResponse
    extends com.google.protobuf.GeneratedMessageV3
    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
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  CustomResponse.Builder
      The filter configuration is a collection of custom response policies in a matcher tree.
      • Nested classes/interfaces inherited from class com.google.protobuf.GeneratedMessageV3

        com.google.protobuf.GeneratedMessageV3.BuilderParent, com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage,​BuilderType extends com.google.protobuf.GeneratedMessageV3.ExtendableBuilder<MessageType,​BuilderType>>, com.google.protobuf.GeneratedMessageV3.ExtendableMessage<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.ExtendableMessageOrBuilder<MessageType extends com.google.protobuf.GeneratedMessageV3.ExtendableMessage>, com.google.protobuf.GeneratedMessageV3.FieldAccessorTable, com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter
      • Nested classes/interfaces inherited from class com.google.protobuf.AbstractMessageLite

        com.google.protobuf.AbstractMessageLite.InternalOneOfEnum
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CUSTOM_RESPONSE_MATCHER_FIELD_NUMBER  
      • Fields inherited from class com.google.protobuf.GeneratedMessageV3

        alwaysUseFieldBuilders, unknownFields
      • Fields inherited from class com.google.protobuf.AbstractMessage

        memoizedSize
      • Fields inherited from class com.google.protobuf.AbstractMessageLite

        memoizedHashCode
    • Field Detail

      • CUSTOM_RESPONSE_MATCHER_FIELD_NUMBER

        public static final int CUSTOM_RESPONSE_MATCHER_FIELD_NUMBER
        See Also:
        Constant Field Values
    • Method Detail

      • newInstance

        protected Object newInstance​(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
        Overrides:
        newInstance in class com.google.protobuf.GeneratedMessageV3
      • getUnknownFields

        public final com.google.protobuf.UnknownFieldSet getUnknownFields()
        Specified by:
        getUnknownFields in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getUnknownFields in class com.google.protobuf.GeneratedMessageV3
      • 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
      • 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.
      • 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
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3
      • writeTo

        public void writeTo​(com.google.protobuf.CodedOutputStream output)
                     throws IOException
        Specified by:
        writeTo in interface com.google.protobuf.MessageLite
        Overrides:
        writeTo in class com.google.protobuf.GeneratedMessageV3
        Throws:
        IOException
      • getSerializedSize

        public int getSerializedSize()
        Specified by:
        getSerializedSize in interface com.google.protobuf.MessageLite
        Overrides:
        getSerializedSize in class com.google.protobuf.GeneratedMessageV3
      • equals

        public boolean equals​(Object obj)
        Specified by:
        equals in interface com.google.protobuf.Message
        Overrides:
        equals in class com.google.protobuf.AbstractMessage
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface com.google.protobuf.Message
        Overrides:
        hashCode in class com.google.protobuf.AbstractMessage
      • parseFrom

        public static CustomResponse parseFrom​(ByteBuffer data)
                                        throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static CustomResponse parseFrom​(ByteBuffer data,
                                               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                        throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static CustomResponse parseFrom​(com.google.protobuf.ByteString data)
                                        throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static CustomResponse parseFrom​(com.google.protobuf.ByteString data,
                                               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                        throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static CustomResponse parseFrom​(byte[] data)
                                        throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static CustomResponse parseFrom​(byte[] data,
                                               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                        throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static CustomResponse parseFrom​(com.google.protobuf.CodedInputStream input,
                                               com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                        throws IOException
        Throws:
        IOException
      • newBuilderForType

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

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

        protected CustomResponse.Builder newBuilderForType​(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
        Specified by:
        newBuilderForType in class com.google.protobuf.GeneratedMessageV3
      • getDefaultInstance

        public static CustomResponse getDefaultInstance()
      • parser

        public static com.google.protobuf.Parser<CustomResponse> parser()
      • getParserForType

        public com.google.protobuf.Parser<CustomResponse> getParserForType()
        Specified by:
        getParserForType in interface com.google.protobuf.Message
        Specified by:
        getParserForType in interface com.google.protobuf.MessageLite
        Overrides:
        getParserForType in class com.google.protobuf.GeneratedMessageV3
      • getDefaultInstanceForType

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