From the release note 37416, you can add a username/password combo to the credential library
My question is, where can I use this credentials set and how?
Can I use this during element creation, like the snmpv3 credentials?
Can I use it on a element for filling in username and password parameters based on that credential?
Can I use it in a custom GQI source to store the e.g database credentials of the database I'm querying in that custom GQI source?
This was one the initial features required to allow access to the credential library via automation script. The next step is indeed allow access to the credential library through automation scripts. When we requested this feature we didn't think initially on ad-hoc data sources (ad-hoc data source was not available at that time).
There is a feature suggestion about this topic as well:
Option to link a credential library to an automation script
Hope it helps.