Class PathRule.Builder (1.64.0)

public static final class PathRule.Builder extends GeneratedMessageV3.Builder<PathRule.Builder> implements PathRuleOrBuilder

A path-matching rule for a URL. If matched, will use the specified BackendService to handle the traffic arriving at this URL.

Protobuf type google.cloud.compute.v1.PathRule

Implements

PathRuleOrBuilder

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addAllPaths(Iterable<String> values)

public PathRule.Builder addAllPaths(Iterable<String> values)

The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.

repeated string paths = 106438894;

Parameter
Name Description
values Iterable<String>

The paths to add.

Returns
Type Description
PathRule.Builder

This builder for chaining.

addPaths(String value)

public PathRule.Builder addPaths(String value)

The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.

repeated string paths = 106438894;

Parameter
Name Description
value String

The paths to add.

Returns
Type Description
PathRule.Builder

This builder for chaining.

addPathsBytes(ByteString value)

public PathRule.Builder addPathsBytes(ByteString value)

The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.

repeated string paths = 106438894;

Parameter
Name Description
value ByteString

The bytes of the paths to add.

Returns
Type Description
PathRule.Builder

This builder for chaining.

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public PathRule.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
PathRule.Builder
Overrides

build()

public PathRule build()
Returns
Type Description
PathRule

buildPartial()

public PathRule buildPartial()
Returns
Type Description
PathRule

clear()

public PathRule.Builder clear()
Returns
Type Description
PathRule.Builder
Overrides

clearCustomErrorResponsePolicy()

public PathRule.Builder clearCustomErrorResponsePolicy()

customErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. If a policy for an error code is not configured for the PathRule, a policy for the error code configured in pathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not specified in pathMatcher.defaultCustomErrorResponsePolicy, the policy configured in UrlMap.defaultCustomErrorResponsePolicy takes effect. For example, consider a UrlMap with the following configuration: - UrlMap.defaultCustomErrorResponsePolicy are configured with policies for 5xx and 4xx errors - A PathRule for /coming_soon/ is configured for the error code 404. If the request is for www.myotherdomain.com and a 404 is encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes effect. If a 404 response is encountered for the request www.example.com/current_events/, the pathMatcher's policy takes effect. If however, the request for www.example.com/coming_soon/ encounters a 404, the policy in PathRule.customErrorResponsePolicy takes effect. If any of the requests in this example encounter a 500 error code, the policy at UrlMap.defaultCustomErrorResponsePolicy takes effect. customErrorResponsePolicy is supported only for global external Application Load Balancers.

optional .google.cloud.compute.v1.CustomErrorResponsePolicy custom_error_response_policy = 202816619;

Returns
Type Description
PathRule.Builder

clearField(Descriptors.FieldDescriptor field)

public PathRule.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
PathRule.Builder
Overrides

clearOneof(Descriptors.OneofDescriptor oneof)

public PathRule.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
PathRule.Builder
Overrides

clearPaths()

public PathRule.Builder clearPaths()

The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.

repeated string paths = 106438894;

Returns
Type Description
PathRule.Builder

This builder for chaining.

clearRouteAction()

public PathRule.Builder clearRouteAction()

In response to a matching path, the load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. If routeAction specifies any weightedBackendServices, service must not be set. Conversely if service is set, routeAction cannot contain any weightedBackendServices. Only one of routeAction or urlRedirect must be set. URL maps for classic Application Load Balancers only support the urlRewrite action within a path rule's routeAction.

optional .google.cloud.compute.v1.HttpRouteAction route_action = 424563948;

Returns
Type Description
PathRule.Builder

clearService()

public PathRule.Builder clearService()

The full or partial URL of the backend service resource to which traffic is directed if this rule is matched. If routeAction is also specified, advanced routing actions, such as URL rewrites, take effect before sending the request to the backend. However, if service is specified, routeAction cannot contain any weightedBackendServices. Conversely, if routeAction specifies any weightedBackendServices, service must not be specified. Only one of urlRedirect, service or routeAction.weightedBackendService must be set.

optional string service = 373540533;

Returns
Type Description
PathRule.Builder

This builder for chaining.

clearUrlRedirect()

public PathRule.Builder clearUrlRedirect()

When a path pattern is matched, the request is redirected to a URL specified by urlRedirect. If urlRedirect is specified, service or routeAction must not be set. Not supported when the URL map is bound to a target gRPC proxy.

optional .google.cloud.compute.v1.HttpRedirectAction url_redirect = 405147820;

Returns
Type Description
PathRule.Builder

clone()

public PathRule.Builder clone()
Returns
Type Description
PathRule.Builder
Overrides

getCustomErrorResponsePolicy()

public CustomErrorResponsePolicy getCustomErrorResponsePolicy()

customErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. If a policy for an error code is not configured for the PathRule, a policy for the error code configured in pathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not specified in pathMatcher.defaultCustomErrorResponsePolicy, the policy configured in UrlMap.defaultCustomErrorResponsePolicy takes effect. For example, consider a UrlMap with the following configuration: - UrlMap.defaultCustomErrorResponsePolicy are configured with policies for 5xx and 4xx errors - A PathRule for /coming_soon/ is configured for the error code 404. If the request is for www.myotherdomain.com and a 404 is encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes effect. If a 404 response is encountered for the request www.example.com/current_events/, the pathMatcher's policy takes effect. If however, the request for www.example.com/coming_soon/ encounters a 404, the policy in PathRule.customErrorResponsePolicy takes effect. If any of the requests in this example encounter a 500 error code, the policy at UrlMap.defaultCustomErrorResponsePolicy takes effect. customErrorResponsePolicy is supported only for global external Application Load Balancers.

optional .google.cloud.compute.v1.CustomErrorResponsePolicy custom_error_response_policy = 202816619;

Returns
Type Description
CustomErrorResponsePolicy

The customErrorResponsePolicy.

getCustomErrorResponsePolicyBuilder()

public CustomErrorResponsePolicy.Builder getCustomErrorResponsePolicyBuilder()

customErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. If a policy for an error code is not configured for the PathRule, a policy for the error code configured in pathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not specified in pathMatcher.defaultCustomErrorResponsePolicy, the policy configured in UrlMap.defaultCustomErrorResponsePolicy takes effect. For example, consider a UrlMap with the following configuration: - UrlMap.defaultCustomErrorResponsePolicy are configured with policies for 5xx and 4xx errors - A PathRule for /coming_soon/ is configured for the error code 404. If the request is for www.myotherdomain.com and a 404 is encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes effect. If a 404 response is encountered for the request www.example.com/current_events/, the pathMatcher's policy takes effect. If however, the request for www.example.com/coming_soon/ encounters a 404, the policy in PathRule.customErrorResponsePolicy takes effect. If any of the requests in this example encounter a 500 error code, the policy at UrlMap.defaultCustomErrorResponsePolicy takes effect. customErrorResponsePolicy is supported only for global external Application Load Balancers.

optional .google.cloud.compute.v1.CustomErrorResponsePolicy custom_error_response_policy = 202816619;

Returns
Type Description
CustomErrorResponsePolicy.Builder

getCustomErrorResponsePolicyOrBuilder()

public CustomErrorResponsePolicyOrBuilder getCustomErrorResponsePolicyOrBuilder()

customErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. If a policy for an error code is not configured for the PathRule, a policy for the error code configured in pathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not specified in pathMatcher.defaultCustomErrorResponsePolicy, the policy configured in UrlMap.defaultCustomErrorResponsePolicy takes effect. For example, consider a UrlMap with the following configuration: - UrlMap.defaultCustomErrorResponsePolicy are configured with policies for 5xx and 4xx errors - A PathRule for /coming_soon/ is configured for the error code 404. If the request is for www.myotherdomain.com and a 404 is encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes effect. If a 404 response is encountered for the request www.example.com/current_events/, the pathMatcher's policy takes effect. If however, the request for www.example.com/coming_soon/ encounters a 404, the policy in PathRule.customErrorResponsePolicy takes effect. If any of the requests in this example encounter a 500 error code, the policy at UrlMap.defaultCustomErrorResponsePolicy takes effect. customErrorResponsePolicy is supported only for global external Application Load Balancers.

optional .google.cloud.compute.v1.CustomErrorResponsePolicy custom_error_response_policy = 202816619;

Returns
Type Description
CustomErrorResponsePolicyOrBuilder

getDefaultInstanceForType()

public PathRule getDefaultInstanceForType()
Returns
Type Description
PathRule

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getPaths(int index)

public String getPaths(int index)

The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.

repeated string paths = 106438894;

Parameter
Name Description
index int

The index of the element to return.

Returns
Type Description
String

The paths at the given index.

getPathsBytes(int index)

public ByteString getPathsBytes(int index)

The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.

repeated string paths = 106438894;

Parameter
Name Description
index int

The index of the value to return.

Returns
Type Description
ByteString

The bytes of the paths at the given index.

getPathsCount()

public int getPathsCount()

The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.

repeated string paths = 106438894;

Returns
Type Description
int

The count of paths.

getPathsList()

public ProtocolStringList getPathsList()

The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.

repeated string paths = 106438894;

Returns
Type Description
ProtocolStringList

A list containing the paths.

getRouteAction()

public HttpRouteAction getRouteAction()

In response to a matching path, the load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. If routeAction specifies any weightedBackendServices, service must not be set. Conversely if service is set, routeAction cannot contain any weightedBackendServices. Only one of routeAction or urlRedirect must be set. URL maps for classic Application Load Balancers only support the urlRewrite action within a path rule's routeAction.

optional .google.cloud.compute.v1.HttpRouteAction route_action = 424563948;

Returns
Type Description
HttpRouteAction

The routeAction.

getRouteActionBuilder()

public HttpRouteAction.Builder getRouteActionBuilder()

In response to a matching path, the load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. If routeAction specifies any weightedBackendServices, service must not be set. Conversely if service is set, routeAction cannot contain any weightedBackendServices. Only one of routeAction or urlRedirect must be set. URL maps for classic Application Load Balancers only support the urlRewrite action within a path rule's routeAction.

optional .google.cloud.compute.v1.HttpRouteAction route_action = 424563948;

Returns
Type Description
HttpRouteAction.Builder

getRouteActionOrBuilder()

public HttpRouteActionOrBuilder getRouteActionOrBuilder()

In response to a matching path, the load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. If routeAction specifies any weightedBackendServices, service must not be set. Conversely if service is set, routeAction cannot contain any weightedBackendServices. Only one of routeAction or urlRedirect must be set. URL maps for classic Application Load Balancers only support the urlRewrite action within a path rule's routeAction.

optional .google.cloud.compute.v1.HttpRouteAction route_action = 424563948;

Returns
Type Description
HttpRouteActionOrBuilder

getService()

public String getService()

The full or partial URL of the backend service resource to which traffic is directed if this rule is matched. If routeAction is also specified, advanced routing actions, such as URL rewrites, take effect before sending the request to the backend. However, if service is specified, routeAction cannot contain any weightedBackendServices. Conversely, if routeAction specifies any weightedBackendServices, service must not be specified. Only one of urlRedirect, service or routeAction.weightedBackendService must be set.

optional string service = 373540533;

Returns
Type Description
String

The service.

getServiceBytes()

public ByteString getServiceBytes()

The full or partial URL of the backend service resource to which traffic is directed if this rule is matched. If routeAction is also specified, advanced routing actions, such as URL rewrites, take effect before sending the request to the backend. However, if service is specified, routeAction cannot contain any weightedBackendServices. Conversely, if routeAction specifies any weightedBackendServices, service must not be specified. Only one of urlRedirect, service or routeAction.weightedBackendService must be set.

optional string service = 373540533;

Returns
Type Description
ByteString

The bytes for service.

getUrlRedirect()

public HttpRedirectAction getUrlRedirect()

When a path pattern is matched, the request is redirected to a URL specified by urlRedirect. If urlRedirect is specified, service or routeAction must not be set. Not supported when the URL map is bound to a target gRPC proxy.

optional .google.cloud.compute.v1.HttpRedirectAction url_redirect = 405147820;

Returns
Type Description
HttpRedirectAction

The urlRedirect.

getUrlRedirectBuilder()

public HttpRedirectAction.Builder getUrlRedirectBuilder()

When a path pattern is matched, the request is redirected to a URL specified by urlRedirect. If urlRedirect is specified, service or routeAction must not be set. Not supported when the URL map is bound to a target gRPC proxy.

optional .google.cloud.compute.v1.HttpRedirectAction url_redirect = 405147820;

Returns
Type Description
HttpRedirectAction.Builder

getUrlRedirectOrBuilder()

public HttpRedirectActionOrBuilder getUrlRedirectOrBuilder()

When a path pattern is matched, the request is redirected to a URL specified by urlRedirect. If urlRedirect is specified, service or routeAction must not be set. Not supported when the URL map is bound to a target gRPC proxy.

optional .google.cloud.compute.v1.HttpRedirectAction url_redirect = 405147820;

Returns
Type Description
HttpRedirectActionOrBuilder

hasCustomErrorResponsePolicy()

public boolean hasCustomErrorResponsePolicy()

customErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. If a policy for an error code is not configured for the PathRule, a policy for the error code configured in pathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not specified in pathMatcher.defaultCustomErrorResponsePolicy, the policy configured in UrlMap.defaultCustomErrorResponsePolicy takes effect. For example, consider a UrlMap with the following configuration: - UrlMap.defaultCustomErrorResponsePolicy are configured with policies for 5xx and 4xx errors - A PathRule for /coming_soon/ is configured for the error code 404. If the request is for www.myotherdomain.com and a 404 is encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes effect. If a 404 response is encountered for the request www.example.com/current_events/, the pathMatcher's policy takes effect. If however, the request for www.example.com/coming_soon/ encounters a 404, the policy in PathRule.customErrorResponsePolicy takes effect. If any of the requests in this example encounter a 500 error code, the policy at UrlMap.defaultCustomErrorResponsePolicy takes effect. customErrorResponsePolicy is supported only for global external Application Load Balancers.

optional .google.cloud.compute.v1.CustomErrorResponsePolicy custom_error_response_policy = 202816619;

Returns
Type Description
boolean

Whether the customErrorResponsePolicy field is set.

hasRouteAction()

public boolean hasRouteAction()

In response to a matching path, the load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. If routeAction specifies any weightedBackendServices, service must not be set. Conversely if service is set, routeAction cannot contain any weightedBackendServices. Only one of routeAction or urlRedirect must be set. URL maps for classic Application Load Balancers only support the urlRewrite action within a path rule's routeAction.

optional .google.cloud.compute.v1.HttpRouteAction route_action = 424563948;

Returns
Type Description
boolean

Whether the routeAction field is set.

hasService()

public boolean hasService()

The full or partial URL of the backend service resource to which traffic is directed if this rule is matched. If routeAction is also specified, advanced routing actions, such as URL rewrites, take effect before sending the request to the backend. However, if service is specified, routeAction cannot contain any weightedBackendServices. Conversely, if routeAction specifies any weightedBackendServices, service must not be specified. Only one of urlRedirect, service or routeAction.weightedBackendService must be set.

optional string service = 373540533;

Returns
Type Description
boolean

Whether the service field is set.

hasUrlRedirect()

public boolean hasUrlRedirect()

When a path pattern is matched, the request is redirected to a URL specified by urlRedirect. If urlRedirect is specified, service or routeAction must not be set. Not supported when the URL map is bound to a target gRPC proxy.

optional .google.cloud.compute.v1.HttpRedirectAction url_redirect = 405147820;

Returns
Type Description
boolean

Whether the urlRedirect field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeCustomErrorResponsePolicy(CustomErrorResponsePolicy value)

public PathRule.Builder mergeCustomErrorResponsePolicy(CustomErrorResponsePolicy value)

customErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. If a policy for an error code is not configured for the PathRule, a policy for the error code configured in pathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not specified in pathMatcher.defaultCustomErrorResponsePolicy, the policy configured in UrlMap.defaultCustomErrorResponsePolicy takes effect. For example, consider a UrlMap with the following configuration: - UrlMap.defaultCustomErrorResponsePolicy are configured with policies for 5xx and 4xx errors - A PathRule for /coming_soon/ is configured for the error code 404. If the request is for www.myotherdomain.com and a 404 is encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes effect. If a 404 response is encountered for the request www.example.com/current_events/, the pathMatcher's policy takes effect. If however, the request for www.example.com/coming_soon/ encounters a 404, the policy in PathRule.customErrorResponsePolicy takes effect. If any of the requests in this example encounter a 500 error code, the policy at UrlMap.defaultCustomErrorResponsePolicy takes effect. customErrorResponsePolicy is supported only for global external Application Load Balancers.

optional .google.cloud.compute.v1.CustomErrorResponsePolicy custom_error_response_policy = 202816619;

Parameter
Name Description
value CustomErrorResponsePolicy
Returns
Type Description
PathRule.Builder

mergeFrom(PathRule other)

public PathRule.Builder mergeFrom(PathRule other)
Parameter
Name Description
other PathRule
Returns
Type Description
PathRule.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public PathRule.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
PathRule.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public PathRule.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
PathRule.Builder
Overrides

mergeRouteAction(HttpRouteAction value)

public PathRule.Builder mergeRouteAction(HttpRouteAction value)

In response to a matching path, the load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. If routeAction specifies any weightedBackendServices, service must not be set. Conversely if service is set, routeAction cannot contain any weightedBackendServices. Only one of routeAction or urlRedirect must be set. URL maps for classic Application Load Balancers only support the urlRewrite action within a path rule's routeAction.

optional .google.cloud.compute.v1.HttpRouteAction route_action = 424563948;

Parameter
Name Description
value HttpRouteAction
Returns
Type Description
PathRule.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final PathRule.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
PathRule.Builder
Overrides

mergeUrlRedirect(HttpRedirectAction value)

public PathRule.Builder mergeUrlRedirect(HttpRedirectAction value)

When a path pattern is matched, the request is redirected to a URL specified by urlRedirect. If urlRedirect is specified, service or routeAction must not be set. Not supported when the URL map is bound to a target gRPC proxy.

optional .google.cloud.compute.v1.HttpRedirectAction url_redirect = 405147820;

Parameter
Name Description
value HttpRedirectAction
Returns
Type Description
PathRule.Builder

setCustomErrorResponsePolicy(CustomErrorResponsePolicy value)

public PathRule.Builder setCustomErrorResponsePolicy(CustomErrorResponsePolicy value)

customErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. If a policy for an error code is not configured for the PathRule, a policy for the error code configured in pathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not specified in pathMatcher.defaultCustomErrorResponsePolicy, the policy configured in UrlMap.defaultCustomErrorResponsePolicy takes effect. For example, consider a UrlMap with the following configuration: - UrlMap.defaultCustomErrorResponsePolicy are configured with policies for 5xx and 4xx errors - A PathRule for /coming_soon/ is configured for the error code 404. If the request is for www.myotherdomain.com and a 404 is encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes effect. If a 404 response is encountered for the request www.example.com/current_events/, the pathMatcher's policy takes effect. If however, the request for www.example.com/coming_soon/ encounters a 404, the policy in PathRule.customErrorResponsePolicy takes effect. If any of the requests in this example encounter a 500 error code, the policy at UrlMap.defaultCustomErrorResponsePolicy takes effect. customErrorResponsePolicy is supported only for global external Application Load Balancers.

optional .google.cloud.compute.v1.CustomErrorResponsePolicy custom_error_response_policy = 202816619;

Parameter
Name Description
value CustomErrorResponsePolicy
Returns
Type Description
PathRule.Builder

setCustomErrorResponsePolicy(CustomErrorResponsePolicy.Builder builderForValue)

public PathRule.Builder setCustomErrorResponsePolicy(CustomErrorResponsePolicy.Builder builderForValue)

customErrorResponsePolicy specifies how the Load Balancer returns error responses when BackendServiceor BackendBucket responds with an error. If a policy for an error code is not configured for the PathRule, a policy for the error code configured in pathMatcher.defaultCustomErrorResponsePolicy is applied. If one is not specified in pathMatcher.defaultCustomErrorResponsePolicy, the policy configured in UrlMap.defaultCustomErrorResponsePolicy takes effect. For example, consider a UrlMap with the following configuration: - UrlMap.defaultCustomErrorResponsePolicy are configured with policies for 5xx and 4xx errors - A PathRule for /coming_soon/ is configured for the error code 404. If the request is for www.myotherdomain.com and a 404 is encountered, the policy under UrlMap.defaultCustomErrorResponsePolicy takes effect. If a 404 response is encountered for the request www.example.com/current_events/, the pathMatcher's policy takes effect. If however, the request for www.example.com/coming_soon/ encounters a 404, the policy in PathRule.customErrorResponsePolicy takes effect. If any of the requests in this example encounter a 500 error code, the policy at UrlMap.defaultCustomErrorResponsePolicy takes effect. customErrorResponsePolicy is supported only for global external Application Load Balancers.

optional .google.cloud.compute.v1.CustomErrorResponsePolicy custom_error_response_policy = 202816619;

Parameter
Name Description
builderForValue CustomErrorResponsePolicy.Builder
Returns
Type Description
PathRule.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public PathRule.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
PathRule.Builder
Overrides

setPaths(int index, String value)

public PathRule.Builder setPaths(int index, String value)

The list of path patterns to match. Each must start with / and the only place a * is allowed is at the end following a /. The string fed to the path matcher does not include any text after the first ? or #, and those chars are not allowed here.

repeated string paths = 106438894;

Parameters
Name Description
index int

The index to set the value at.

value String

The paths to set.

Returns
Type Description
PathRule.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public PathRule.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
PathRule.Builder
Overrides

setRouteAction(HttpRouteAction value)

public PathRule.Builder setRouteAction(HttpRouteAction value)

In response to a matching path, the load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. If routeAction specifies any weightedBackendServices, service must not be set. Conversely if service is set, routeAction cannot contain any weightedBackendServices. Only one of routeAction or urlRedirect must be set. URL maps for classic Application Load Balancers only support the urlRewrite action within a path rule's routeAction.

optional .google.cloud.compute.v1.HttpRouteAction route_action = 424563948;

Parameter
Name Description
value HttpRouteAction
Returns
Type Description
PathRule.Builder

setRouteAction(HttpRouteAction.Builder builderForValue)

public PathRule.Builder setRouteAction(HttpRouteAction.Builder builderForValue)

In response to a matching path, the load balancer performs advanced routing actions, such as URL rewrites and header transformations, before forwarding the request to the selected backend. If routeAction specifies any weightedBackendServices, service must not be set. Conversely if service is set, routeAction cannot contain any weightedBackendServices. Only one of routeAction or urlRedirect must be set. URL maps for classic Application Load Balancers only support the urlRewrite action within a path rule's routeAction.

optional .google.cloud.compute.v1.HttpRouteAction route_action = 424563948;

Parameter
Name Description
builderForValue HttpRouteAction.Builder
Returns
Type Description
PathRule.Builder

setService(String value)

public PathRule.Builder setService(String value)

The full or partial URL of the backend service resource to which traffic is directed if this rule is matched. If routeAction is also specified, advanced routing actions, such as URL rewrites, take effect before sending the request to the backend. However, if service is specified, routeAction cannot contain any weightedBackendServices. Conversely, if routeAction specifies any weightedBackendServices, service must not be specified. Only one of urlRedirect, service or routeAction.weightedBackendService must be set.

optional string service = 373540533;

Parameter
Name Description
value String

The service to set.

Returns
Type Description
PathRule.Builder

This builder for chaining.

setServiceBytes(ByteString value)

public PathRule.Builder setServiceBytes(ByteString value)

The full or partial URL of the backend service resource to which traffic is directed if this rule is matched. If routeAction is also specified, advanced routing actions, such as URL rewrites, take effect before sending the request to the backend. However, if service is specified, routeAction cannot contain any weightedBackendServices. Conversely, if routeAction specifies any weightedBackendServices, service must not be specified. Only one of urlRedirect, service or routeAction.weightedBackendService must be set.

optional string service = 373540533;

Parameter
Name Description
value ByteString

The bytes for service to set.

Returns
Type Description
PathRule.Builder

This builder for chaining.

setUnknownFields(UnknownFieldSet unknownFields)

public final PathRule.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
PathRule.Builder
Overrides

setUrlRedirect(HttpRedirectAction value)

public PathRule.Builder setUrlRedirect(HttpRedirectAction value)

When a path pattern is matched, the request is redirected to a URL specified by urlRedirect. If urlRedirect is specified, service or routeAction must not be set. Not supported when the URL map is bound to a target gRPC proxy.

optional .google.cloud.compute.v1.HttpRedirectAction url_redirect = 405147820;

Parameter
Name Description
value HttpRedirectAction
Returns
Type Description
PathRule.Builder

setUrlRedirect(HttpRedirectAction.Builder builderForValue)

public PathRule.Builder setUrlRedirect(HttpRedirectAction.Builder builderForValue)

When a path pattern is matched, the request is redirected to a URL specified by urlRedirect. If urlRedirect is specified, service or routeAction must not be set. Not supported when the URL map is bound to a target gRPC proxy.

optional .google.cloud.compute.v1.HttpRedirectAction url_redirect = 405147820;

Parameter
Name Description
builderForValue HttpRedirectAction.Builder
Returns
Type Description
PathRule.Builder