Shipyard远程API

1、鉴权模块

1.1 Login,获取token

POST  http://192.168.31.149:8080/auth/login

Headers

Content-Type: application/json

Body:

{

"username": "admin",

"password": "shipyard"

}

response


{

"auth_token": "$2a$10$kwlWJbgjkEWnN.JhHJINZOp6grcuio1.USA.io28tTLkKzuCnLl.m",

"user_agent": "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0"

}

2、容器管理

2.1 获取容器列表

GET  http://192.168.31.149:8080/api/containers

Headers

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0

X-Access-Token: admin:$ $2a$10$kwlWJbgjkEWnN.JhHJINZOp6grcuio1.USA.io28tTLkKzuCnLl.m

response


[

{

"id": "5c12b9ad2961cba3a57947ef5a927dd01545bfe8a73785f7c3b13cb7d0704e38",

"name": "/shipyard",

"image": {

"name": "shipyard/shipyard:latest",

"entrypoint": [

"/controller"

],

"hostname": "5c12b9ad2961",

"bind_ports": [

{

"proto": "tcp",

"host_ip": "0.0.0.0",

"port": 8080,

"container_port": 8080

}

],

"restart_policy": {},

"network_mode": "bridge"

},

"engine": {

"id": "compute2",

"addr": "http://192.168.31.149:4243",

"cpus": 4,

"memory": 4096,

"labels": [

"dd"

]

},

"state": "running",

"ports": [

{

"proto": "tcp",

"host_ip": "0.0.0.0",

"port": 8080,

"container_port": 8080

}

]

},

{

"id": "4a5f16641c2a5ecca0b05b399bfdaf3c62abf3681289189ee5336feeeb96b4a9",

"name": "/gloomy_darwin",

"image": {

"name": "mysql_test:latest",

"environment": {

"CLOUD_URL": "http://192.168.31.147:8080/starott_cloud_client/cloud/commomconfig/"

},

"hostname": "mysqls",

"restart_policy": {},

"network_mode": "bridge"

},

"engine": {

"id": "compute2",

"addr": "http://192.168.31.149:4243",

"cpus": 4,

"memory": 4096,

"labels": [

"dd"

]

},

"state": "stopped"

},

 

2.2 创建容器

POST  /api/containers

Headers

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0

X-Access-Token: admin:$2a$10$P8jnLva2KnYP0xWOLCmYruD0B11z0JIpH3cOnDHplxFdbBIZv.iOW

Request body


{

"name": "ehazlett/go-demo",

"container_name": "demo",

"cpus": 0.1,

"memory": 32,

"type": "service",

"hostname": "",

"domain": "",

"labels": ["local"],

"args": [],

"environment": {

"FOO": "bar"

},

"restart_policy": {

"name": "always"

},

"bind_ports": [

{

"host_ip": "10.1.2.3",

"proto": "tcp",

"container_port": 8080

},

{

"proto": "tcp",

"port": 80,

"container_port": 8080

}

],

"links": {

"redis": "db"

}

}

Reponse

       [
  {
    "state": {
      "started_at": "2014-09-12T00:48:23.824260519Z",
      "pid": 5890,
      "running": true
    }, 
    "ports": [
      {
        "container_port": 8080,
        "host_ip": "10.1.2.3",
        "port": 49172,
        "proto": "tcp"
      }
    ],
    "engine": {
      "labels": [
        "local",
        "dev"
      ],
      "memory": 4096,
      "cpus": 4,
      "addr": "http://172.16.1.50:2375",
      "id": "local"
    },
    "image": {
      "restart_policy": {
        "name": "always"  
      },
      "labels": [
        "local"
      ],
      "bind_ports": [
        {
          "proto": "tcp",
          "port": 49153,
          "container_port": 8080
        },
        {
          "proto": "tcp",
          "port": 80,
          "container_port": 8080
        }
      ],
      "links": {
        "redis": "db"
      },
      "type": "service",
      "memory": 32,
      "cpus": 0.1,
      "name": "ehazlett/go-demo"
    },
    "id": "4a5da04b8428e7241a9d9993699513d11b89948399dedfa12"
  }
]

 

2.3 重启容器

GET /api/containers/<id>/restart
Restart a container
Request
GET /api/containers/3e532/restart HTTP/1.1
Response
HTTP/1.1 204 No Content

2.4 停止容器

GET /api/containers/<id>/stop
Stop a container
Request
GET /api/containers/3e532/stop HTTP/1.1
Response
HTTP/1.1 204 No Content

2.5 销毁容器

DELETE /api/containers/<id>
Destroy a container
Request
DELETE /api/containers/3e532 HTTP/1.1
Response
HTTP/1.1 204 No Content

 

3、计算节点管理

3.1 获取计算节点列表

GET  http://192.168.31.149:8080/api/engines

Headers

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0

X-Access-Token: admin:$2a$10$P8jnLva2KnYP0xWOLCmYruD0B11z0JIpH3cOnDHplxFdbBIZv.iOW

response


[

{

"id": "c589bf34-513e-4a15-8164-146511c5e177",

"engine": {

"id": "compute2",

"addr": "http://192.168.31.149:4243",

"cpus": 4,

"memory": 4096,

"labels": [

"dd"

]

},

"health": {

"status": "up",

"response_time": 1375306

},

"docker_version": "1.5.0-dev"

}

]

3.2 添加计算节点

POST /api/engines

Add an engine to the cluster

Request

POST /api/engines HTTP/1.1
Content-Type application/json
 
{
  "id": "local",
  "ssl_cert": "",
  "ssl_key": "",
  "ca_cert": "",
  "engine": {
    "id": "local",
    "addr": "http://10.1.2.3:2375",
    "cpus": 4.0,
    "memory": 8192,
    "labels": [
      "local",
      "dev"
    ]
  }
}
Response
HTTP/1.1 201 Created

3.3 删除计算节点

DELETE /api/engines/<id>

Remove an engine from the cluster

Request

DELETE /api/engines/99095f5f-7579-4a70-9369-04ad73c21312 HTTP/1.1

Response

HTTP/1.1 204 No Content

时间: 2024-11-03 03:35:25

Shipyard远程API的相关文章

Debian 下docker 开启远程api失败

系统版本: Debian 8.3 问题: Debian下增加dcoker的远程api,始终不能打开网络端口. 过程: 修改/etc/default/docker 增加一行 DOCKER_OPTS="-H 0.0.0.0:2376 -H unix:///var/run/docker.sock" 重启docker: service docker restart 查看端口是否打开: lsof -i:2376  没有任何返回. 查看日志: Mar 28 12:44:32 docker1 doc

Confluence 6 启用远程 API

XML-RPC 和 SOAP 远程 API 从 Confluence 5.5 开始已经废弃了.我们推荐你使用完全支持的Confluence Server REST API. 希望启用 XML-RPC 和 SOAP 远程 API,你需要从管理员控制台(Administration Console)中启用 API.你需要具有系统管理员权限才能进行这个操作. 如何启用远程 API: 在屏幕的右上角单击 控制台按钮 ,然后选择 General Configuration 链接. 在左侧面板中单击 更多设

Confluence 6 匿名访问远程 API

Confluence 管理员可能希望为匿名用户禁用远程访问 API.这样能够避免恶意软件随意在网站进行批量修改. 希望禁用远程访问 API: 在屏幕的右上角单击 控制台按钮 ,然后选择 General Configuration 链接. 在左侧的面板中选择 安全配置(Security Configuration).安全配置(Security Configuration) 界面将会显示出来. 选择 编辑(Edit). 取消 匿名访问 API(Anonymous Access to API)的选择框

大叔也说Xamarin~Android篇~调用远程API接口,发POST请求

Xamarin我们在上节已经教大家如何去部署它的环境了,今天来说一个实际的例子,使用android客户调用.net web api的一个接口,并发送POST请求,当服务端回到请求后做出响应,客户端android将响应的内容输出,并跳换到别一个Activity页面,在新视图上加载网页内容到webView控件上,整个流程结束! 一 在主页面上添加几个表单元素,账号,密码,登陆按钮,并在Activity类的OnCreate方法中为它们赋值,并添加按钮的click事件 protected overrid

本地调试远程api tag

当你在本地开发js且需要跨域调用远程接口的时候.可按照下列步骤设置你的chrome. 1.创建chrome快捷方式. 2.右键属性新的快捷方式,在目标一栏后面追加 "--args --disable-web-security". 3.关闭所有chrome,从新的快捷方式启动.当出现以下黄条则说明设置成功.

通过Hutool 调用远程API接口(POST/GET)

背景:需要调用第三方接口,开启某项任务,用Hutool代替了HttpClient 调用第三方接口,简单粗暴. 代码如下:import java.util.Date;import org.apache.commons.lang.time.DateFormatUtils;import cn.hutool.http.HttpRequest;import cn.hutool.http.HttpUtil;import cn.hutool.json.JSONObject;import cn.hutool.j

.Net C#向远程服务器Api上传文件

Api服务代码一: /// <summary> /// 服务器接收接口 /// </summary> [HttpPost] [Route("ReceiveFile")] public HttpResponseMessage ReceiveFile() { string result = string.Empty; ArrayList list = new ArrayList(); try { Stream postStream = HttpContext.Cur

android命令模式IntentService 远程下载文件

服务可用在一下情景: 1,用户离开activity后,仍需要继续工作,例如从网络下载文件,播放音乐. 2,无论activity出现或离开,都需要持续工作,例如网络聊天应用. 3,连接网络服务,正在使用一个远程API提供的服务. 4,定时触发的任务 1.因为IntentService是Service子类,所以也需要在manifest中声明服务 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns

ABP源码分析三十六:ABP.Web.Api

这里的内容和ABP 动态webapi没有关系.除了动态webapi,ABP必然是支持使用传统的webApi.ABP.Web.Api模块中实现了一些同意的基础功能,以方便我们创建和使用asp.net webApi. AbpApiController:这是一个抽象基类,继承自ApiController,是AB WebApi系统中所有controller的基类.如下图中,其封装了ABP核心模块中提供的大多数的功能对象.同时实现了一些公共的方法.它有四个派生类:DynamicApiController<