GestioneCorsAccessControl.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */
  20. package org.openspcoop2.core.config.rs.server.model;

  21. import java.util.List;
  22. import javax.validation.constraints.*;

  23. import io.swagger.v3.oas.annotations.media.Schema;
  24. import com.fasterxml.jackson.annotation.JsonProperty;
  25. import javax.validation.Valid;

  26. public class GestioneCorsAccessControl  {
  27.  
  28.   @Schema(required = true, description = "")
  29.   private Boolean allAllowOrigins = true;
  30.  
  31.   @Schema(description = "")
  32.   private List<String> allowOrigins = null;
  33.  
  34.   @Schema(description = "")
  35.   private Boolean allAllowHeaders = false;
  36.  
  37.   @Schema(description = "")
  38.   private List<String> allowHeaders = null;
  39.  
  40.   @Schema(description = "")
  41.   private Boolean allAllowMethods = false;
  42.  
  43.   @Schema(description = "")
  44.   private List<HttpMethodEnum> allowMethods = null;
  45.  
  46.   @Schema(description = "")
  47.   private Boolean allowCredentials = false;
  48.  
  49.   @Schema(description = "")
  50.   private List<String> exposeHeaders = null;
  51.  
  52.   @Schema(description = "")
  53.   private Boolean maxAge = false;
  54.  
  55.   @Schema(description = "")
  56.   private Integer maxAgeSeconds = null;
  57.  /**
  58.    * Get allAllowOrigins
  59.    * @return allAllowOrigins
  60.   **/
  61.   @JsonProperty("all_allow_origins")
  62.   @NotNull
  63.   @Valid
  64.   public Boolean isAllAllowOrigins() {
  65.     return this.allAllowOrigins;
  66.   }

  67.   public void setAllAllowOrigins(Boolean allAllowOrigins) {
  68.     this.allAllowOrigins = allAllowOrigins;
  69.   }

  70.   public GestioneCorsAccessControl allAllowOrigins(Boolean allAllowOrigins) {
  71.     this.allAllowOrigins = allAllowOrigins;
  72.     return this;
  73.   }

  74.  /**
  75.    * Get allowOrigins
  76.    * @return allowOrigins
  77.   **/
  78.   @JsonProperty("allow_origins")
  79.   @Valid
  80.   public List<String> getAllowOrigins() {
  81.     return this.allowOrigins;
  82.   }

  83.   public void setAllowOrigins(List<String> allowOrigins) {
  84.     this.allowOrigins = allowOrigins;
  85.   }

  86.   public GestioneCorsAccessControl allowOrigins(List<String> allowOrigins) {
  87.     this.allowOrigins = allowOrigins;
  88.     return this;
  89.   }

  90.   public GestioneCorsAccessControl addAllowOriginsItem(String allowOriginsItem) {
  91.     this.allowOrigins.add(allowOriginsItem);
  92.     return this;
  93.   }

  94.  /**
  95.    * Get allAllowHeaders
  96.    * @return allAllowHeaders
  97.   **/
  98.   @JsonProperty("all_allow_headers")
  99.   @Valid
  100.   public Boolean isAllAllowHeaders() {
  101.     return this.allAllowHeaders;
  102.   }

  103.   public void setAllAllowHeaders(Boolean allAllowHeaders) {
  104.     this.allAllowHeaders = allAllowHeaders;
  105.   }

  106.   public GestioneCorsAccessControl allAllowHeaders(Boolean allAllowHeaders) {
  107.     this.allAllowHeaders = allAllowHeaders;
  108.     return this;
  109.   }

  110.  /**
  111.    * Get allowHeaders
  112.    * @return allowHeaders
  113.   **/
  114.   @JsonProperty("allow_headers")
  115.   @Valid
  116.   public List<String> getAllowHeaders() {
  117.     return this.allowHeaders;
  118.   }

  119.   public void setAllowHeaders(List<String> allowHeaders) {
  120.     this.allowHeaders = allowHeaders;
  121.   }

  122.   public GestioneCorsAccessControl allowHeaders(List<String> allowHeaders) {
  123.     this.allowHeaders = allowHeaders;
  124.     return this;
  125.   }

  126.   public GestioneCorsAccessControl addAllowHeadersItem(String allowHeadersItem) {
  127.     this.allowHeaders.add(allowHeadersItem);
  128.     return this;
  129.   }

  130.  /**
  131.    * Get allAllowMethods
  132.    * @return allAllowMethods
  133.   **/
  134.   @JsonProperty("all_allow_methods")
  135.   @Valid
  136.   public Boolean isAllAllowMethods() {
  137.     return this.allAllowMethods;
  138.   }

  139.   public void setAllAllowMethods(Boolean allAllowMethods) {
  140.     this.allAllowMethods = allAllowMethods;
  141.   }

  142.   public GestioneCorsAccessControl allAllowMethods(Boolean allAllowMethods) {
  143.     this.allAllowMethods = allAllowMethods;
  144.     return this;
  145.   }

  146.  /**
  147.    * Get allowMethods
  148.    * @return allowMethods
  149.   **/
  150.   @JsonProperty("allow_methods")
  151.   @Valid
  152.   public List<HttpMethodEnum> getAllowMethods() {
  153.     return this.allowMethods;
  154.   }

  155.   public void setAllowMethods(List<HttpMethodEnum> allowMethods) {
  156.     this.allowMethods = allowMethods;
  157.   }

  158.   public GestioneCorsAccessControl allowMethods(List<HttpMethodEnum> allowMethods) {
  159.     this.allowMethods = allowMethods;
  160.     return this;
  161.   }

  162.   public GestioneCorsAccessControl addAllowMethodsItem(HttpMethodEnum allowMethodsItem) {
  163.     this.allowMethods.add(allowMethodsItem);
  164.     return this;
  165.   }

  166.  /**
  167.    * Get allowCredentials
  168.    * @return allowCredentials
  169.   **/
  170.   @JsonProperty("allow_credentials")
  171.   @Valid
  172.   public Boolean isAllowCredentials() {
  173.     return this.allowCredentials;
  174.   }

  175.   public void setAllowCredentials(Boolean allowCredentials) {
  176.     this.allowCredentials = allowCredentials;
  177.   }

  178.   public GestioneCorsAccessControl allowCredentials(Boolean allowCredentials) {
  179.     this.allowCredentials = allowCredentials;
  180.     return this;
  181.   }

  182.  /**
  183.    * Get exposeHeaders
  184.    * @return exposeHeaders
  185.   **/
  186.   @JsonProperty("expose_headers")
  187.   @Valid
  188.   public List<String> getExposeHeaders() {
  189.     return this.exposeHeaders;
  190.   }

  191.   public void setExposeHeaders(List<String> exposeHeaders) {
  192.     this.exposeHeaders = exposeHeaders;
  193.   }

  194.   public GestioneCorsAccessControl exposeHeaders(List<String> exposeHeaders) {
  195.     this.exposeHeaders = exposeHeaders;
  196.     return this;
  197.   }

  198.   public GestioneCorsAccessControl addExposeHeadersItem(String exposeHeadersItem) {
  199.     this.exposeHeaders.add(exposeHeadersItem);
  200.     return this;
  201.   }

  202.  /**
  203.    * Get maxAge
  204.    * @return maxAge
  205.   **/
  206.   @JsonProperty("max_age")
  207.   @Valid
  208.   public Boolean isMaxAge() {
  209.     return this.maxAge;
  210.   }

  211.   public void setMaxAge(Boolean maxAge) {
  212.     this.maxAge = maxAge;
  213.   }

  214.   public GestioneCorsAccessControl maxAge(Boolean maxAge) {
  215.     this.maxAge = maxAge;
  216.     return this;
  217.   }

  218.  /**
  219.    * Get maxAgeSeconds
  220.    * @return maxAgeSeconds
  221.   **/
  222.   @JsonProperty("max_age_seconds")
  223.   @Valid
  224.   public Integer getMaxAgeSeconds() {
  225.     return this.maxAgeSeconds;
  226.   }

  227.   public void setMaxAgeSeconds(Integer maxAgeSeconds) {
  228.     this.maxAgeSeconds = maxAgeSeconds;
  229.   }

  230.   public GestioneCorsAccessControl maxAgeSeconds(Integer maxAgeSeconds) {
  231.     this.maxAgeSeconds = maxAgeSeconds;
  232.     return this;
  233.   }


  234.   @Override
  235.   public String toString() {
  236.     StringBuilder sb = new StringBuilder();
  237.     sb.append("class GestioneCorsAccessControl {\n");
  238.    
  239.     sb.append("    allAllowOrigins: ").append(GestioneCorsAccessControl.toIndentedString(this.allAllowOrigins)).append("\n");
  240.     sb.append("    allowOrigins: ").append(GestioneCorsAccessControl.toIndentedString(this.allowOrigins)).append("\n");
  241.     sb.append("    allAllowHeaders: ").append(GestioneCorsAccessControl.toIndentedString(this.allAllowHeaders)).append("\n");
  242.     sb.append("    allowHeaders: ").append(GestioneCorsAccessControl.toIndentedString(this.allowHeaders)).append("\n");
  243.     sb.append("    allAllowMethods: ").append(GestioneCorsAccessControl.toIndentedString(this.allAllowMethods)).append("\n");
  244.     sb.append("    allowMethods: ").append(GestioneCorsAccessControl.toIndentedString(this.allowMethods)).append("\n");
  245.     sb.append("    allowCredentials: ").append(GestioneCorsAccessControl.toIndentedString(this.allowCredentials)).append("\n");
  246.     sb.append("    exposeHeaders: ").append(GestioneCorsAccessControl.toIndentedString(this.exposeHeaders)).append("\n");
  247.     sb.append("    maxAge: ").append(GestioneCorsAccessControl.toIndentedString(this.maxAge)).append("\n");
  248.     sb.append("    maxAgeSeconds: ").append(GestioneCorsAccessControl.toIndentedString(this.maxAgeSeconds)).append("\n");
  249.     sb.append("}");
  250.     return sb.toString();
  251.   }

  252.   /**
  253.    * Convert the given object to string with each line indented by 4 spaces
  254.    * (except the first line).
  255.    */
  256.   private static String toIndentedString(java.lang.Object o) {
  257.     if (o == null) {
  258.       return "null";
  259.     }
  260.     return o.toString().replace("\n", "\n    ");
  261.   }
  262. }