public final class CorsPolicy extends GeneratedMessageV3 implements CorsPolicyOrBuilder
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.
Protobuf type google.cloud.compute.v1.CorsPolicy
Static Fields
ALLOW_CREDENTIALS_FIELD_NUMBER
public static final int ALLOW_CREDENTIALS_FIELD_NUMBER
Field Value
public static final int ALLOW_HEADERS_FIELD_NUMBER
Field Value
ALLOW_METHODS_FIELD_NUMBER
public static final int ALLOW_METHODS_FIELD_NUMBER
Field Value
ALLOW_ORIGINS_FIELD_NUMBER
public static final int ALLOW_ORIGINS_FIELD_NUMBER
Field Value
ALLOW_ORIGIN_REGEXES_FIELD_NUMBER
public static final int ALLOW_ORIGIN_REGEXES_FIELD_NUMBER
Field Value
DISABLED_FIELD_NUMBER
public static final int DISABLED_FIELD_NUMBER
Field Value
public static final int EXPOSE_HEADERS_FIELD_NUMBER
Field Value
MAX_AGE_FIELD_NUMBER
public static final int MAX_AGE_FIELD_NUMBER
Field Value
Static Methods
getDefaultInstance()
public static CorsPolicy getDefaultInstance()
Returns
getDescriptor()
public static final Descriptors.Descriptor getDescriptor()
Returns
newBuilder()
public static CorsPolicy.Builder newBuilder()
Returns
newBuilder(CorsPolicy prototype)
public static CorsPolicy.Builder newBuilder(CorsPolicy prototype)
Parameter
Returns
public static CorsPolicy parseDelimitedFrom(InputStream input)
Parameter
Returns
Exceptions
public static CorsPolicy parseDelimitedFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
parseFrom(byte[] data)
public static CorsPolicy parseFrom(byte[] data)
Parameter
Name | Description |
data | byte[]
|
Returns
Exceptions
parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
public static CorsPolicy parseFrom(byte[] data, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
parseFrom(ByteString data)
public static CorsPolicy parseFrom(ByteString data)
Parameter
Returns
Exceptions
parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
public static CorsPolicy parseFrom(ByteString data, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
public static CorsPolicy parseFrom(CodedInputStream input)
Parameter
Returns
Exceptions
public static CorsPolicy parseFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
public static CorsPolicy parseFrom(InputStream input)
Parameter
Returns
Exceptions
public static CorsPolicy parseFrom(InputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
parseFrom(ByteBuffer data)
public static CorsPolicy parseFrom(ByteBuffer data)
Parameter
Returns
Exceptions
parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
public static CorsPolicy parseFrom(ByteBuffer data, ExtensionRegistryLite extensionRegistry)
Parameters
Returns
Exceptions
parser()
public static Parser<CorsPolicy> parser()
Returns
Methods
equals(Object obj)
public boolean equals(Object obj)
Parameter
Returns
Overrides
getAllowCredentials()
public boolean 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.
optional bool allow_credentials = 481263366;
Returns
Type | Description |
boolean | The allowCredentials.
|
public String getAllowHeaders(int index)
Specifies the content for the Access-Control-Allow-Headers header.
repeated string allow_headers = 45179024;
Parameter
Name | Description |
index | int
The index of the element to return.
|
Returns
Type | Description |
String | The allowHeaders at the given index.
|
public ByteString getAllowHeadersBytes(int index)
Specifies the content for the Access-Control-Allow-Headers header.
repeated string allow_headers = 45179024;
Parameter
Name | Description |
index | int
The index of the value to return.
|
Returns
Type | Description |
ByteString | The bytes of the allowHeaders at the given index.
|
public int getAllowHeadersCount()
Specifies the content for the Access-Control-Allow-Headers header.
repeated string allow_headers = 45179024;
Returns
Type | Description |
int | The count of allowHeaders.
|
public ProtocolStringList getAllowHeadersList()
Specifies the content for the Access-Control-Allow-Headers header.
repeated string allow_headers = 45179024;
Returns
getAllowMethods(int index)
public String getAllowMethods(int index)
Specifies the content for the Access-Control-Allow-Methods header.
repeated string allow_methods = 205405372;
Parameter
Name | Description |
index | int
The index of the element to return.
|
Returns
Type | Description |
String | The allowMethods at the given index.
|
getAllowMethodsBytes(int index)
public ByteString getAllowMethodsBytes(int index)
Specifies the content for the Access-Control-Allow-Methods header.
repeated string allow_methods = 205405372;
Parameter
Name | Description |
index | int
The index of the value to return.
|
Returns
Type | Description |
ByteString | The bytes of the allowMethods at the given index.
|
getAllowMethodsCount()
public int getAllowMethodsCount()
Specifies the content for the Access-Control-Allow-Methods header.
repeated string allow_methods = 205405372;
Returns
Type | Description |
int | The count of allowMethods.
|
getAllowMethodsList()
public ProtocolStringList getAllowMethodsList()
Specifies the content for the Access-Control-Allow-Methods header.
repeated string allow_methods = 205405372;
Returns
getAllowOriginRegexes(int index)
public String getAllowOriginRegexes(int index)
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.
repeated string allow_origin_regexes = 215385810;
Parameter
Name | Description |
index | int
The index of the element to return.
|
Returns
Type | Description |
String | The allowOriginRegexes at the given index.
|
getAllowOriginRegexesBytes(int index)
public ByteString getAllowOriginRegexesBytes(int index)
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.
repeated string allow_origin_regexes = 215385810;
Parameter
Name | Description |
index | int
The index of the value to return.
|
Returns
Type | Description |
ByteString | The bytes of the allowOriginRegexes at the given index.
|
getAllowOriginRegexesCount()
public int getAllowOriginRegexesCount()
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.
repeated string allow_origin_regexes = 215385810;
Returns
Type | Description |
int | The count of allowOriginRegexes.
|
getAllowOriginRegexesList()
public ProtocolStringList getAllowOriginRegexesList()
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.
repeated string allow_origin_regexes = 215385810;
Returns
getAllowOrigins(int index)
public String getAllowOrigins(int index)
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.
repeated string allow_origins = 194914071;
Parameter
Name | Description |
index | int
The index of the element to return.
|
Returns
Type | Description |
String | The allowOrigins at the given index.
|
getAllowOriginsBytes(int index)
public ByteString getAllowOriginsBytes(int index)
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.
repeated string allow_origins = 194914071;
Parameter
Name | Description |
index | int
The index of the value to return.
|
Returns
Type | Description |
ByteString | The bytes of the allowOrigins at the given index.
|
getAllowOriginsCount()
public int getAllowOriginsCount()
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.
repeated string allow_origins = 194914071;
Returns
Type | Description |
int | The count of allowOrigins.
|
getAllowOriginsList()
public ProtocolStringList getAllowOriginsList()
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.
repeated string allow_origins = 194914071;
Returns
getDefaultInstanceForType()
public CorsPolicy getDefaultInstanceForType()
Returns
getDisabled()
public boolean 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.
optional bool disabled = 270940796;
Returns
Type | Description |
boolean | The disabled.
|
public String getExposeHeaders(int index)
Specifies the content for the Access-Control-Expose-Headers header.
repeated string expose_headers = 247604747;
Parameter
Name | Description |
index | int
The index of the element to return.
|
Returns
Type | Description |
String | The exposeHeaders at the given index.
|
public ByteString getExposeHeadersBytes(int index)
Specifies the content for the Access-Control-Expose-Headers header.
repeated string expose_headers = 247604747;
Parameter
Name | Description |
index | int
The index of the value to return.
|
Returns
Type | Description |
ByteString | The bytes of the exposeHeaders at the given index.
|
public int getExposeHeadersCount()
Specifies the content for the Access-Control-Expose-Headers header.
repeated string expose_headers = 247604747;
Returns
Type | Description |
int | The count of exposeHeaders.
|
public ProtocolStringList getExposeHeadersList()
Specifies the content for the Access-Control-Expose-Headers header.
repeated string expose_headers = 247604747;
Returns
getMaxAge()
Specifies how long results of a preflight request can be cached in seconds. This field translates to the Access-Control-Max-Age header.
optional int32 max_age = 307559332;
Returns
Type | Description |
int | The maxAge.
|
getParserForType()
public Parser<CorsPolicy> getParserForType()
Returns
Overrides
getSerializedSize()
public int getSerializedSize()
Returns
Overrides
getUnknownFields()
public final UnknownFieldSet getUnknownFields()
Returns
Overrides
hasAllowCredentials()
public boolean hasAllowCredentials()
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.
optional bool allow_credentials = 481263366;
Returns
Type | Description |
boolean | Whether the allowCredentials field is set.
|
hasDisabled()
public boolean hasDisabled()
If true, the setting specifies the CORS policy is disabled. The default value of false, which indicates that the CORS policy is in effect.
optional bool disabled = 270940796;
Returns
Type | Description |
boolean | Whether the disabled field is set.
|
hasMaxAge()
public boolean hasMaxAge()
Specifies how long results of a preflight request can be cached in seconds. This field translates to the Access-Control-Max-Age header.
optional int32 max_age = 307559332;
Returns
Type | Description |
boolean | Whether the maxAge field is set.
|
hashCode()
Returns
Overrides
internalGetFieldAccessorTable()
protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Overrides
isInitialized()
public final boolean isInitialized()
Returns
Overrides
newBuilderForType()
public CorsPolicy.Builder newBuilderForType()
Returns
newBuilderForType(GeneratedMessageV3.BuilderParent parent)
protected CorsPolicy.Builder newBuilderForType(GeneratedMessageV3.BuilderParent parent)
Parameter
Returns
Overrides
newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
protected Object newInstance(GeneratedMessageV3.UnusedPrivateParameter unused)
Parameter
Returns
Overrides
toBuilder()
public CorsPolicy.Builder toBuilder()
Returns
writeTo(CodedOutputStream output)
public void writeTo(CodedOutputStream output)
Parameter
Overrides
Exceptions