Google Cloud Network Services V1 Client - Class CorsPolicy (0.2.2)

Reference documentation and code samples for the Google Cloud Network Services V1 Client class CorsPolicy.

The Specification for allowing client side cross-origin requests.

Generated from protobuf message google.cloud.networkservices.v1.HttpRoute.CorsPolicy

Namespace

Google \ Cloud \ NetworkServices \ V1 \ HttpRoute

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ allow_origins array

Specifies the list of origins that will be allowed to do CORS requests. An origin is allowed if it matches either an item in allow_origins or an item in allow_origin_regexes.

↳ allow_origin_regexes array

Specifies the regular expression patterns that match allowed origins. For regular expression grammar, please see https://github.com/google/re2/wiki/Syntax.

↳ allow_methods array

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

↳ allow_headers array

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

↳ expose_headers array

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

↳ max_age string

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

↳ allow_credentials bool

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

↳ disabled bool

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

getAllowOrigins

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

An origin is allowed if it matches either an item in allow_origins or an item in allow_origin_regexes.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setAllowOrigins

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

An origin is allowed if it matches either an item in allow_origins or an item in allow_origin_regexes.

Parameter
Name Description
var string[]
Returns
Type Description
$this

getAllowOriginRegexes

Specifies the regular expression patterns that match allowed origins. For regular expression grammar, please see https://github.com/google/re2/wiki/Syntax.

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setAllowOriginRegexes

Specifies the regular expression patterns that match allowed origins. For regular expression grammar, please see https://github.com/google/re2/wiki/Syntax.

Parameter
Name Description
var string[]
Returns
Type Description
$this

getAllowMethods

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

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setAllowMethods

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

Parameter
Name Description
var string[]
Returns
Type Description
$this

getAllowHeaders

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

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setAllowHeaders

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

Parameter
Name Description
var string[]
Returns
Type Description
$this

getExposeHeaders

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

Returns
Type Description
Google\Protobuf\Internal\RepeatedField

setExposeHeaders

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

Parameter
Name Description
var string[]
Returns
Type Description
$this

getMaxAge

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

Returns
Type Description
string

setMaxAge

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

Parameter
Name Description
var string
Returns
Type Description
$this

getAllowCredentials

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

Default value is false.

Returns
Type Description
bool

setAllowCredentials

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

Default value is false.

Parameter
Name Description
var bool
Returns
Type Description
$this

getDisabled

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

Returns
Type Description
bool

setDisabled

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

Parameter
Name Description
var bool
Returns
Type Description
$this