provisioningapi

package
v0.0.0-...-d4572dd Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0, MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const K8sRequestTimeout = 3 * time.Second

Variables

This section is empty.

Functions

func CreateTenantHandlerFactory

func CreateTenantHandlerFactory(cfg Config) func(*gin.Context)

@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

func DeleteTenantHandlerFactory(cfg Config) func(*gin.Context)

@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

func FetchTenantHandlerFactory(cfg Config) func(*gin.Context)

@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"

func SetRoutes

func SetRoutes(router *gin.Engine, cfg Config)

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"`
}

Jump to

Keyboard shortcuts

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