cmp

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: AGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CMP_ADDON_CONFIG = apis.ApiSpec{
	Path:         "/api/addons/actions/config",
	BackendPath:  "/api/addons/actions/config",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.AddonConfigRequest{},
	ResponseType: apistructs.AddonConfigResponse{},
	Doc:          "Addon 运行配置参数获取",
}
View Source
var CMP_ADDON_CONFIG_UPDATE = apis.ApiSpec{
	Path:         "/api/addons/actions/config",
	BackendPath:  "/api/addons/actions/config",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.AddonConfigUpdateRequest{},
	ResponseType: apistructs.AddonConfigUpdateResponse{},
	Doc:          "Addon 运行配置参数更新",
}
View Source
var CMP_ADDON_SCALE = apis.ApiSpec{
	Path:         "/api/addons/actions/scale",
	BackendPath:  "/api/addons/actions/scale",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.AddonScaleRequest{},
	ResponseType: apistructs.AddonScaleResponse{},
	Doc:          "Addon 扩缩容",
}
View Source
var CMP_ADDON_STATUS = apis.ApiSpec{
	Path:         "/api/addons/status",
	BackendPath:  "/api/addons/status",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.OpsAddonStatusQueryRequest{},
	ResponseType: apistructs.OpsAddonStatusResponse{},
	Doc:          "调用scheduler api 获取 addon status",
}
View Source
var CMP_CLOUD_CLUSTERS = apis.ApiSpec{
	Path:         "/api/cloud-clusters",
	BackendPath:  "/api/cloud-clusters",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CloudClusterRequest{},
	ResponseType: apistructs.CloudClusterResponse{},
	Doc:          "创建并添加云集群",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CloudClusterRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.CloudVendor == "" || request.CloudVendor == "aliyun" {
			request.CloudVendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.CreateClusterTemplate,
			Context: map[string]interface{}{
				"vendor":      request.CloudVendor,
				"region":      request.Region,
				"clusterName": request.ClusterName,
				"version":     request.DiceVersion,
			},
		})
	},
}
View Source
var CMP_CLOUD_NODES = apis.ApiSpec{
	Path:         "/api/ops/cloud-nodes",
	BackendPath:  "/api/ops/cloud-nodes",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CloudNodesRequest{},
	ResponseType: apistructs.CloudNodesResponse{},
	Doc:          "创建并添加云机器",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CloudNodesRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.CloudVendor == "" || request.CloudVendor == "aliyun" {
			request.CloudVendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.AddCloudNodeTemplate,
			Context: map[string]interface{}{
				"vendor":       request.CloudVendor,
				"clusterName":  request.ClusterName,
				"instanceType": request.InstanceType,
				"instanceNum":  request.InstanceNum,
				"labels":       strings.Join(request.Labels, ","),
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE = apis.ApiSpec{
	Path:        "/api/ops/cloud-resource",
	BackendPath: "/api/ops/cloud-resource",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc:         "获取云资源信息",
}
View Source
var CMP_CLOUD_RESOURCE_ACCOUNT_CREATE = apis.ApiSpec{
	Path:         "/api/cloud-account",
	BackendPath:  "/api/cloud-account",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CreateCloudAccountRequest{},
	ResponseType: apistructs.CreateCloudAccountResponse{},
	Doc:          "导入 云账号",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CreateCloudAccountRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.CreateCloudAccountTemplate,
			Context: map[string]interface{}{
				"vendor":      request.Vendor,
				"accessKeyID": request.AccessKey,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_ACCOUNT_DELETE = apis.ApiSpec{
	Path:         "/api/cloud-account",
	BackendPath:  "/api/cloud-account",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "DELETE",
	CheckLogin:   true,
	RequestType:  apistructs.DeleteCloudAccountRequest{},
	ResponseType: apistructs.DeleteCloudAccountResponse{},
	Doc:          "删除 云账号",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.DeleteCloudAccountRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.DeleteCloudAccountTemplate,
			Context: map[string]interface{}{
				"vendor":      request.Vendor,
				"accessKeyID": request.AccessKey,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_ACCOUNT_LIST = apis.ApiSpec{
	Path:         "/api/cloud-account",
	BackendPath:  "/api/cloud-account",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	ResponseType: apistructs.ListCloudAccountResponse{},
	Doc:          "获取 云账号 列表",
}
View Source
var CMP_CLOUD_RESOURCE_ECS_AUTO_RENEW = apis.ApiSpec{
	Path:         "/api/cloud-ecs/actions/config-renew-attribute",
	BackendPath:  "/api/cloud-ecs/actions/config-renew-attribute",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.AutoRenewCloudResourceEcsRequest{},
	ResponseType: apistructs.HandleCloudResourceECSResponse{},
	Doc:          "配置ECS实例的自动续费",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.AutoRenewCloudResourceEcsRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		duration := strconv.Itoa(request.Duration)
		autoRenew := strconv.FormatBool(request.Switch)

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.EcsAutoRenewTemplate,
			Context: map[string]interface{}{
				"vendor":      request.Vendor,
				"region":      request.Region,
				"instanceIds": strings.Join(request.InstanceIds, ","),
				"duration":    duration,
				"autoRenew":   autoRenew,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_ECS_LIST = apis.ApiSpec{
	Path:         "/api/cloud-ecs",
	BackendPath:  "/api/cloud-ecs",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.ListCloudResourceECSRequest{},
	ResponseType: apistructs.ListCloudResourceECSResponse{},
	Doc:          "获取 ecs 信息列表",
}
View Source
var CMP_CLOUD_RESOURCE_ECS_RESTART = apis.ApiSpec{
	Path:         "/api/cloud-ecs/actions/restart",
	BackendPath:  "/api/cloud-ecs/actions/restart",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.HandleCloudResourceEcsRequest{},
	ResponseType: apistructs.HandleCloudResourceECSResponse{},
	Doc:          "重启ECS实例",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.HandleCloudResourceEcsRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.EcsRestartTemplate,
			Context: map[string]interface{}{
				"vendor":      request.Vendor,
				"region":      request.Region,
				"instanceIds": strings.Join(request.InstanceIds, ","),
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_ECS_START = apis.ApiSpec{
	Path:         "/api/cloud-ecs/actions/start",
	BackendPath:  "/api/cloud-ecs/actions/start",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.HandleCloudResourceEcsRequest{},
	ResponseType: apistructs.HandleCloudResourceECSResponse{},
	Doc:          "启动ECS实例",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.HandleCloudResourceEcsRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.EcsStartTemplate,
			Context: map[string]interface{}{
				"vendor":      request.Vendor,
				"region":      request.Region,
				"instanceIds": strings.Join(request.InstanceIds, ","),
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_ECS_STOP = apis.ApiSpec{
	Path:         "/api/cloud-ecs/actions/stop",
	BackendPath:  "/api/cloud-ecs/actions/stop",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.HandleCloudResourceEcsRequest{},
	ResponseType: apistructs.HandleCloudResourceECSResponse{},
	Doc:          "停止ECS实例",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.HandleCloudResourceEcsRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.EcsStopTemplate,
			Context: map[string]interface{}{
				"vendor":      request.Vendor,
				"region":      request.Region,
				"instanceIds": strings.Join(request.InstanceIds, ","),
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_ECS_TREND = apis.ApiSpec{
	Path:         "/api/ecs-trending",
	BackendPath:  "/api/ecs-trending",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	ResponseType: apistructs.GetCloudResourceECSTrendResponse{},
	Doc:          "获取 ecs 增量趋势",
}
View Source
var CMP_CLOUD_RESOURCE_GATEWAY_LIST = apis.ApiSpec{
	Path:         "/api/cloud-gateway",
	BackendPath:  "/api/cloud-gateway",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.ListCloudResourceGatewayRequest{},
	ResponseType: apistructs.ListCloudResourceGatewayResponse{},
	Doc:          "获取 gateway 信息列表",
}
View Source
var CMP_CLOUD_RESOURCE_LIST = apis.ApiSpec{
	Path:        "/api/ops/cloud-resource-list",
	BackendPath: "/api/ops/cloud-resource-list",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc:         "云资源类型列表",
}
View Source
var CMP_CLOUD_RESOURCE_MYSQL_ACCOUNT_CREATE = apis.ApiSpec{
	Path:         "/api/cloud-mysql/actions/create-account",
	BackendPath:  "/api/cloud-mysql/actions/create-account",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CreateCloudResourceMysqlAccountRequest{},
	ResponseType: apistructs.CreateCloudResourceMysqlAccountResponse{},
	Doc:          "创建 mysql account",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CreateCloudResourceMysqlAccountRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.CreateMysqlAccountTemplate,
			Context: map[string]interface{}{
				"vendor":     request.Vendor,
				"instanceID": request.InstanceID,
				"account":    request.Account,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_MYSQL_ACCOUNT_INFO = apis.ApiSpec{
	Path:         "/api/cloud-mysql/<instanceID>/accounts",
	BackendPath:  "/api/cloud-mysql/<instanceID>/accounts",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.CloudResourceMysqlListAccountRequest{},
	ResponseType: apistructs.CloudResourceMysqlListAccountResponse{},
	Doc:          "list mysql accounts",
}
View Source
var CMP_CLOUD_RESOURCE_MYSQL_ACCOUNT_PASSWORD_RESET = apis.ApiSpec{
	Path:         "/api/cloud-mysql/actions/reset-password",
	BackendPath:  "/api/cloud-mysql/actions/reset-password",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CreateCloudResourceMysqlAccountRequest{},
	ResponseType: apistructs.CreateCloudResourceMysqlAccountResponse{},
	Doc:          "reset account password",
}
View Source
var CMP_CLOUD_RESOURCE_MYSQL_ACCOUNT_PRIVILEGE_GRANT = apis.ApiSpec{
	Path:         "/api/cloud-mysql/actions/grant-privilege",
	BackendPath:  "/api/cloud-mysql/actions/grant-privilege",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.GrantMysqlAccountPrivilegeRequest{},
	ResponseType: apistructs.GrantMysqlAccountPrivilegeResponse{},
	Doc:          "grant account privilege",
}
View Source
var CMP_CLOUD_RESOURCE_MYSQL_CREATE = apis.ApiSpec{
	Path:         "/api/cloud-mysql",
	BackendPath:  "/api/cloud-mysql",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CreateCloudResourceMysqlRequest{},
	ResponseType: apistructs.CreateCloudResourceMysqlResponse{},
	Doc:          "创建 mysql",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CreateCloudResourceMysqlRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.CreateMysqlTemplate,
			Context: map[string]interface{}{
				"vendor": request.Vendor,
				"name":   request.InstanceName,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_MYSQL_DATABASE_INFO = apis.ApiSpec{
	Path:         "/api/cloud-mysql/<instanceID>/databases",
	BackendPath:  "/api/cloud-mysql/<instanceID>/databases",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.CloudResourceMysqlDBRequest{},
	ResponseType: apistructs.CloudResourceMysqlDBResponse{},
	Doc:          "query参数传入dbName, 返回相应db info; 未传入,则返回所有db info",
}
View Source
var CMP_CLOUD_RESOURCE_MYSQL_DB_CREATE = apis.ApiSpec{
	Path:         "/api/cloud-mysql/actions/create-db",
	BackendPath:  "/api/cloud-mysql/actions/create-db",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CreateCloudResourceMysqlDBRequest{},
	ResponseType: apistructs.CreateCloudResourceMysqlDBResponse{},
	Doc:          "创建 mysql databases",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CreateCloudResourceMysqlDBRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		var dbList []string
		for _, t := range request.Databases {
			dbList = append(dbList, t.DBName)
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.CreateMysqlDbTemplate,
			Context: map[string]interface{}{
				"vendor":     request.Vendor,
				"instanceID": request.InstanceID,
				"databases":  strings.Join(dbList, ","),
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_MYSQL_DB_DELETE = apis.ApiSpec{
	Path:         "/api/cloud-mysql/actions/delete-db",
	BackendPath:  "/api/cloud-mysql/actions/delete-db",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "DELETE",
	CheckLogin:   true,
	RequestType:  apistructs.DeleteCloudResourceMysqlDBRequest{},
	ResponseType: apistructs.CloudAddonResourceDeleteRespnse{},
	Doc:          "删除 mysql database",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.DeleteCloudResourceMysqlDBRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		project, err := ctx.GetProject(request.ProjectID)
		if err != nil {
			return err
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.ProjectScope,
			ScopeID:      project.ID,
			ProjectID:    project.ID,
			TemplateName: apistructs.DeleteMysqlDbTemplate,
			Context: map[string]interface{}{
				"projectName": project.Name,
				"addonID":     request.AddonID,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_MYSQL_DELETE = apis.ApiSpec{
	Path:         "/api/cloud-mysql",
	BackendPath:  "/api/cloud-mysql",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "DELETE",
	CheckLogin:   true,
	RequestType:  apistructs.DeleteCloudResourceMysqlRequest{},
	ResponseType: apistructs.CloudAddonResourceDeleteRespnse{},
	Doc:          "删除 mysql",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.DeleteCloudResourceMysqlRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.DeleteMysqlTemplate,
			Context: map[string]interface{}{
				"vendor":     request.Vendor,
				"instanceID": request.InstanceID,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_MYSQL_DETAIL_INFO = apis.ApiSpec{
	Path:         "/api/cloud-mysql/<id or name>",
	BackendPath:  "/api/cloud-mysql/<id or name>",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.CloudResourceMysqlDetailInfoRequest{},
	ResponseType: apistructs.CloudResourceMysqlDetailInfoResponse{},
	Doc:          "获取 mysql instance 详细信息",
}
View Source
var CMP_CLOUD_RESOURCE_MYSQL_LIST = apis.ApiSpec{
	Path:         "/api/cloud-mysql",
	BackendPath:  "/api/cloud-mysql",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.ListCloudResourceMysqlRequest{},
	ResponseType: apistructs.ListCloudResourceMysqlResponse{},
	Doc:          "获取 mysql 信息列表",
}
View Source
var CMP_CLOUD_RESOURCE_ONS_CREATE = apis.ApiSpec{
	Path:         "/api/cloud-ons",
	BackendPath:  "/api/cloud-ons",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CreateCloudResourceOnsRequest{},
	ResponseType: apistructs.CreateCloudResourceOnsResponse{},
	Doc:          "创建 ons",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CreateCloudResourceOnsRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.CreateOnsTemplate,
			Context: map[string]interface{}{
				"vendor": request.Vendor,
				"name":   request.Name,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_ONS_DELETE = apis.ApiSpec{
	Path:         "/api/cloud-ons",
	BackendPath:  "/api/cloud-ons",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "DELETE",
	CheckLogin:   true,
	RequestType:  apistructs.DeleteCloudResourceOnsRequest{},
	ResponseType: apistructs.CloudAddonResourceDeleteRespnse{},
	Doc:          "删除 ons",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.DeleteCloudResourceOnsRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.DeleteOnsTemplate,
			Context: map[string]interface{}{
				"vendor":     request.Vendor,
				"instanceID": request.InstanceID,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_ONS_DETAIL_INFO = apis.ApiSpec{
	Path:         "/api/cloud-ons/<instance_id>",
	BackendPath:  "/api/cloud-ons/<instance_id>",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.CloudResourceOnsDetailInfoRequest{},
	ResponseType: apistructs.CloudResourceOnsDetailInfoResponse{},
	Doc:          "获取 ons instance 详细信息",
}
View Source
var CMP_CLOUD_RESOURCE_ONS_GROUP_CREATE = apis.ApiSpec{
	Path:         "/api/cloud-ons/actions/create-group",
	BackendPath:  "/api/cloud-ons/actions/create-group",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CreateCloudResourceOnsGroupRequest{},
	ResponseType: apistructs.CreateCloudResourceOnsGroupResponse{},
	Doc:          "创建 ons group",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CreateCloudResourceOnsGroupRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		var groupList []string
		for _, g := range request.Groups {
			groupList = append(groupList, g.GroupId)
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.CreateOnsGroupTemplate,
			Context: map[string]interface{}{
				"vendor":     request.Vendor,
				"instanceID": request.InstanceID,
				"groupID":    strings.Join(groupList, ","),
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_ONS_GROUP_INFO = apis.ApiSpec{
	Path:         "/api/cloud-ons/actions/list-group",
	BackendPath:  "/api/cloud-ons/actions/list-group",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.CloudResourceOnsGroupInfoRequest{},
	ResponseType: apistructs.CloudResourceOnsGroupInfoResponse{},
	Doc:          "query参数传入topicName时,返回相应topic信息;未传入则返回所有topic信息",
}
View Source
var CMP_CLOUD_RESOURCE_ONS_LIST = apis.ApiSpec{
	Path:         "/api/cloud-ons",
	BackendPath:  "/api/cloud-ons",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.ListCloudResourceOnsRequest{},
	ResponseType: apistructs.ListCloudResourceOnsResponse{},
	Doc:          "获取 ons 信息列表",
}
View Source
var CMP_CLOUD_RESOURCE_ONS_TOPIC_CREATE = apis.ApiSpec{
	Path:         "/api/cloud-ons/actions/create-topic",
	BackendPath:  "/api/cloud-ons/actions/create-topic",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CreateCloudResourceOnsTopicRequest{},
	ResponseType: apistructs.CreateCloudResourceOnsTopicResponse{},
	Doc:          "创建 ons topic",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CreateCloudResourceOnsTopicRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		var topicList []string
		for _, t := range request.Topics {
			topicList = append(topicList, t.TopicName)
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.CreateOnsTopicTemplate,
			Context: map[string]interface{}{
				"vendor":     request.Vendor,
				"instanceID": request.InstanceID,
				"topic":      strings.Join(topicList, ","),
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_ONS_TOPIC_DELETE = apis.ApiSpec{
	Path:         "/api/cloud-ons/actions/delete-topic",
	BackendPath:  "/api/cloud-ons/actions/delete-topic",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "DELETE",
	CheckLogin:   true,
	RequestType:  apistructs.DeleteCloudResourceOnsRequest{},
	ResponseType: apistructs.CloudAddonResourceDeleteRespnse{},
	Doc:          "删除 ons topic",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.DeleteCloudResourceOnsRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		project, err := ctx.GetProject(request.ProjectID)
		if err != nil {
			return err
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.ProjectScope,
			ScopeID:      project.ID,
			ProjectID:    project.ID,
			TemplateName: apistructs.DeleteOnsTopicTemplate,
			Context: map[string]interface{}{
				"projectName": project.Name,
				"addonID":     request.AddonID,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_ONS_TOPIC_INFO = apis.ApiSpec{
	Path:         "/api/cloud-ons/actions/list-topic",
	BackendPath:  "/api/cloud-ons/actions/list-topic",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.CloudResourceOnsTopicInfoRequest{},
	ResponseType: apistructs.CloudResourceOnsTopicInfoResponse{},
	Doc:          "query参数传入topicName时,返回相应topic信息;未传入则返回所有topic信息",
}
View Source
var CMP_CLOUD_RESOURCE_OSS_CREATE = apis.ApiSpec{
	Path:         "/api/cloud-oss",
	BackendPath:  "/api/cloud-oss",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CreateCloudResourceOssRequest{},
	ResponseType: apistructs.CreateCloudResourceOssResponse{},
	Doc:          "创建 oss bucket",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CreateCloudResourceOssRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		var bucketList []string
		for _, v := range request.Buckets {
			bucketList = append(bucketList, v.Name)
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.CreateOssTemplate,
			Context: map[string]interface{}{
				"vendor": request.Vendor,
				"name":   strings.Join(bucketList, ","),
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_OSS_DELETE = apis.ApiSpec{
	Path:         "/api/cloud-oss",
	BackendPath:  "/api/cloud-oss",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "DELETE",
	CheckLogin:   true,
	RequestType:  apistructs.DeleteCloudResourceOssRequest{},
	ResponseType: apistructs.CloudAddonResourceDeleteRespnse{},
	Doc:          "删除 oss",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.DeleteCloudResourceOssRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		project, err := ctx.GetProject(request.ProjectID)
		if err != nil {
			return err
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.ProjectScope,
			ScopeID:      project.ID,
			ProjectID:    project.ID,
			TemplateName: apistructs.DeleteOssTemplate,
			Context: map[string]interface{}{
				"projectName": project.Name,
				"addonID":     request.AddonID,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_OSS_DETAIL_INFO = apis.ApiSpec{
	Path:         "/api/cloud-oss/<bucket name>",
	BackendPath:  "/api/cloud-oss/<bucket name>",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.CloudResourceOssDetailInfoRequest{},
	ResponseType: apistructs.CloudResourceOssDetailInfoResponse{},
	Doc:          "获取 oss bucket 详细信息",
}
View Source
var CMP_CLOUD_RESOURCE_OSS_LIST = apis.ApiSpec{
	Path:         "/api/cloud-oss",
	BackendPath:  "/api/cloud-oss",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.ListCloudResourceOssRequest{},
	ResponseType: apistructs.ListCloudResourceOssResponse{},
	Doc:          "获取 oss 信息列表",
}
View Source
var CMP_CLOUD_RESOURCE_OVERVIEW = apis.ApiSpec{
	Path:         "/api/cloud-resource-overview",
	BackendPath:  "/api/cloud-resource-overview",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.CloudResourceOverviewRequest{},
	ResponseType: apistructs.CloudResourceOverviewResponse{},
	Doc:          "获取云资源信息总览",
}
View Source
var CMP_CLOUD_RESOURCE_REDIS_CREATE = apis.ApiSpec{
	Path:         "/api/cloud-redis",
	BackendPath:  "/api/cloud-redis",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CreateCloudResourceRedisRequest{},
	ResponseType: apistructs.CreateCloudResourceRedisResponse{},
	Doc:          "创建 redis",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CreateCloudResourceRedisRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.CreateRedisTemplate,
			Context: map[string]interface{}{
				"vendor": request.Vendor,
				"name":   request.InstanceName,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_REDIS_DELETE = apis.ApiSpec{
	Path:         "/api/cloud-redis",
	BackendPath:  "/api/cloud-redis",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "DELETE",
	CheckLogin:   true,
	RequestType:  apistructs.DeleteCloudResourceRedisRequest{},
	ResponseType: apistructs.CloudAddonResourceDeleteRespnse{},
	Doc:          "删除 redis",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.DeleteCloudResourceRedisRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		project, err := ctx.GetProject(request.ProjectID)
		if err != nil {
			return err
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.ProjectScope,
			ScopeID:      project.ID,
			ProjectID:    project.ID,
			TemplateName: apistructs.DeleteRedisTemplate,
			Context: map[string]interface{}{
				"projectName": project.Name,
				"addonID":     request.AddonID,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_REDIS_DETAIL_INFO = apis.ApiSpec{
	Path:         "/api/cloud-redis/<instance_id>",
	BackendPath:  "/api/cloud-redis/<instance_id>",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.CloudResourceRedisDetailInfoRequest{},
	ResponseType: apistructs.CloudResourceRedisDetailInfoResponse{},
	Doc:          "获取 redis instance 详细信息",
}
View Source
var CMP_CLOUD_RESOURCE_REGION_LIST = apis.ApiSpec{
	Path:         "/api/cloud-region",
	BackendPath:  "/api/cloud-region",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.ListCloudResourceRegionRequest{},
	ResponseType: apistructs.ListCloudResourceRegionResponse{},
	Doc:          "获取 region 列表",
}
View Source
var CMP_CLOUD_RESOURCE_Redis_LIST = apis.ApiSpec{
	Path:         "/api/cloud-redis",
	BackendPath:  "/api/cloud-redis",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.ListCloudResourceRedisRequest{},
	ResponseType: apistructs.ListCloudResourceRedisResponse{},
	Doc:          "获取 redis 信息列表",
}
View Source
var CMP_CLOUD_RESOURCE_SET_TAG = apis.ApiSpec{
	Path:         "/api/cloud-resource/set-tag",
	BackendPath:  "/api/cloud-resource/set-tag",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CloudResourceSetTagRequest{},
	ResponseType: apistructs.CloudResourceSetTagResponse{},
	Doc:          "tag cluster on vpc",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CloudResourceSetTagRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		var rsList []string
		var vendor string
		for _, v := range request.Items {
			vendor = v.Vendor
			rsList = append(rsList, v.ResourceID)
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.SetCRTagsTemplate,
			Context: map[string]interface{}{
				"vendor":       vendor,
				"resourceType": request.ResourceType,
				"instanceID":   request.InstanceID,
				"crItems":      strings.Join(rsList, ","),
				"labels":       strings.Join(request.Tags, ","),
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_VPC_CREATE = apis.ApiSpec{
	Path:         "/api/cloud-vpc",
	BackendPath:  "/api/cloud-vpc",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CreateCloudResourceVPCRequest{},
	ResponseType: apistructs.CreateCloudResourceVPCResponse{},
	Doc:          "创建 vpc",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CreateCloudResourceVPCRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.CreateVpcTemplate,
			Context: map[string]interface{}{
				"vendor":    request.Vendor,
				"region":    request.Region,
				"name":      request.VPCName,
				"cidrBlock": request.CidrBlock,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_VPC_LIST = apis.ApiSpec{
	Path:         "/api/cloud-vpc",
	BackendPath:  "/api/cloud-vpc",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.ListCloudResourceVPCRequest{},
	ResponseType: apistructs.ListCloudResourceVPCResponse{},
	Doc:          "获取 vpc 信息列表",
}
View Source
var CMP_CLOUD_RESOURCE_VSW_CREATE = apis.ApiSpec{
	Path:         "/api/cloud-vsw",
	BackendPath:  "/api/cloud-vsw",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.CreateCloudResourceVSWRequest{},
	ResponseType: apistructs.CreateCloudResourceVSWResponse{},
	Doc:          "创建 vswitch",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.CreateCloudResourceVSWRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		if request.Vendor == "" || request.Vendor == "aliyun" {
			request.Vendor = "alicloud"
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.CreateVswitchTemplate,
			Context: map[string]interface{}{
				"vendor":    request.Vendor,
				"region":    request.Region,
				"vpcID":     request.VPCID,
				"name":      request.VSWName,
				"cidrBlock": request.CidrBlock,
			},
		})
	},
}
View Source
var CMP_CLOUD_RESOURCE_VSW_LIST = apis.ApiSpec{
	Path:         "/api/cloud-vsw",
	BackendPath:  "/api/cloud-vsw",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.ListCloudResourceVSWRequest{},
	ResponseType: apistructs.ListCloudResourceVSWResponse{},
	Doc:          "获取 vswitch 信息列表",
}
View Source
var CMP_CLOUD_RESOURCE_ZONE_LIST = apis.ApiSpec{
	Path:         "/api/cloud-zone",
	BackendPath:  "/api/cloud-zone",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.ListCloudResourceZoneRequest{},
	ResponseType: apistructs.ListCloudResourceZoneResponse{},
	Doc:          "获取 zone 列表",
}
View Source
var CMP_CLUSTER_BATCH_UPGRADE = apis.ApiSpec{
	Path:         "/api/cluster/actions/batch-upgrade",
	BackendPath:  "/api/cluster/actions/batch-upgrade",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.BatchUpgradeEdgeClusterRequest{},
	ResponseType: apistructs.BatchUpgradeEdgeClusterResponse{},
	Doc:          "边缘集群批量升级",
}
View Source
var CMP_CLUSTER_IMPORT = apis.ApiSpec{
	Path:        "/api/clusters",
	BackendPath: "/api/cluster/actions/import",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	CheckToken:  true,
	IsOpenAPI:   true,
	Doc:         "summary: 创建集群",
}
View Source
var CMP_CLUSTER_INFO = apis.ApiSpec{
	Path:        "/api/cluster",
	BackendPath: "/api/cluster",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc:         "获取集群详情",
}
View Source
var CMP_CLUSTER_INIT_COMMAND = apis.ApiSpec{
	Path:        "/api/cluster/init-command",
	BackendPath: "/api/cluster/init-command",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	Doc:         "summary: 获取集群初始化命令",
}
View Source
var CMP_CLUSTER_INIT_RETRY = apis.ApiSpec{
	Path:        "/api/cluster/actions/init-retry",
	BackendPath: "/api/cluster/actions/init-retry",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	IsOpenAPI:   true,
	Doc:         "summary: 集群初始化重试",
}
View Source
var CMP_CLUSTER_OFFLINE = apis.ApiSpec{
	Path:         "/api/cluster",
	BackendPath:  "/api/cluster",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "DELETE",
	CheckLogin:   true,
	RequestType:  apistructs.OfflineEdgeClusterRequest{},
	ResponseType: apistructs.OfflineEdgeClusterResponse{},
	Doc:          "集群下线",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.OfflineEdgeClusterRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.DeleteClusterTemplate,
			Context: map[string]interface{}{
				"clusterName": request.ClusterName,
			},
		})
	},
}
View Source
var CMP_CLUSTER_PREVIEW = apis.ApiSpec{
	Path:        "/api/cluster-preview",
	BackendPath: "/api/cluster-preview",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	Doc:         "创建集群预览",
}
View Source
var CMP_CLUSTER_UPDATE = apis.ApiSpec{
	Path:         "/api/clusters",
	BackendPath:  "/api/clusters",
	Method:       "PUT",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	CheckLogin:   true,
	RequestType:  apistructs.ClusterUpdateRequest{},
	ResponseType: apistructs.ClusterUpdateResponse{},
	Doc:          "summary: 更新集群",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.ClusterUpdateRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.UpdateClusterConfigTemplate,
			Context: map[string]interface{}{
				"clusterName": request.Name,
			},
		})
	},
}
View Source
var CMP_CLUSTER_UPGRADE = apis.ApiSpec{
	Path:         "/api/cluster/actions/upgrade",
	BackendPath:  "/api/cluster/actions/upgrade",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.UpgradeEdgeClusterRequest{},
	ResponseType: apistructs.UpgradeEdgeClusterResponse{},
	Doc:          "边缘集群升级",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.UpgradeEdgeClusterRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.UpgradeClusterTemplate,
			Context: map[string]interface{}{
				"clusterName": request.ClusterName,
			},
		})
	},
}
View Source
var CMP_EDGE_HOST_OFFLINE = apis.ApiSpec{
	Path:        "/api/edge/site/offline/<ID>",
	BackendPath: "/api/edge/site/offline/<ID>",
	Host:        "ecp.marathon.l4lb.thisdcos.directory:9029",
	Scheme:      "http",
	Method:      "DELETE",
	RequestType: EdgeHostOffline{},
	CheckLogin:  true,
	Doc:         "下线边缘计算站点机器",
}
View Source
var CMP_K8S_CONFIG_MAP_CREATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/configmaps",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/configmaps",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	Doc:         "创建 k8s configmap",
}
View Source
var CMP_K8S_CONFIG_MAP_DELETE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/configmaps/<cmName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/configmaps/<cmName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "DELETE",
	CheckLogin:  true,
	Doc:         "删除 k8s configmap 对象",
}
View Source
var CMP_K8S_CONFIG_MAP_GET = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/configmaps/<cmName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/configmaps/<cmName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc:         "获取 k8s configmap 对象信息",
}
View Source
var CMP_K8S_CONFIG_MAP_LIST = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/configmaps",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/configmaps",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc:         "获取 k8s configmap 列表",
}
View Source
var CMP_K8S_CONFIG_MAP_UPDATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/configmaps/<cmName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/configmaps/<cmName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "PUT",
	CheckLogin:  true,
	Doc:         "更新 k8s configmap 对象",
}
View Source
var CMP_K8S_DAEMON_SET_CREATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/daemonsets",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/daemonsets",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodPost,
	CheckLogin:  true,
	Doc:         "创建 k8s daemonset",
}
View Source
var CMP_K8S_DAEMON_SET_DELETE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/daemonsets/<daemonsetName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/daemonsets/<daemonsetName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodDelete,
	CheckLogin:  true,
	Doc:         "删除 k8s daemonset",
}
View Source
var CMP_K8S_DAEMON_SET_GET = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/daemonsets/<daemonsetName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/daemonsets/<daemonsetName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodGet,
	CheckLogin:  true,
	Doc:         "获取 k8s daemonset 详情",
}
View Source
var CMP_K8S_DAEMON_SET_LIST = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/daemonsets",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/daemonsets",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodGet,
	CheckLogin:  true,
	Doc:         "获取 k8s daemonset 列表",
}
View Source
var CMP_K8S_DAEMON_SET_UPDATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/daemonsets/<daemonsetName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/daemonsets/<daemonsetName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodPut,
	CheckLogin:  true,
	Doc:         "更新 k8s daemonset",
}
View Source
var CMP_K8S_NAMESAPCE_GET = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodGet,
	CheckLogin:  true,
	Doc:         "获取 k8s namespace 详情",
}
View Source
var CMP_K8S_NAMESAPCE_LIST = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces",
	BackendPath: "/apis/clusters/<clusterName>/namespaces",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodGet,
	CheckLogin:  true,
	Doc:         "获取 k8s namespace 列表",
}
View Source
var CMP_K8S_NAMESPACE_CREATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces",
	BackendPath: "/apis/clusters/<clusterName>/namespaces",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodPost,
	CheckLogin:  true,
	Doc:         "创建 k8s namespace",
}
View Source
var CMP_K8S_NAMESPACE_DELETE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodDelete,
	CheckLogin:  true,
	Doc:         "删除 k8s namespace",
}
View Source
var CMP_K8S_NAMESPACE_UPDATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodPut,
	CheckLogin:  true,
	Doc:         "更新 k8s namespace",
}
View Source
var CMP_K8S_NODE_DRAIN = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/nodes/drain",
	BackendPath: "/apis/clusters/<clusterName>/nodes/drain",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodPost,
	CheckLogin:  true,
	Doc:         "按节点驱逐pod",
}
View Source
var CMP_K8S_NODE_TAINT_UPDATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/nodes/taint",
	BackendPath: "/apis/clusters/<clusterName>/nodes/taint",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodPut,
	CheckLogin:  true,
	Doc:         "更新 k8s node污点",
}
View Source
var CMP_K8S_POD_CREATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/pods",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/pods",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	Doc:         "创建 k8s pod",
}
View Source
var CMP_K8S_POD_DELETE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/pods/<podName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/pods/<podName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "DELETE",
	CheckLogin:  true,
	Doc:         "删除 k8s pod",
}
View Source
var CMP_K8S_POD_GET = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/pods/<podName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/pods/<podName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc:         "获取 k8s pod 详情",
}
View Source
var CMP_K8S_POD_LIST = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/pods",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/pods",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc:         "获取 k8s pod 列表",
}
View Source
var CMP_K8S_POD_UPDATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/pods/<podName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/pods/<podName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "PUT",
	CheckLogin:  true,
	Doc:         "更新 k8s pod 对象",
}
View Source
var CMP_K8S_SECRET_CREATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/secrets",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/secrets",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodPost,
	CheckLogin:  true,
	Doc:         "创建 k8s secret",
}
View Source
var CMP_K8S_SECRET_DELETE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/secrets/<secretName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/secrets/<secretName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodDelete,
	CheckLogin:  true,
	Doc:         "删除 k8s secret",
}
View Source
var CMP_K8S_SECRET_GET = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/secrets/<secretName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/secrets/<secretName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodGet,
	CheckLogin:  true,
	Doc:         "获取 k8s secret 详情",
}
View Source
var CMP_K8S_SECRET_LIST = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/secrets",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/secrets",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodGet,
	CheckLogin:  true,
	Doc:         "获取 k8s secret 列表",
}
View Source
var CMP_K8S_SECRET_UPDATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/secrets/<secretName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/secrets/<secretName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodPut,
	CheckLogin:  true,
	Doc:         "更新 k8s secret",
}
View Source
var CMP_K8S_SERVICE_CREATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/services",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/services",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "POST",
	CheckLogin:  true,
	Doc:         "创建 k8s service",
}
View Source
var CMP_K8S_SERVICE_DELETE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/services/<serviceName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/services/<serviceName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "DELETE",
	CheckLogin:  true,
	Doc:         "删除 k8s service 对象",
}
View Source
var CMP_K8S_SERVICE_GET = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/services/<serviceName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/services/<serviceName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc:         "获取 k8s service 对象信息",
}
View Source
var CMP_K8S_SERVICE_LIST = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/services",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/services",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc:         "获取 k8s service 列表",
}
View Source
var CMP_K8S_SERVICE_UPDATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/services/<serviceName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/services/<serviceName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "PUT",
	CheckLogin:  true,
	Doc:         "更新 k8s service 对象",
}
View Source
var CMP_K8S_STATEFULSET_CREATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/statefulsets",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/statefulsets",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodPost,
	CheckLogin:  true,
	Doc:         "创建 k8s statefulset",
}
View Source
var CMP_K8S_STATEFULSET_DELETE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/statefulsets/<statefulsetName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/statefulsets/<statefulsetName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodDelete,
	CheckLogin:  true,
	Doc:         "删除 k8s statefulset",
}
View Source
var CMP_K8S_STATEFULSET_GET = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/statefulsets/<statefulsetName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/statefulsets/<statefulsetName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodGet,
	CheckLogin:  true,
	Doc:         "获取 k8s statefulset 详情",
}
View Source
var CMP_K8S_STATEFULSET_LIST = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/statefulsets",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/statefulsets",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodGet,
	CheckLogin:  true,
	Doc:         "获取 k8s statefulset 列表",
}
View Source
var CMP_K8S_STATEFULSET_UPDATE = apis.ApiSpec{
	Path:        "/apis/clusters/<clusterName>/namespaces/<namespaceName>/statefulsets/<statefulsetName>",
	BackendPath: "/apis/clusters/<clusterName>/namespaces/<namespaceName>/statefulsets/<statefulsetName>",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      http.MethodPut,
	CheckLogin:  true,
	Doc:         "更新 k8s statefulset",
}
View Source
var CMP_NODES = apis.ApiSpec{
	Path:         "/api/nodes",
	BackendPath:  "/api/nodes",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.AddNodesRequest{},
	ResponseType: apistructs.AddNodesResponse{},
	Doc:          "增加节点",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.AddNodesRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.AddExistNodeTemplate,
			Context: map[string]interface{}{
				"clusterName": request.ClusterName,
				"instanceIPs": strings.Join(request.Hosts, ","),
				"labels":      strings.Join(request.Labels, ","),
			},
		})
	},
}
View Source
var CMP_NODES_REMOVE = apis.ApiSpec{
	Path:         "/api/nodes",
	BackendPath:  "/api/nodes",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "DELETE",
	CheckLogin:   true,
	RequestType:  apistructs.RmNodesRequest{},
	ResponseType: apistructs.RmNodesResponse{},
	Doc:          "下线节点",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.RmNodesRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.DeleteNodeTemplate,
			Context: map[string]interface{}{
				"clusterName": request.ClusterName,
				"instanceIPs": strings.Join(request.Hosts, ","),
			},
		})
	},
}
View Source
var CMP_NODE_LABELS_LIST = apis.ApiSpec{
	Path:        "/api/node-labels",
	BackendPath: "/api/node-labels",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc:         "获取 node label 列表",
}
View Source
var CMP_NODE_LABELS_UPDATE = apis.ApiSpec{
	Path:         "/api/node-labels",
	BackendPath:  "/api/node-labels",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "POST",
	CheckLogin:   true,
	RequestType:  apistructs.UpdateLabelsRequest{},
	ResponseType: apistructs.UpdateLabelsResponse{},
	Doc:          "更新 node label",
	Audit: func(ctx *spec.AuditContext) error {
		var request apistructs.UpdateLabelsRequest
		if err := ctx.BindRequestData(&request); err != nil {
			return err
		}

		labels := strings.Join(request.Labels, ",")
		nodes := strings.Join(request.Hosts, ",")

		return ctx.CreateAudit(&apistructs.Audit{
			ScopeType:    apistructs.OrgScope,
			ScopeID:      uint64(ctx.OrgID),
			TemplateName: apistructs.UpdateNodeLabelsTemplate,
			Context: map[string]interface{}{
				"clusterName": request.ClusterName,
				"nodes":       nodes,
				"labels":      labels,
			},
		})
	},
}
View Source
var CMP_NODE_LOGS = apis.ApiSpec{
	Path:        "/api/node-logs",
	BackendPath: "/api/node-logs",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc:         "查询 cmp 操作日志",
}
View Source
var CMP_ORG_CLUSTER_INFO = apis.ApiSpec{
	Path:         "/api/org-cluster-info",
	BackendPath:  "/api/org-cluster-info",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	Method:       "GET",
	CheckLogin:   true,
	RequestType:  apistructs.OrgClusterInfoRequest{},
	ResponseType: apistructs.OrgClusterInfoResponse{},
	Doc:          "获取企业集群相关信息",
}
View Source
var CMP_RECORDS = apis.ApiSpec{
	Path:        "/api/records",
	BackendPath: "/api/records",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc:         "查询 cmp 操作记录",
}
View Source
var CMP_RECORDTYPES = apis.ApiSpec{
	Path:        "/api/recordtypes",
	BackendPath: "/api/recordtypes",
	Host:        "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:      "http",
	Method:      "GET",
	CheckLogin:  true,
	Doc:         "获取 recordtype 列表",
}
View Source
var CMP_RUNNING_TASKS_LIST = apis.ApiSpec{
	Path:         "/api/org/actions/list-running-tasks",
	BackendPath:  "/api/org/actions/list-running-tasks",
	Method:       "GET",
	Host:         "cmp.marathon.l4lb.thisdcos.directory:9027",
	Scheme:       "http",
	CheckLogin:   true,
	RequestType:  apistructs.OrgRunningTasksListRequest{},
	ResponseType: apistructs.OrgRunningTasksListResponse{},
	Doc:          "summary: 获取指定企业的任务 (job/deployment) 列表",
}

Functions

This section is empty.

Types

type EdgeHostOffline

type EdgeHostOffline struct {
	SiteIP string `json:"siteIP"`
}

Source Files

Jump to

Keyboard shortcuts

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