orchestrator

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ADDON_METRICS_HISTOGRAM = apis.ApiSpec{
	Path:        "/api/addon/metrics/charts/<scope>/histogram",
	BackendPath: "/api/metrics/charts/<scope>/histogram",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	CheckToken:  true,
	Doc:         "summary: 查询监控数据曲线图数据",
}
View Source
var ORCHESTRATOR_ADDON_AVAILABLE = apis.ApiSpec{
	Path:         "/api/addons/actions/list-available",
	BackendPath:  "/api/addons/actions/list-available",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	RequestType:  apistructs.AddonAvailableRequest{},
	ResponseType: apistructs.AddonAvailableResponse{},
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	Doc:          `summary: 获取可选 adon 列表(diceyml编辑时)`,
}
View Source
var ORCHESTRATOR_ADDON_CREATE = apis.ApiSpec{
	Path:        "/api/addons/actions/create-addon",
	BackendPath: "/api/addons/actions/create-addon",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	RequestType: apistructs.AddonDirectCreateRequest{},
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         `summary: 创建 addon`,
}
View Source
var ORCHESTRATOR_ADDON_CREATE_CUSTOM = apis.ApiSpec{
	Path:        "/api/addons/actions/create-custom",
	BackendPath: "/api/addons/actions/create-custom",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	RequestType: apistructs.CustomAddonCreateRequest{},
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         `summary: 创建自定义 addon`,
	Audit: func(ctx *spec.AuditContext) error {
		var reqBody apistructs.CustomAddonCreateRequest
		if err := ctx.BindRequestData(&reqBody); err != nil {
			return err
		}
		project, err := ctx.Bundle.GetProject(reqBody.ProjectID)
		if err != nil {
			return err
		}
		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.ProjectScope,
			ScopeID:      project.ID,
			ProjectID:    project.ID,
			TemplateName: apistructs.CreateCustomAddonTemplate,
			Context: map[string]interface{}{
				"addonName":   fmt.Sprintf("%s/%s", reqBody.AddonName, reqBody.Name),
				"projectName": project.Name,
				"projectId":   fmt.Sprintf("%d", project.ID),
			},
		})
	},
}
View Source
var ORCHESTRATOR_ADDON_CUSTOM = apis.ApiSpec{
	Path:        "/api/addons/actions/list-customs",
	BackendPath: "/api/addons/actions/list-customs",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	CheckToken:  true,
	Doc:         `summary: 获取第三方addon信息`,
}
View Source
var ORCHESTRATOR_ADDON_DELETE = apis.ApiSpec{
	Path:         "/api/addons/<addonId>",
	BackendPath:  "/api/addons/<addonId>",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "DELETE",
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	ResponseType: apistructs.AddonFetchResponse{},
	Doc:          `summary: 删除 addon`,
	Audit: func(ctx *spec.AuditContext) error {
		var resp apistructs.AddonFetchResponse
		if err := ctx.BindResponseData(&resp); err != nil {
			return err
		}
		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.ProjectScope,
			ScopeID:      resp.Data.ProjectID,
			ProjectID:    resp.Data.ProjectID,
			TemplateName: apistructs.DeleteAddonTemplate,
			Context: map[string]interface{}{
				"addonName":   fmt.Sprintf("%s/%s", resp.Data.AddonName, resp.Data.Name),
				"projectName": resp.Data.ProjectName,
				"projectId":   resp.Data.ProjectID,
			},
		})
	},
}
View Source
var ORCHESTRATOR_ADDON_EXPORT = apis.ApiSpec{
	Path:        "/api/addon/action/yml-export",
	BackendPath: "/api/addon/action/yml-export",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         `summary: 导出addon yml`,
}
View Source
var ORCHESTRATOR_ADDON_EXTENSION = apis.ApiSpec{
	Path:         "/api/addons/actions/list-extension",
	BackendPath:  "/api/addons/actions/list-extension",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	ResponseType: apistructs.AddonExtensionResponse{},
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	Doc:          `summary: 获取可选 extension 列表(diceyml编辑时)`,
}
View Source
var ORCHESTRATOR_ADDON_FETCH = apis.ApiSpec{
	Path:         "/api/addons/<addonId>",
	BackendPath:  "/api/addons/<addonId>",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	ResponseType: apistructs.AddonFetchResponse{},
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	Doc:          `summary: 获取 addon 详情`,
}
View Source
var ORCHESTRATOR_ADDON_IMPORT = apis.ApiSpec{
	Path:        "/api/addon/action/yml-import",
	BackendPath: "/api/addon/action/yml-import",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         `summary: 导入addon yml`,
}
View Source
var ORCHESTRATOR_ADDON_LIST = apis.ApiSpec{
	Path:         "/api/addons",
	BackendPath:  "/api/addons",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	RequestType:  apistructs.AddonListRequest{},
	ResponseType: apistructs.AddonListResponse{},
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	Doc:          `summary: addon 列表`,
}
View Source
var ORCHESTRATOR_ADDON_LOGS = apis.ApiSpec{
	Path:        "/api/addons/<instanceId>/logs",
	BackendPath: "/api/addons/<instanceId>/logs",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         `summary: addon 日志`,
}
View Source
var ORCHESTRATOR_ADDON_MENU = apis.ApiSpec{
	Path:        "/api/addons/actions/menu",
	BackendPath: "/api/addons/actions/menu",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	IsOpenAPI:   true,
	Doc:         `summary: 获取 addon 分类菜单`,
}
View Source
var ORCHESTRATOR_ADDON_REFERENCES = apis.ApiSpec{
	Path:         "/api/addons/<addonID>/actions/references",
	BackendPath:  "/api/addons/<addonID>/actions/references",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	ResponseType: apistructs.AddonReferencesResponse{},
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	Doc:          `summary: 获取 addon 引用列表`,
}
View Source
var ORCHESTRATOR_ADDON_TENANT_CREATE = apis.ApiSpec{
	Path:        "/api/addons/actions/create-tenant",
	BackendPath: "/api/addons/actions/create-tenant",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	RequestType: apistructs.AddonTenantCreateRequest{},
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         `summary: 创建 addon tenant`,
}
View Source
var ORCHESTRATOR_ADDON_UPDATE_CUSTOM = apis.ApiSpec{
	Path:        "/api/addons/<addonId>/actions/update-custom",
	BackendPath: "/api/addons/<addonId>/actions/update-custom",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "PUT",
	RequestType: apistructs.CustomAddonUpdateRequest{},
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         `summary: 更新自定义 addon`,
}
View Source
var ORCHESTRATOR_CLUSTER_INSTANCES_USAGE = apis.ApiSpec{
	Path:        "/api/cmdb/clusters/<cluster>/instances-usage",
	BackendPath: "/api/clusters/<cluster>/instances-usage",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc: `
summary: 获取某类实例集合的资源使用情况
parameters:
  - in: path
    name: cluster
    type: string
    required: true
    description: 集群名或者ID
  - in: query
    name: type
    type: string
    required: true
    enum: [cluster, host, project, application, runtime, service, component, addon]
    description: 指定请求实例的类型
    example: project
  - in: query
    name: host
    type: string
    description: type 等于 host时,若输入 host,则获取指定 host 信息;如果没有输入,则获取整个集群所有的 hosts 信息
  - in: query
    name: project
    type: string
    description: type 等于 project时,若输入 project,则获取指定 project 实例信息;如果没有输入,则获取整个集群所有的 projects 实例信息
  - in: query
    name: application
    type: string
    description: type 等于 application时,若输入 application,则获取指定 application 实例信息;如果没有输入,则获取整个集群所有的 applications 实例信息
  - in: query
    name: runtime
    type: string
    description: type 等于 runtime时,若输入 runtime,则获取指定 runtime 实例信息;如果没有输入,则获取整个集群所有的 runtimes 实例信息
  - in: query
    name: service
    type: string
    description: type 等于 service时,输入 runtime 必要参数。若输入 service,则获取指定 service 实例信息;如果没有输入,则获取指定runtime下所有的 services 实例信息
  - in: query
    name: component
    type: string
    description: type 等于 component时。若输入 component,则获取指定 component 实例信息;如果没有输入,则获取指定集群所有的 component 实例信息
  - in: query
    name: addon
    type: string
    description: type 等于 addon时。若输入 addon,则获取指定 addon 实例信息;如果没有输入,则获取指定集群所有的 addon 实例信息
produces:
  - application/json

responses:
  '200':
    description: OK
    schema:
      type: string
      example: 参考 https://yuque.antfin-inc.com/terminus_paas_dev/paas/gosn9b#va3psl
components:
  schemas:
    ComponentUsage:
      type: object
      properties:
        name:
            type: string
            description: 组件名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    AddonUsage:
      type: object
      properties:
        name:
            type: string
            description: 组件名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    ProjectUsage:
      type: object
      properties:
        id:
            type: string
            description: 项目ID
        name:
            type: string
            description: 项目名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    ApplicationUsage:
      type: object
      properties:
        id:
            type: string
            description: 应用ID
        name:
            type: string
            description: 应用名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    RuntimeUsage:
      type: object
      properties:
        id:
            type: string
            description: runtime ID
        name:
            type: string
            description: runtime名
        application:
            type: string
            description: 应用名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    ServiceUsage:
      type: object
      properties:
        name:
            type: string
            description: service名
        runtime:
            type: string
            description: runtime名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
`,
}
View Source
var ORCHESTRATOR_DEPLOYMENT_ADDONS = apis.ApiSpec{
	Path:        "/api/deployments/<deploymentID>/actions/deploy-addons",
	BackendPath: "/api/deployments/<deploymentID>/actions/deploy-addons",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	CheckToken:  true,
	Doc:         `部署 addon 步骤`,
}
View Source
var ORCHESTRATOR_DEPLOYMENT_APPROVE = apis.ApiSpec{
	Path:         "/api/deployments/actions/approve",
	BackendPath:  "/api/deployments/actions/approve",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	CheckToken:   true,
	RequestType:  apistructs.DeploymentApproveRequest{},
	ResponseType: apistructs.DeploymentApproveResponse{},
	Doc:          `审批部署`,
}
View Source
var ORCHESTRATOR_DEPLOYMENT_CANCEL = apis.ApiSpec{
	Path:         "/api/deployments/<deploymentId>/actions/cancel",
	BackendPath:  "/api/deployments/<deploymentId>/actions/cancel",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   false,
	RequestType:  apistructs.DeploymentCancelRequest{},
	ResponseType: apistructs.DeploymentCancelResponse{},
	Doc:          `取消部署`,
}
View Source
var ORCHESTRATOR_DEPLOYMENT_DOMAINS = apis.ApiSpec{
	Path:        "/api/deployments/<deploymentID>/actions/deploy-domains",
	BackendPath: "/api/deployments/<deploymentID>/actions/deploy-domains",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	CheckToken:  true,
	Doc:         `部署 domains 步骤`,
}
View Source
var ORCHESTRATOR_DEPLOYMENT_LIST = apis.ApiSpec{
	Path:         "/api/deployments",
	BackendPath:  "/api/deployments",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	CheckToken:   true,
	RequestType:  apistructs.DeploymentListRequest{},
	ResponseType: apistructs.DeploymentListResponse{},
	Doc:          `查询部署列表`,
}
View Source
var ORCHESTRATOR_DEPLOYMENT_LIST_APPROVED = apis.ApiSpec{
	Path:         "/api/deployments/actions/list-approved",
	BackendPath:  "/api/deployments/actions/list-approved",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.DeploymentDetailListResponse{},
	Doc:          `查询已审批列表`,
}
View Source
var ORCHESTRATOR_DEPLOYMENT_LIST_LAUNCHED_APPROVAL = apis.ApiSpec{
	Path:         "/api/deployments/actions/list-launched-approval",
	BackendPath:  "/api/deployments/actions/list-launched-approval",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.DeploymentDetailListResponse{},
	Doc:          `查询'user-id'发起的部署审批列表`,
}
View Source
var ORCHESTRATOR_DEPLOYMENT_LIST_PENDING_APPROVAL = apis.ApiSpec{
	Path:         "/api/deployments/actions/list-pending-approval",
	BackendPath:  "/api/deployments/actions/list-pending-approval",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.DeploymentDetailListResponse{},
	Doc:          `查询待审批列表`,
}
View Source
var ORCHESTRATOR_DEPLOYMENT_QUERY_STATUS = apis.ApiSpec{
	Path:        "/api/deployments/<deploymentId>/status",
	BackendPath: "/api/deployments/<deploymentId>/status",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckToken:  true,
	CheckLogin:  true,
	Doc: `
summary: 查询部署状态
`,
}
View Source
var ORCHESTRATOR_DEPLOYMENT_SERVICES = apis.ApiSpec{
	Path:        "/api/deployments/<deploymentID>/actions/deploy-services",
	BackendPath: "/api/deployments/<deploymentID>/actions/deploy-services",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	CheckToken:  true,
	Doc:         `部署 service 步骤`,
}
View Source
var ORCHESTRATOR_GET_APP_WORKSPACE_RELEASES = apis.ApiSpec{
	Path:         "/api/runtimes/actions/get-app-workspace-releases",
	BackendPath:  "/api/runtimes/actions/get-app-workspace-releases",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.AppWorkspaceReleasesGetRequest{},
	ResponseType: apistructs.AppWorkspaceReleasesGetResponse{},
}
View Source
var ORCHESTRATOR_INSTANCES_USAGE = apis.ApiSpec{
	Path:        "/api/instances-usage",
	BackendPath: "/api/instances-usage",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc: `
summary: 获取某类实例集合的资源使用情况
parameters:
  - in: path
    name: cluster
    type: string
    required: true
    description: 集群名或者ID
  - in: query
    name: type
    type: string
    required: true
    enum: [cluster, host, project, application, runtime, service, component, addon]
    description: 指定请求实例的类型
    example: project
  - in: query
    name: host
    type: string
    description: type 等于 host时,若输入 host,则获取指定 host 信息;如果没有输入,则获取整个集群所有的 hosts 信息
  - in: query
    name: project
    type: string
    description: type 等于 project时,若输入 project,则获取指定 project 实例信息;如果没有输入,则获取整个集群所有的 projects 实例信息
  - in: query
    name: application
    type: string
    description: type 等于 application时,若输入 application,则获取指定 application 实例信息;如果没有输入,则获取整个集群所有的 applications 实例信息
  - in: query
    name: runtime
    type: string
    description: type 等于 runtime时,若输入 runtime,则获取指定 runtime 实例信息;如果没有输入,则获取整个集群所有的 runtimes 实例信息
  - in: query
    name: service
    type: string
    description: type 等于 service时,输入 runtime 必要参数。若输入 service,则获取指定 service 实例信息;如果没有输入,则获取指定runtime下所有的 services 实例信息
  - in: query
    name: component
    type: string
    description: type 等于 component时。若输入 component,则获取指定 component 实例信息;如果没有输入,则获取指定集群所有的 component 实例信息
  - in: query
    name: addon
    type: string
    description: type 等于 addon时。若输入 addon,则获取指定 addon 实例信息;如果没有输入,则获取指定集群所有的 addon 实例信息
produces:
  - application/json

responses:
  '200':
    description: OK
    schema:
      type: string
      example: 参考 https://yuque.antfin-inc.com/terminus_paas_dev/paas/gosn9b#va3psl
components:
  schemas:
    ComponentUsage:
      type: object
      properties:
        name:
            type: string
            description: 组件名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    AddonUsage:
      type: object
      properties:
        name:
            type: string
            description: 组件名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    ProjectUsage:
      type: object
      properties:
        id:
            type: string
            description: 项目ID
        name:
            type: string
            description: 项目名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    ApplicationUsage:
      type: object
      properties:
        id:
            type: string
            description: 应用ID
        name:
            type: string
            description: 应用名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    RuntimeUsage:
      type: object
      properties:
        id:
            type: string
            description: runtime ID
        name:
            type: string
            description: runtime名
        application:
            type: string
            description: 应用名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
    ServiceUsage:
      type: object
      properties:
        name:
            type: string
            description: service名
        runtime:
            type: string
            description: runtime名
        instance:
            type: integer
            description: 实例数
        memory:
            type: number
            format: double
            description: 分配的内存(MB)
        cpu:
            type: number
            format: double
            description: 分配的cpu数
        disk:
            type: number
            format: double
            description: 分配的磁盘空间(MB)
`,
}
View Source
var ORCHESTRATOR_MICRO_SERVICE_MENUS = apis.ApiSpec{
	Path:         "/api/microservice/project/<projectID>/menus",
	BackendPath:  "/api/microservice/project/<projectID>/menus",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	ResponseType: apistructs.MicroServiceMenuResponseData{},
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	Doc:          `summary: 项目对应微服务菜单`,
	Group:        "addons",
}
View Source
var ORCHESTRATOR_MICRO_SERVICE_PROJECTS = apis.ApiSpec{
	Path:         "/api/microservice/projects",
	BackendPath:  "/api/microservice/projects",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	ResponseType: apistructs.MicroServiceProjectResponse{},
	Custom:       attachProjectParams,
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	Doc:          `summary: 微服务项目列表`,
	Group:        "addons",
}
View Source
var ORCHESTRATOR_MIDDLEWARE_ADDON_CLASSIFICATION = apis.ApiSpec{
	Path:        "/api/middlewares/resource/classification",
	BackendPath: "/api/middlewares/resource/classification",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	RequestType: apistructs.MiddlewareListRequest{},
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         `summary: middleware addon分类资源占用`,
	Group:       "addons",
}
View Source
var ORCHESTRATOR_MIDDLEWARE_DAILY = apis.ApiSpec{
	Path:        "/api/middlewares/resource/daily",
	BackendPath: "/api/middlewares/resource/daily",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	RequestType: apistructs.MiddlewareListRequest{},
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         `summary: middleware addon每日资源占用`,
	Group:       "addons",
}
View Source
var ORCHESTRATOR_MIDDLEWARE_FETCH = apis.ApiSpec{
	Path:         "/api/middlewares/<addonId>",
	BackendPath:  "/api/middlewares/<addonId>",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	ResponseType: apistructs.MiddlewareFetchResponse{},
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	Doc:          `summary: middleware 详情`,
	Group:        "addons",
}
View Source
var ORCHESTRATOR_MIDDLEWARE_FETCH_RESOURCE = apis.ApiSpec{
	Path:         "/api/middlewares/<addonId>/actions/get-resource",
	BackendPath:  "/api/middlewares/<addonId>/actions/get-resource",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	ResponseType: apistructs.MiddlewareResourceFetchResponse{},
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	Doc:          `summary: middleware 资源详情`,
	Group:        "addons",
}
View Source
var ORCHESTRATOR_MIDDLEWARE_LIST = apis.ApiSpec{
	Path:         "/api/middlewares",
	BackendPath:  "/api/middlewares",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	RequestType:  apistructs.MiddlewareListRequest{},
	ResponseType: apistructs.MiddlewareListResponse{},
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	Doc:          `summary: middleware 列表`,
	Group:        "addons",
}
View Source
var ORCHESTRATOR_MIGRATION_LOG = apis.ApiSpec{
	Path:        "/api/migration/<migrationId>/logs",
	BackendPath: "/api/migration/<migrationId>/logs",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         `summary: 通过migrationId,获取migration执行日志'`,
}
View Source
var ORCHESTRATOR_ORG_JOB_LOG = apis.ApiSpec{
	Path:        "/api/orgCenter/job/logs",
	BackendPath: "/api/orgCenter/job/logs",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         `summary: orgcenter job logs'`,
}
View Source
var ORCHESTRATOR_PRE_DICE_OVERLAY_UPDATE = apis.ApiSpec{
	Path:        "/api/runtimes/actions/update-pre-overlay",
	BackendPath: "/api/runtimes/actions/update-pre-overlay",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "PUT",
	CheckLogin:  true,
	Doc: `
summary: 更新 pre dice overlay
`,
	Audit: func(ctx *spec.AuditContext) error {
		var (
			resp struct{ Data apistructs.PreDiceDTO }
			req  apistructs.PreDiceDTO
		)
		if err := ctx.BindRequestData(&req); err != nil {
			return err
		}
		if err := ctx.BindResponseData(&resp); err != nil {
			return err
		}

		appID, err := strconv.ParseUint(ctx.Request.URL.Query().Get("applicationId"), 10, 64)
		if err != nil {
			return err
		}

		audit := &apistructs.Audit{
			ScopeType:    apistructs.AppScope,
			ScopeID:      appID,
			TemplateName: apistructs.ScaleRuntimeTemplate,
			Context:      make(map[string]interface{}, 0),
		}

		for serviceName := range req.Services {
			audit.Context["serviceName"] = serviceName
			audit.Context["scaleMessageZH"], audit.Context["scaleMessageEN"] = genScaleMessage(resp.Data.Services[serviceName], req.Services[serviceName])
			if err := ctx.CreateAudit(audit); err != nil {
				return err
			}
		}

		return nil
	},
}
View Source
var ORCHESTRATOR_RUNTIME_BULK_GET_STATUS = apis.ApiSpec{
	Path:        "/api/runtimes/actions/bulk-get-status",
	BackendPath: "/api/runtimes/actions/bulk-get-status",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	CheckToken:  true,
	Doc: `
summary: 批量查询 ServiceGroup Status
`,
}
View Source
var ORCHESTRATOR_RUNTIME_CREATE = apis.ApiSpec{
	Path:        "/api/runtimes",
	BackendPath: "/api/runtimes",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  false,
	Doc: `
summary: 创建 Runtime
consumes:
  - application/json
parameters:
  - in: body
    description: runtime to create
    schema:
      type: object
      properties:
        name:
          type: string
          description: Runtime Name (pipeline 请用分支名)
        releaseId:
          type: string
          description: diceHub 的 releaseId
        operator:
          type: string
          description: 操作人用户 ID
        clusterName:
          type: string
          description: 告知发布的集群 (aka "az")
        source:
          type: string
          description: PIPELINE / RUNTIMEADDON / ABILITY
        extra:
          type: object
          description: |
            格式为 key(string) / value(object):

                {
                  "k1": "v1",
                  "k2": 123,
                  "k3": ["1", "2", "3"],
                  "k4": {
                    "f1": "g1",
                    "f2": "g2"
                  }
                }

            若为 PIPELINE, 需要传
              - orgId (integer)
              - projectId (integer)
              - applicationId (integer)
              - workspace
              - buildId (integer)

            若为 RUNTIMEADDON, 需要传
              - orgId (integer)
              - projectId (integer)
              - applicationId (integer)
              - workspace
              - instanceId (string)

            若为 ABILITY, 需要传
              - orgId (integer)
              - applicationId (integer) 或 applicationName (自动创建 application)
              - workspace
              - clusterId (string)
              - addonActions (map[string]interface{})
produces:
  - application/json
responses:
  '200':
    description: ok
    schema:
      type: object
      properties:
        success:
          type: boolean
        err:
          type: object
          properties:
            code:
              type: string
            msg:
              type: string
            ctx:
              type: object
        data:
          type: object
          properties:
            deploymentId:
              type: integer
            applicationId:
              type: integer
            runtimeId:
              type: integer
  '400':
    description: bad request
`,
}
View Source
var ORCHESTRATOR_RUNTIME_DELETE = apis.ApiSpec{
	Path:         "/api/runtimes/<runtimeId>",
	BackendPath:  "/api/runtimes/<runtimeId>",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "DELETE",
	CheckLogin:   true,
	CheckToken:   true,
	ResponseType: apistructs.RuntimeDeleteResponse{},
	Doc:          `删除应用实例`,
	Audit: func(ctx *spec.AuditContext) error {
		var resp apistructs.RuntimeDeleteResponse
		if err := ctx.BindResponseData(&resp); err != nil {
			return err
		}
		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.AppScope,
			ScopeID:      resp.Data.ApplicationID,
			TemplateName: apistructs.DeleteRuntimeTemplate,
			Context: map[string]interface{}{
				"runtimeName":     resp.Data.Name,
				"applicationName": resp.Data.ApplicationName,
				"workspace":       resp.Data.Workspace,
				"projectId":       fmt.Sprintf("%d", resp.Data.ProjectID),
				"appId":           fmt.Sprintf("%d", resp.Data.ApplicationID),
			},
		})
	},
}
View Source
var ORCHESTRATOR_RUNTIME_DEPLOY_LOG = apis.ApiSpec{
	Path:        "/api/runtimes/deploy/logs",
	BackendPath: "/api/runtimes/deploy/logs",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         `summary: runtime deploy logs'`,
}
View Source
var ORCHESTRATOR_RUNTIME_DOMAIN_GET = apis.ApiSpec{
	Path:         "/api/runtimes/<runtimeId>/domains",
	BackendPath:  "/api/runtimes/<runtimeId>/domains",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.DomainListRequest{},
	ResponseType: apistructs.DomainListResponse{},
	Doc:          `获取 Runtime 域名`,
}
View Source
var ORCHESTRATOR_RUNTIME_DOMAIN_UPDATE = apis.ApiSpec{
	Path:         "/api/runtimes/<runtimeId>/domains",
	BackendPath:  "/api/runtimes/<runtimeId>/domains",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "PUT",
	CheckLogin:   true,
	RequestType:  apistructs.DomainUpdateRequest{},
	ResponseType: apistructs.DomainUpdateResponse{},
	Doc:          `更新 Runtime 域名`,
}
View Source
var ORCHESTRATOR_RUNTIME_INSPECT = apis.ApiSpec{
	Path:         "/api/runtimes/<idOrName>",
	BackendPath:  "/api/runtimes/<idOrName>",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	CheckToken:   true,
	RequestType:  apistructs.RuntimeInspectRequest{},
	ResponseType: apistructs.RuntimeInspectResponse{},
	Doc:          `查询 Runtime`,
	IsOpenAPI:    true,
}
View Source
var ORCHESTRATOR_RUNTIME_INSPECT_SERVICEGROUP = apis.ApiSpec{
	Path:        "/api/runtimes/<runtimeId>/configuration",
	BackendPath: "/api/runtimes/<runtimeId>/configuration",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	CheckToken:  true,
	Doc: `
summary: 查询 ServiceGroup configuration
`,
}
View Source
var ORCHESTRATOR_RUNTIME_KILLPOD = apis.ApiSpec{
	Path:        "/api/runtimes/actions/killpod",
	BackendPath: "/api/runtimes/actions/killpod",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	RequestType: apistructs.RuntimeKillPodRequest{},
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         `删除指定 pod`,
}
View Source
var ORCHESTRATOR_RUNTIME_REDEPLOY = apis.ApiSpec{
	Path:        "/api/runtimes/<runtimeId>/actions/redeploy",
	BackendPath: "/api/runtimes/<runtimeId>/actions/redeploy",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	Doc: `
summary: 重新部署 Runtime (必须要已经部署过一次)
consumes:
  - application/json
parameters:
  - in: path
    name: runtimeId
    type: integer
    required: true
    description: Runtime Id
produces:
  - application/json
responses:
  '200':
    description: ok
    schema:
      type: object
      properties:
        success:
          type: boolean
        err:
          type: object
          properties:
            code:
              type: string
            msg:
              type: string
            ctx:
              type: object
        data:
          type: object
          properties:
            deploymentId:
              type: integer
            applicationId:
              type: integer
            runtimeId:
              type: integer
  '400':
    description: bad request
`,
	Audit: func(ctx *spec.AuditContext) error {
		var resp apistructs.RuntimeDeployResponse

		if err := ctx.BindResponseData(&resp); err != nil {
			return err
		}
		for _, v := range resp.Data.ServicesNames {
			err := ctx.CreateAudit(&apistructs.Audit{
				ScopeType:    apistructs.AppScope,
				ScopeID:      resp.Data.ApplicationID,
				TemplateName: apistructs.RedeployRuntimeTemplate,
				Context: map[string]interface{}{
					"projectId":   resp.Data.ProjectID,
					"appId":       resp.Data.ApplicationID,
					"projectName": resp.Data.ProjectName,
					"appName":     resp.Data.ApplicationName,
					"serviceName": v,
				},
			})
			if err != nil {
				return err
			}
		}
		return nil
	},
}
View Source
var ORCHESTRATOR_RUNTIME_REDEPLOY_ACTION = apis.ApiSpec{
	Path:        "/api/runtimes/<runtimeId>/actions/redeploy-action",
	BackendPath: "/api/runtimes/<runtimeId>/actions/redeploy-action",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	CheckToken:  true,
	Doc:         `redeploy 的 action 调用 api`,
}
View Source
var ORCHESTRATOR_RUNTIME_RELEASE_CREATE = apis.ApiSpec{
	Path:         "/api/runtimes/actions/deploy-release",
	BackendPath:  "/api/runtimes/actions/deploy-release",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "POST",
	RequestType:  apistructs.RuntimeReleaseCreateRequest{},
	ResponseType: apistructs.RuntimeReleaseCreatePipelineResponse{},
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	Doc:          "summary: 通过releaseId创建runtime",
	Audit: func(ctx *spec.AuditContext) error {
		var resp apistructs.RuntimeDeployResponse

		if err := ctx.BindResponseData(&resp); err != nil {
			return err
		}

		for _, v := range resp.Data.ServicesNames {
			err := ctx.CreateAudit(&apistructs.Audit{
				ScopeType:    apistructs.AppScope,
				ScopeID:      resp.Data.ApplicationID,
				TemplateName: apistructs.DeployRuntimeTemplate,
				Context: map[string]interface{}{
					"projectId":   resp.Data.ProjectID,
					"appId":       resp.Data.ApplicationID,
					"projectName": resp.Data.ProjectName,
					"appName":     resp.Data.ApplicationName,
					"serviceName": v,
				},
			})
			if err != nil {
				return err
			}
		}
		return nil
	},
}
View Source
var ORCHESTRATOR_RUNTIME_RELEASE_CREATE_ACTION = apis.ApiSpec{
	Path:         "/api/runtimes/actions/deploy-release-action",
	BackendPath:  "/api/runtimes/actions/deploy-release-action",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "POST",
	RequestType:  apistructs.RuntimeReleaseCreateRequest{},
	ResponseType: apistructs.RuntimeCreateResponse{},
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
}
View Source
var ORCHESTRATOR_RUNTIME_ROLLBACK = apis.ApiSpec{
	Path:        "/api/runtimes/<runtimeId>/actions/rollback",
	BackendPath: "/api/runtimes/<runtimeId>/actions/rollback",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	Doc: `
summary: 回滚 Runtime (只能回滚到成功的部署单)
consumes:
  - application/json
parameters:
  - in: path
    name: runtimeId
    type: integer
    required: true
    description: Runtime Id
  - in: body
    description: rollback body
    schema:
      type: object
      properties:
        deploymentId:
          type: int
          description: Deployment Id
produces:
  - application/json
responses:
  '200':
    description: ok
    schema:
      type: object
      properties:
        success:
          type: boolean
        err:
          type: object
          properties:
            code:
              type: string
            msg:
              type: string
            ctx:
              type: object
        data:
          type: object
          properties:
            deploymentId:
              type: integer
            applicationId:
              type: integer
            runtimeId:
              type: integer
  '400':
    description: bad request
`,
	Audit: func(ctx *spec.AuditContext) error {
		var resp apistructs.RuntimeDeployResponse

		if err := ctx.BindResponseData(&resp); err != nil {
			return err
		}
		for _, v := range resp.Data.ServicesNames {
			err := ctx.CreateAudit(&apistructs.Audit{
				ScopeType:    apistructs.AppScope,
				ScopeID:      resp.Data.ApplicationID,
				TemplateName: apistructs.RollbackRuntimeTemplate,
				Context: map[string]interface{}{
					"projectId":   resp.Data.ProjectID,
					"appId":       resp.Data.ApplicationID,
					"projectName": resp.Data.ProjectName,
					"appName":     resp.Data.ApplicationName,
					"serviceName": v,
				},
			})
			if err != nil {
				return err
			}
		}
		return nil
	},
}
View Source
var ORCHESTRATOR_RUNTIME_ROLLBACK_ACTION = apis.ApiSpec{
	Path:        "/api/runtimes/<runtimeId>/actions/rollback-action",
	BackendPath: "/api/runtimes/<runtimeId>/actions/rollback-action",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	CheckToken:  true,
	Doc:         `rollback 的 action 调用 api`,
}
View Source
var ORCHESTRATOR_RUNTIME_SEARCH = apis.ApiSpec{
	Path:        "/api/runtimes",
	BackendPath: "/api/runtimes",
	Host:        "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	CheckToken:  true,
	Doc: `
summary: 搜索 Runtime
`,
}
View Source
var ORCHESTRATOR_SERVICE_INSTANCE_LIST = apis.ApiSpec{
	Path:         "/api/instances/actions/get-service",
	BackendPath:  "/api/instances/actions/get-service",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	RequestType:  apistructs.ContainerListRequest{},
	ResponseType: apistructs.ContainerListResponse{},
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	Doc:          `summary: runtime 下 service  实例列表`,
}
View Source
var ORCHESTRATOR_SERVICE_POD_LIST = apis.ApiSpec{
	Path:         "/api/instances/actions/get-service-pods",
	BackendPath:  "/api/instances/actions/get-service-pods",
	Host:         "orchestrator.marathon.l4lb.thisdcos.directory:8081",
	Scheme:       "http",
	Method:       "GET",
	RequestType:  apistructs.PodListRequest{},
	ResponseType: apistructs.PodListResponse{},
	CheckLogin:   true,
	CheckToken:   true,
	IsOpenAPI:    true,
	Doc:          `summary: runtime 下 service pod 列表`,
}

Functions

func Err

func Err(w http.ResponseWriter, err *apistructs.ErrorResponse, httpCode int)

func ErrFromError

func ErrFromError(w http.ResponseWriter, error error)

func Succ

func Succ(w http.ResponseWriter, data interface{})

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

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