# 12.2 Open API
Open API授权公共参数和签名方式请参考 API授权
本文档包含了主要的接口清单,详细文档正在编写中
# 接口总览
GET api/v1/confgo/config/list           
GET api/v1/confgo/config/detail         
GET api/v1/confgo/config/diff           
GET api/v1/confgo/config/instance/list
GET api/v1/confgo/config/history        
POST api/v1/confgo/config/create         
POST api/v1/confgo/config/update         
POST api/v1/confgo/config/publish        
POST api/v1/confgo/config/delete
GET api/v1/confgo/config/diffVersion
GET api/v1/resource/app_env_zone/list
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
# 接口详情
# GET api/v1/confgo/config/list
input
AppName string `query:"app_name"`
Env     string `query:"env"`
1
2
2
output
    [{
        ID          uint       `json:"id"`
        AID         uint       `json:"aid"`
        Name        string     `json:"name"`
        Format      string     `json:"format"` // Yaml/Toml
        Env         string     `json:"env"`    // 环境
        Zone        string     `json:"zone"`   // 机房Zone
        CreatedAt   time.Time  `json:"created_time"`
        UpdatedAt   time.Time  `json:"update_time"`
        DeletedAt   *time.Time `json:"deleted_at"`
        PublishedAt *time.Time `json:"published"` // 未发布/发布时间
    }]
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
# GET api/v1/confgo/config/detail
input
ID uint `json:"id"`
1
output
ID          uint       `json:"id"`
AID         uint       `json:"aid"`
Name        string     `json:"name"`
Content     string     `json:"content"`
Format      string     `json:"format"` // Yaml/Toml
Env         string     `json:"env"`    // 环境
Zone        string     `json:"zone"`   // 机房Zone
CreatedAt   time.Time  `json:"created_time"`
UpdatedAt   time.Time  `json:"update_time"`
PublishedAt *time.Time `json:"published"` // 未发布/发布时间
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
# api/v1/confgo/config/diff
input
ID        uint `query:"id" valid:"required"`         // 配置ID
HistoryID uint `query:"history_id" valid:"required"` // 版本ID
1
2
2
output
Origin   *RespDetailConfig `json:"origin,omitempty"`
Modified RespDetailConfig  `json:"modified"`
1
2
2
# api/v1/confgo/config/instance/list
input
ConfigurationID uint   `json:"id" query:"id" validate:"required"`
Env             string `json:"env" query:"env" validate:"required"`
ZoneCode        string `json:"zone_code" query:"zone_code" validate:"required"`
1
2
3
2
3
output
[{
        ConfigurationStatusID uint      `json:"configuration_status_id"`
        Env                   string    `json:"env"`
        IP                    string    `json:"ip"`
        HostName              string    `json:"host_name"`
        DeviceID              int       `json:"device_id"`
        RegionCode            string    `json:"region_code"`
        RegionName            string    `json:"region_name"`
        ZoneCode              string    `json:"zone_code"`
        ZoneName              string    `json:"zone_name"`
        ConfigFilePath        string    `json:"config_file_path"`
        ConfigFileUsed        uint      `json:"config_file_used"` // 1 supervisor 2 systemd
        ConfigFileSynced      uint      `json:"config_file_synced"`
        ConfigFileTakeEffect  uint      `json:"config_file_take_effect"`
        SyncAt                time.Time `json:"sync_at"`
    }]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# api/v1/confgo/config/history
input
ID   uint `json:"id"` // 配置文件ID
Size uint `json:"size"`
Page uint `json:"page"`
1
2
3
2
3
output
{
        Pagination {
            Current  int `json:"current"`
            Total    int `json:"total"`
            PageSize int `json:"pageSize"`
        } `json:"pagination"`
        List[{
            ID              uint      `json:"id"`
            UID             uint      `json:"uid"` // 发布人ID
            UserName        string    `json:"user_name"`
            ChangeLog       string    `json:"change_log"`
            ConfigurationID uint      `json:"configuration_id"`
            Version         string    `json:"version"` // 发布到Juno Proxy的版本号
            CreatedAt       time.Time `json:"created_at"`
        }] `json:"list"`
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# POST api/v1/confgo/config/create
input
AppName  string       `json:"app_name"`
Env      string       `json:"env"`
Zone     string       `json:"zone"`
FileName string       `json:"file_name"` // 文件名(不带后缀)
Format   ConfigFormat `json:"format"`    // 格式后缀名(比如: toml, yaml)
1
2
3
4
5
2
3
4
5
# POST api/v1/confgo/config/update
input
ID      uint   `json:"id"`
Message string `json:"message"`
Content string `json:"content"`
1
2
3
2
3
# POST api/v1/confgo/config/publish
input
ID      uint    `json:"id"`      // 配置ID
Version *string `json:"version"` // 版本号
1
2
2
# api/v1/confgo/config/delete
input
ID uint `json:"id"`
1
# POST api/v1/confgo/config/diffVersion
| 参数名 | 必选 | 类型 | 说明 | 
|---|---|---|---|
| ipList | 是 | []string | ip地址列表 | 
| appName | 是 | string | 应用名称 | 
| env | 是 | string | 环境名称 | 
- 请求参数示例
{
http://10.117.22.35:50000/api/v1/confgo/config/diffVersion?ips=10.117.22.35&appName=jupiter-demo&env=live
}
1
2
3
2
3
- 返回值
{
    "code": 0,
    "msg": "",
    "data": {
        "hasNew": false,
        "diffUrlList": [{
            "name": "single-rexxx:qgion-admin",
            "diffUrl": "http://jupiterxxxconsole.douyu.com/app?aid=1\u0026appName=jupiter-demo\u0026env=live\u0026tab=confgo\u0026publishVersion=\u0026serviceVersion=fa041303713cc4d198f6feb282f23a98"
        }]
    }
}
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
# GET api/v1/resource/app_env_zone/list
input
AppName string `query:"app_name"`
1
output
[
    {
        Env      string `json:"env"`
        ZoneList []struct {
            ZoneCode string `json:"zone_code"`
            ZoneName string `json:"zone_name"`
        } `json:"zone_list"`
    }
]
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
← 12.1 API 授权 14.1 系统设置 →