aboutsummaryrefslogtreecommitdiff
path: root/templates/index.tpl
blob: da0b59e00504eb2f1c4cfd033aa0358edd47f70f (plain)
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
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>Select Account</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="/assets/site.css" />
        <script id="shell_template" type="text/template">
            export AWS_CREDS_EXPIRATION="[[ .expiration ]]"
            export AWS_ACCESS_KEY_ID="[[ .access_key ]]"
            export AWS_SECRET_ACCESS_KEY="[[ .secret_key ]]"
            export AWS_SESSION_TOKEN="[[ .session_token ]]"
        </script>
        <script id="powershell_template" type="text/template">
            Set-Item -path env:AWS_CREDS_EXPIRATION -value '[[ .expiration ]]'
            Set-Item -path env:AWS_ACCESS_KEY_ID -value '[[ .access_key ]]'
            Set-Item -path env:AWS_SECRET_ACCESS_KEY -value '[[ .secret_key ]]'
            Set-Item -path env:AWS_SESSION_TOKEN -value '[[ .session_token ]]'
        </script>
        <script id="aws_config_template" type="text/template">
            [profile [[ .ShortName ]]]
            aws_access_key_id=[[ .access_key ]]
            aws_secret_access_key=[[ .secret_key ]]
            aws_session_token=[[ .session_token ]]
            expiration=[[ .expiration ]]
        </script>
        <script id="credential_row_template" type="text/template">
            <tr id="credentials-for-[[ .Account ]]">
                <td colspan="3">
                    <textarea>[[ .Content ]]</textarea>
                    <button>Close</button>
                </td>
            </tr>
        </script>
        <script id="account_row_template" type="text/template">
            <tr id="account-row-[[ .short_name ]]" data-account-name="[[ .short_name ]]" data-global-credential-endpoint="[[ .global_credential_url ]]">
                <td>[[ .name ]]</td>
                <td>[[ .vendor ]]</td>
                <td>
                    <a href="[[ .console_redirect_url ]]">Console</a> |
                    <a data-template="aws_config_template" href="#/cli/[[ .short_name ]]">AWS CLI</a> |
                    <a data-template="shell_template" href="#/sh/[[ .short_name ]]">Bash</a> |
                    <a data-template="powershell_template" href="#/ps/[[ .short_name ]]">Powershell</a>
                    <span class="admin">| <a>Edit</a></span>
                </td>
            </tr>
        </script>
        <script type="text/javascript" src="/assets/site.js"></script>
        <script type="text/javascript">
            window.addEventListener('load', populateAPIKey);
            window.addEventListener('load', populateAccountTable);
            window.addEventListener('load', setAdminClass);
        </script>
    </head>
    <body>
        <p id="api-error">Error communicating with the API.</p>

        <h1>Cloud Accounts</h1>
        <table id="account-table">
            <tr>
                <th>Console Login</th>
                <th>Vendor</th>
                <th>Credentials</th>
            </tr>
        </table>
        <p><button class="admin">Add Account</button></p>

        <h1>API Key</h1>
        <div id="api-key">
            <p>To access <a href="/api/account">the API</a> set the header <tt>Authorization: Bearer {token}</tt> to the token below:</p>
            <textarea>Bearer {token}</textarea>
            <p><b>Token Expires:</b> <span id="session-expires"></span></p>
        </div>
    </body>
</html>