in footmark/rds/connection.py [0:0]
def _create_database(self, instance_id, db_name, db_description, character_set_name):
"""
Creates a new database in an instance
:type instance_id: str
:param instance_id: Id of instances
:type db_name: str
:param db_name: Name of a database to create within the instance. If not specified, then no database is created
:type db_description: str
:param db_description: Description of a database to create within the instance. If not specified,
then no database is created.
:type character_set_name: str
:param character_set_name: Associate the DB instance with a specified character set.
:return: Result dict of operation
"""
params = {}
results = []
changed = False
if instance_id:
self.build_list_params(params, instance_id, 'DBInstanceId')
if db_name:
self.build_list_params(params, db_name, 'DBName')
if character_set_name:
self.build_list_params(params, character_set_name, 'CharacterSetName')
if db_description:
self.build_list_params(params, db_description, 'DBDescription')
try:
response = self.get_status('CreateDatabase', params)
results.append(response)
changed = True
except Exception as ex:
if (ex.args is None) or (ex.args == "need more than 2 values to unpack") \
or (ex.message == "need more than 2 values to unpack"):
results.append({"Error Message": "The API is showing None error code and error message"})
else:
error_code = ex.error_code
error_msg = ex.message
results.append({"Error Code": error_code, "Error Message": error_msg})
return changed, results