api

package
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(appCtx *AppContext, controllers []Controller) *mux.Router

Types

type AppContext

type AppContext struct {
	ApplicationService   service.ApplicationService
	ProjectsService      service.ProjectsService
	SecretService        service.SecretService
	SecretStorageService service.SecretStorageService
	DefaultSecretStorage *models.SecretStorage

	AuthorizationEnabled       bool
	UseAuthorizationMiddleware bool
	Enforcer                   enforcer.Enforcer
}

func NewAppContext

func NewAppContext(db *gorm.DB, cfg *config.Config) (ctx *AppContext, err error)

type ApplicationsController

type ApplicationsController struct {
	*AppContext
}

func (*ApplicationsController) ListApplications

func (c *ApplicationsController) ListApplications(_ *http.Request, _ map[string]string, _ interface{}) *Response

func (*ApplicationsController) Routes

func (c *ApplicationsController) Routes() []Route

type Controller

type Controller interface {
	Routes() []Route
}

type ErrorMessage

type ErrorMessage struct {
	Message string `json:"error"`
}

type Handler

type Handler func(r *http.Request, vars map[string]string, body interface{}) *Response

type Handler func(r *http.Request, vars map[string]string, body interface{}) *Response

type ProjectsController

type ProjectsController struct {
	*AppContext
}

func (*ProjectsController) CreateProject

func (c *ProjectsController) CreateProject(r *http.Request, vars map[string]string, body interface{}) *Response

func (*ProjectsController) GetProject

func (c *ProjectsController) GetProject(r *http.Request, vars map[string]string, body interface{}) *Response

func (*ProjectsController) ListProjects

func (c *ProjectsController) ListProjects(r *http.Request, vars map[string]string, _ interface{}) *Response

func (*ProjectsController) Routes

func (c *ProjectsController) Routes() []Route

func (*ProjectsController) UpdateProject

func (c *ProjectsController) UpdateProject(r *http.Request, vars map[string]string, body interface{}) *Response

type Response

type Response struct {
	// contains filtered or unexported fields
}

func BadRequest

func BadRequest(msg string) *Response

func Conflict added in v1.8.0

func Conflict(msg string) *Response

func Created

func Created(data interface{}) *Response

func Error

func Error(code int, msg string) *Response

func Forbidden

func Forbidden(msg string) *Response

func FromError added in v1.8.0

func FromError(err error) *Response

func InternalServerError

func InternalServerError(msg string) *Response

func NoContent

func NoContent() *Response

func NotFound

func NotFound(msg string) *Response

func Ok

func Ok(data interface{}) *Response

func (*Response) WriteTo

func (r *Response) WriteTo(w http.ResponseWriter)

type Route

type Route struct {
	Method  string
	Path    string
	Body    interface{}
	Handler Handler
	Name    string
}

func (Route) HandlerFunc

func (route Route) HandlerFunc(validate *validator.Validate) http.HandlerFunc

type SecretStoragesController added in v1.8.0

type SecretStoragesController struct {
	*AppContext
}

func (*SecretStoragesController) CreateSecretStorage added in v1.8.0

func (c *SecretStoragesController) CreateSecretStorage(_ *http.Request,
	vars map[string]string,
	body interface{}) *Response

CreateSecretStorage creates a secret storage for a project

func (*SecretStoragesController) DeleteSecretStorage added in v1.8.0

func (c *SecretStoragesController) DeleteSecretStorage(_ *http.Request,
	vars map[string]string,
	_ interface{}) *Response

func (*SecretStoragesController) GetSecretStorage added in v1.8.0

func (c *SecretStoragesController) GetSecretStorage(_ *http.Request,
	vars map[string]string,
	_ interface{}) *Response

GetSecretStorage gets a secret storage given specified project_id and secret_storage_id

func (*SecretStoragesController) ListSecretStorage added in v1.8.0

func (c *SecretStoragesController) ListSecretStorage(_ *http.Request,
	vars map[string]string,
	_ interface{}) *Response

ListSecretStorage lists all secret storage for a project including the global secret storage

func (*SecretStoragesController) Routes added in v1.8.0

func (c *SecretStoragesController) Routes() []Route

func (*SecretStoragesController) UpdateSecretStorage added in v1.8.0

func (c *SecretStoragesController) UpdateSecretStorage(_ *http.Request,
	vars map[string]string,
	body interface{}) *Response

UpdateSecretStorage updates a secret storage given specified project_id and secret_storage_id Note: cannot update global secret storage

type SecretsController

type SecretsController struct {
	*AppContext
}

func (*SecretsController) CreateSecret

func (c *SecretsController) CreateSecret(r *http.Request, vars map[string]string, body interface{}) *Response

func (*SecretsController) DeleteSecret

func (c *SecretsController) DeleteSecret(r *http.Request, vars map[string]string, _ interface{}) *Response

func (*SecretsController) GetSecret added in v1.8.0

func (c *SecretsController) GetSecret(r *http.Request, vars map[string]string, _ interface{}) *Response

func (*SecretsController) ListSecret

func (c *SecretsController) ListSecret(r *http.Request, vars map[string]string, body interface{}) *Response

func (*SecretsController) Routes

func (c *SecretsController) Routes() []Route

func (*SecretsController) UpdateSecret

func (c *SecretsController) UpdateSecret(r *http.Request, vars map[string]string, body interface{}) *Response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL