Class CorsPolicy
java.lang.Object
com.azure.resourcemanager.cosmos.models.CorsPolicy
- All Implemented Interfaces:
com.azure.json.JsonSerializable<CorsPolicy>
The CORS policy for the Cosmos DB database account.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the allowedHeaders property: The request headers that the origin domain may specify on the CORS request.Get the allowedMethods property: The methods (HTTP request verbs) that the origin domain may use for a CORS request.Get the allowedOrigins property: The origin domains that are permitted to make a request against the service via CORS.Get the exposedHeaders property: The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer.static CorsPolicy
fromJson
(com.azure.json.JsonReader jsonReader) Reads an instance of CorsPolicy from the JsonReader.Get the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS request.com.azure.json.JsonWriter
toJson
(com.azure.json.JsonWriter jsonWriter) void
validate()
Validates the instance.withAllowedHeaders
(String allowedHeaders) Set the allowedHeaders property: The request headers that the origin domain may specify on the CORS request.withAllowedMethods
(String allowedMethods) Set the allowedMethods property: The methods (HTTP request verbs) that the origin domain may use for a CORS request.withAllowedOrigins
(String allowedOrigins) Set the allowedOrigins property: The origin domains that are permitted to make a request against the service via CORS.withExposedHeaders
(String exposedHeaders) Set the exposedHeaders property: The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer.withMaxAgeInSeconds
(Long maxAgeInSeconds) Set the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS request.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.azure.json.JsonSerializable
toJson, toJson, toJsonBytes, toJsonString
-
Constructor Details
-
CorsPolicy
public CorsPolicy()Creates an instance of CorsPolicy class.
-
-
Method Details
-
allowedOrigins
Get the allowedOrigins property: The origin domains that are permitted to make a request against the service via CORS.- Returns:
- the allowedOrigins value.
-
withAllowedOrigins
Set the allowedOrigins property: The origin domains that are permitted to make a request against the service via CORS.- Parameters:
allowedOrigins
- the allowedOrigins value to set.- Returns:
- the CorsPolicy object itself.
-
allowedMethods
Get the allowedMethods property: The methods (HTTP request verbs) that the origin domain may use for a CORS request.- Returns:
- the allowedMethods value.
-
withAllowedMethods
Set the allowedMethods property: The methods (HTTP request verbs) that the origin domain may use for a CORS request.- Parameters:
allowedMethods
- the allowedMethods value to set.- Returns:
- the CorsPolicy object itself.
-
allowedHeaders
Get the allowedHeaders property: The request headers that the origin domain may specify on the CORS request.- Returns:
- the allowedHeaders value.
-
withAllowedHeaders
Set the allowedHeaders property: The request headers that the origin domain may specify on the CORS request.- Parameters:
allowedHeaders
- the allowedHeaders value to set.- Returns:
- the CorsPolicy object itself.
-
exposedHeaders
Get the exposedHeaders property: The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer.- Returns:
- the exposedHeaders value.
-
withExposedHeaders
Set the exposedHeaders property: The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer.- Parameters:
exposedHeaders
- the exposedHeaders value to set.- Returns:
- the CorsPolicy object itself.
-
maxAgeInSeconds
Get the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS request.- Returns:
- the maxAgeInSeconds value.
-
withMaxAgeInSeconds
Set the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS request.- Parameters:
maxAgeInSeconds
- the maxAgeInSeconds value to set.- Returns:
- the CorsPolicy object itself.
-
validate
public void validate()Validates the instance.- Throws:
IllegalArgumentException
- thrown if the instance is not valid.
-
toJson
- Specified by:
toJson
in interfacecom.azure.json.JsonSerializable<CorsPolicy>
- Throws:
IOException
-
fromJson
Reads an instance of CorsPolicy from the JsonReader.- Parameters:
jsonReader
- The JsonReader being read.- Returns:
- An instance of CorsPolicy if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
- Throws:
IllegalStateException
- If the deserialized JSON object was missing any required properties.IOException
- If an error occurs while reading the CorsPolicy.
-