~ubuntu-branches/ubuntu/trusty/python-boto/trusty

« back to all changes in this revision

Viewing changes to boto/ec2/elb/policies.py

  • Committer: Package Import Robot
  • Author(s): Eric Evans
  • Date: 2011-11-13 11:58:40 UTC
  • mfrom: (14.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20111113115840-ckzyt3h17uh8s41y
Tags: 2.0-2
Promote new upstream to unstable (Closes: #638931).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (c) 2010 Reza Lotun http://reza.lotun.name
 
2
#
 
3
# Permission is hereby granted, free of charge, to any person obtaining a
 
4
# copy of this software and associated documentation files (the
 
5
# "Software"), to deal in the Software without restriction, including
 
6
# without limitation the rights to use, copy, modify, merge, publish, dis-
 
7
# tribute, sublicense, and/or sell copies of the Software, and to permit
 
8
# persons to whom the Software is furnished to do so, subject to the fol-
 
9
# lowing conditions:
 
10
#
 
11
# The above copyright notice and this permission notice shall be included
 
12
# in all copies or substantial portions of the Software.
 
13
#
 
14
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 
15
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
 
16
# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
 
17
# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 
18
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 
19
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 
20
# IN THE SOFTWARE.
 
21
 
 
22
from boto.resultset import ResultSet
 
23
 
 
24
 
 
25
class AppCookieStickinessPolicy(object):
 
26
    def __init__(self, connection=None):
 
27
        self.cookie_name = None
 
28
        self.policy_name = None
 
29
 
 
30
    def __repr__(self):
 
31
        return 'AppCookieStickiness(%s, %s)' % (self.policy_name,
 
32
                                                self.cookie_name)
 
33
 
 
34
    def startElement(self, name, attrs, connection):
 
35
        pass
 
36
 
 
37
    def endElement(self, name, value, connection):
 
38
        if name == 'CookieName':
 
39
            self.cookie_name = value
 
40
        elif name == 'PolicyName':
 
41
            self.policy_name = value
 
42
 
 
43
 
 
44
class LBCookieStickinessPolicy(object):
 
45
    def __init__(self, connection=None):
 
46
        self.policy_name = None
 
47
        self.cookie_expiration_period = None
 
48
 
 
49
    def __repr__(self):
 
50
        return 'LBCookieStickiness(%s, %s)' % (self.policy_name,
 
51
                                               self.cookie_expiration_period)
 
52
 
 
53
    def startElement(self, name, attrs, connection):
 
54
        pass
 
55
 
 
56
    def endElement(self, name, value, connection):
 
57
        if name == 'CookieExpirationPeriod':
 
58
            self.cookie_expiration_period = value
 
59
        elif name == 'PolicyName':
 
60
            self.policy_name = value
 
61
 
 
62
 
 
63
class Policies(object):
 
64
    """
 
65
    ELB Policies
 
66
    """
 
67
    def __init__(self, connection=None):
 
68
        self.connection = connection
 
69
        self.app_cookie_stickiness_policies = None
 
70
        self.lb_cookie_stickiness_policies = None
 
71
 
 
72
    def __repr__(self):
 
73
        app = 'AppCookieStickiness%s' % self.app_cookie_stickiness_policies
 
74
        lb = 'LBCookieStickiness%s' % self.lb_cookie_stickiness_policies
 
75
        return 'Policies(%s,%s)' % (app, lb)
 
76
 
 
77
    def startElement(self, name, attrs, connection):
 
78
        if name == 'AppCookieStickinessPolicies':
 
79
            rs = ResultSet([('member', AppCookieStickinessPolicy)])
 
80
            self.app_cookie_stickiness_policies = rs
 
81
        elif name == 'LBCookieStickinessPolicies':
 
82
            rs = ResultSet([('member', LBCookieStickinessPolicy)])
 
83
            self.lb_cookie_stickiness_policies = rs
 
84
 
 
85
    def endElement(self, name, value, connection):
 
86
        return
 
87