API
server
URI
http:/<server>:<port>/imanager/cloud/web/nodes/server[.<format>]
支持的方法
GET、POST
介绍
server 是 GIS 服务器列表的资源,可以获取 GIS 服务器列表,也可以通过 POST 请求来创建 GIS 服务器。
支持的方法:
- GET:获取 GIS 服务器列表。
- POST:创建 GIS 服务器。
支持的表述格式:JSON。
HTTP 请求方法
对如下 URI 执行 HTTP 请求,以 json 输出格式为例加以说明,其中,supermapimanager 是服务器名。
http://supermapimanager:8390/imanager/cloud/web/nodes/server.json
GET 请求
获取 GIS 服务器列表
请求参数
| 名称 | 类型 | 含义 | 
|---|---|---|
| pageSize | String | 每页大小,如果为-1,则没有限制,默认值是-1 | 
响应结构
返回 GIS 服务器列表,其中包含 GIS 服务器的基本信息,由以下字段组成:
| 字段 | 类型 | 说明 | 
|---|---|---|
| list | List | 本次请求返回的GIS 服务器列表 | 
| total | String | 总记录数,即 GIS 服务器个数 | 
其中 NodeInfo 表示 GIS 服务器详细信息,由以下字段组成:
| 字段 | 类型 | 说明 | 
|---|---|---|
| availabelTime | long | 环境可用时间 | 
| clusterSource | ClusterSource | 集群来源,其中ClusterSource有两个值CREATED表示由系统创建,BUILDED组建而来,特指集群 | 
| cpu | int | 虚拟机占用CPU内核数(个) | 
| createTime | long | 创建时间 | 
| description | String | 描述信息 | 
| disk | int | 虚拟机占用磁盘大小(GB) | 
| hireDays | int | 租用天数,默认0,表示无限制 | 
| hostName | String | 环境的主机名 | 
| id | int | 环境id | 
| ip | String | 环境ip | 
| memory | int | 虚拟机占用内存大小(GB) | 
| nodeCount | int | 环境个数或集群节点个数 | 
| nodeName | String | 节点名称,如果不指定,则默认为VM的名称.如:sm_iServer-123 | 
| nodeSource | NodeSource | 环境来源,其中NodeSource有两个值CREATED表示由系统创建,IMPORTED表示外部导入而来 | 
| nodeSpec | String | 节点规格,对应模板规格名称 | 
| nodeStatus | NodeStatus | 环境状态,包括 CREATING(正在创建), STARTING(正在启动), STOPPING(正在停止),REBOOTING(正在重启), RUNNING(运行中), DELETING(正在删除),STOPPED(已停止),PAUSED(已暂停),CREATE_FAILED(创建失败),NOT_FOUND(不存在),UNKNOWN(未知), MOVING(正在移动),RESIZING(正在调整),RESIZED(确认调整) | 
| operatingSystem | OperatingSystem | 环境操作系统类型,包括WINDOWS,LINUX,UNKNOWN | 
| parentId | int | 父节点ID.针对集群子节点 | 
| password | String | 环境密码 | 
| productInfos | List | 环境中所部署的应用信息 | 
| productPath | String | 环境中应用部署位置 | 
| resourceType | String | 资源类型,对应模板类型名称 | 
| thresholdEntity | ThresholdEntity | 环境阈值配置信息 | 
| updateTime | long | 更新时间 | 
| userName | String | 环境所属用户 | 
| uuid | String | 环境uuid,对应虚拟平台的唯一标识 | 
其中 ProductInfo 表示 环境中所部署的应用信息详细信息,由以下字段组成:
| 字段 | 类型 | 说明 | 
|---|---|---|
| id | int | 应用id | 
| nodeId | int | 环境id | 
| name | String | 应用名称 | 
| address | String | 应用地址 | 
| productStatus | ProductStatus | 应用状态,包括CREATING(正在创建),STARTING(正在启动), START_FAILED(启动失败),STOPPING(正在停止),REBOOTING(正在重启),RUNNING(运行中), DELETING(正在删除),STOPPED(已停止), CREATE_FAILED(创建失败), NOT_FOUND(不存在),UNKNOWN(未知), DEPLOYING(环境配置中) | 
其中 ThresholdEntity 表示 阈值实体 详细信息,由以下字段组成:
| 字段 | 类型 | 说明 | 
|---|---|---|
| id | int | 阈值id | 
| maxCreateCount | int | 最大新增节点数 | 
| maxUsage | float | 最大阈值 | 
| minUsage | float | 最小阈值 | 
| metricType | MetricType | 性能监控类型,包括 CPU(cpu), RAM(内存), NETWORK(网络I/O),INSTANCE(实例) | 
| thresholdStatus | ThresholdStatus | 动态伸缩的状态, 包括 ENABLED(动态伸缩开启), DISABLED(动态伸缩关闭),CONFLICT(动态伸缩出现冲突) | 
响应示例
在管理员登录的状态下,对http://supermapimanager:8390/imanager/cloud/web/nodes/server.json执行GET请求,则返回的 json 格式的响应结果如下:
{
  "list": [
    {
      "availabelTime": 0,
      "clusterSource": "CREATED",
      "cpu": 2,
      "createTime": 1480665238132,
      "description": "",
      "disk": 20,
      "hireDays": 0,
      "hostName": "iServer-38",
      "id": 4,
      "ip": "172.16.16.38",
      "memory": 2,
      "nodeCount": 1,
      "nodeName": "test",
      "nodeSource": "CREATED",
      "nodeSpec": "SMALL",
      "nodeStatus": "RUNNING",
      "operatingSystem": "LINUX",
      "parentId": -1,
      "password": "test",
      "productInfos": [
        {
          "address": "http://172.16.16.38:8090/iserver",
          "id": 5,
          "name": "iServer",
          "nodeId": 4,
          "productStatus": "STOPPED",
          "webApp": true
        }
      ],
      "productPath": "/etc/icloud/SuperMapiServer",
      "resourceType": "SERVER",
      "thresholdEntity": {
        "id": 4,
        "maxCreateCount": 0,
        "maxUsage": 80,
        "metricType": "CPU",
        "minUsage": 20,
        "thresholdStatus": "DISABLED"
      },
      "thresholdId": 4,
      "updateTime": 1480665267181,
      "userName": "admin",
      "uuid": "bc43556c-a6f7-4670-a5c7-bb5682b8f8a4"
    }
  ],
  "total": 1
}POST 请求
创建 GIS 服务器。
请求参数
| 字段 | 类型 | 说明 | 
|---|---|---|
| nodeSpec | String | 节点规格,对应模板规格名称 | 
| nodeCount | int | 环境个数或集群节点个数 | 
| nodeName | String | 节点名称,如果不指定,则默认为VM的名称.如:sm_iserver-123 | 
| password | String | 环境密码 | 
| description | String | 描述信息 | 
| physicalMachineName | String | 物理机名称,即VM需要部署在哪个主机上,默认跟模板VM一致 | 
响应结构
返回 GIS 服务器是否创建成功,如果失败会给出错误信息:
| 字段 | 类型 | 说明 | 
|---|---|---|
| isSucceed | boolean | 是否执行成功,失败时是false | 
| msg | String | 如果执行失败,会显示错误信息,执行成功则为空 | 
| resultId | String | 请求处理结果id。 例如创建环境返回对应任务的id | 
响应示例
在管理员登录的状态下,对http://supermapimanager:8390/imanager/cloud/web/nodes/server.json执行POST请求,传入相关参数,如下所示:
{
  "nodeSpec": "MEDIUM",
  "nodeCount": 1,
  "nodeName": "iserver",
  "password": "",
  "description": "",
  "physicalMachineName": "admin"
}则返回的 json 格式的响应结果如下:
{
  "isSucceed": true,
  "msg": "",
  "resultId": "684"
}