comparison env/lib/python3.9/site-packages/boto/rds/dbsnapshot.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 # Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/
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 class DBSnapshot(object):
23 """
24 Represents a RDS DB Snapshot
25
26 Properties reference available from the AWS documentation at http://docs.amazonwebservices.com/AmazonRDS/latest/APIReference/API_DBSnapshot.html
27
28 :ivar engine_version: Specifies the version of the database engine
29 :ivar license_model: License model information for the restored DB instance
30 :ivar allocated_storage: Specifies the allocated storage size in gigabytes (GB)
31 :ivar availability_zone: Specifies the name of the Availability Zone the DB Instance was located in at the time of the DB Snapshot
32 :ivar connection: boto.rds.RDSConnection associated with the current object
33 :ivar engine: Specifies the name of the database engine
34 :ivar id: Specifies the identifier for the DB Snapshot (DBSnapshotIdentifier)
35 :ivar instance_create_time: Specifies the time (UTC) when the snapshot was taken
36 :ivar instance_id: Specifies the the DBInstanceIdentifier of the DB Instance this DB Snapshot was created from (DBInstanceIdentifier)
37 :ivar master_username: Provides the master username for the DB Instance
38 :ivar port: Specifies the port that the database engine was listening on at the time of the snapshot
39 :ivar snapshot_create_time: Provides the time (UTC) when the snapshot was taken
40 :ivar status: Specifies the status of this DB Snapshot. Possible values are [ available, backing-up, creating, deleted, deleting, failed, modifying, rebooting, resetting-master-credentials ]
41 :ivar iops: Specifies the Provisioned IOPS (I/O operations per second) value of the DB instance at the time of the snapshot.
42 :ivar option_group_name: Provides the option group name for the DB snapshot.
43 :ivar percent_progress: The percentage of the estimated data that has been transferred.
44 :ivar snapshot_type: Provides the type of the DB snapshot.
45 :ivar source_region: The region that the DB snapshot was created in or copied from.
46 :ivar vpc_id: Provides the Vpc Id associated with the DB snapshot.
47 """
48
49 def __init__(self, connection=None, id=None):
50 self.connection = connection
51 self.id = id
52 self.engine = None
53 self.engine_version = None
54 self.snapshot_create_time = None
55 self.instance_create_time = None
56 self.port = None
57 self.status = None
58 self.availability_zone = None
59 self.master_username = None
60 self.allocated_storage = None
61 self.instance_id = None
62 self.availability_zone = None
63 self.license_model = None
64 self.iops = None
65 self.option_group_name = None
66 self.percent_progress = None
67 self.snapshot_type = None
68 self.source_region = None
69 self.vpc_id = None
70
71 def __repr__(self):
72 return 'DBSnapshot:%s' % self.id
73
74 def startElement(self, name, attrs, connection):
75 pass
76
77 def endElement(self, name, value, connection):
78 if name == 'Engine':
79 self.engine = value
80 elif name == 'EngineVersion':
81 self.engine_version = value
82 elif name == 'InstanceCreateTime':
83 self.instance_create_time = value
84 elif name == 'SnapshotCreateTime':
85 self.snapshot_create_time = value
86 elif name == 'DBInstanceIdentifier':
87 self.instance_id = value
88 elif name == 'DBSnapshotIdentifier':
89 self.id = value
90 elif name == 'Port':
91 self.port = int(value)
92 elif name == 'Status':
93 self.status = value
94 elif name == 'AvailabilityZone':
95 self.availability_zone = value
96 elif name == 'MasterUsername':
97 self.master_username = value
98 elif name == 'AllocatedStorage':
99 self.allocated_storage = int(value)
100 elif name == 'SnapshotTime':
101 self.time = value
102 elif name == 'LicenseModel':
103 self.license_model = value
104 elif name == 'Iops':
105 self.iops = int(value)
106 elif name == 'OptionGroupName':
107 self.option_group_name = value
108 elif name == 'PercentProgress':
109 self.percent_progress = int(value)
110 elif name == 'SnapshotType':
111 self.snapshot_type = value
112 elif name == 'SourceRegion':
113 self.source_region = value
114 elif name == 'VpcId':
115 self.vpc_id = value
116 else:
117 setattr(self, name, value)
118
119 def update(self, validate=False):
120 """
121 Update the DB snapshot's status information by making a call to fetch
122 the current snapshot attributes from the service.
123
124 :type validate: bool
125 :param validate: By default, if EC2 returns no data about the
126 instance the update method returns quietly. If
127 the validate param is True, however, it will
128 raise a ValueError exception if no data is
129 returned from EC2.
130 """
131 rs = self.connection.get_all_dbsnapshots(self.id)
132 if len(rs) > 0:
133 for i in rs:
134 if i.id == self.id:
135 self.__dict__.update(i.__dict__)
136 elif validate:
137 raise ValueError('%s is not a valid Snapshot ID' % self.id)
138 return self.status