Class CorsPolicy


  • public final class CorsPolicy
    extends Object
    The CORS policy for the Cosmos DB database account.
    • Constructor Summary

      Constructors 
      Constructor Description
      CorsPolicy()  
    • Constructor Detail

      • CorsPolicy

        public CorsPolicy()
    • Method Detail

      • allowedOrigins

        public String 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

        public CorsPolicy withAllowedOrigins​(String allowedOrigins)
        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

        public String 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

        public CorsPolicy withAllowedMethods​(String allowedMethods)
        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

        public String allowedHeaders()
        Get the allowedHeaders property: The request headers that the origin domain may specify on the CORS request.
        Returns:
        the allowedHeaders value.
      • withAllowedHeaders

        public CorsPolicy withAllowedHeaders​(String allowedHeaders)
        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

        public String 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

        public CorsPolicy 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.
        Parameters:
        exposedHeaders - the exposedHeaders value to set.
        Returns:
        the CorsPolicy object itself.
      • maxAgeInSeconds

        public Long maxAgeInSeconds()
        Get the maxAgeInSeconds property: The maximum amount time that a browser should cache the preflight OPTIONS request.
        Returns:
        the maxAgeInSeconds value.
      • withMaxAgeInSeconds

        public CorsPolicy withMaxAgeInSeconds​(Long maxAgeInSeconds)
        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.