def modify_instance_public_connection()

in footmark/rds/connection.py [0:0]


    def modify_instance_public_connection(self, db_instance_id, current_connection_string,
                                          connection_string_prefix, port):
        """
        Modify Instance Public connection string

        :type db_instance_id: string
        :param db_instance_id: Id of instances to change
        :type current_connection_string: string
        :param current_connection_string: Current connection string of an instance.
        :type connection_string_prefix: string
        :param connection_string_prefix: Prefix of an Internet connection string
        :type port: integer
        :param port: The public connection port.
        :return:
            changed: If instance public connection string modified 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 current_connection_string:
            self.build_list_params(params, current_connection_string, 'CurrentConnectionString')
        if connection_string_prefix:
            self.build_list_params(params, connection_string_prefix, 'ConnectionStringPrefix')
        if port:
            self.build_list_params(params, port, 'Port')
        try:
            results = self.get_status('ModifyDBInstanceConnectionString', 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 modifying public connection string "})
            else:
                error_code = ex.error_code
                error_msg = ex.message
                results.append("Failed to modify public connection string with error code " + error_code +
                               " and message: " + error_msg)

        return changed, results