in footmark/rds/connection.py [0:0]
def create_instance_public_connection_string(self, db_instance_id, public_connection_string_prefix, public_port):
"""
Create Instance Public Connection String
:type db_instance_id: string
:param db_instance_id: Id of instances to change
:type public_connection_string_prefix: string
:param public_connection_string_prefix: Prefix of an Internet connection string
:type public_port: integer
:param public_port: The public connection port.
:return:
changed: If instance public connection string created successfully.The changed para will be set to True else
False
result: detailed server response
"""
params = {}
results = []
changed = False
if db_instance_id:
self.build_list_params(params, db_instance_id, 'DBInstanceId')
if public_connection_string_prefix:
self.build_list_params(params, public_connection_string_prefix, 'ConnectionStringPrefix')
if public_port:
self.build_list_params(params, public_port, 'Port')
try:
results = self.get_status('AllocateInstancePublicConnection', 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 creating public connection string "})
else:
error_code = ex.error_code
error_msg = ex.message
results.append("Failed to create public connection string with error code " + error_code +
" and message: " + error_msg)
return changed, results