All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.apigatewayv2.model.Cors Maven / Gradle / Ivy

/*
 * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */
package com.amazonaws.services.apigatewayv2.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 * 

* Represents a CORS configuration. Supported only for HTTP APIs. See Configuring CORS for more * information. *

*/ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Cors implements Serializable, Cloneable, StructuredPojo { /** *

* Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs. *

*/ private Boolean allowCredentials; /** *

* Represents a collection of allowed headers. Supported only for HTTP APIs. *

*/ private java.util.List allowHeaders; /** *

* Represents a collection of allowed HTTP methods. Supported only for HTTP APIs. *

*/ private java.util.List allowMethods; /** *

* Represents a collection of allowed origins. Supported only for HTTP APIs. *

*/ private java.util.List allowOrigins; /** *

* Represents a collection of exposed headers. Supported only for HTTP APIs. *

*/ private java.util.List exposeHeaders; /** *

* The number of seconds that the browser should cache preflight request results. Supported only for HTTP APIs. *

*/ private Integer maxAge; /** *

* Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs. *

* * @param allowCredentials * Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs. */ public void setAllowCredentials(Boolean allowCredentials) { this.allowCredentials = allowCredentials; } /** *

* Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs. *

* * @return Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs. */ public Boolean getAllowCredentials() { return this.allowCredentials; } /** *

* Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs. *

* * @param allowCredentials * Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs. * @return Returns a reference to this object so that method calls can be chained together. */ public Cors withAllowCredentials(Boolean allowCredentials) { setAllowCredentials(allowCredentials); return this; } /** *

* Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs. *

* * @return Specifies whether credentials are included in the CORS request. Supported only for HTTP APIs. */ public Boolean isAllowCredentials() { return this.allowCredentials; } /** *

* Represents a collection of allowed headers. Supported only for HTTP APIs. *

* * @return Represents a collection of allowed headers. Supported only for HTTP APIs. */ public java.util.List getAllowHeaders() { return allowHeaders; } /** *

* Represents a collection of allowed headers. Supported only for HTTP APIs. *

* * @param allowHeaders * Represents a collection of allowed headers. Supported only for HTTP APIs. */ public void setAllowHeaders(java.util.Collection allowHeaders) { if (allowHeaders == null) { this.allowHeaders = null; return; } this.allowHeaders = new java.util.ArrayList(allowHeaders); } /** *

* Represents a collection of allowed headers. Supported only for HTTP APIs. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setAllowHeaders(java.util.Collection)} or {@link #withAllowHeaders(java.util.Collection)} if you want to * override the existing values. *

* * @param allowHeaders * Represents a collection of allowed headers. Supported only for HTTP APIs. * @return Returns a reference to this object so that method calls can be chained together. */ public Cors withAllowHeaders(String... allowHeaders) { if (this.allowHeaders == null) { setAllowHeaders(new java.util.ArrayList(allowHeaders.length)); } for (String ele : allowHeaders) { this.allowHeaders.add(ele); } return this; } /** *

* Represents a collection of allowed headers. Supported only for HTTP APIs. *

* * @param allowHeaders * Represents a collection of allowed headers. Supported only for HTTP APIs. * @return Returns a reference to this object so that method calls can be chained together. */ public Cors withAllowHeaders(java.util.Collection allowHeaders) { setAllowHeaders(allowHeaders); return this; } /** *

* Represents a collection of allowed HTTP methods. Supported only for HTTP APIs. *

* * @return Represents a collection of allowed HTTP methods. Supported only for HTTP APIs. */ public java.util.List getAllowMethods() { return allowMethods; } /** *

* Represents a collection of allowed HTTP methods. Supported only for HTTP APIs. *

* * @param allowMethods * Represents a collection of allowed HTTP methods. Supported only for HTTP APIs. */ public void setAllowMethods(java.util.Collection allowMethods) { if (allowMethods == null) { this.allowMethods = null; return; } this.allowMethods = new java.util.ArrayList(allowMethods); } /** *

* Represents a collection of allowed HTTP methods. Supported only for HTTP APIs. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setAllowMethods(java.util.Collection)} or {@link #withAllowMethods(java.util.Collection)} if you want to * override the existing values. *

* * @param allowMethods * Represents a collection of allowed HTTP methods. Supported only for HTTP APIs. * @return Returns a reference to this object so that method calls can be chained together. */ public Cors withAllowMethods(String... allowMethods) { if (this.allowMethods == null) { setAllowMethods(new java.util.ArrayList(allowMethods.length)); } for (String ele : allowMethods) { this.allowMethods.add(ele); } return this; } /** *

* Represents a collection of allowed HTTP methods. Supported only for HTTP APIs. *

* * @param allowMethods * Represents a collection of allowed HTTP methods. Supported only for HTTP APIs. * @return Returns a reference to this object so that method calls can be chained together. */ public Cors withAllowMethods(java.util.Collection allowMethods) { setAllowMethods(allowMethods); return this; } /** *

* Represents a collection of allowed origins. Supported only for HTTP APIs. *

* * @return Represents a collection of allowed origins. Supported only for HTTP APIs. */ public java.util.List getAllowOrigins() { return allowOrigins; } /** *

* Represents a collection of allowed origins. Supported only for HTTP APIs. *

* * @param allowOrigins * Represents a collection of allowed origins. Supported only for HTTP APIs. */ public void setAllowOrigins(java.util.Collection allowOrigins) { if (allowOrigins == null) { this.allowOrigins = null; return; } this.allowOrigins = new java.util.ArrayList(allowOrigins); } /** *

* Represents a collection of allowed origins. Supported only for HTTP APIs. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setAllowOrigins(java.util.Collection)} or {@link #withAllowOrigins(java.util.Collection)} if you want to * override the existing values. *

* * @param allowOrigins * Represents a collection of allowed origins. Supported only for HTTP APIs. * @return Returns a reference to this object so that method calls can be chained together. */ public Cors withAllowOrigins(String... allowOrigins) { if (this.allowOrigins == null) { setAllowOrigins(new java.util.ArrayList(allowOrigins.length)); } for (String ele : allowOrigins) { this.allowOrigins.add(ele); } return this; } /** *

* Represents a collection of allowed origins. Supported only for HTTP APIs. *

* * @param allowOrigins * Represents a collection of allowed origins. Supported only for HTTP APIs. * @return Returns a reference to this object so that method calls can be chained together. */ public Cors withAllowOrigins(java.util.Collection allowOrigins) { setAllowOrigins(allowOrigins); return this; } /** *

* Represents a collection of exposed headers. Supported only for HTTP APIs. *

* * @return Represents a collection of exposed headers. Supported only for HTTP APIs. */ public java.util.List getExposeHeaders() { return exposeHeaders; } /** *

* Represents a collection of exposed headers. Supported only for HTTP APIs. *

* * @param exposeHeaders * Represents a collection of exposed headers. Supported only for HTTP APIs. */ public void setExposeHeaders(java.util.Collection exposeHeaders) { if (exposeHeaders == null) { this.exposeHeaders = null; return; } this.exposeHeaders = new java.util.ArrayList(exposeHeaders); } /** *

* Represents a collection of exposed headers. Supported only for HTTP APIs. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setExposeHeaders(java.util.Collection)} or {@link #withExposeHeaders(java.util.Collection)} if you want * to override the existing values. *

* * @param exposeHeaders * Represents a collection of exposed headers. Supported only for HTTP APIs. * @return Returns a reference to this object so that method calls can be chained together. */ public Cors withExposeHeaders(String... exposeHeaders) { if (this.exposeHeaders == null) { setExposeHeaders(new java.util.ArrayList(exposeHeaders.length)); } for (String ele : exposeHeaders) { this.exposeHeaders.add(ele); } return this; } /** *

* Represents a collection of exposed headers. Supported only for HTTP APIs. *

* * @param exposeHeaders * Represents a collection of exposed headers. Supported only for HTTP APIs. * @return Returns a reference to this object so that method calls can be chained together. */ public Cors withExposeHeaders(java.util.Collection exposeHeaders) { setExposeHeaders(exposeHeaders); return this; } /** *

* The number of seconds that the browser should cache preflight request results. Supported only for HTTP APIs. *

* * @param maxAge * The number of seconds that the browser should cache preflight request results. Supported only for HTTP * APIs. */ public void setMaxAge(Integer maxAge) { this.maxAge = maxAge; } /** *

* The number of seconds that the browser should cache preflight request results. Supported only for HTTP APIs. *

* * @return The number of seconds that the browser should cache preflight request results. Supported only for HTTP * APIs. */ public Integer getMaxAge() { return this.maxAge; } /** *

* The number of seconds that the browser should cache preflight request results. Supported only for HTTP APIs. *

* * @param maxAge * The number of seconds that the browser should cache preflight request results. Supported only for HTTP * APIs. * @return Returns a reference to this object so that method calls can be chained together. */ public Cors withMaxAge(Integer maxAge) { setMaxAge(maxAge); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAllowCredentials() != null) sb.append("AllowCredentials: ").append(getAllowCredentials()).append(","); if (getAllowHeaders() != null) sb.append("AllowHeaders: ").append(getAllowHeaders()).append(","); if (getAllowMethods() != null) sb.append("AllowMethods: ").append(getAllowMethods()).append(","); if (getAllowOrigins() != null) sb.append("AllowOrigins: ").append(getAllowOrigins()).append(","); if (getExposeHeaders() != null) sb.append("ExposeHeaders: ").append(getExposeHeaders()).append(","); if (getMaxAge() != null) sb.append("MaxAge: ").append(getMaxAge()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Cors == false) return false; Cors other = (Cors) obj; if (other.getAllowCredentials() == null ^ this.getAllowCredentials() == null) return false; if (other.getAllowCredentials() != null && other.getAllowCredentials().equals(this.getAllowCredentials()) == false) return false; if (other.getAllowHeaders() == null ^ this.getAllowHeaders() == null) return false; if (other.getAllowHeaders() != null && other.getAllowHeaders().equals(this.getAllowHeaders()) == false) return false; if (other.getAllowMethods() == null ^ this.getAllowMethods() == null) return false; if (other.getAllowMethods() != null && other.getAllowMethods().equals(this.getAllowMethods()) == false) return false; if (other.getAllowOrigins() == null ^ this.getAllowOrigins() == null) return false; if (other.getAllowOrigins() != null && other.getAllowOrigins().equals(this.getAllowOrigins()) == false) return false; if (other.getExposeHeaders() == null ^ this.getExposeHeaders() == null) return false; if (other.getExposeHeaders() != null && other.getExposeHeaders().equals(this.getExposeHeaders()) == false) return false; if (other.getMaxAge() == null ^ this.getMaxAge() == null) return false; if (other.getMaxAge() != null && other.getMaxAge().equals(this.getMaxAge()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAllowCredentials() == null) ? 0 : getAllowCredentials().hashCode()); hashCode = prime * hashCode + ((getAllowHeaders() == null) ? 0 : getAllowHeaders().hashCode()); hashCode = prime * hashCode + ((getAllowMethods() == null) ? 0 : getAllowMethods().hashCode()); hashCode = prime * hashCode + ((getAllowOrigins() == null) ? 0 : getAllowOrigins().hashCode()); hashCode = prime * hashCode + ((getExposeHeaders() == null) ? 0 : getExposeHeaders().hashCode()); hashCode = prime * hashCode + ((getMaxAge() == null) ? 0 : getMaxAge().hashCode()); return hashCode; } @Override public Cors clone() { try { return (Cors) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.apigatewayv2.model.transform.CorsMarshaller.getInstance().marshall(this, protocolMarshaller); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy