aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/api_account_list.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/api_account_list.go')
-rw-r--r--app/controllers/api_account_list.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/app/controllers/api_account_list.go b/app/controllers/api_account_list.go
index 28b64c1..4835d0c 100644
--- a/app/controllers/api_account_list.go
+++ b/app/controllers/api_account_list.go
@@ -4,10 +4,10 @@ import (
4 "context" 4 "context"
5 "net/http" 5 "net/http"
6 6
7 "code.crute.us/mcrute/cloud-identity-broker/app"
7 "code.crute.us/mcrute/cloud-identity-broker/app/middleware" 8 "code.crute.us/mcrute/cloud-identity-broker/app/middleware"
8 "code.crute.us/mcrute/cloud-identity-broker/app/models" 9 "code.crute.us/mcrute/cloud-identity-broker/app/models"
9 10
10 glecho "code.crute.us/mcrute/golib/echo"
11 "code.crute.us/mcrute/golib/echo/controller" 11 "code.crute.us/mcrute/golib/echo/controller"
12 "github.com/labstack/echo/v4" 12 "github.com/labstack/echo/v4"
13) 13)
@@ -25,15 +25,17 @@ type jsonAccount struct {
25} 25}
26 26
27func jsonAccountFromAccount(c echo.Context, a *models.Account) *jsonAccount { 27func jsonAccountFromAccount(c echo.Context, a *models.Account) *jsonAccount {
28 u := app.AppURL{}
29
28 return &jsonAccount{ 30 return &jsonAccount{
29 AccountNumber: a.AccountNumber, 31 AccountNumber: a.AccountNumber,
30 ShortName: a.ShortName, 32 ShortName: a.ShortName,
31 Name: a.Name, 33 Name: a.Name,
32 SelfUrl: glecho.URLFor(c, "/api/account", a.ShortName).String(), 34 SelfUrl: u.Account(c, "aws", &a.ShortName),
33 ConsoleUrl: glecho.URLFor(c, "/api/account", a.ShortName, "console").String(), 35 ConsoleUrl: u.AccountConsole(c, "aws", a.ShortName, false),
34 ConsoleRedirectUrl: glecho.URLFor(c, "/api/account", a.ShortName, "console").Query("redirect", "1").String(), 36 ConsoleRedirectUrl: u.AccountConsole(c, "aws", a.ShortName, true),
35 CredentialsUrl: glecho.URLFor(c, "/api/account", a.ShortName, "credentials").String(), 37 CredentialsUrl: u.AccountCredentials(c, "aws", a.ShortName, ""),
36 GlobalCredentialsUrl: glecho.URLFor(c, "/api/account", a.ShortName, "credentials/global").String(), 38 GlobalCredentialsUrl: u.AccountCredentials(c, "aws", a.ShortName, "global"),
37 } 39 }
38} 40}
39 41