Skip to content

Commit

Permalink
Merge pull request #2 from breezelxp/hostserver
Browse files Browse the repository at this point in the history
update develop branch
  • Loading branch information
breezelxp committed Jul 14, 2018
2 parents ce85c81 + a7db9f7 commit c87dffa
Show file tree
Hide file tree
Showing 754 changed files with 53,179 additions and 25,439 deletions.
5 changes: 0 additions & 5 deletions docs/apidoc/host_relation.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,3 @@ host_info说明:
| bk_error_code | int | 错误编码。 0表示success,>0表示失败错误 |error code. 0 represent success, >0 represent failure code |
| bk_error_msg | string | 请求失败返回的错误信息 |error message from failed request|
| data | null | 请求返回的数据 |the data response|





2 changes: 1 addition & 1 deletion docs/apidoc/object_batch.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
### 导入模型属性

- API: POST /object/owner/{bk_supplier_account}/object/{bk_obj_id}/import
- API 名称:export_object_attribute
- API 名称:import_object_attribute
- 功能说明:
- 中文:导入模型属性
- English:import object attribute
Expand Down
2 changes: 1 addition & 1 deletion docs/apidoc/object_model_classify.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ data 字段说明:

# 查询模型分类及附属模型信息

- API: POST /api/{version}/object/classification/{bk_owner_id}/objects
- API: POST /api/{version}/object/classification/{bk_supplier_account}/objects
- API 名称:search_classifications_objects
- 功能说明:
- 中文: 查询所有模型分类下的模型集合
Expand Down
53 changes: 53 additions & 0 deletions docs/apidoc/proc_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"condition":{
"bk_biz_id":"12233",
"bk_process_name":"nginx"
"bk_module_name":"nginx"
}
}
Expand Down Expand Up @@ -275,6 +276,58 @@ body 字段为进程属性
| bk_error_msg | string | 请求失败返回的错误信息 |error message from failed request|
| data | string | 请求返回的数据 |the data response|



### 批量更新进程
* API: PUT /api/{version}/proc/{bk_supplier_account}/{bk_biz_id}
* API名称: batch_update_process
* 功能说明:
* 中文:批量更新进程
* English :update process
* input body:
```
{
"bk_process_id" : "44,45,46,47,48",
"start_cmd": "./start.sh 8080",
"port": "1000"
...
// "bk_process_name": "assdfasdfasf", // 不允许批量编辑
// "bk_func_id" : "111", // 不允许批量编辑
}
}
```

* input字段说明:

| 名称 | 类型 |必填| 默认值 | 说明 | Description|
| --- | --- | --- |--- | --- | ---|
| bk_supplier_account| string|||开发商 code |supplier account code|
| bk_biz_id| int |||业务 id|business id |
| bk_process_id| string|||逗号分隔的进程id列表|process id|
body 字段为进程属性


* output:

```
{
"result":true,
"bk_error_code":0,
"bk_error_msg":"",
"data":"success"
}
```

* output字段说明:

| 名称 | 类型 | 说明 |Description|
|---|---|---|---|
| result | bool | 请求成功与否。true:请求成功;false请求失败 |request result true or false|
| bk_error_code | int | 错误编码。 0表示success,>0表示失败错误 |error code. 0 represent success, >0 represent failure code |
| bk_error_msg | string | 请求失败返回的错误信息 |error message from failed request|
| data | string | 请求返回的数据 |the data response|


### 获取进程绑定模块
* API: GET /api/{version}/proc/module/{bk_supplier_account}/{bk_biz_id}/{bk_process_id}
* API名称: get_process_bind_module
Expand Down
194 changes: 188 additions & 6 deletions docs/overview/framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ GetCapacity() (int, error)
// SetBusinessID 设置集群所属的业务ID,调用此方法会同步将当前集群的父节点设置为传入的业务。
SetBusinessID(businessID int64) error

// GetBusiness 获取集群所属的业务ID
// GetBusiness 获取集群所属的业务ID,在调用Save 和Update 之后此处返回的仅是最后一次被更新的业务的ID
GetBusinessID() (int, error)

// SetSupplierAccount 设置集群所属的开发商ID
Expand All @@ -263,7 +263,7 @@ SetSupplierAccount(supplierAccount string) error
GetSupplierAccount() (string, error)


// GetID 获取集群的ID
// GetID 获取集群的ID,在调用Save 和Update 之后此处返回的仅是最后一次被更新的集群的ID
GetID() (int, error)

// SetParent 设置当前节点的父实例节点,只有在当前集群的父实例不是业务的时候才需要设置此参数。
Expand Down Expand Up @@ -357,8 +357,8 @@ SetBakOperator(bakOperator string) error
// GetBakOperator 获取备份维护人
GetBakOperator() (string, error)

// SetBusinessID 设置业务ID
SetBusinessID(businessID int64) error
// SetTopo 设置模块的层级
SetTopo(bizID, setID int64) error

// GetBusinessID 获取业务ID
GetBusinessID() (int, error)
Expand All @@ -378,7 +378,7 @@ SetName(name string) error
// GetName 获取模块的名字
GetName() (string, error)

// GetID 获取模块的ID
// GetID 获取模块的ID, 在调用Save 和Update 之后此处返回的仅是最后一次被更新的模块的ID
GetID() (int, error)

// Save 保存模块的信息。
Expand Down Expand Up @@ -455,7 +455,7 @@ SetValue(key string, val interface{}) error
SetSupplierAccount(supplierAccount string) error
// GetSupplierAccount 获取云区域开发商
GetSupplierAccount() (string, error)
// GetID 获取云区域ID
// GetID 获取云区域ID,在调用Save 和Update 之后此处返回的仅是最后一次被更新的云区域的ID
GetID() (int, error)
// SetName 设置云区域名字
SetName(name string) error
Expand Down Expand Up @@ -518,12 +518,78 @@ ForEach(callback func(plat *PlatWrapper) error) error
### 主机管理 API

#### 主机转移接口方法声明

> 类型:TransferInterface
> 方法列表:
``` golang

// MoveToModule 将主机转移到主机当前所在业务的其他模块,isIncrement true 主机原来所在模块不会被改变,false 会从原来所在模块中删除
MoveToModule(newModuleIDS []int64, isIncrement bool) error

// MoveToFaultModule 将主机移动到主机当前所在业务的故障机模块
MoveToFaultModule() error

// MoveToIdleModule 将主机移动到主机当前所在业务的空闲机模块
MoveToIdleModule() error

// MoveToResourcePools 将主机移动到资源池
MoveToResourcePools() error

// MoveToBusinessIdleModuleFromResourcePools 将主机从资源池分配到业务空闲机模块
MoveToBusinessIdleModuleFromResourcePools(bizID int64) error

// MoveToAnotherBusinessModules 将主机从当前业务转移到另一个业务的给定模块下
MoveToAnotherBusinessModules(bizID int64, moduleID int64) error

// ResetBusinessHosts 将主机从给定的模块和集群下清空,转移至业务的空闲机下
ResetBusinessHosts(setID, moduleID int64) error

```

#### 主机管理包装器(用于查询接口返回的数据结构)

> 类型:FinderHostWrapper
> 方法列表:

``` golang

// GetBizs 获取业务信息
GetBizs() ([]*BusinessWrapper, error)

// GetSets 获取业务信息
GetSets() ([]*SetWrapper, error)

// GetModules 获取模块信息
GetModules() ([]*ModuleWrapper, error)

其余方法与HostWrapper一致

```

#### 主机管理包装器

> 类型:HostWrapper
> 方法列表:
``` golang

// Transfer 返回主机转移操作方法
Transfer() inst.TransferInterface

// SetModuleIDS 设置主机所属业务的模块ID,HostAppendModule 表示追加所属模块,HostReplaceModule 表示替换所属模块
SetModuleIDS(moduleIDS []int64, act HostModuleActionType)

// SetBusiness 设置主机所属的业务
SetBusiness(bizID int64)

// SetTopo 设置主机所属的业务及业务下的模块ID, act 取值,HostAppendModule 表示追加所属模块,HostReplaceModule 表示替换所属模块
SetTopo(bizID int64, setName, moduleName string, act HostModuleActionType) error

// SetValue 为自定义字段进行复制,key 字段名,val 字段的值
SetValue(key string, val interface{}) error

Expand Down Expand Up @@ -874,3 +940,119 @@ GetChildren() ([]Topo, error)
>> - model.Classification:模型分类对象,通过此对象可以对该分类下的模型进行管理。
>> - error: 如果创建实例失败会返回错误。

### 事件订阅 API

#### 事件回调方法声明

```` golang
// EventCallbackFunc the event deal function
type EventCallbackFunc func(evn []*Event) error
````

#### 取消事件订阅

> 方法:UnRegisterEvent(eventKey types.EventKey)
>
> 参数:
>
>> - eventKey:注册事件后返回的Key
>>
> 返回值:
>
>>
#### 订阅主机信息变更事件

> 方法:RegisterEventHost(eventFunc types.EventCallbackFunc) types.EventKey
>
> 参数:
>
>> - eventFunc:事件回调方法
>>
> 返回值:
>
>> - 注册事件关联的Key

#### 订阅业务信息变更事件

> 方法:RegisterEventBusiness(eventFunc types.EventCallbackFunc) types.EventKey
>
> 参数:
>
>> - eventFunc:事件回调方法
>>
> 返回值:
>
>> - 注册事件关联的Key
#### 订阅模块信息变更事件

> 方法:RegisterEventModule(eventFunc types.EventCallbackFunc) types.EventKey
>
> 参数:
>
>> - eventFunc:事件回调方法
>>
> 返回值:
>
>> - 注册事件关联的Key

#### 订阅主机身份信息变更事件

> 方法:RegisterEventHostIdentifier(eventFunc types.EventCallbackFunc) types.EventKey
>
> 参数:
>
>> - eventFunc:事件回调方法
>>
> 返回值:
>
>> - 注册事件关联的Key

#### 订阅集群信息变更事件

> 方法:RegisterEventSet(eventFunc types.EventCallbackFunc) types.EventKey
>
> 参数:
>
>> - eventFunc:事件回调方法
>>
> 返回值:
>
>> - 注册事件关联的Key
#### 订阅通用模型实例信息变更事件

> 方法:RegisterEventInst(eventFunc types.EventCallbackFunc) types.EventKey
>
> 参数:
>
>> - eventFunc:事件回调方法
>>
> 返回值:
>
>> - 注册事件关联的Key
#### 订阅模块转移信息变更事件

> 方法:RegisterEventModuleTransfer(eventFunc types.EventCallbackFunc) types.EventKey
>
> 参数:
>
>> - eventFunc:事件回调方法
>>
> 返回值:
>
>> - 注册事件关联的Key
7 changes: 7 additions & 0 deletions pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

### 新加的功能:
- xxxx
### 优化的功能:
- xxxx
### 修复的问题:
- xxxx
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

[(English Documents Available)](readme_en.md)

**提示**: `master` 分支在开发过程中可能处于 *不稳定或者不可用状态*
> **重要提示**: `master` 分支在开发过程中可能处于 *不稳定或者不可用状态*
请通过[releases](https://github.com/tencent/bk-cmdb/releases) 而非 `master` 去获取稳定的二进制文件。

蓝鲸配置平台(蓝鲸CMDB)是一个基于运维场景设计的企业配置管理服务。
Expand Down
2 changes: 1 addition & 1 deletion readme_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![Build Status](https://travis-ci.org/Tencent/bk-cmdb.svg?branch=master)](https://travis-ci.org/Tencent/bk-cmdb)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/bk-cmdb/pulls)

**Note**: The `master` branch may be in an *unstable or even broken state* during development.
> **Note**: The `master` branch may be in an *unstable or even broken state* during development.
Please use [releases](https://github.com/tencent/bk-cmdb/releases) instead of the `master` branch in order to get stable binaries.

BlueKing Configuration Management DataBase (bk-cmdb) is an enterprise level configuration management serivce database.
Expand Down
2 changes: 2 additions & 0 deletions resources/configures/topo.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ maxOpenConns=3000
maxIDleConns=1000
[errors]
res=conf/errors
[level]
businessTopoMax=6

0 comments on commit c87dffa

Please sign in to comment.