endpoints

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package endpoints 定义所有的 route handle.

Index

Constants

This section is empty.

Variables

This section is empty.

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) AddonConfigCallback

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

AddonConfigCallback addon provider配置回调接口

func (*Endpoints) AddonCreateCallback

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

AddonCreateCallback addon provider创建状态回调接口

func (*Endpoints) AddonDeleteCallback

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

AddonDeleteCallback addon provider删除状态回调接口

func (*Endpoints) AddonLogs

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

AddonLogs addon日志信息

func (*Endpoints) AddonMetrics

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

AddonMetrics addon链路转发监控信息

func (*Endpoints) AddonYmlExport

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

func (*Endpoints) AddonYmlImport

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

func (*Endpoints) CancelDeployment

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

CancelDeployment 取消部署

func (*Endpoints) CleanUnusedMigrationNs

func (e *Endpoints) CleanUnusedMigrationNs() (bool, error)

清理migration namespace

func (*Endpoints) CreateAddonDirectly

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

func (*Endpoints) CreateAddonTenant

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

func (*Endpoints) CreateCustomAddon

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

CreateCustomAddon 创建自定义 addon

func (*Endpoints) CreateRuntime

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

CreateRuntime 创建应用实例

func (*Endpoints) CreateRuntimeByRelease

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

CreateRuntimeByRelease 通过releaseId创建runtime

func (*Endpoints) CreateRuntimeByReleaseAction

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

func (*Endpoints) DeleteAddon

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

DeleteAddon 删除 addon

func (*Endpoints) DeleteRuntime

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

DeleteRuntime 删除应用实例

func (*Endpoints) DeployStagesAddons

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

func (*Endpoints) DeployStagesDomains

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

func (*Endpoints) DeployStagesServices

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

func (*Endpoints) DeploymentApprove

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

ApproveDeployment 审批 deployment

func (*Endpoints) FullGC

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

FullGC 触发全量 GC

func (*Endpoints) FullGCLoop

func (e *Endpoints) FullGCLoop(ctx context.Context)

func (*Endpoints) GetAddon

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

GetAddon 获取 addon 详情

func (*Endpoints) GetAddonReferences

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

GetAddonReferences 获取 addon 详情的引用列表

func (*Endpoints) GetAppWorkspaceReleases

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

GetAppWorkspaceReleases 获取应用某一环境下可部署的 releases

func (*Endpoints) GetClusterResourceReference

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

获取集群中service和addon的数量

func (*Endpoints) GetDeploymentStatus

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

GetDeploymentStatus 查询部署状态

func (*Endpoints) GetMiddleware

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

GetMiddleware 获取 middleware 详情

func (*Endpoints) GetMiddlewareAddonClassification

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

GetMiddlewareAddonClassification 获取 middleware addon分类资源占用

func (*Endpoints) GetMiddlewareAddonDaily

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

GetMiddlewareAddonDaily 获取 middleware 每日addon资源占用

func (*Endpoints) GetMiddlewareResource

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

GetMiddlewareResource 获取 middleware 资源详情

func (*Endpoints) GetProjectResource

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

获取项目资源信息,包括service和addon

func (*Endpoints) GetRuntime

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

GetRuntime 查询应用实例

func (*Endpoints) GetRuntimeSpec

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

func (*Endpoints) Info

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

Info 返回 orchestrator 描述

func (*Endpoints) InnerGetMiddleware

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

InnerGetMiddleware 内部获取middleware详情

func (*Endpoints) InstancesUsage

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

func (*Endpoints) KillPod

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

func (*Endpoints) ListAddon

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

ListAddon addon 列表 type=addon&value=<addonName> 按 addon 名称获取 addon 列表 type=category

func (*Endpoints) ListAddonMenu

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

ListAddonMenu addon menu 列表

func (*Endpoints) ListAppUsage

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

ListAppUsage 获取应用维度资源使用统计

func (*Endpoints) ListApprovedDeployments

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

func (*Endpoints) ListAvailableAddon

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

ListAvailableAddon dice.yml 编辑时列出可选 addon 列表

func (*Endpoints) ListByAddonName

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

ListByAddonName 通过addonName来控制

func (*Endpoints) ListCustomAddon

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

ListCustomAddon 添加第三方addon,先获取第三方addon列表

func (*Endpoints) ListDeployments

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

ListDeployments 查询部署列表

func (*Endpoints) ListDomains

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

ListDomains 查询域名列表

func (*Endpoints) ListExtensionAddon

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

ListExtensionAddon dice.yml 编辑时列出可选 extension 列表

func (*Endpoints) ListLaunchedApprovalDeployments

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

ListLaunchedApprovedDeployments 列出'user-id'用户发起审批的 deployments

func (*Endpoints) ListMicroServiceMenu

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

ListMicroServiceMenu 获取项目下的微服务菜单

func (*Endpoints) ListMicroServiceProject

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

ListMicroServiceProject 获取使用微服务的项目列表

func (*Endpoints) ListMiddleware

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

ListMiddlewares 获取 addon 真实实例列表

func (*Endpoints) ListPendingApprovalDeployments

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

ListPendingApprovalDeployments 列出待审批 deployments

func (*Endpoints) ListProjectUsage

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

ListProjectUsage 获取 project 资源分配列表

func (*Endpoints) ListRuntimeUsage

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

ListRuntimeUsage 获取 runtime 维度资源使用统计

func (*Endpoints) ListRuntimes

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

ListRuntimes 查询应用实例列表

func (*Endpoints) ListRuntimesGroupByApps added in v1.5.0

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

ListRuntimesGroupByApps responses the runtimes for the given apps.

func (*Endpoints) ListServiceInstance

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

ListServiceInstance 获取runtime 下服务实例列表

func (*Endpoints) ListServicePod

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

func (*Endpoints) ListServiceUsage

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

ListServiceUsage 获取 service 维度资源使用统计

func (*Endpoints) MigrationLog

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

MigrationLog migration log接口

func (*Endpoints) OrgcenterJobLogs

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

OrgcenterJobLogs 包装数据中心--->任务列表 日志

func (*Endpoints) PushOnDeletingRuntimes

func (e *Endpoints) PushOnDeletingRuntimes() (abort bool, err0 error)

func (*Endpoints) PushOnDeletingRuntimesPolling

func (e *Endpoints) PushOnDeletingRuntimesPolling() (abort bool, err0 error)

TODO: we should refactor the polling

func (*Endpoints) PushOnDeployment

func (e *Endpoints) PushOnDeployment() (bool, error)

func (*Endpoints) PushOnDeploymentPolling

func (e *Endpoints) PushOnDeploymentPolling() (abort bool, err0 error)

TODO: we should refactor the polling

func (*Endpoints) RedeployRuntime

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

RedeployRuntime 重新部署

func (*Endpoints) RedeployRuntimeAction

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

RedeployRuntime 重新部署, 给 action 调用的 endpoint

func (*Endpoints) ReferCluster

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

ReferCluster 查看 runtime & addon 是否有使用集群

func (*Endpoints) RemoveAddons

func (e *Endpoints) RemoveAddons() (bool, error)

RemoveAddons 同步市场 addons 信息

func (*Endpoints) RestartRuntime

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

RestartRuntime 重启应用实例

func (*Endpoints) RollbackRuntime

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

Rollback 回滚应用实例

func (*Endpoints) RollbackRuntimeAction

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

func (*Endpoints) Routes

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

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

func (*Endpoints) RuntimeLogs

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

runtimeLogs 包装runtime部署日志

func (*Endpoints) StartRuntime

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

StartRuntime 启动应用实例

func (*Endpoints) StopRuntime

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

StopRuntime 停止应用实例

func (*Endpoints) SyncAddonReferenceNum

func (e *Endpoints) SyncAddonReferenceNum() (bool, error)

func (*Endpoints) SyncAddonResources

func (e *Endpoints) SyncAddonResources() (bool, error)

func (*Endpoints) SyncAddons

func (e *Endpoints) SyncAddons() (bool, error)

SyncAddons 同步市场 addons 信息

func (*Endpoints) SyncDeployAddon

func (e *Endpoints) SyncDeployAddon() (bool, error)

SyncDeployAddon 检测是否有未正常结束的addon,重新同步

func (*Endpoints) SyncProjects

func (e *Endpoints) SyncProjects() (bool, error)

SyncProjects 同步project信息

func (*Endpoints) UpdateCustomAddon

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

UpdateCustomAddon 更新自定义 addon

func (*Endpoints) UpdateDomains

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

UpdateDomains 更新域名

type InstanceRequestType

type InstanceRequestType string

InstanceRequestType 获取实例输入的请求参数

const (
	INSTANCE_REQUEST_TYPE_PROJECT     InstanceRequestType = "project"
	INSTANCE_REQUEST_TYPE_APPLICATION InstanceRequestType = "application"
	INSTANCE_REQUEST_TYPE_SERVICE     InstanceRequestType = "service"
	INSTANCE_REQUEST_TYPE_RUNTIME     InstanceRequestType = "runtime"
)

type InstanceStatusEvent

type InstanceStatusEvent struct {
	TaskId string                 `json:"id"` // TaskId
	IP     string                 `json:"ip"`
	Status string                 `json:"instanceStatus"`
	Stage  string                 `json:"stage"`
	Extra  map[string]interface{} `json:"extra"`
}

type Option

type Option func(*Endpoints)

Option Endpoints 配置选项

func WithAddon

func WithAddon(addon *addon.Addon) Option

WithAddon 设置 addon service

func WithBundle

func WithBundle(bdl *bundle.Bundle) Option

WithBundle 配置 bundle

func WithDBClient

func WithDBClient(db *dbclient.DBClient) Option

WithDBClient 配置 db

func WithDeployment

func WithDeployment(deployment *deployment.Deployment) Option

WithDeployment 设置 deployment 对象.

func WithDomain

func WithDomain(domain *domain.Domain) Option

WithDomain 设置 domain 对象.

func WithEnvEncrypt

func WithEnvEncrypt(encrypt *encryption.EnvEncrypt) Option

WithEnvEncrypt 设置 encrypt service

func WithEventManager

func WithEventManager(evMgr *events.EventManager) Option

WithEventManager 配置 EventManager

func WithInstance

func WithInstance(instance *instance.Instance) Option

WithInstance 设置 instance 对象

func WithMigration

func WithMigration(migration *migration.Migration) Option

WithMigration 设置 migration service

func WithPool

func WithPool(pool *goroutinepool.GoroutinePool) Option

WithPool 配置 pool

func WithQueue

func WithQueue(queue *queue.PusherQueue) Option

WithQueue 配置 queue

func WithResource

func WithResource(resource *resource.Resource) Option

WithResource 设置 resource service

func WithRuntime

func WithRuntime(runtime *runtime.Runtime) Option

WithRuntime 设置 runtime 对象.

type RuntimeStatusEventReq

type RuntimeStatusEventReq struct {
	RuntimeName     string               `json:"runtimeName"`
	IsDeleted       bool                 `json:"isDeleted"`
	EventType       string               `json:"eventType"` // total(全量事件)/increment(增量事件)
	ServiceStatuses []ServiceStatusEvent `json:"serviceStatuses"`
}

type ServiceStatusEvent

type ServiceStatusEvent struct {
	ServiceName      string                `json:"serviceName"`
	Status           string                `json:"serviceStatus"`
	Replica          int                   `json:"replica"`
	InstanceStatuses []InstanceStatusEvent `json:"instanceStatuses"`
}

Jump to

Keyboard shortcuts

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