OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2011 Mitch Garnaat http://garnaat.org/ |
| 2 # Copyright (c) 2011, Eucalyptus Systems, Inc. |
| 3 # |
| 4 # Permission is hereby granted, free of charge, to any person obtaining a |
| 5 # copy of this software and associated documentation files (the |
| 6 # "Software"), to deal in the Software without restriction, including |
| 7 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 8 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 9 # persons to whom the Software is furnished to do so, subject to the fol- |
| 10 # lowing conditions: |
| 11 # |
| 12 # The above copyright notice and this permission notice shall be included |
| 13 # in all copies or substantial portions of the Software. |
| 14 # |
| 15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 16 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- |
| 17 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT |
| 18 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 19 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
| 21 # IN THE SOFTWARE. |
| 22 |
| 23 class Credentials(object): |
| 24 """ |
| 25 :ivar access_key: The AccessKeyID. |
| 26 :ivar secret_key: The SecretAccessKey. |
| 27 :ivar session_token: The session token that must be passed with |
| 28 requests to use the temporary credentials |
| 29 :ivar expiration: The timestamp for when the credentials will expire |
| 30 """ |
| 31 |
| 32 def __init__(self, parent=None): |
| 33 self.parent = parent |
| 34 self.access_key = None |
| 35 self.secret_key = None |
| 36 self.session_token = None |
| 37 self.expiration = None |
| 38 |
| 39 def startElement(self, name, attrs, connection): |
| 40 return None |
| 41 |
| 42 def endElement(self, name, value, connection): |
| 43 if name == 'AccessKeyId': |
| 44 self.access_key = value |
| 45 elif name == 'SecretAccessKey': |
| 46 self.secret_key = value |
| 47 elif name == 'SessionToken': |
| 48 self.session_token = value |
| 49 elif name == 'Expiration': |
| 50 self.expiration = value |
| 51 elif name == 'RequestId': |
| 52 self.request_id = value |
| 53 else: |
| 54 pass |
| 55 |
| 56 class FederationToken(object): |
| 57 """ |
| 58 :ivar credentials: A Credentials object containing the credentials. |
| 59 :ivar federated_user_arn: ARN specifying federated user using credentials. |
| 60 :ivar federated_user_id: The ID of the federated user using credentials. |
| 61 :ivar packed_policy_size: A percentage value indicating the size of |
| 62 the policy in packed form |
| 63 """ |
| 64 |
| 65 def __init__(self, parent=None): |
| 66 self.parent = parent |
| 67 self.credentials = None |
| 68 self.federated_user_arn = None |
| 69 self.federated_user_id = None |
| 70 self.packed_policy_size = None |
| 71 |
| 72 def startElement(self, name, attrs, connection): |
| 73 if name == 'Credentials': |
| 74 self.credentials = Credentials() |
| 75 return self.credentials |
| 76 else: |
| 77 return None |
| 78 |
| 79 def endElement(self, name, value, connection): |
| 80 if name == 'Arn': |
| 81 self.federated_user_arn = value |
| 82 elif name == 'FederatedUserId': |
| 83 self.federated_user_id = value |
| 84 elif name == 'PackedPolicySize': |
| 85 self.packed_policy_size = int(value) |
| 86 elif name == 'RequestId': |
| 87 self.request_id = value |
| 88 else: |
| 89 pass |
| 90 |
OLD | NEW |