/**
* Use the Cloud Secret Manger API to interact with the pre-configured secrets.
*/
function getCurrentSecrets() {
let baseUrl, token, params, response;
token = ScriptApp.getOAuthToken();
params = {
"name" : "projects/my-project-id/secrets/my-secret-name"
}
response = UrlFetchApp.fetch(buildUrl_(baseUrl, params), {
headers: {
Authorization: 'Bearer ' + token
}
});
}
/**
* Builds a complete URL from a base URL and a map of URL parameters.
* @param {string} url The base URL.
* @param {Object.<string, string>} params The URL parameters and values.
* @return {string} The complete URL.
* @private
*/
function buildUrl_(url, params) {
var paramString = Object.keys(params).map(function(key) {
return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
}).join('&');
return url + (url.indexOf('?') >= 0 ? '&' : '?') + paramString;
}
I would really appreciate your help on this, as this is a time sensitive and I need to present the solution as soon as possible.