template

package
v0.0.0-...-d125d34 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

type Controller interface {
	// ListV2 lists all template available
	ListV2(ctx context.Context, query *q.Query, withFullPath bool) (Templates, error)
	// ListTemplate list all template available
	ListTemplate(ctx context.Context) (Templates, error)
	// ListTemplateRelease list all releases of the specified template
	ListTemplateRelease(ctx context.Context, templateName string) (Releases, error)
	// GetTemplateSchema get schema for a template release
	GetTemplateSchema(ctx context.Context, releaseID uint, params map[string]string) (*Schemas, error)
	// ListTemplateByGroupID lists all template available by group ID
	ListTemplateByGroupID(ctx context.Context, groupID uint, withoutCI bool) (Templates, error)
	// ListTemplateReleaseByTemplateID lists all releases of the specified template
	ListTemplateReleaseByTemplateID(ctx context.Context, templateID uint) (Releases, error)
	// CreateTemplate creates a template with a release under a group
	CreateTemplate(ctx context.Context, groupID uint, request CreateTemplateRequest) (*Template, error)
	// CreateRelease downloads template archive and push it to chatmusuem,
	// then creates a template release in database.
	CreateRelease(ctx context.Context, templateID uint, request CreateReleaseRequest) (*Release, error)
	// GetTemplate gets template by templateID
	GetTemplate(ctx context.Context, templateID uint) (*Template, error)
	// GetRelease gets release by releaseID
	GetRelease(ctx context.Context, releaseID uint) (*Release, error)
	// DeleteTemplate deletes a template by ID
	DeleteTemplate(ctx context.Context, templateID uint) error
	// DeleteRelease deletes a template release by ID
	DeleteRelease(ctx context.Context, releaseID uint) error
	// UpdateTemplate deletes a template by ID
	UpdateTemplate(ctx context.Context, templateID uint, request UpdateTemplateRequest) error
	// UpdateRelease deletes a template release by ID
	UpdateRelease(ctx context.Context, releaseID uint, request UpdateReleaseRequest) error
	// SyncReleaseToRepo downloads template from gitlab, packages the template and uploads it to chart repo
	SyncReleaseToRepo(ctx context.Context, releaseID uint) error
}

func NewController

func NewController(param *param.Param, repo templaterepo.TemplateRepo) Controller

NewController initializes a new controller

type CreateReleaseRequest

type CreateReleaseRequest struct {
	Name        string `json:"name"`
	Recommended bool   `json:"recommended"`
	Description string `json:"description"`
	OnlyOwner   bool   `json:"onlyOwner"`
}

type CreateTemplateRequest

type CreateTemplateRequest struct {
	// when creating template, user must create a release,
	// otherwise, it's a useless template.
	CreateReleaseRequest `json:"release"`
	Name                 string `json:"name"`
	Description          string `json:"description"`
	Repository           string `json:"repository"`
	Type                 string `json:"type"`
	OnlyOwner            bool   `json:"onlyOwner"`
}

type Release

type Release struct {
	ID             uint      `json:"id"`
	Name           string    `json:"name"`
	TemplateID     uint      `json:"templateID"`
	TemplateName   string    `json:"templateName"`
	ChartVersion   string    `json:"chartVersion"`
	Description    string    `json:"description"`
	Recommended    bool      `json:"recommended"`
	OnlyOwner      bool      `json:"onlyOwner"`
	CommitID       string    `json:"commitID"`
	SyncStatusCode uint8     `json:"syncStatusCode"`
	SyncStatus     string    `json:"syncStatus"`
	LastSyncAt     time.Time `json:"lastSyncAt"`
	FailedReason   string    `json:"failedReason"`
	CreatedAt      time.Time `json:"createdAt"`
	UpdatedAt      time.Time `json:"updatedAt"`
	CreatedBy      uint      `json:"createdBy"`
	UpdatedBy      uint      `json:"updatedBy"`
}

type Releases

type Releases []*Release

func (Releases) Len

func (r Releases) Len() int

func (Releases) Less

func (r Releases) Less(i, j int) bool

func (Releases) Swap

func (r Releases) Swap(i, j int)

type Schema

type Schema struct {
	JSONSchema map[string]interface{} `json:"jsonSchema"`
	UISchema   map[string]interface{} `json:"uiSchema"`
}

type Schemas

type Schemas struct {
	//
	Application *Schema `json:"application"`
	Pipeline    *Schema `json:"pipeline"`
}

type Template

type Template struct {
	ID          uint      `json:"id"`
	Name        string    `json:"name"`
	ChartName   string    `json:"chartName"`
	Description string    `json:"description"`
	Repository  string    `json:"repository"`
	Releases    Releases  `json:"releases,omitempty"`
	FullPath    string    `json:"fullPath,omitempty"`
	GroupID     uint      `json:"group"`
	OnlyOwner   bool      `json:"onlyOwner"`
	WithoutCI   bool      `json:"withoutCI"`
	Type        string    `json:"type"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
	CreatedBy   uint      `json:"createdBy"`
	UpdatedBy   uint      `json:"updatedBy"`
}

type Templates

type Templates []*Template

type UpdateReleaseRequest

type UpdateReleaseRequest struct {
	Name        string `json:"name"`
	Recommended *bool  `json:"recommended,omitempty"`
	Description string `json:"description"`
	OnlyOwner   bool   `json:"onlyOwner"`
}

type UpdateTemplateRequest

type UpdateTemplateRequest struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Repository  string `json:"repository"`
	OnlyOwner   bool   `json:"onlyOwner"`
	Type        string `json:"type"`
	WithoutCI   bool   `json:"withoutCI"`
}

Jump to

Keyboard shortcuts

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