aws-iam-managed-policies 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +44 -0
- package/dist/managedPolicies.json +428300 -0
- package/dist/types.d.ts +18 -0
- package/dist/types.js +2 -0
- package/examples/index.js +3 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Tobi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# aws-iam-managed-policies
|
|
2
|
+
Automatically populated repository of AWS IAM Managed Policies, which also updates a npm package containing the full history of AWS IAM Managed Policies.
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
|
|
6
|
+
### Installation
|
|
7
|
+
You can install the npm package like this:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i --save aws-iam-managed-policies
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### API
|
|
14
|
+
|
|
15
|
+
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ManagedPolicies, ManagedPolicy } from '../src/types';
|
|
2
|
+
export declare const listPolicies: () => string[];
|
|
3
|
+
export declare const getPolicyCount: () => number;
|
|
4
|
+
export declare const getPolicyByName: (policyName: string) => ManagedPolicy | undefined;
|
|
5
|
+
export declare const getLatestPolicyDocument: (policyName: string) => object | undefined;
|
|
6
|
+
export declare const getPolicyDocumentByVersion: (policyName: string, policyVersion: number) => object | undefined;
|
|
7
|
+
export { ManagedPolicies, };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getPolicyDocumentByVersion = exports.getLatestPolicyDocument = exports.getPolicyByName = exports.getPolicyCount = exports.listPolicies = void 0;
|
|
7
|
+
var managedPolicies_json_1 = __importDefault(require("./managedPolicies.json"));
|
|
8
|
+
var sortObjectByPropertyNames = function (obj) { return Object.keys(obj).sort().reduce(function (objEntries, key) {
|
|
9
|
+
objEntries[key] = obj[key];
|
|
10
|
+
return objEntries;
|
|
11
|
+
}, {}); };
|
|
12
|
+
var listPolicies = function () {
|
|
13
|
+
return Object.keys(sortObjectByPropertyNames(managedPolicies_json_1.default));
|
|
14
|
+
};
|
|
15
|
+
exports.listPolicies = listPolicies;
|
|
16
|
+
var getPolicyCount = function () {
|
|
17
|
+
return Object.keys(managedPolicies_json_1.default).length;
|
|
18
|
+
};
|
|
19
|
+
exports.getPolicyCount = getPolicyCount;
|
|
20
|
+
var getPolicyByName = function (policyName) {
|
|
21
|
+
return managedPolicies_json_1.default[policyName];
|
|
22
|
+
};
|
|
23
|
+
exports.getPolicyByName = getPolicyByName;
|
|
24
|
+
var getLatestPolicyDocument = function (policyName) {
|
|
25
|
+
var policy = managedPolicies_json_1.default[policyName];
|
|
26
|
+
if (policy) {
|
|
27
|
+
var latestVersionId = policy.latestVersionId;
|
|
28
|
+
return policy.versions[latestVersionId].document;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.getLatestPolicyDocument = getLatestPolicyDocument;
|
|
35
|
+
var getPolicyDocumentByVersion = function (policyName, policyVersion) {
|
|
36
|
+
var policy = managedPolicies_json_1.default[policyName];
|
|
37
|
+
if (policy) {
|
|
38
|
+
return policy.versions[policyVersion].document;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.getPolicyDocumentByVersion = getPolicyDocumentByVersion;
|