We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
RDS ValueError on LicenseModel
I'm hitting a similar problem to #316, Postgres instances only use the string `'postgresql-license'` for the LicenseModel parameter and I'm getting a ValueError:

```
ValueError: DBInstance LicenseModel must be one of: license-included, bring-your-own-license, general-public-license
```

I could not find the `postgresql-license` in any API documentation, but it is in the [user-guide](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CreatePostgreSQLInstance.html)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `troposphere/rds.py`
Content:
```
1 # Copyright (c) 2013, Mark Peek <mark@peek.org>
2 # All rights reserved.
3 #
4 # See LICENSE file for full license.
5 
6 import re
7 
8 from . import AWSHelperFn, AWSObject, AWSProperty, Ref
9 from .validators import boolean, network_port, integer, positive_integer
10 
11 # Taken from:
12 # http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html
13 
14 VALID_STORAGE_TYPES = ('standard', 'gp2', 'io1')
15 VALID_DB_ENGINES = ('MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee',
16                     'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex',
17                     'sqlserver-web', 'postgres')
18 VALID_LICENSE_MODELS = ('license-included', 'bring-your-own-license',
19                         'general-public-license')
20 
21 
22 def validate_iops(iops):
23     """DBInstance Iops validation rules."""
24 
25     iops = integer(iops)
26     if int(iops) < 1000:
27         raise ValueError("DBInstance Iops, if set, must be greater than 1000.")
28     if int(iops) > 10000:
29         raise ValueError("DBInstance Iops, if set, must be less than 10000.")
30     return iops
31 
32 
33 def validate_storage_type(storage_type):
34     """Validate StorageType for DBInstance"""
35 
36     if storage_type not in VALID_STORAGE_TYPES:
37         raise ValueError("DBInstance StorageType must be one of: %s" %
38                          ", ".join(VALID_STORAGE_TYPES))
39     return storage_type
40 
41 
42 def validate_engine(engine):
43     """Validate database Engine for DBInstance """
44 
45     if engine not in VALID_DB_ENGINES:
46         raise ValueError("DBInstance Engine must be one of: %s" %
47                          ", ".join(VALID_DB_ENGINES))
48     return engine
49 
50 
51 def validate_license_model(license_model):
52     """Validate LicenseModel for DBInstance"""
53 
54     if license_model not in VALID_LICENSE_MODELS:
55         raise ValueError("DBInstance LicenseModel must be one of: %s" %
56                          ", ".join(VALID_LICENSE_MODELS))
57     return license_model
58 
59 
60 def validate_backup_window(window):
61     """Validate PreferredBackupWindow for DBInstance"""
62 
63     hour = r'[01]?[0-9]|2[0-3]'
64     minute = r'[0-5][0-9]'
65     r = ("(?P<start_hour>%s):(?P<start_minute>%s)-"
66          "(?P<end_hour>%s):(?P<end_minute>%s)") % (hour, minute, hour, minute)
67     range_regex = re.compile(r)
68     m = range_regex.match(window)
69     if not m:
70         raise ValueError("DBInstance PreferredBackupWindow must be in the "
71                          "format: hh24:mi-hh24:mi")
72     start_ts = (int(m.group('start_hour')) * 60) + int(m.group('start_minute'))
73     end_ts = (int(m.group('end_hour')) * 60) + int(m.group('end_minute'))
74     if abs(end_ts - start_ts) < 30:
75         raise ValueError("DBInstance PreferredBackupWindow must be at least "
76                          "30 minutes long.")
77     return window
78 
79 
80 def validate_maintenance_window(window):
81     """Validate PreferredMaintenanceWindow for DBInstance"""
82 
83     days = ("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
84     day_re = r'[A-Z]{1}[a-z]{2}'
85     hour = r'[01]?[0-9]|2[0-3]'
86     minute = r'[0-5][0-9]'
87     r = ("(?P<start_day>%s):(?P<start_hour>%s):(?P<start_minute>%s)-"
88          "(?P<end_day>%s):(?P<end_hour>%s):(?P<end_minute>%s)") % (day_re,
89                                                                    hour,
90                                                                    minute,
91                                                                    day_re,
92                                                                    hour,
93                                                                    minute)
94     range_regex = re.compile(r)
95     m = range_regex.match(window)
96     if not m:
97         raise ValueError("DBInstance PreferredMaintenanceWindow must be in "
98                          "the format: ddd:hh24:mi-ddd:hh24:mi")
99     if m.group('start_day') not in days or m.group('end_day') not in days:
100         raise ValueError("DBInstance PreferredMaintenanceWindow day part of "
101                          "ranges must be one of: %s" % ", ".join(days))
102     start_ts = (days.index(m.group('start_day')) * 24 * 60) + \
103         (int(m.group('start_hour')) * 60) + int(m.group('start_minute'))
104     end_ts = (days.index(m.group('end_day')) * 24 * 60) + \
105         (int(m.group('end_hour')) * 60) + int(m.group('end_minute'))
106     if abs(end_ts - start_ts) < 30:
107         raise ValueError("DBInstance PreferredMaintenanceWindow must be at "
108                          "least 30 minutes long.")
109     return window
110 
111 
112 def validate_backup_retention_period(days):
113     """Validate BackupRetentionPeriod for DBInstance"""
114 
115     days = positive_integer(days)
116     if int(days) > 35:
117         raise ValueError("DBInstance BackupRetentionPeriod cannot be larger "
118                          "than 35 days.")
119     return days
120 
121 
122 class DBInstance(AWSObject):
123     resource_type = "AWS::RDS::DBInstance"
124 
125     props = {
126         'AllocatedStorage': (positive_integer, True),
127         'AllowMajorVersionUpgrade': (boolean, False),
128         'AutoMinorVersionUpgrade': (boolean, False),
129         'AvailabilityZone': (basestring, False),
130         'BackupRetentionPeriod': (validate_backup_retention_period, False),
131         'CharacterSetName': (basestring, False),
132         'DBInstanceClass': (basestring, True),
133         'DBInstanceIdentifier': (basestring, False),
134         'DBName': (basestring, False),
135         'DBParameterGroupName': (basestring, False),
136         'DBSecurityGroups': (list, False),
137         'DBSnapshotIdentifier': (basestring, False),
138         'DBSubnetGroupName': (basestring, False),
139         'Engine': (validate_engine, True),
140         'EngineVersion': (basestring, False),
141         'Iops': (validate_iops, False),
142         'KmsKeyId': (basestring, False),
143         'LicenseModel': (validate_license_model, False),
144         'MasterUsername': (basestring, False),
145         'MasterUserPassword': (basestring, False),
146         'MultiAZ': (boolean, False),
147         'OptionGroupName': (basestring, False),
148         'Port': (network_port, False),
149         'PreferredBackupWindow': (validate_backup_window, False),
150         'PreferredMaintenanceWindow': (basestring, False),
151         'PubliclyAccessible': (boolean, False),
152         'SourceDBInstanceIdentifier': (basestring, False),
153         'StorageEncrypted': (boolean, False),
154         'StorageType': (basestring, False),
155         'Tags': (list, False),
156         'VPCSecurityGroups': ([basestring, AWSHelperFn], False),
157     }
158 
159     def validate(self):
160         if 'SourceDBInstanceIdentifier' in self.properties:
161 
162             invalid_replica_properties = (
163                 'BackupRetentionPeriod', 'DBName', 'MasterUsername',
164                 'MasterUserPassword', 'PreferredBackupWindow', 'MultiAZ',
165                 'DBSnapshotIdentifier', 'DBSubnetGroupName',
166             )
167 
168             invalid_properties = [s for s in self.properties.keys() if
169                                   s in invalid_replica_properties]
170 
171             if invalid_properties:
172                 raise ValueError(
173                     ('{0} properties can\'t be provided when '
174                      'SourceDBInstanceIdentifier is present '
175                      'AWS::RDS::DBInstance.'
176                      ).format(', '.join(sorted(invalid_properties))))
177 
178         if ('DBSnapshotIdentifier' not in self.properties and
179             'SourceDBInstanceIdentifier' not in self.properties) and \
180             ('MasterUsername' not in self.properties or
181              'MasterUserPassword' not in self.properties):
182             raise ValueError(
183                 'Either (MasterUsername and MasterUserPassword) or'
184                 ' DBSnapshotIdentifier are required in type '
185                 'AWS::RDS::DBInstance.'
186             )
187 
188         if 'KmsKeyId' in self.properties and \
189            'StorageEncrypted' not in self.properties:
190             raise ValueError(
191                 'If KmsKeyId is provided, StorageEncrypted is required '
192                 'AWS::RDS::DBInstance.'
193             )
194 
195         nonetype = type(None)
196         avail_zone = self.properties.get('AvailabilityZone', None)
197         multi_az = self.properties.get('MultiAZ', None)
198         if not (isinstance(avail_zone, (AWSHelperFn, nonetype)) and
199                 isinstance(multi_az, (AWSHelperFn, nonetype))):
200             if 'AvailabilityZone' in self.properties and \
201                     self.properties.get('MultiAZ', None):
202                 raise ValueError("AvailabiltyZone cannot be set on "
203                                  "DBInstance if MultiAZ is set to true.")
204 
205         storage_type = self.properties.get('StorageType', None)
206         if storage_type and storage_type == 'io1' and \
207                 'Iops' not in self.properties:
208             raise ValueError("Must specify Iops if using StorageType io1")
209 
210         allocated_storage = self.properties.get('AllocatedStorage')
211         iops = self.properties.get('Iops', None)
212         if iops:
213             if not isinstance(allocated_storage, AWSHelperFn) and \
214                     allocated_storage < 100:
215                 raise ValueError("AllocatedStorage must be at least 100 when "
216                                  "Iops is set.")
217             if not isinstance(allocated_storage, AWSHelperFn) and not \
218                     isinstance(iops, AWSHelperFn) and \
219                     float(iops) / float(allocated_storage) > 10.0:
220                 raise ValueError("AllocatedStorage must be no less than "
221                                  "1/10th the provisioned Iops")
222 
223         return True
224 
225 
226 class DBParameterGroup(AWSObject):
227     resource_type = "AWS::RDS::DBParameterGroup"
228 
229     props = {
230         'Description': (basestring, False),
231         'Family': (basestring, False),
232         'Parameters': (dict, False),
233         'Tags': (list, False),
234     }
235 
236 
237 class DBSubnetGroup(AWSObject):
238     resource_type = "AWS::RDS::DBSubnetGroup"
239 
240     props = {
241         'DBSubnetGroupDescription': (basestring, True),
242         'SubnetIds': (list, True),
243         'Tags': (list, False),
244     }
245 
246 
247 class RDSSecurityGroup(AWSProperty):
248     props = {
249         'CIDRIP': (basestring, False),
250         'EC2SecurityGroupId': (basestring, False),
251         'EC2SecurityGroupName': (basestring, False),
252         'EC2SecurityGroupOwnerId': (basestring, False),
253     }
254 
255 
256 class DBSecurityGroup(AWSObject):
257     resource_type = "AWS::RDS::DBSecurityGroup"
258 
259     props = {
260         'EC2VpcId': (basestring, False),
261         'DBSecurityGroupIngress': (list, True),
262         'GroupDescription': (basestring, True),
263         'Tags': (list, False),
264     }
265 
266 
267 class DBSecurityGroupIngress(AWSObject):
268     resource_type = "AWS::RDS::DBSecurityGroupIngress"
269 
270     props = {
271         'CIDRIP': (basestring, False),
272         'DBSecurityGroupName': (basestring, True),
273         'EC2SecurityGroupId': (basestring, False),
274         'EC2SecurityGroupName': (basestring, False),
275         'EC2SecurityGroupOwnerId': (basestring, False),
276     }
277 
278 
279 class EventSubscription(AWSObject):
280     resource_type = "AWS::RDS::EventSubscription"
281 
282     props = {
283         'Enabled': (boolean, False),
284         'EventCategories': ([basestring], False),
285         'SnsTopicArn': (basestring, True),
286         'SourceIds': ([basestring, Ref], False),
287         'SourceType': (basestring, False),
288     }
289 
290 
291 class OptionSetting(AWSProperty):
292     props = {
293         'Name': (basestring, False),
294         'Value': (basestring, False),
295     }
296 
297 
298 class OptionConfiguration(AWSProperty):
299     props = {
300         'DBSecurityGroupMemberships': ([basestring, Ref], False),
301         'OptionName': (basestring, True),
302         'OptionSettings': ([OptionSetting], False),
303         'Port': (network_port, False),
304         'VpcSecurityGroupMemberships': ([basestring, Ref], False),
305     }
306 
307 
308 class OptionGroup(AWSObject):
309     resource_type = "AWS::RDS::OptionGroup"
310 
311     props = {
312         'EngineName': (basestring, True),
313         'MajorEngineVersion': (basestring, True),
314         'OptionGroupDescription': (basestring, True),
315         'OptionConfigurations': ([OptionConfiguration], True),
316         'Tags': (list, False),
317     }
318
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/troposphere/rds.py b/troposphere/rds.py
--- a/troposphere/rds.py
+++ b/troposphere/rds.py
@@ -16,7 +16,7 @@
                     'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex',
                     'sqlserver-web', 'postgres')
 VALID_LICENSE_MODELS = ('license-included', 'bring-your-own-license',
-                        'general-public-license')
+                        'general-public-license', 'postgresql-license')
 
 
 def validate_iops(iops):

{"golden_diff": "diff --git a/troposphere/rds.py b/troposphere/rds.py\n--- a/troposphere/rds.py\n+++ b/troposphere/rds.py\n@@ -16,7 +16,7 @@\n                     'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex',\n                     'sqlserver-web', 'postgres')\n VALID_LICENSE_MODELS = ('license-included', 'bring-your-own-license',\n-                        'general-public-license')\n+                        'general-public-license', 'postgresql-license')\n \n \n def validate_iops(iops):\n", "issue": "RDS ValueError on LicenseModel\nI'm hitting a similar problem to #316, Postgres instances only use the string `'postgresql-license'` for the LicenseModel parameter and I'm getting a ValueError:\n\n```\nValueError: DBInstance LicenseModel must be one of: license-included, bring-your-own-license, general-public-license\n```\n\nI could not find the `postgresql-license` in any API documentation, but it is in the [user-guide](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_CreatePostgreSQLInstance.html)\n\n", "before_files": [{"content": "# Copyright (c) 2013, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\nimport re\n\nfrom . import AWSHelperFn, AWSObject, AWSProperty, Ref\nfrom .validators import boolean, network_port, integer, positive_integer\n\n# Taken from:\n# http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html\n\nVALID_STORAGE_TYPES = ('standard', 'gp2', 'io1')\nVALID_DB_ENGINES = ('MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee',\n                    'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex',\n                    'sqlserver-web', 'postgres')\nVALID_LICENSE_MODELS = ('license-included', 'bring-your-own-license',\n                        'general-public-license')\n\n\ndef validate_iops(iops):\n    \"\"\"DBInstance Iops validation rules.\"\"\"\n\n    iops = integer(iops)\n    if int(iops) < 1000:\n        raise ValueError(\"DBInstance Iops, if set, must be greater than 1000.\")\n    if int(iops) > 10000:\n        raise ValueError(\"DBInstance Iops, if set, must be less than 10000.\")\n    return iops\n\n\ndef validate_storage_type(storage_type):\n    \"\"\"Validate StorageType for DBInstance\"\"\"\n\n    if storage_type not in VALID_STORAGE_TYPES:\n        raise ValueError(\"DBInstance StorageType must be one of: %s\" %\n                         \", \".join(VALID_STORAGE_TYPES))\n    return storage_type\n\n\ndef validate_engine(engine):\n    \"\"\"Validate database Engine for DBInstance \"\"\"\n\n    if engine not in VALID_DB_ENGINES:\n        raise ValueError(\"DBInstance Engine must be one of: %s\" %\n                         \", \".join(VALID_DB_ENGINES))\n    return engine\n\n\ndef validate_license_model(license_model):\n    \"\"\"Validate LicenseModel for DBInstance\"\"\"\n\n    if license_model not in VALID_LICENSE_MODELS:\n        raise ValueError(\"DBInstance LicenseModel must be one of: %s\" %\n                         \", \".join(VALID_LICENSE_MODELS))\n    return license_model\n\n\ndef validate_backup_window(window):\n    \"\"\"Validate PreferredBackupWindow for DBInstance\"\"\"\n\n    hour = r'[01]?[0-9]|2[0-3]'\n    minute = r'[0-5][0-9]'\n    r = (\"(?P<start_hour>%s):(?P<start_minute>%s)-\"\n         \"(?P<end_hour>%s):(?P<end_minute>%s)\") % (hour, minute, hour, minute)\n    range_regex = re.compile(r)\n    m = range_regex.match(window)\n    if not m:\n        raise ValueError(\"DBInstance PreferredBackupWindow must be in the \"\n                         \"format: hh24:mi-hh24:mi\")\n    start_ts = (int(m.group('start_hour')) * 60) + int(m.group('start_minute'))\n    end_ts = (int(m.group('end_hour')) * 60) + int(m.group('end_minute'))\n    if abs(end_ts - start_ts) < 30:\n        raise ValueError(\"DBInstance PreferredBackupWindow must be at least \"\n                         \"30 minutes long.\")\n    return window\n\n\ndef validate_maintenance_window(window):\n    \"\"\"Validate PreferredMaintenanceWindow for DBInstance\"\"\"\n\n    days = (\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\")\n    day_re = r'[A-Z]{1}[a-z]{2}'\n    hour = r'[01]?[0-9]|2[0-3]'\n    minute = r'[0-5][0-9]'\n    r = (\"(?P<start_day>%s):(?P<start_hour>%s):(?P<start_minute>%s)-\"\n         \"(?P<end_day>%s):(?P<end_hour>%s):(?P<end_minute>%s)\") % (day_re,\n                                                                   hour,\n                                                                   minute,\n                                                                   day_re,\n                                                                   hour,\n                                                                   minute)\n    range_regex = re.compile(r)\n    m = range_regex.match(window)\n    if not m:\n        raise ValueError(\"DBInstance PreferredMaintenanceWindow must be in \"\n                         \"the format: ddd:hh24:mi-ddd:hh24:mi\")\n    if m.group('start_day') not in days or m.group('end_day') not in days:\n        raise ValueError(\"DBInstance PreferredMaintenanceWindow day part of \"\n                         \"ranges must be one of: %s\" % \", \".join(days))\n    start_ts = (days.index(m.group('start_day')) * 24 * 60) + \\\n        (int(m.group('start_hour')) * 60) + int(m.group('start_minute'))\n    end_ts = (days.index(m.group('end_day')) * 24 * 60) + \\\n        (int(m.group('end_hour')) * 60) + int(m.group('end_minute'))\n    if abs(end_ts - start_ts) < 30:\n        raise ValueError(\"DBInstance PreferredMaintenanceWindow must be at \"\n                         \"least 30 minutes long.\")\n    return window\n\n\ndef validate_backup_retention_period(days):\n    \"\"\"Validate BackupRetentionPeriod for DBInstance\"\"\"\n\n    days = positive_integer(days)\n    if int(days) > 35:\n        raise ValueError(\"DBInstance BackupRetentionPeriod cannot be larger \"\n                         \"than 35 days.\")\n    return days\n\n\nclass DBInstance(AWSObject):\n    resource_type = \"AWS::RDS::DBInstance\"\n\n    props = {\n        'AllocatedStorage': (positive_integer, True),\n        'AllowMajorVersionUpgrade': (boolean, False),\n        'AutoMinorVersionUpgrade': (boolean, False),\n        'AvailabilityZone': (basestring, False),\n        'BackupRetentionPeriod': (validate_backup_retention_period, False),\n        'CharacterSetName': (basestring, False),\n        'DBInstanceClass': (basestring, True),\n        'DBInstanceIdentifier': (basestring, False),\n        'DBName': (basestring, False),\n        'DBParameterGroupName': (basestring, False),\n        'DBSecurityGroups': (list, False),\n        'DBSnapshotIdentifier': (basestring, False),\n        'DBSubnetGroupName': (basestring, False),\n        'Engine': (validate_engine, True),\n        'EngineVersion': (basestring, False),\n        'Iops': (validate_iops, False),\n        'KmsKeyId': (basestring, False),\n        'LicenseModel': (validate_license_model, False),\n        'MasterUsername': (basestring, False),\n        'MasterUserPassword': (basestring, False),\n        'MultiAZ': (boolean, False),\n        'OptionGroupName': (basestring, False),\n        'Port': (network_port, False),\n        'PreferredBackupWindow': (validate_backup_window, False),\n        'PreferredMaintenanceWindow': (basestring, False),\n        'PubliclyAccessible': (boolean, False),\n        'SourceDBInstanceIdentifier': (basestring, False),\n        'StorageEncrypted': (boolean, False),\n        'StorageType': (basestring, False),\n        'Tags': (list, False),\n        'VPCSecurityGroups': ([basestring, AWSHelperFn], False),\n    }\n\n    def validate(self):\n        if 'SourceDBInstanceIdentifier' in self.properties:\n\n            invalid_replica_properties = (\n                'BackupRetentionPeriod', 'DBName', 'MasterUsername',\n                'MasterUserPassword', 'PreferredBackupWindow', 'MultiAZ',\n                'DBSnapshotIdentifier', 'DBSubnetGroupName',\n            )\n\n            invalid_properties = [s for s in self.properties.keys() if\n                                  s in invalid_replica_properties]\n\n            if invalid_properties:\n                raise ValueError(\n                    ('{0} properties can\\'t be provided when '\n                     'SourceDBInstanceIdentifier is present '\n                     'AWS::RDS::DBInstance.'\n                     ).format(', '.join(sorted(invalid_properties))))\n\n        if ('DBSnapshotIdentifier' not in self.properties and\n            'SourceDBInstanceIdentifier' not in self.properties) and \\\n            ('MasterUsername' not in self.properties or\n             'MasterUserPassword' not in self.properties):\n            raise ValueError(\n                'Either (MasterUsername and MasterUserPassword) or'\n                ' DBSnapshotIdentifier are required in type '\n                'AWS::RDS::DBInstance.'\n            )\n\n        if 'KmsKeyId' in self.properties and \\\n           'StorageEncrypted' not in self.properties:\n            raise ValueError(\n                'If KmsKeyId is provided, StorageEncrypted is required '\n                'AWS::RDS::DBInstance.'\n            )\n\n        nonetype = type(None)\n        avail_zone = self.properties.get('AvailabilityZone', None)\n        multi_az = self.properties.get('MultiAZ', None)\n        if not (isinstance(avail_zone, (AWSHelperFn, nonetype)) and\n                isinstance(multi_az, (AWSHelperFn, nonetype))):\n            if 'AvailabilityZone' in self.properties and \\\n                    self.properties.get('MultiAZ', None):\n                raise ValueError(\"AvailabiltyZone cannot be set on \"\n                                 \"DBInstance if MultiAZ is set to true.\")\n\n        storage_type = self.properties.get('StorageType', None)\n        if storage_type and storage_type == 'io1' and \\\n                'Iops' not in self.properties:\n            raise ValueError(\"Must specify Iops if using StorageType io1\")\n\n        allocated_storage = self.properties.get('AllocatedStorage')\n        iops = self.properties.get('Iops', None)\n        if iops:\n            if not isinstance(allocated_storage, AWSHelperFn) and \\\n                    allocated_storage < 100:\n                raise ValueError(\"AllocatedStorage must be at least 100 when \"\n                                 \"Iops is set.\")\n            if not isinstance(allocated_storage, AWSHelperFn) and not \\\n                    isinstance(iops, AWSHelperFn) and \\\n                    float(iops) / float(allocated_storage) > 10.0:\n                raise ValueError(\"AllocatedStorage must be no less than \"\n                                 \"1/10th the provisioned Iops\")\n\n        return True\n\n\nclass DBParameterGroup(AWSObject):\n    resource_type = \"AWS::RDS::DBParameterGroup\"\n\n    props = {\n        'Description': (basestring, False),\n        'Family': (basestring, False),\n        'Parameters': (dict, False),\n        'Tags': (list, False),\n    }\n\n\nclass DBSubnetGroup(AWSObject):\n    resource_type = \"AWS::RDS::DBSubnetGroup\"\n\n    props = {\n        'DBSubnetGroupDescription': (basestring, True),\n        'SubnetIds': (list, True),\n        'Tags': (list, False),\n    }\n\n\nclass RDSSecurityGroup(AWSProperty):\n    props = {\n        'CIDRIP': (basestring, False),\n        'EC2SecurityGroupId': (basestring, False),\n        'EC2SecurityGroupName': (basestring, False),\n        'EC2SecurityGroupOwnerId': (basestring, False),\n    }\n\n\nclass DBSecurityGroup(AWSObject):\n    resource_type = \"AWS::RDS::DBSecurityGroup\"\n\n    props = {\n        'EC2VpcId': (basestring, False),\n        'DBSecurityGroupIngress': (list, True),\n        'GroupDescription': (basestring, True),\n        'Tags': (list, False),\n    }\n\n\nclass DBSecurityGroupIngress(AWSObject):\n    resource_type = \"AWS::RDS::DBSecurityGroupIngress\"\n\n    props = {\n        'CIDRIP': (basestring, False),\n        'DBSecurityGroupName': (basestring, True),\n        'EC2SecurityGroupId': (basestring, False),\n        'EC2SecurityGroupName': (basestring, False),\n        'EC2SecurityGroupOwnerId': (basestring, False),\n    }\n\n\nclass EventSubscription(AWSObject):\n    resource_type = \"AWS::RDS::EventSubscription\"\n\n    props = {\n        'Enabled': (boolean, False),\n        'EventCategories': ([basestring], False),\n        'SnsTopicArn': (basestring, True),\n        'SourceIds': ([basestring, Ref], False),\n        'SourceType': (basestring, False),\n    }\n\n\nclass OptionSetting(AWSProperty):\n    props = {\n        'Name': (basestring, False),\n        'Value': (basestring, False),\n    }\n\n\nclass OptionConfiguration(AWSProperty):\n    props = {\n        'DBSecurityGroupMemberships': ([basestring, Ref], False),\n        'OptionName': (basestring, True),\n        'OptionSettings': ([OptionSetting], False),\n        'Port': (network_port, False),\n        'VpcSecurityGroupMemberships': ([basestring, Ref], False),\n    }\n\n\nclass OptionGroup(AWSObject):\n    resource_type = \"AWS::RDS::OptionGroup\"\n\n    props = {\n        'EngineName': (basestring, True),\n        'MajorEngineVersion': (basestring, True),\n        'OptionGroupDescription': (basestring, True),\n        'OptionConfigurations': ([OptionConfiguration], True),\n        'Tags': (list, False),\n    }\n", "path": "troposphere/rds.py"}], "after_files": [{"content": "# Copyright (c) 2013, Mark Peek <mark@peek.org>\n# All rights reserved.\n#\n# See LICENSE file for full license.\n\nimport re\n\nfrom . import AWSHelperFn, AWSObject, AWSProperty, Ref\nfrom .validators import boolean, network_port, integer, positive_integer\n\n# Taken from:\n# http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_CreateDBInstance.html\n\nVALID_STORAGE_TYPES = ('standard', 'gp2', 'io1')\nVALID_DB_ENGINES = ('MySQL', 'oracle-se1', 'oracle-se', 'oracle-ee',\n                    'sqlserver-ee', 'sqlserver-se', 'sqlserver-ex',\n                    'sqlserver-web', 'postgres')\nVALID_LICENSE_MODELS = ('license-included', 'bring-your-own-license',\n                        'general-public-license', 'postgresql-license')\n\n\ndef validate_iops(iops):\n    \"\"\"DBInstance Iops validation rules.\"\"\"\n\n    iops = integer(iops)\n    if int(iops) < 1000:\n        raise ValueError(\"DBInstance Iops, if set, must be greater than 1000.\")\n    if int(iops) > 10000:\n        raise ValueError(\"DBInstance Iops, if set, must be less than 10000.\")\n    return iops\n\n\ndef validate_storage_type(storage_type):\n    \"\"\"Validate StorageType for DBInstance\"\"\"\n\n    if storage_type not in VALID_STORAGE_TYPES:\n        raise ValueError(\"DBInstance StorageType must be one of: %s\" %\n                         \", \".join(VALID_STORAGE_TYPES))\n    return storage_type\n\n\ndef validate_engine(engine):\n    \"\"\"Validate database Engine for DBInstance \"\"\"\n\n    if engine not in VALID_DB_ENGINES:\n        raise ValueError(\"DBInstance Engine must be one of: %s\" %\n                         \", \".join(VALID_DB_ENGINES))\n    return engine\n\n\ndef validate_license_model(license_model):\n    \"\"\"Validate LicenseModel for DBInstance\"\"\"\n\n    if license_model not in VALID_LICENSE_MODELS:\n        raise ValueError(\"DBInstance LicenseModel must be one of: %s\" %\n                         \", \".join(VALID_LICENSE_MODELS))\n    return license_model\n\n\ndef validate_backup_window(window):\n    \"\"\"Validate PreferredBackupWindow for DBInstance\"\"\"\n\n    hour = r'[01]?[0-9]|2[0-3]'\n    minute = r'[0-5][0-9]'\n    r = (\"(?P<start_hour>%s):(?P<start_minute>%s)-\"\n         \"(?P<end_hour>%s):(?P<end_minute>%s)\") % (hour, minute, hour, minute)\n    range_regex = re.compile(r)\n    m = range_regex.match(window)\n    if not m:\n        raise ValueError(\"DBInstance PreferredBackupWindow must be in the \"\n                         \"format: hh24:mi-hh24:mi\")\n    start_ts = (int(m.group('start_hour')) * 60) + int(m.group('start_minute'))\n    end_ts = (int(m.group('end_hour')) * 60) + int(m.group('end_minute'))\n    if abs(end_ts - start_ts) < 30:\n        raise ValueError(\"DBInstance PreferredBackupWindow must be at least \"\n                         \"30 minutes long.\")\n    return window\n\n\ndef validate_maintenance_window(window):\n    \"\"\"Validate PreferredMaintenanceWindow for DBInstance\"\"\"\n\n    days = (\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\")\n    day_re = r'[A-Z]{1}[a-z]{2}'\n    hour = r'[01]?[0-9]|2[0-3]'\n    minute = r'[0-5][0-9]'\n    r = (\"(?P<start_day>%s):(?P<start_hour>%s):(?P<start_minute>%s)-\"\n         \"(?P<end_day>%s):(?P<end_hour>%s):(?P<end_minute>%s)\") % (day_re,\n                                                                   hour,\n                                                                   minute,\n                                                                   day_re,\n                                                                   hour,\n                                                                   minute)\n    range_regex = re.compile(r)\n    m = range_regex.match(window)\n    if not m:\n        raise ValueError(\"DBInstance PreferredMaintenanceWindow must be in \"\n                         \"the format: ddd:hh24:mi-ddd:hh24:mi\")\n    if m.group('start_day') not in days or m.group('end_day') not in days:\n        raise ValueError(\"DBInstance PreferredMaintenanceWindow day part of \"\n                         \"ranges must be one of: %s\" % \", \".join(days))\n    start_ts = (days.index(m.group('start_day')) * 24 * 60) + \\\n        (int(m.group('start_hour')) * 60) + int(m.group('start_minute'))\n    end_ts = (days.index(m.group('end_day')) * 24 * 60) + \\\n        (int(m.group('end_hour')) * 60) + int(m.group('end_minute'))\n    if abs(end_ts - start_ts) < 30:\n        raise ValueError(\"DBInstance PreferredMaintenanceWindow must be at \"\n                         \"least 30 minutes long.\")\n    return window\n\n\ndef validate_backup_retention_period(days):\n    \"\"\"Validate BackupRetentionPeriod for DBInstance\"\"\"\n\n    days = positive_integer(days)\n    if int(days) > 35:\n        raise ValueError(\"DBInstance BackupRetentionPeriod cannot be larger \"\n                         \"than 35 days.\")\n    return days\n\n\nclass DBInstance(AWSObject):\n    resource_type = \"AWS::RDS::DBInstance\"\n\n    props = {\n        'AllocatedStorage': (positive_integer, True),\n        'AllowMajorVersionUpgrade': (boolean, False),\n        'AutoMinorVersionUpgrade': (boolean, False),\n        'AvailabilityZone': (basestring, False),\n        'BackupRetentionPeriod': (validate_backup_retention_period, False),\n        'CharacterSetName': (basestring, False),\n        'DBInstanceClass': (basestring, True),\n        'DBInstanceIdentifier': (basestring, False),\n        'DBName': (basestring, False),\n        'DBParameterGroupName': (basestring, False),\n        'DBSecurityGroups': (list, False),\n        'DBSnapshotIdentifier': (basestring, False),\n        'DBSubnetGroupName': (basestring, False),\n        'Engine': (validate_engine, True),\n        'EngineVersion': (basestring, False),\n        'Iops': (validate_iops, False),\n        'KmsKeyId': (basestring, False),\n        'LicenseModel': (validate_license_model, False),\n        'MasterUsername': (basestring, False),\n        'MasterUserPassword': (basestring, False),\n        'MultiAZ': (boolean, False),\n        'OptionGroupName': (basestring, False),\n        'Port': (network_port, False),\n        'PreferredBackupWindow': (validate_backup_window, False),\n        'PreferredMaintenanceWindow': (basestring, False),\n        'PubliclyAccessible': (boolean, False),\n        'SourceDBInstanceIdentifier': (basestring, False),\n        'StorageEncrypted': (boolean, False),\n        'StorageType': (basestring, False),\n        'Tags': (list, False),\n        'VPCSecurityGroups': ([basestring, AWSHelperFn], False),\n    }\n\n    def validate(self):\n        if 'SourceDBInstanceIdentifier' in self.properties:\n\n            invalid_replica_properties = (\n                'BackupRetentionPeriod', 'DBName', 'MasterUsername',\n                'MasterUserPassword', 'PreferredBackupWindow', 'MultiAZ',\n                'DBSnapshotIdentifier', 'DBSubnetGroupName',\n            )\n\n            invalid_properties = [s for s in self.properties.keys() if\n                                  s in invalid_replica_properties]\n\n            if invalid_properties:\n                raise ValueError(\n                    ('{0} properties can\\'t be provided when '\n                     'SourceDBInstanceIdentifier is present '\n                     'AWS::RDS::DBInstance.'\n                     ).format(', '.join(sorted(invalid_properties))))\n\n        if ('DBSnapshotIdentifier' not in self.properties and\n            'SourceDBInstanceIdentifier' not in self.properties) and \\\n            ('MasterUsername' not in self.properties or\n             'MasterUserPassword' not in self.properties):\n            raise ValueError(\n                'Either (MasterUsername and MasterUserPassword) or'\n                ' DBSnapshotIdentifier are required in type '\n                'AWS::RDS::DBInstance.'\n            )\n\n        if 'KmsKeyId' in self.properties and \\\n           'StorageEncrypted' not in self.properties:\n            raise ValueError(\n                'If KmsKeyId is provided, StorageEncrypted is required '\n                'AWS::RDS::DBInstance.'\n            )\n\n        nonetype = type(None)\n        avail_zone = self.properties.get('AvailabilityZone', None)\n        multi_az = self.properties.get('MultiAZ', None)\n        if not (isinstance(avail_zone, (AWSHelperFn, nonetype)) and\n                isinstance(multi_az, (AWSHelperFn, nonetype))):\n            if 'AvailabilityZone' in self.properties and \\\n                    self.properties.get('MultiAZ', None):\n                raise ValueError(\"AvailabiltyZone cannot be set on \"\n                                 \"DBInstance if MultiAZ is set to true.\")\n\n        storage_type = self.properties.get('StorageType', None)\n        if storage_type and storage_type == 'io1' and \\\n                'Iops' not in self.properties:\n            raise ValueError(\"Must specify Iops if using StorageType io1\")\n\n        allocated_storage = self.properties.get('AllocatedStorage')\n        iops = self.properties.get('Iops', None)\n        if iops:\n            if not isinstance(allocated_storage, AWSHelperFn) and \\\n                    allocated_storage < 100:\n                raise ValueError(\"AllocatedStorage must be at least 100 when \"\n                                 \"Iops is set.\")\n            if not isinstance(allocated_storage, AWSHelperFn) and not \\\n                    isinstance(iops, AWSHelperFn) and \\\n                    float(iops) / float(allocated_storage) > 10.0:\n                raise ValueError(\"AllocatedStorage must be no less than \"\n                                 \"1/10th the provisioned Iops\")\n\n        return True\n\n\nclass DBParameterGroup(AWSObject):\n    resource_type = \"AWS::RDS::DBParameterGroup\"\n\n    props = {\n        'Description': (basestring, False),\n        'Family': (basestring, False),\n        'Parameters': (dict, False),\n        'Tags': (list, False),\n    }\n\n\nclass DBSubnetGroup(AWSObject):\n    resource_type = \"AWS::RDS::DBSubnetGroup\"\n\n    props = {\n        'DBSubnetGroupDescription': (basestring, True),\n        'SubnetIds': (list, True),\n        'Tags': (list, False),\n    }\n\n\nclass RDSSecurityGroup(AWSProperty):\n    props = {\n        'CIDRIP': (basestring, False),\n        'EC2SecurityGroupId': (basestring, False),\n        'EC2SecurityGroupName': (basestring, False),\n        'EC2SecurityGroupOwnerId': (basestring, False),\n    }\n\n\nclass DBSecurityGroup(AWSObject):\n    resource_type = \"AWS::RDS::DBSecurityGroup\"\n\n    props = {\n        'EC2VpcId': (basestring, False),\n        'DBSecurityGroupIngress': (list, True),\n        'GroupDescription': (basestring, True),\n        'Tags': (list, False),\n    }\n\n\nclass DBSecurityGroupIngress(AWSObject):\n    resource_type = \"AWS::RDS::DBSecurityGroupIngress\"\n\n    props = {\n        'CIDRIP': (basestring, False),\n        'DBSecurityGroupName': (basestring, True),\n        'EC2SecurityGroupId': (basestring, False),\n        'EC2SecurityGroupName': (basestring, False),\n        'EC2SecurityGroupOwnerId': (basestring, False),\n    }\n\n\nclass EventSubscription(AWSObject):\n    resource_type = \"AWS::RDS::EventSubscription\"\n\n    props = {\n        'Enabled': (boolean, False),\n        'EventCategories': ([basestring], False),\n        'SnsTopicArn': (basestring, True),\n        'SourceIds': ([basestring, Ref], False),\n        'SourceType': (basestring, False),\n    }\n\n\nclass OptionSetting(AWSProperty):\n    props = {\n        'Name': (basestring, False),\n        'Value': (basestring, False),\n    }\n\n\nclass OptionConfiguration(AWSProperty):\n    props = {\n        'DBSecurityGroupMemberships': ([basestring, Ref], False),\n        'OptionName': (basestring, True),\n        'OptionSettings': ([OptionSetting], False),\n        'Port': (network_port, False),\n        'VpcSecurityGroupMemberships': ([basestring, Ref], False),\n    }\n\n\nclass OptionGroup(AWSObject):\n    resource_type = \"AWS::RDS::OptionGroup\"\n\n    props = {\n        'EngineName': (basestring, True),\n        'MajorEngineVersion': (basestring, True),\n        'OptionGroupDescription': (basestring, True),\n        'OptionConfigurations': ([OptionConfiguration], True),\n        'Tags': (list, False),\n    }\n", "path": "troposphere/rds.py"}]}