in footmark/rds/connection.py [0:0]
def bind_tags(self, instance_id, db_tags):
"""
Bind Tags to Instance
:type instance_id: string
:param instance_id: Id of instances to change
:type instance_id: dict
:param db_tags: A dictionaries of db tags
:return:
changed: If tags binded to instance successfully.The changed para will
be set to True else False
result: detailed server response
"""
params = {}
results = []
changed = False
if instance_id:
self.build_list_params(params, instance_id, 'DBInstanceId')
if db_tags:
db_tags_json = json.dumps(db_tags)
if db_tags_json:
self.build_list_params(params, db_tags_json, 'Tags')
try:
results = self.get_status('AddTagsToResource', params)
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") or ex.error_code is None:
results.append({"Error Message": "The API is showing None error code and error message "
"while binding tags"})
else:
error_code = ex.error_code
error_msg = ex.message
results.append("Failed to bind tags with error code " + error_code +
" and message: " + error_msg)
return changed, results