'Add a rule to this CORS configuration.  This only adds
the rule to the local copy.  To install the new rule(s) on
the bucket, you need to pass this CORS config object
to the set_cors method of the Bucket object.
:type allowed_methods: list of str
:param allowed_methods: An HTTP method that you want to allow the
origin to execute.  Each CORSRule must identify at least one
origin and one method. Valid values are:
GET|PUT|HEAD|POST|DELETE
:type allowed_origin: list of str
:param allowed_origin: An origin that you want to allow cross-domain
requests from. This can contain at most one * wild character.
Each CORSRule must identify at least one origin and one method.
The origin value can include at most one \'*\' wild character.
For example, "http://*.example.com". You can also specify
only * as the origin value allowing all origins
cross-domain access.
:type id: str
:param id: A unique identifier for the rule.  The ID value can be
up to 255 characters long.  The IDs help you find a rule in
the configuration.
:type allowed_header: list of str
:param allowed_header: Specifies which headers are allowed in a
pre-flight OPTIONS request via the
Access-Control-Request-Headers header. Each header name
specified in the Access-Control-Request-Headers header must
have a corresponding entry in the rule. Amazon S3 will send
only the allowed headers in a response that were requested.
This can contain at most one * wild character.
:type max_age_seconds: int
:param max_age_seconds: The time in seconds that your browser is to
cache the preflight response for the specified resource.
:type expose_header: list of str
:param expose_header: 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).  You
add one ExposeHeader element in the rule for each header.'

def add_rule(self, allowed_method, allowed_origin, id=None, allowed_header=None, max_age_seconds=None, expose_header=None):

    if (not isinstance(allowed_method, (list, tuple))):
        allowed_method = [allowed_method]
    if (not isinstance(allowed_origin, (list, tuple))):
        allowed_origin = [allowed_origin]
    if (not isinstance(allowed_origin, (list, tuple))):
        if (allowed_origin is None):
            allowed_origin = []
        else:
            allowed_origin = [allowed_origin]
    if (not isinstance(expose_header, (list, tuple))):
        if (expose_header is None):
            expose_header = []
        else:
            expose_header = [expose_header]
    rule = CORSRule(allowed_method, allowed_origin, id, allowed_header, max_age_seconds, expose_header)
    self.append(rule)
