aboutsummaryrefslogtreecommitdiff
path: root/app/controllers/api_region_list.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/api_region_list.go')
-rw-r--r--app/controllers/api_region_list.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/app/controllers/api_region_list.go b/app/controllers/api_region_list.go
index 44d591c..c34ac3a 100644
--- a/app/controllers/api_region_list.go
+++ b/app/controllers/api_region_list.go
@@ -3,7 +3,7 @@ package controllers
3import ( 3import (
4 "net/http" 4 "net/http"
5 5
6 glecho "code.crute.us/mcrute/golib/echo" 6 "code.crute.us/mcrute/cloud-identity-broker/app"
7 "code.crute.us/mcrute/golib/echo/controller" 7 "code.crute.us/mcrute/golib/echo/controller"
8 "github.com/labstack/echo/v4" 8 "github.com/labstack/echo/v4"
9) 9)
@@ -17,10 +17,14 @@ type jsonRegion struct {
17 17
18type APIRegionListHandler struct { 18type APIRegionListHandler struct {
19 *AWSAPI 19 *AWSAPI
20 urls app.AppURL
20} 21}
21 22
22func NewAPIRegionListHandler(a *AWSAPI) echo.HandlerFunc { 23func NewAPIRegionListHandler(a *AWSAPI) echo.HandlerFunc {
23 al := &APIRegionListHandler{a} 24 al := &APIRegionListHandler{
25 AWSAPI: a,
26 urls: app.AppURL{},
27 }
24 h := &controller.ContentTypeNegotiatingHandler{ 28 h := &controller.ContentTypeNegotiatingHandler{
25 DefaultHandler: al.Handle, 29 DefaultHandler: al.Handle,
26 Handlers: map[string]echo.HandlerFunc{ 30 Handlers: map[string]echo.HandlerFunc{
@@ -52,9 +56,8 @@ func (h *APIRegionListHandler) Handle(c echo.Context) error {
52 Default: rc.Account.DefaultRegion == r.Name, 56 Default: rc.Account.DefaultRegion == r.Name,
53 } 57 }
54 if r.Enabled { 58 if r.Enabled {
55 out[i].CredentialsURL = glecho.URLFor(c, 59 out[i].CredentialsURL = h.urls.AccountCredentials(
56 "/api/account", rc.Account.ShortName, "credentials", r.Name, 60 c, "aws", rc.Account.ShortName, r.Name)
57 ).String()
58 } 61 }
59 } 62 }
60 63