endpoints

package
v1.1.0-rc Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: AGPL-3.0 Imports: 37 Imported by: 0

Documentation

Overview

Package endpoints 定义所有的 route handle.

Package endpoints cmdb api 逻辑处理层

Index

Constants

This section is empty.

Variables

View Source
var (
	// job/deployment列表的任务存在时间,默认7天
	TaskCleanDurationTimestamp int64 = 7 * 24 * 60 * 60
)

Functions

This section is empty.

Types

type Endpoints

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

Endpoints 定义 endpoint 方法

func New

func New(options ...Option) *Endpoints

New 创建 Endpoints 对象.

func (*Endpoints) CreateCluster

func (e *Endpoints) CreateCluster(ctx context.Context, r *http.Request, vars map[string]string) (httpserver.Responser, error)

CreateCluster 创建集群

func (*Endpoints) DBClient

func (e *Endpoints) DBClient() *dao.DBClient

DBClient 获取db client

func (*Endpoints) DealTaskEvent

func (e *Endpoints) DealTaskEvent(ctx context.Context, r *http.Request, vars map[string]string) (httpserver.Responser, error)

DealTaskEvent 接收任务的事件

func (*Endpoints) DeleteCluster

func (e *Endpoints) DeleteCluster(ctx context.Context, r *http.Request, vars map[string]string) (httpserver.Responser, error)

DeleteCluster 删除集群

func (*Endpoints) GetCluster

func (e *Endpoints) GetCluster(ctx context.Context, r *http.Request, vars map[string]string) (httpserver.Responser, error)

GetCluster 获取集群详情

func (*Endpoints) GetHost

func (e *Endpoints) GetHost(ctx context.Context, r *http.Request, vars map[string]string) (httpserver.Responser, error)

GetHost 获取指定集群下某个host的信息

func (*Endpoints) GetLocale

func (e *Endpoints) GetLocale(request *http.Request) *i18n.LocaleResource

GetLocale 获取本地化资源

func (*Endpoints) Health

func (e *Endpoints) Health(ctx context.Context, r *http.Request, vars map[string]string) (httpserver.Responser, error)

Component health check interface

func (*Endpoints) Info

func (e *Endpoints) Info(ctx context.Context, r *http.Request, vars map[string]string) (httpserver.Responser, error)

Info 用于健康检查

func (*Endpoints) ListCluster

func (e *Endpoints) ListCluster(ctx context.Context, r *http.Request, vars map[string]string) (httpserver.Responser, error)

ListCluster 获取集群列表(可按orgID过滤)

func (*Endpoints) ListEdasContainers

func (e *Endpoints) ListEdasContainers(ctx context.Context, r *http.Request, vars map[string]string) (httpserver.Responser, error)

ListEdasContainers 获取 edas 实例列表 (内部调用)

func (*Endpoints) ListOrgRunningTasks

func (e *Endpoints) ListOrgRunningTasks(ctx context.Context, r *http.Request, vars map[string]string) (httpserver.Responser, error)

ListOrgRunningTasks 指定企业获取服务或者job列表

func (*Endpoints) Routes

func (e *Endpoints) Routes() []httpserver.Endpoint

Routes 返回 endpoints 的所有 endpoint 方法,也就是 route.

func (*Endpoints) SyncHostResource

func (e *Endpoints) SyncHostResource(interval time.Duration)

SyncHostResource 定时同步主机实际使用资源

func (*Endpoints) SyncTaskStatus

func (e *Endpoints) SyncTaskStatus(interval time.Duration)

SyncTaskStatus 定时同步主机实际使用资源

func (*Endpoints) TaskClean

func (e *Endpoints) TaskClean(interval time.Duration)

TaskClean 定时清理任务(job/deployment)资源

func (*Endpoints) UCClient

func (e *Endpoints) UCClient() *ucauth.UCClient

func (*Endpoints) UpdateCluster

func (e *Endpoints) UpdateCluster(ctx context.Context, r *http.Request, vars map[string]string) (httpserver.Responser, error)

UpdateCluster 更新集群

func (*Endpoints) UpdateInstanceBySchedulerEvent

func (e *Endpoints) UpdateInstanceBySchedulerEvent(ctx context.Context, r *http.Request, vars map[string]string) (httpserver.Responser, error)

type Option

type Option func(*Endpoints)

func WithBundle

func WithBundle(bdl *bundle.Bundle) Option

WithBundle 配置 bundle

func WithCluster

func WithCluster(cluster *cluster.Cluster) Option

WithCluster 配置 cluster service

func WithContainer

func WithContainer(container *container.Container) Option

WithContainer 配置 container service

func WithDBClient

func WithDBClient(db *dao.DBClient) Option

WithDBClient 配置 db

func WithErrorBox

func WithErrorBox(errorbox *errorbox.ErrorBox) Option

func WithEtcdStore

func WithEtcdStore(etcdStore *etcd.Store) Option

WithEtcdStore 配置 etcdStore

func WithHost

func WithHost(host *host.Host) Option

WithHost 配置 host service

func WithJSONStore

func WithJSONStore(store jsonstore.JsonStore) Option

WithJSONStore 配置 jsonstore

func WithLicense

func WithLicense(license *license.License) Option

WithLicense 配置 license

func WithOSSClient

func WithOSSClient(client *oss.Client) Option

WithOSSClient 配置OSS Client

func WithOrg

func WithOrg(org *org.Org) Option

WithOrg 配置 org service

func WithQueryStringDecoder

func WithQueryStringDecoder(decoder *schema.Decoder) Option

WithQueryStringDecoder 配置 queryStringDecoder

func WithUCClient

func WithUCClient(uc *ucauth.UCClient) Option

WithUCClient 配置 UC Client

Jump to

Keyboard shortcuts

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