package controllers import ( "net/http" "code.crute.us/mcrute/cloud-identity-broker/app" "code.crute.us/mcrute/cloud-identity-broker/app/middleware" "github.com/labstack/echo/v4" ) const ( contentTypeV1 = "application/vnd.broker.v1+json" // Original type contentTypeV2 = "application/vnd.broker.v2+json" // Start of migration to multi-cloud contentTypeV2AWSBash = "application/vnd.broker.v2.credential.aws.sh" // Bash Formatted Credential for AWS contentTypeV2AWSPowershell = "application/vnd.broker.v2.credential.aws.psl" // Powershell Formatted Credential for AWS contentTypeV2AWSConfig = "application/vnd.broker.v2.credential.aws.ini" // INI Formatted Credential for AWS ) func APIIndexHandler(c echo.Context) error { p, err := middleware.GetAuthorizedPrincipal(c) if err != nil { return echo.ErrUnauthorized } au := app.AppURL{} out := map[string]string{ "accounts": au.Account(c, "", nil), } if p.IsAdmin { out["users"] = au.User(c, nil) } return c.JSON(http.StatusOK, out) }