java.lang.Object
com.azure.resourcemanager.appcontainers.models.CorsPolicy
All Implemented Interfaces:
com.azure.json.JsonSerializable<CorsPolicy>

public final class CorsPolicy extends Object implements com.azure.json.JsonSerializable<CorsPolicy>
Cross-Origin-Resource-Sharing policy.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of CorsPolicy class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the allowCredentials property: Specifies whether the resource allows credentials.
    Get the allowedHeaders property: Specifies the content for the access-control-allow-headers header.
    Get the allowedMethods property: Specifies the content for the access-control-allow-methods header.
    Get the allowedOrigins property: Specifies the content for the access-control-allow-origins header.
    Get the exposeHeaders property: Specifies the content for the access-control-expose-headers header.
    static CorsPolicy
    fromJson(com.azure.json.JsonReader jsonReader)
    Reads an instance of CorsPolicy from the JsonReader.
    Get the maxAge property: Specifies the content for the access-control-max-age header.
    com.azure.json.JsonWriter
    toJson(com.azure.json.JsonWriter jsonWriter)
    void
    Validates the instance.
    withAllowCredentials(Boolean allowCredentials)
    Set the allowCredentials property: Specifies whether the resource allows credentials.
    withAllowedHeaders(List<String> allowedHeaders)
    Set the allowedHeaders property: Specifies the content for the access-control-allow-headers header.
    withAllowedMethods(List<String> allowedMethods)
    Set the allowedMethods property: Specifies the content for the access-control-allow-methods header.
    withAllowedOrigins(List<String> allowedOrigins)
    Set the allowedOrigins property: Specifies the content for the access-control-allow-origins header.
    withExposeHeaders(List<String> exposeHeaders)
    Set the exposeHeaders property: Specifies the content for the access-control-expose-headers header.
    Set the maxAge property: Specifies the content for the access-control-max-age header.

    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

      public List<String> allowedOrigins()
      Get the allowedOrigins property: Specifies the content for the access-control-allow-origins header.
      Returns:
      the allowedOrigins value.
    • withAllowedOrigins

      public CorsPolicy withAllowedOrigins(List<String> allowedOrigins)
      Set the allowedOrigins property: Specifies the content for the access-control-allow-origins header.
      Parameters:
      allowedOrigins - the allowedOrigins value to set.
      Returns:
      the CorsPolicy object itself.
    • allowedMethods

      public List<String> allowedMethods()
      Get the allowedMethods property: Specifies the content for the access-control-allow-methods header.
      Returns:
      the allowedMethods value.
    • withAllowedMethods

      public CorsPolicy withAllowedMethods(List<String> allowedMethods)
      Set the allowedMethods property: Specifies the content for the access-control-allow-methods header.
      Parameters:
      allowedMethods - the allowedMethods value to set.
      Returns:
      the CorsPolicy object itself.
    • allowedHeaders

      public List<String> allowedHeaders()
      Get the allowedHeaders property: Specifies the content for the access-control-allow-headers header.
      Returns:
      the allowedHeaders value.
    • withAllowedHeaders

      public CorsPolicy withAllowedHeaders(List<String> allowedHeaders)
      Set the allowedHeaders property: Specifies the content for the access-control-allow-headers header.
      Parameters:
      allowedHeaders - the allowedHeaders value to set.
      Returns:
      the CorsPolicy object itself.
    • exposeHeaders

      public List<String> exposeHeaders()
      Get the exposeHeaders property: Specifies the content for the access-control-expose-headers header.
      Returns:
      the exposeHeaders value.
    • withExposeHeaders

      public CorsPolicy withExposeHeaders(List<String> exposeHeaders)
      Set the exposeHeaders property: Specifies the content for the access-control-expose-headers header.
      Parameters:
      exposeHeaders - the exposeHeaders value to set.
      Returns:
      the CorsPolicy object itself.
    • maxAge

      public Integer maxAge()
      Get the maxAge property: Specifies the content for the access-control-max-age header.
      Returns:
      the maxAge value.
    • withMaxAge

      public CorsPolicy withMaxAge(Integer maxAge)
      Set the maxAge property: Specifies the content for the access-control-max-age header.
      Parameters:
      maxAge - the maxAge value to set.
      Returns:
      the CorsPolicy object itself.
    • allowCredentials

      public Boolean allowCredentials()
      Get the allowCredentials property: Specifies whether the resource allows credentials.
      Returns:
      the allowCredentials value.
    • withAllowCredentials

      public CorsPolicy withAllowCredentials(Boolean allowCredentials)
      Set the allowCredentials property: Specifies whether the resource allows credentials.
      Parameters:
      allowCredentials - the allowCredentials 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

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<CorsPolicy>
      Throws:
      IOException
    • fromJson

      public static CorsPolicy fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      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.