Documentation ¶
Index ¶
- Constants
- func CreateTenantHandlerFactory(cfg Config) func(*gin.Context)
- func DeleteTenantHandlerFactory(cfg Config) func(*gin.Context)
- func FetchTenantHandlerFactory(cfg Config) func(*gin.Context)
- func SetRoutes(router *gin.Engine, cfg Config)
- type Config
- type GitlabTenantsDB
- type ProjectPathParams
- type TenantData
- type TopLevelNamespaceHeader
Constants ¶
const K8sRequestTimeout = 3 * time.Second
Variables ¶
This section is empty.
Functions ¶
func CreateTenantHandlerFactory ¶
@Id CreateTenant @Summary Fetch information about the tenant @Router /v3/tenant/{project_id} [put] @Param project path ProjectPathParams true "Project ID" @Param namespace header TopLevelNamespaceHeader true "Top-level namespace ID" @Success 201 "Tenant created" @Failure 409 "Tenant already exists" @Failure 500 "Tenant creation failed"
func DeleteTenantHandlerFactory ¶
@Id DeleteTenant @Summary Delete a tenant - not yet implemented @Router /v3/tenant/{project_id} [delete] @Param project path ProjectPathParams true "Project ID" @Param namespace header TopLevelNamespaceHeader true "Top-level namespace ID" @Failure 501 "Not implemented"
func FetchTenantHandlerFactory ¶
@Id GetTenant @Summary Fetch information about the tenant @Router /v3/tenant/{project_id} [get] @Param project path ProjectPathParams true "Project ID" @Param namespace header TopLevelNamespaceHeader true "Top-level namespace ID" @Success 200 {object} TenantData @Failure 404 "Tenant not found"
Types ¶
type Config ¶
type Config struct { K8sClient client.Client TenantsDB *GitlabTenantsDB Logger *zap.SugaredLogger }
type GitlabTenantsDB ¶
type GitlabTenantsDB struct { DB map[int64]TenantData sync.RWMutex }
func NewGitlabTenantDB ¶
func NewGitlabTenantDB( logger *zap.SugaredLogger, ctx context.Context, dynamicClient *dynamic.DynamicClient, ) (*GitlabTenantsDB, error)
type ProjectPathParams ¶
type ProjectPathParams struct {
ProjectID int64 `uri:"project_id" binding:"required,numeric,min=1"`
}
type TenantData ¶
type TenantData struct { Name *string `json:"name" form:"name" binding:"required,dns_rfc1035_label,min=1"` TopLevelNamespaceID *int64 `json:"topLevelNamespaceID" form:"topLevelNamespaceID" binding:"required,numeric,min=1"` // Status is one of `ready`, `not ready`, `unknown` Status *string `json:"status"` }
type TopLevelNamespaceHeader ¶
type TopLevelNamespaceHeader struct {
GroupID *int64 `header:"x-top-level-namespace" binding:"required,numeric,min=1"`
}