link2aws 1.0.0 → 1.0.5

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.
Files changed (4) hide show
  1. package/README.md +47 -5
  2. package/link2aws +11 -0
  3. package/link2aws.js +969 -943
  4. package/package.json +8 -4
package/README.md CHANGED
@@ -2,16 +2,46 @@
2
2
 
3
3
  Copy/paste ARN, get direct link to AWS console
4
4
 
5
+ <a href="https://link2aws.github.io">
6
+ <img src="screenshot.png" alt="Screenshot of link2aws.github.io" />
7
+ </a>
8
+
5
9
  Copyright (c) 2020, Felix Kaiser. License: [ISC](https://spdx.org/licenses/ISC.html)
6
10
 
11
+ ![Node.js CI](https://github.com/link2aws/link2aws.github.io/workflows/Node.js%20CI/badge.svg)
12
+
7
13
  ## How to...
8
14
 
9
- ### Use interactively
15
+ ### Use as website
16
+
17
+ Go to [link2aws.github.io](https://link2aws.github.io) (privacy notice: it runs in the browser and does *not* send your input anywhere)
18
+
19
+ Or run directly from source:
20
+
21
+ ```sh
22
+ # git clone https://github.com/link2aws/link2aws.github.io
23
+ # firefox link2aws.github.io/index.html
24
+ ```
25
+
26
+ ### Use as command line tool
10
27
 
11
- * Online: go to [link2aws.github.io](https://link2aws.github.io) (privacy notice: it runs in the browser and does *not* send your input anywhere)
12
- * Self-hosted: clone the repo, open `index.html` in your browser (there is no build step)
28
+ Via NPM:
13
29
 
14
- ### Use via JavaScript API
30
+ ```sh
31
+ # npm install -g link2aws
32
+ # link2aws arn:aws:s3:::abcdefgh1234
33
+ https://s3.console.aws.amazon.com/s3/buckets/abcdefgh1234
34
+ ```
35
+
36
+ Or clone the repo and run the file (no setup required):
37
+
38
+ ```sh
39
+ # git clone https://github.com/link2aws/link2aws.github.io
40
+ # node link2aws.github.io/link2aws.js arn:aws:s3:::abcdefgh1234
41
+ https://s3.console.aws.amazon.com/s3/buckets/abcdefgh1234
42
+ ```
43
+
44
+ ### Use as JavaScript library
15
45
 
16
46
  ```js
17
47
  var link2aws = require('link2aws');
@@ -19,10 +49,22 @@ new link2aws.ARN('arn:aws:s3:::abcdefgh1234').consoleLink
19
49
  // https://s3.console.aws.amazon.com/s3/buckets/abcdefgh1234
20
50
  ```
21
51
 
22
- If the ARN is invalid, or we valid but we have no link for it, an exception is thrown.
52
+ Or:
53
+
54
+ ```js
55
+ import { ARN } from 'link2aws';
56
+ new ARN('arn:aws:s3:::abcdefgh1234').consoleLink;
57
+ // https://s3.console.aws.amazon.com/s3/buckets/abcdefgh1234
58
+ ```
59
+
60
+ If the ARN is invalid, or valid but we have no link for it, an exception is thrown.
23
61
 
24
62
  ### Add support for resource types
25
63
 
64
+ It's super easy - see [this example](https://github.com/link2aws/link2aws.github.io/commit/0432ecbbe522dbbd7e746caeeb4a7d1a6be5f057).
65
+
66
+ Pull requests welcome!
67
+
26
68
  #### Add code
27
69
 
28
70
  * Support for new resource types: see large dict at the end of `link2aws.js`
package/link2aws ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+
3
+ let ARN = require("./link2aws.js").ARN;
4
+
5
+ for (let i = 2; i < process.argv.length; i++) {
6
+ try {
7
+ console.log(new ARN(process.argv[i]).consoleLink);
8
+ } catch (e) {
9
+ console.error(e);
10
+ }
11
+ }