路由

https://flynn.io/schema/router/route#

属性 类型 描述
id uuid string 唯一标示
parent_ref uuid string 唯一标示
type string http tcp
service uuid string 唯一标示
domain string 路由域名。仅适用于 HTTP 路由。
tls_cert string 路由可选的 TLS 证书。仅用于 HTTP 路由。
tls_key string 路由可选的 TLS 私钥。仅用于 HTTP 路由。
path string 路由到这个服务的可选路径。仅用于 HTTP 路由,且不与 TLS 选项公用
sticky boolean 路由是否使用粘性会话。仅用于 HTTP 路由。
port integer TCP 端口上监听 TCP 路由。
created_at date-time string 对象创建的时间戳
updated_at date-time string 对象最新更新的时间戳

创建路由

实例:—————————————————请求—————————————————

  1. POST /routes HTTP/1.1
  2. Content-Type: application/json
  1. {
  2. "type": "http",
  3. "service": "foo-web",
  4. "created_at": "0001-01-01T00:00:00Z",
  5. "updated_at": "0001-01-01T00:00:00Z",
  6. "domain": "http://example.com"
  7. }

—————————————————响应—————————————————

  1. Content-Type: application/json; charset=UTF-8
  1. {
  2. "type": "http",
  3. "id": "e8080915-1d48-4374-ac4f-c54a88bdd210",
  4. "service": "foo-web",
  5. "created_at": "2015-02-16T21:19:04.116018Z",
  6. "updated_at": "2015-02-16T21:19:04.116018Z",
  7. "domain": "http://example.com"
  8. }

更新路由

实例:—————————————————请求—————————————————

  1. PUT /routes/http/e8080915-1d48-4374-ac4f-c54a88bdd210 HTTP/1.1
  2. Content-Type: application/json
  1. {
  2. "type": "http",
  3. "id": "e8080915-1d48-4374-ac4f-c54a88bdd210",
  4. "service": "bar-web",
  5. "created_at": "0001-01-01T00:00:00Z",
  6. "updated_at": "0001-01-01T00:00:00Z",
  7. "domain": "http://example.com"
  8. }

—————————————————响应—————————————————

  1. Content-Type: application/json; charset=UTF-8
  1. {
  2. "type": "http",
  3. "id": "e8080915-1d48-4374-ac4f-c54a88bdd210",
  4. "service": "bar-web",
  5. "created_at": "2015-02-16T21:19:04.116018Z",
  6. "updated_at": "2015-02-16T21:19:04.11883Z",
  7. "domain": "http://example.com"
  8. }

获取路由

实例:—————————————————请求—————————————————

  1. GET /routes/http/e8080915-1d48-4374-ac4f-c54a88bdd210 HTTP/1.1
  2. Content-Type: application/json

—————————————————响应—————————————————

  1. Content-Type: application/json; charset=UTF-8
  1. {
  2. "type": "http",
  3. "id": "e8080915-1d48-4374-ac4f-c54a88bdd210",
  4. "service": "bar-web",
  5. "created_at": "2015-02-16T21:19:04.116018Z",
  6. "updated_at": "2015-02-16T21:19:04.11883Z",
  7. "domain": "http://example.com"
  8. }

获取路由列表

实例:—————————————————请求—————————————————

  1. GET /routes HTTP/1.1
  2. Content-Type: application/json

—————————————————响应—————————————————

  1. Content-Type: application/json; charset=UTF-8
  1. [
  2. {
  3. "type": "http",
  4. "id": "e8080915-1d48-4374-ac4f-c54a88bdd210",
  5. "service": "bar-web",
  6. "created_at": "2015-02-16T21:19:04.116018Z",
  7. "updated_at": "2015-02-16T21:19:04.11883Z",
  8. "domain": "http://example.com"
  9. },
  10. {
  11. "type": "http",
  12. "id": "6391ee42-7db1-4387-95da-75cfee2e80e1",
  13. "parent_ref": "controller/apps/61c01ac5e89140d39410395cdfcf38fa",
  14. "service": "dashboard-web",
  15. "created_at": "2015-02-16T21:19:02.094033Z",
  16. "updated_at": "2015-02-16T21:19:02.094033Z",
  17. "domain": "dashboard.dev.localflynn.com",
  18. "tls_cert": "-----BEGIN CERTIFICATE-----\nMIIDOjCCAiSgAwIBAgIQLcnOaDV3iECxwsxhMPbvSTALBgkqhkiG9w0BAQswHTEO\nMAwGA1UEChMFRmx5bm4xCzAJBgNVBAsTAkNBMB4XDTE1MDIxNjIxMTkwMVoXDTIw\nMDIxNTIxMTkwMVowLTEOMAwGA1UEChMFRmx5bm4xGzAZBgNVBAMTEmRldi5sb2Nh\nbGZseW5uLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMZc97RD\nC66GKEpKRmtCazziQl+M4M8P0OfWyN73IANpCiu6pbgdXuCVsQFjC/kLuWwINxp9\ntvXvjWk5UYyU5EX0ZMUu6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WhM/04ey6edk\n3ncMytXMrSixx3qLgud/2K01xgAjf0LvWt24WUfWYI3b+n1Mmd8OsVNsGE7Nf8xy\nC3q9HAaOevO64JvjXaLCw6Qn2kymj3sJffoBLe9WefrF8CL2Hj6MXTlDp6xNZU7i\nf6OlTQKBgQCYa/mTIT4NZuyoQitUIl8GyqeR3GHyaSfxCaPlynUG3iHdlr2NOfL1\nGlx5tGwcawJ1DUe/eKzA3Cj7IM+UcDTdIJM2t3dbQOPh/qEPY54NKTh5yHZ+qeuO\nrpSlpImSAUx46q7rnnm8KlEYKg6xVEwACHJFk55WxilDmee+/ZACag==\n-----END RSA PRIVATE KEY-----\n"
  20. },
  21. {
  22. "type": "http",
  23. "id": "4cf50c90-4f33-43a6-af4b-f1695fd17ee4",
  24. "parent_ref": "controller/apps/0fa0d7a91e634d58be2a758e9e109ee8",
  25. "service": "flynn-controller",
  26. "created_at": "2015-02-16T21:19:01.537271Z",
  27. "updated_at": "2015-02-16T21:19:01.537271Z",
  28. "domain": "controller.dev.localflynn.com",
  29. "tls_cert": "-----BEGIN CERTIFICATE-----\nMIIDOjCCAiSgAwIBAgIQLcnOaDV3iECxwsxhMPbvSTALBgkqhkiG9w0BAQswHTEO\nMAwGA1UEChMFRmx5bm4xCzAJBgNVBAsTAkNBMB4XDTE1MDIxNjIxMTkwMVoXDTIw\nMDIxNTIxMTkwMVowLTEOMAwGA1UEChMFRmx5bm4xGzAZBgNVBAMTEmRldi5sb2Nh\nbGZseW5uLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMZc97RD\nC66GKEpKRmtCazziQl+M4M8P0OfWyN73IANpCiu6pbgdXuCVsQFjC/kLuWwINxp9\ntvXvjWk5UYyU5EX0ZMUu6uaN7DQ8tIUPV89lpFx1bIbH+vtx/KvhUtUc0eNT0leG\n2Jd6PgO468oFYAT8I+QPe3ngpbNvLWofZe59nOTYWvxBfHoE2kacFUCaTYC9fgjq\nnh6Pn9xcBM3pIJQ4m9kL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p6xNZU7i\nf6OlTQKBgQCYa/mTIT4NZuyoQitUIl8GyqeR3GHyaSfxCaPlynUG3iHdlr2NOfL1\nGlx5tGwcawJ1DUe/eKzA3Cj7IM+UcDTdIJM2t3dbQOPh/qEPY54NKTh5yHZ+qeuO\nrpSlpImSAUx46q7rnnm8KlEYKg6xVEwACHJFk55WxilDmee+/ZACag==\n-----END RSA PRIVATE KEY-----\n"
  31. },
  32. {
  33. "type": "tcp",
  34. "id": "733348c4-f2e0-490f-bd90-67c9551aa3a6",
  35. "parent_ref": "controller/apps/a1f78fa3a47243cea6a0b4a4e0b40beb",
  36. "service": "gitreceive",
  37. "created_at": "2015-02-16T21:19:01.521562Z",
  38. "updated_at": "2015-02-16T21:19:01.521562Z",
  39. "port": 2222
  40. }
  41. ]

删除路由

实例:—————————————————请求—————————————————

  1. DELETE /routes/http/e8080915-1d48-4374-ac4f-c54a88bdd210 HTTP/1.1
  2. Content-Type: application/json

—————————————————响应—————————————————

  1. Content-Type: application/json; charset=UTF-8

错误

https://flynn.io/schema/router/error#

属性 类型 描述
code string 未发现、未发现对象、对象已存在、语法错误、校验错误、未知错误
message string
detail object

原文: http://doc.oschina.net/flynn?t=54126