@cloud-copilot/iam-data
Version:
39 lines • 1.24 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.iamServiceKeys = iamServiceKeys;
exports.iamServiceExists = iamServiceExists;
exports.iamServiceName = iamServiceName;
const data_js_1 = require("./data.js");
/**
* Get keys for all services
*
* @returns an array of all service keys
*/
async function iamServiceKeys() {
return (0, data_js_1.readDataFile)('services.json');
}
/**
* Check if a service exists
*
* @param serviceKey the service key to check, is case insensitive
* @returns true if the service exists, false otherwise
*/
async function iamServiceExists(serviceKey) {
const data = await (0, data_js_1.readDataFile)('serviceNames.json');
return !!data[serviceKey.toLowerCase()];
}
/**
* Get the name of a service
*
* @param serviceKey the service key to get the name for
* @throws error if the service does not exist
* @returns the name of the service
*/
async function iamServiceName(serviceKey) {
const data = await (0, data_js_1.readDataFile)('serviceNames.json');
if (!data[serviceKey.toLowerCase()]) {
throw new Error(`Service ${serviceKey} does not exist`);
}
return data[serviceKey.toLowerCase()];
}
//# sourceMappingURL=services.js.map