# Interface CustomErrorResponsePolicyOrBuilder (1.101.0)

1.103.0 (latest) 1.101.0 1.98.0 1.97.0 1.95.0 1.93.0 1.92.0 1.91.0 1.90.0 1.88.0 1.86.0 1.85.0 1.84.0 1.83.0 1.82.0 1.80.0 1.78.0 1.77.0 1.74.0 1.73.0 1.72.0 1.70.0 1.69.0 1.68.0 1.67.0 1.66.0 1.65.0 1.64.0 1.63.0 1.62.0 1.61.0 1.59.0 1.58.0 1.57.0 1.56.0 1.55.0 1.54.0 1.53.0 1.52.0 1.51.0 1.50.0 1.49.0 1.47.0 1.46.0 1.45.0 1.44.0 1.43.0 1.42.0 1.41.0 1.40.0 1.39.0 1.38.0 1.37.0 1.34.0 1.33.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 1.24.0 1.23.0 1.22.0 1.21.0 1.20.0 1.19.0 1.18.0 1.17.0 1.16.0 1.15.0 1.14.0 1.13.0 1.12.1 1.11.0 1.9.1 1.8.1 1.7.2 1.6.0-beta

    public interface CustomErrorResponsePolicyOrBuilder extends MessageOrBuilder

## Implements

[MessageOrBuilder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder.html)

## Methods

### getErrorResponseRules(int index)

    public abstract CustomErrorResponsePolicyCustomErrorResponseRule getErrorResponseRules(int index)

Specifies rules for returning error responses.

In a given policy, if you specify rules for both a range of error codes
as well as rules for specific error codes then rules with specific error
codes have a higher priority. For example, assume that you configure a rule
for 401 (Un-authorized) code, and another for all 4 series
error codes (4XX). If the backend service returns a401, then the rule for 401 will be applied.
However if the backend service returns a 403, the rule for4xx takes effect.

`
repeated .google.cloud.compute.v1.CustomErrorResponsePolicyCustomErrorResponseRule error_response_rules = 14620304;
`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-compute/latest/com.google.cloud.compute.v1.CustomErrorResponsePolicyCustomErrorResponseRule` |   |

### getErrorResponseRulesCount()

    public abstract int getErrorResponseRulesCount()

Specifies rules for returning error responses.

In a given policy, if you specify rules for both a range of error codes
as well as rules for specific error codes then rules with specific error
codes have a higher priority. For example, assume that you configure a rule
for 401 (Un-authorized) code, and another for all 4 series
error codes (4XX). If the backend service returns a401, then the rule for 401 will be applied.
However if the backend service returns a 403, the rule for4xx takes effect.

`
repeated .google.cloud.compute.v1.CustomErrorResponsePolicyCustomErrorResponseRule error_response_rules = 14620304;
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getErrorResponseRulesList()

    public abstract List<CustomErrorResponsePolicyCustomErrorResponseRule> getErrorResponseRulesList()

Specifies rules for returning error responses.

In a given policy, if you specify rules for both a range of error codes
as well as rules for specific error codes then rules with specific error
codes have a higher priority. For example, assume that you configure a rule
for 401 (Un-authorized) code, and another for all 4 series
error codes (4XX). If the backend service returns a401, then the rule for 401 will be applied.
However if the backend service returns a 403, the rule for4xx takes effect.

`
repeated .google.cloud.compute.v1.CustomErrorResponsePolicyCustomErrorResponseRule error_response_rules = 14620304;
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<https://docs.cloud.google.com/java/docs/reference/google-cloud-compute/latest/com.google.cloud.compute.v1.CustomErrorResponsePolicyCustomErrorResponseRule>` |   |

### getErrorResponseRulesOrBuilder(int index)

    public abstract CustomErrorResponsePolicyCustomErrorResponseRuleOrBuilder getErrorResponseRulesOrBuilder(int index)

Specifies rules for returning error responses.

In a given policy, if you specify rules for both a range of error codes
as well as rules for specific error codes then rules with specific error
codes have a higher priority. For example, assume that you configure a rule
for 401 (Un-authorized) code, and another for all 4 series
error codes (4XX). If the backend service returns a401, then the rule for 401 will be applied.
However if the backend service returns a 403, the rule for4xx takes effect.

`
repeated .google.cloud.compute.v1.CustomErrorResponsePolicyCustomErrorResponseRule error_response_rules = 14620304;
`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `index` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-compute/latest/com.google.cloud.compute.v1.CustomErrorResponsePolicyCustomErrorResponseRuleOrBuilder` |   |

### getErrorResponseRulesOrBuilderList()

    public abstract List<? extends CustomErrorResponsePolicyCustomErrorResponseRuleOrBuilder> getErrorResponseRulesOrBuilderList()

Specifies rules for returning error responses.

In a given policy, if you specify rules for both a range of error codes
as well as rules for specific error codes then rules with specific error
codes have a higher priority. For example, assume that you configure a rule
for 401 (Un-authorized) code, and another for all 4 series
error codes (4XX). If the backend service returns a401, then the rule for 401 will be applied.
However if the backend service returns a 403, the rule for4xx takes effect.

`
repeated .google.cloud.compute.v1.CustomErrorResponsePolicyCustomErrorResponseRule error_response_rules = 14620304;
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/List.html<? extends com.google.cloud.compute.v1.CustomErrorResponsePolicyCustomErrorResponseRuleOrBuilder>` |   |

### getErrorService()

    public abstract String getErrorService()

The full or partial URL to the BackendBucket resource that
contains the custom error content. Examples are:

- <https://www.googleapis.com/compute/v1/projects/project/global/backendBuckets/myBackendBucket>
- compute/v1/projects/project/global/backendBuckets/myBackendBucket
- global/backendBuckets/myBackendBucket

  If errorService is not specified at lower levels likepathMatcher, pathRule and routeRule,
  an errorService specified at a higher level in theUrlMap will be used. IfUrlMap.defaultCustomErrorResponsePolicy contains one or moreerrorResponseRules\[\], it must specifyerrorService.

  If load balancer cannot reach
  the backendBucket, a simple Not Found Error will
  be returned, with the original response code (oroverrideResponseCode if configured).

  errorService is not supported for internal or regionalHTTP/HTTPS load balancers.

`optional string error_service = 164214654;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The errorService. |

### getErrorServiceBytes()

    public abstract ByteString getErrorServiceBytes()

The full or partial URL to the BackendBucket resource that
contains the custom error content. Examples are:

- <https://www.googleapis.com/compute/v1/projects/project/global/backendBuckets/myBackendBucket>
- compute/v1/projects/project/global/backendBuckets/myBackendBucket
- global/backendBuckets/myBackendBucket

  If errorService is not specified at lower levels likepathMatcher, pathRule and routeRule,
  an errorService specified at a higher level in theUrlMap will be used. IfUrlMap.defaultCustomErrorResponsePolicy contains one or moreerrorResponseRules\[\], it must specifyerrorService.

  If load balancer cannot reach
  the backendBucket, a simple Not Found Error will
  be returned, with the original response code (oroverrideResponseCode if configured).

  errorService is not supported for internal or regionalHTTP/HTTPS load balancers.

`optional string error_service = 164214654;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for errorService. |

### hasErrorService()

    public abstract boolean hasErrorService()

The full or partial URL to the BackendBucket resource that
contains the custom error content. Examples are:

- <https://www.googleapis.com/compute/v1/projects/project/global/backendBuckets/myBackendBucket>
- compute/v1/projects/project/global/backendBuckets/myBackendBucket
- global/backendBuckets/myBackendBucket

  If errorService is not specified at lower levels likepathMatcher, pathRule and routeRule,
  an errorService specified at a higher level in theUrlMap will be used. IfUrlMap.defaultCustomErrorResponsePolicy contains one or moreerrorResponseRules\[\], it must specifyerrorService.

  If load balancer cannot reach
  the backendBucket, a simple Not Found Error will
  be returned, with the original response code (oroverrideResponseCode if configured).

  errorService is not supported for internal or regionalHTTP/HTTPS load balancers.

`optional string error_service = 164214654;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the errorService field is set. |