Documentation ¶
Index ¶
- Constants
- Variables
- func Bool(b bool) *bool
- func ErrMessage(msg string) []byte
- func GetAuthorizedParamFilter(c echo.Context, au User) map[string]interface{}
- func GetParamFilter(c echo.Context) map[string]interface{}
- func GetRequestBody(c echo.Context) ([]byte, error)
- func GetSearchFilter(c echo.Context) map[string]interface{}
- func IsAuthorized(au User, resource string) (int, []byte)
- func IsAuthorizedToReadResource(au User, endpoint, resource, resourceID string) (int, []byte)
- func IsAuthorizedToResource(au User, endpoint, resource, resourceID string) (int, []byte)
- func IsLicensed(au User, resource string) (int, []byte)
- func Licensed() error
- func Respond(c echo.Context, st int, b []byte) error
- func ValidCliVersion(r *http.Request) error
- type ResponseError
- type User
Constants ¶
const RequiredCliVersion string = "2.2.0"
RequiredCliVersion : ..
Variables ¶
var ( // AuthNonAdmin : Response body for non authorized requests on admin resources AuthNonAdmin = []byte(`{"message": "You don't have permissions to perform this action, please login with an admin account"}`) // AuthNonOwner : Response body for non authorized requests on owned resources AuthNonOwner = []byte(`{"message": "You don't have permissions to perform this action, please login as a resource owner"}`) // AuthNonReadable : Response body for non authorized requests on admin resources AuthNonReadable = []byte(`{"message": "You don't have permissions to perform this action, please contact the resource owner"}`) // GetProject : ... GetProject = "get_project" // DeleteProject : ... DeleteProject = "delete_project" // UpdateProject : ... UpdateProject = "update_project" // DeleteEnv : ... DeleteEnv = "delete_env" // DeleteEnvForce : .. DeleteEnvForce = "delete_env_force" // UpdateEnv : ... UpdateEnv = "update_env" // GetEnv : ... GetEnv = "get_environment" // SyncEnv : ... SyncEnv = "sync_env" // ListBuilds : ... ListBuilds = "list_builds" // DeleteBuild : ... DeleteBuild = "delete_build" // GetBuild : ... GetBuild = "get_build" // ResetBuild : ... ResetBuild = "reset_build" // SubmitBuild : ... SubmitBuild = "submit_build" // DiffBuild : ... DiffBuild = "diff_build" // GetPolicy : ... GetPolicy = "get_policy" // DeletePolicy : ... DeletePolicy = "delete_policy" // UpdatePolicy : ... UpdatePolicy = "update_policy" )
var ( echo.NewHTTPError(http.StatusForbidden, "") // ErrNotFound : HTTP 404 error ErrNotFound = echo.NewHTTPError(http.StatusNotFound, "") // ErrBadReqBody : HTTP 400 error ErrBadReqBody = echo.NewHTTPError(http.StatusBadRequest, "") // ErrGatewayTimeout : HTTP 504 error ErrGatewayTimeout = echo.NewHTTPError(http.StatusGatewayTimeout, "") // ErrInternal : HTTP 500 error ErrInternal = echo.NewHTTPError(http.StatusInternalServerError, "") // ErrNotImplemented : HTTP 405 error ErrNotImplemented = echo.NewHTTPError(http.StatusNotImplemented, "") // ErrExists : HTTP Error ErrExists = echo.NewHTTPError(http.StatusSeeOther, "") )ErrUnauthorized =
var L = logrus.New()
L : API-gateway logger
Functions ¶
func ErrMessage ¶
ErrMessage prepares a message string to be responded
func GetAuthorizedParamFilter ¶
GetAuthorizedParamFilter : Get filters based on the params defined on the url
func GetParamFilter ¶
GetParamFilter : Returns a filter based on parameters defined on the url stem
func GetRequestBody ¶
GetRequestBody : Get the request body
func GetSearchFilter ¶
GetSearchFilter : Returns a filter based on url query values from the request
func IsAuthorized ¶
IsAuthorized : Validates if the given user has access to the given resource
func IsAuthorizedToReadResource ¶
IsAuthorizedToReadResource : check if the user is authorized to read only access a specific resource
func IsAuthorizedToResource ¶
IsAuthorizedToResource : check if the user is authorized to access a specific resource
func IsLicensed ¶
IsLicensed : checks if the action being performed is licensed
func Licensed ¶
func Licensed() error
Licensed : Checks if the current api is running with premium support
func ValidCliVersion ¶
ValidCliVersion checks to see if the client version meets minimum requirements