-
Notifications
You must be signed in to change notification settings - Fork 22
/
index.html
118 lines (104 loc) · 4.19 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>link2aws - Get AWS console link from ARN</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='stylesheet' type='text/css' media='screen' href='index.css'>
<script>var exports = {};</script>
<script src='link2aws.js'></script>
</head>
<body>
<div>
<div>
</div>
<div class="container">
<div class="section">
<h1>link2aws.github.io</h1>
</div>
<div class="section">
Copy/paste <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html" class="unimportant-link" title="Amazon Resource Name">ARN</a>, get direct link to AWS console:
</div>
<div class="section">
<input
id="text"
type="text"
placeholder="ex.: arn:aws:iam::aws:policy/AdministratorAccess" />
</div>
<div id="link-container" class="section">
<noscript>
This page requires JavaScript.<br />
Or you could mail me a letter with the ARN and I can reply with the link. ;-)
</noscript>
</div>
</div>
<div>
<div class="section unimportant-text">
<div>
<p>
Do you want links that auto-redirect to the AWS console? Append <code>#arn</code> like <a href="https://link2aws.github.io/#arn:aws:ec2:us-west-1:136693071363:image/ami-0851c4af3ebd71c35">this</a>!
</p>
<p>
Need a command line tool or a JavaScript library to convert ARN's to AWS console links? Check out our <a href="https://www.npmjs.com/package/link2aws">link2aws</a> NPM package!
</p>
<p>
Found a problem? Missing a resource type? <a href="https://github.com/link2aws/link2aws.github.io/issues/new/choose">Report it</a> or send a pull request for our <a href="https://github.com/link2aws/link2aws.github.io">GitHub project</a>.
</p>
</div>
</div>
</div>
</div>
<script>
function onLoad() {
var elem = document.getElementById("text");
elem.onchange = onUpdate;
elem.onclick = onUpdate;
elem.oninput = onUpdate;
elem.onpaste = onUpdate;
elem.onkeyup = onKeyUp;
//document.getElementById("text").value = "arn:aws:iam::aws:policy/AdministratorAccess";
onUpdate();
// If the user passes in the arn as a anchor, immediately redirect them
var arn = window.location.hash.replace('#', '');
if (arn) {
elem.value = arn;
onUpdate();
var a = document.getElementById('link');
if (a) {
location.href = a.innerText;
}
};
}
function onUpdate() {
var container = document.getElementById("link-container");
var input = document.getElementById("text").value;
console.log(input);
var output;
try {
container.innerHTML = '';
var link = new ARN(input).consoleLink;
var a = document.createElement('a');
a.setAttribute('href', link);
a.setAttribute('id', 'link');
a.innerText = link;
container.appendChild(a);
} catch (e) {
container.innerHTML = '<span class="unimportant-text">No (supported) ARN detected.</span>'
console.log(input, e);
}
}
function onKeyUp(e) {
if (e.key !== 'Enter') {
return onUpdate();
}
var a = document.getElementById('link');
if (a) {
location.href = a.innerText;
}
}
onLoad();
</script>
</body>
</html>