# Compute V1 Client - Class CorsPolicy (2.10.0)

2.10.0 (latest) 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.0.0 1.36.0 1.35.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.1 1.21.0 1.20.0 1.19.0 1.18.1 1.17.0 1.16.2 1.14.0 1.13.0 1.12.1 1.11.1 1.10.1 1.9.1 1.8.3 1.7.1 1.6.1 1.5.0 Reference documentation and code samples for the Compute V1 Client class CorsPolicy.

The specification for allowing client-side cross-origin requests. For more
information about the W3C recommendation for cross-origin resource sharing
(CORS), see Fetch API Living
Standard.

Generated from protobuf message `google.cloud.compute.v1.CorsPolicy`

## Namespace

Google \\ Cloud \\ Compute \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ allow_credentials` | `bool` In response to a preflight request, setting this to true indicates that the actual request can include user credentials. This field translates to the Access-Control-Allow-Credentials header. Default is false. |
| `↳ allow_headers` | `string[]` Specifies the content for the Access-Control-Allow-Headers header. |
| `↳ allow_methods` | `string[]` Specifies the content for the Access-Control-Allow-Methods header. |
| `↳ allow_origin_regexes` | `string[]` Specifies a regular expression that matches allowed origins. For more information, see regular expression syntax. An origin is allowed if it matches either an item inallowOrigins or an item inallowOriginRegexes. Regular expressions can only be used when the loadBalancingScheme is set to INTERNAL_SELF_MANAGED. |
| `↳ allow_origins` | `string[]` Specifies the list of origins that is allowed to do CORS requests. An origin is allowed if it matches either an item inallowOrigins or an item inallowOriginRegexes. |
| `↳ disabled` | `bool` If true, disables the CORS policy. The default value is false, which indicates that the CORS policy is in effect. |
| `↳ expose_headers` | `string[]` Specifies the content for the Access-Control-Expose-Headers header. |
| `↳ max_age` | `int` Specifies how long results of a preflight request can be cached in seconds. This field translates to the Access-Control-Max-Age header. |

### getAllowCredentials

In response to a preflight request, setting this to true
indicates that
the actual request can include user credentials. This field translates to
the Access-Control-Allow-Credentials header.

Default is false.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasAllowCredentials

### clearAllowCredentials

### setAllowCredentials

In response to a preflight request, setting this to true
indicates that
the actual request can include user credentials. This field translates to
the Access-Control-Allow-Credentials header.

Default is false.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAllowHeaders

Specifies the content for the Access-Control-Allow-Headers
header.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setAllowHeaders

Specifies the content for the Access-Control-Allow-Headers
header.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAllowMethods

Specifies the content for the Access-Control-Allow-Methods
header.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setAllowMethods

Specifies the content for the Access-Control-Allow-Methods
header.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAllowOriginRegexes

Specifies a regular expression that matches allowed origins. For
more information, see regular expression syntax.

An origin is allowed if it matches either an item inallowOrigins or an item inallowOriginRegexes.
Regular expressions can only be used when the loadBalancingScheme is
set to INTERNAL_SELF_MANAGED.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setAllowOriginRegexes

Specifies a regular expression that matches allowed origins. For
more information, see regular expression syntax.

An origin is allowed if it matches either an item inallowOrigins or an item inallowOriginRegexes.
Regular expressions can only be used when the loadBalancingScheme is
set to INTERNAL_SELF_MANAGED.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAllowOrigins

Specifies the list of origins that is allowed to do CORS requests.

An origin is allowed if it matches either an item inallowOrigins or an item inallowOriginRegexes.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setAllowOrigins

Specifies the list of origins that is allowed to do CORS requests.

An origin is allowed if it matches either an item inallowOrigins or an item inallowOriginRegexes.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDisabled

If true, disables the CORS policy.

The default value is false, which indicates that the CORS
policy is in effect.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasDisabled

### clearDisabled

### setDisabled

If true, disables the CORS policy.

The default value is false, which indicates that the CORS
policy is in effect.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getExposeHeaders

Specifies the content for the Access-Control-Expose-Headers
header.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setExposeHeaders

Specifies the content for the Access-Control-Expose-Headers
header.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getMaxAge

Specifies how long results of a preflight request can be cached in
seconds. This field translates to the Access-Control-Max-Age
header.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasMaxAge

### clearMaxAge

### setMaxAge

Specifies how long results of a preflight request can be cached in
seconds. This field translates to the Access-Control-Max-Age
header.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |