@csermet/multiprovider
Version:
cloud-graph provider plugin for AWS used to fetch AWS cloud data.
25 lines (24 loc) • 810 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const format_1 = require("../../utils/format");
const GLOBAL_ARN_PREFIX = '::aws:';
/**
* IAM Policy
*/
exports.default = ({ service: rawData, account, }) => {
const { PolicyName: name = '', Arn: arn = '', Path: path = '', Description: description = '', Document: policyContent = '', Tags: tags = {}, } = rawData;
// Format Policy Tags
const policyTags = format_1.formatTagsFromMap(tags);
const policy = {
id: arn,
name,
arn,
accountId: arn.includes(GLOBAL_ARN_PREFIX) ? 'global' : account,
path,
rawPolicy: policyContent,
policyContent: format_1.formatIamJsonPolicy(policyContent),
description,
tags: policyTags,
};
return policy;
};