/*
* Copyright 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.
*/
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;
namespace Amazon.S3.Model
{
/// C O R S Rule
///
public class CORSRule
{
private string id;
private List allowedMethods = new List();
private List allowedOrigins = new List();
private List exposeHeaders = new List();
private List allowedHeaders = new List();
private int? maxAgeSeconds;
///
/// Identifies HTTP methods that the domain/origin specified in the rule is allowed to execute.
///
///
public List AllowedMethods
{
get { return this.allowedMethods; }
set { this.allowedMethods = value; }
}
// Check to see if AllowedMethods property is set
internal bool IsSetAllowedMethods()
{
return this.allowedMethods.Count > 0;
}
///
/// One or more origins you want customers to be able to access the bucket from.
///
///
public List AllowedOrigins
{
get { return this.allowedOrigins; }
set { this.allowedOrigins = value; }
}
// Check to see if AllowedOrigins property is set
internal bool IsSetAllowedOrigins()
{
return this.allowedOrigins.Count > 0;
}
///
///
Unique identifier for the rule. The value cannot be longer than 255 characters.
///
///
/// The IDs help you find a rule in the configuration.
///
public string Id
{
get { return this.id; }
set { this.id = value; }
}
///
/// Checks if Id property is set.
///
/// true if Id property is set.
internal bool IsSetId()
{
return this.id != null;
}
///
/// One or more headers in the response that you want customers to be able to access from their applications (for example, from a JavaScript
/// XMLHttpRequest object).
///
///
public List ExposeHeaders
{
get { return this.exposeHeaders; }
set { this.exposeHeaders = value; }
}
// Check to see if ExposeHeaders property is set
internal bool IsSetExposeHeaders()
{
return this.exposeHeaders.Count > 0;
}
///
/// The time in seconds that your browser is to cache the preflight response for the specified resource.
///
///
public int MaxAgeSeconds
{
get { return this.maxAgeSeconds ?? default(int); }
set { this.maxAgeSeconds = value; }
}
// Check to see if MaxAgeSeconds property is set
internal bool IsSetMaxAgeSeconds()
{
return this.maxAgeSeconds.HasValue;
}
///
/// Specifies which headers are allowed in a pre-flight OPTIONS request through the
/// Access-Control-Request-Headers header.
///
///
/// Each header name specified in the Access-Control-Request-Headers must have a corresponding
/// entry in the rule. Only the headers that were requested will be sent back.
/// This element can contain at most one * wildcard character.
///
public List AllowedHeaders
{
get { return this.allowedHeaders; }
set { this.allowedHeaders = value; }
}
///
/// Checks if AllowedHeaders property is set.
///
/// true if AllowedHeaders property is set.
internal bool IsSetAllowedHeaders()
{
return (this.AllowedHeaders.Count > 0);
}
}
}