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
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 |
array
Specifies the content for the Access-Control-Allow-Headers header. |
↳ allow_methods |
array
Specifies the content for the Access-Control-Allow-Methods header. |
↳ allow_origin_regexes |
array
Specifies a regular expression that matches allowed origins. For more information about the regular expression syntax, see Syntax. An origin is allowed if it matches either an item in allowOrigins or an item in allowOriginRegexes. Regular expressions can only be used when the loadBalancingScheme is set to INTERNAL_SELF_MANAGED. |
↳ allow_origins |
array
Specifies the list of origins that is allowed to do CORS requests. An origin is allowed if it matches either an item in allowOrigins or an item in allowOriginRegexes. |
↳ disabled |
bool
If true, the setting specifies the CORS policy is disabled. The default value of false, which indicates that the CORS policy is in effect. |
↳ expose_headers |
array
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.
Generated from protobuf field optional bool allow_credentials = 481263366;
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.
Generated from protobuf field optional bool allow_credentials = 481263366;
Parameter | |
---|---|
Name | Description |
var |
bool
|
Returns | |
---|---|
Type | Description |
$this |
getAllowHeaders
Specifies the content for the Access-Control-Allow-Headers header.
Generated from protobuf field repeated string allow_headers = 45179024;
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setAllowHeaders
Specifies the content for the Access-Control-Allow-Headers header.
Generated from protobuf field repeated string allow_headers = 45179024;
Parameter | |
---|---|
Name | Description |
var |
string[]
|
Returns | |
---|---|
Type | Description |
$this |
getAllowMethods
Specifies the content for the Access-Control-Allow-Methods header.
Generated from protobuf field repeated string allow_methods = 205405372;
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setAllowMethods
Specifies the content for the Access-Control-Allow-Methods header.
Generated from protobuf field repeated string allow_methods = 205405372;
Parameter | |
---|---|
Name | Description |
var |
string[]
|
Returns | |
---|---|
Type | Description |
$this |
getAllowOriginRegexes
Specifies a regular expression that matches allowed origins. For more information about the regular expression syntax, see Syntax. An origin is allowed if it matches either an item in allowOrigins or an item in allowOriginRegexes. Regular expressions can only be used when the loadBalancingScheme is set to INTERNAL_SELF_MANAGED.
Generated from protobuf field repeated string allow_origin_regexes = 215385810;
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setAllowOriginRegexes
Specifies a regular expression that matches allowed origins. For more information about the regular expression syntax, see Syntax. An origin is allowed if it matches either an item in allowOrigins or an item in allowOriginRegexes. Regular expressions can only be used when the loadBalancingScheme is set to INTERNAL_SELF_MANAGED.
Generated from protobuf field repeated string allow_origin_regexes = 215385810;
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 in allowOrigins or an item in allowOriginRegexes.
Generated from protobuf field repeated string allow_origins = 194914071;
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setAllowOrigins
Specifies the list of origins that is allowed to do CORS requests. An origin is allowed if it matches either an item in allowOrigins or an item in allowOriginRegexes.
Generated from protobuf field repeated string allow_origins = 194914071;
Parameter | |
---|---|
Name | Description |
var |
string[]
|
Returns | |
---|---|
Type | Description |
$this |
getDisabled
If true, the setting specifies the CORS policy is disabled. The default value of false, which indicates that the CORS policy is in effect.
Generated from protobuf field optional bool disabled = 270940796;
Returns | |
---|---|
Type | Description |
bool |
hasDisabled
clearDisabled
setDisabled
If true, the setting specifies the CORS policy is disabled. The default value of false, which indicates that the CORS policy is in effect.
Generated from protobuf field optional bool disabled = 270940796;
Parameter | |
---|---|
Name | Description |
var |
bool
|
Returns | |
---|---|
Type | Description |
$this |
getExposeHeaders
Specifies the content for the Access-Control-Expose-Headers header.
Generated from protobuf field repeated string expose_headers = 247604747;
Returns | |
---|---|
Type | Description |
Google\Protobuf\Internal\RepeatedField |
setExposeHeaders
Specifies the content for the Access-Control-Expose-Headers header.
Generated from protobuf field repeated string expose_headers = 247604747;
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.
Generated from protobuf field optional int32 max_age = 307559332;
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.
Generated from protobuf field optional int32 max_age = 307559332;
Parameter | |
---|---|
Name | Description |
var |
int
|
Returns | |
---|---|
Type | Description |
$this |