Class CustomResponse.Builder
- java.lang.Object
-
- com.google.protobuf.AbstractMessageLite.Builder
-
- com.google.protobuf.AbstractMessage.Builder<BuilderType>
-
- 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 typeenvoy.extensions.filters.http.custom_response.v3.CustomResponse
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CustomResponse.BuilderaddRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)CustomResponsebuild()CustomResponsebuildPartial()CustomResponse.Builderclear()CustomResponse.BuilderclearCustomResponseMatcher()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.CustomResponse.BuilderclearField(com.google.protobuf.Descriptors.FieldDescriptor field)CustomResponse.BuilderclearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)CustomResponse.Builderclone()MatchergetCustomResponseMatcher()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.BuildergetCustomResponseMatcherBuilder()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.MatcherOrBuildergetCustomResponseMatcherOrBuilder()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.CustomResponsegetDefaultInstanceForType()static com.google.protobuf.Descriptors.DescriptorgetDescriptor()com.google.protobuf.Descriptors.DescriptorgetDescriptorForType()booleanhasCustomResponseMatcher()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.FieldAccessorTableinternalGetFieldAccessorTable()booleanisInitialized()CustomResponse.BuildermergeCustomResponseMatcher(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.CustomResponse.BuildermergeFrom(com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)CustomResponse.BuildermergeFrom(com.google.protobuf.Message other)CustomResponse.BuildermergeFrom(CustomResponse other)CustomResponse.BuildermergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)CustomResponse.BuildersetCustomResponseMatcher(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.CustomResponse.BuildersetCustomResponseMatcher(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.CustomResponse.BuildersetField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)CustomResponse.BuildersetRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)CustomResponse.BuildersetUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)-
Methods inherited from class com.google.protobuf.GeneratedMessageV3.Builder
getAllFields, getField, getFieldBuilder, getOneofFieldDescriptor, getParentForChildren, getRepeatedField, getRepeatedFieldBuilder, getRepeatedFieldCount, getUnknownFields, hasField, hasOneof, internalGetMapField, internalGetMutableMapField, isClean, markClean, newBuilderForField, onBuilt, onChanged, 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
-
-
-
-
Method Detail
-
getDescriptor
public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
-
internalGetFieldAccessorTable
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
- Specified by:
internalGetFieldAccessorTablein classcom.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
-
clear
public CustomResponse.Builder clear()
- Specified by:
clearin interfacecom.google.protobuf.Message.Builder- Specified by:
clearin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clearin classcom.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
-
getDescriptorForType
public com.google.protobuf.Descriptors.Descriptor getDescriptorForType()
- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.Message.Builder- Specified by:
getDescriptorForTypein interfacecom.google.protobuf.MessageOrBuilder- Overrides:
getDescriptorForTypein classcom.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
-
getDefaultInstanceForType
public CustomResponse getDefaultInstanceForType()
- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageLiteOrBuilder- Specified by:
getDefaultInstanceForTypein interfacecom.google.protobuf.MessageOrBuilder
-
build
public CustomResponse build()
- Specified by:
buildin interfacecom.google.protobuf.Message.Builder- Specified by:
buildin interfacecom.google.protobuf.MessageLite.Builder
-
buildPartial
public CustomResponse buildPartial()
- Specified by:
buildPartialin interfacecom.google.protobuf.Message.Builder- Specified by:
buildPartialin interfacecom.google.protobuf.MessageLite.Builder
-
clone
public CustomResponse.Builder clone()
- Specified by:
clonein interfacecom.google.protobuf.Message.Builder- Specified by:
clonein interfacecom.google.protobuf.MessageLite.Builder- Overrides:
clonein classcom.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
-
setField
public CustomResponse.Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
- Specified by:
setFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
-
clearField
public CustomResponse.Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field)
- Specified by:
clearFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
clearFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
-
clearOneof
public CustomResponse.Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)
- Specified by:
clearOneofin interfacecom.google.protobuf.Message.Builder- Overrides:
clearOneofin classcom.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
-
setRepeatedField
public CustomResponse.Builder setRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value)
- Specified by:
setRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
setRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
-
addRepeatedField
public CustomResponse.Builder addRepeatedField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value)
- Specified by:
addRepeatedFieldin interfacecom.google.protobuf.Message.Builder- Overrides:
addRepeatedFieldin classcom.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
-
mergeFrom
public CustomResponse.Builder mergeFrom(com.google.protobuf.Message other)
- Specified by:
mergeFromin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeFromin classcom.google.protobuf.AbstractMessage.Builder<CustomResponse.Builder>
-
mergeFrom
public CustomResponse.Builder mergeFrom(CustomResponse other)
-
isInitialized
public final boolean isInitialized()
- Specified by:
isInitializedin interfacecom.google.protobuf.MessageLiteOrBuilder- Overrides:
isInitializedin classcom.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:
mergeFromin interfacecom.google.protobuf.Message.Builder- Specified by:
mergeFromin interfacecom.google.protobuf.MessageLite.Builder- Overrides:
mergeFromin classcom.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:
hasCustomResponseMatcherin interfaceCustomResponseOrBuilder- 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:
getCustomResponseMatcherin interfaceCustomResponseOrBuilder- 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:
getCustomResponseMatcherOrBuilderin interfaceCustomResponseOrBuilder
-
setUnknownFields
public final CustomResponse.Builder setUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
- Specified by:
setUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
setUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
-
mergeUnknownFields
public final CustomResponse.Builder mergeUnknownFields(com.google.protobuf.UnknownFieldSet unknownFields)
- Specified by:
mergeUnknownFieldsin interfacecom.google.protobuf.Message.Builder- Overrides:
mergeUnknownFieldsin classcom.google.protobuf.GeneratedMessageV3.Builder<CustomResponse.Builder>
-
-