應用列表

建立 HTTP 應用

URI

POST /admin-api/applications/http

請求示例

Shell

curl 'http://{admin-site}/admin-api/applications/http' \
 -H 'Content-Type: application/json;charset=UTF-8' \
  --data-raw '{
    "partitions":[        // 應用所屬分割槽
        1
    ],
    "is_default":false,   // 是否預設應用
    "http_ports":[        // 監聽埠
        80
    ],
    "https_ports":[
        443
    ],
    "http2_status":"global",     // 支援 1."global": 使用全域性配置 2."disabled": 禁用 3."enabled": 啟用
    "allow_access_by_ip_list":["11.11.11.11"],  // 使用ip地址載入證書
    "allow_load_by_ip_list":[],  // 使用ip地址載入應用
    "domains":[
        {
            "is_wildcard":false, // 是否萬用字元
            "domain":"www.openresty.com"
        }
    ],
    "name": "openresty"          // 標籤
}'

響應示例

Status: 200 OK
{
    "status":0,
    "data":{
        "id":42    // app id
    }
}

建立 TLS 應用

URI

POST /admin-api/applications/tls

請求示例

Shell

curl 'http://{admin-site}/admin-api/applications/tls' \
 -H 'Content-Type: application/json;charset=UTF-8' \
  --data-raw '{
    "partitions":[        // 應用所屬分割槽
        1
    ],
    "is_default":false,   // 是否預設應用
    "http_ports":[        // 監聽埠
        80
    ],
    "https_ports":[
        443
    ],
    "http2_status":"global",    // 支援 1."global": 使用全域性配置 2."disabled": 禁用 3."enabled": 啟用
    "allow_access_by_ip_list":["11.11.11.11"],  // 使用ip地址載入證書
    "allow_load_by_ip_list":[], // 使用ip地址載入應用
    "domains":[
        "www.openresty.com"
    ],
    "name": "openresty"         // 標籤
}'

響應示例

Status: 200 OK
{
    "status":0,
    "data":{
        "id":42    // app id
    }
}

建立 TCP 應用

URI

POST /admin-api/applications/tcp

請求示例

Shell

curl 'http://{admin-site}/admin-api/applications/tcp' \
 -H 'Content-Type: application/json;charset=UTF-8' \
  --data-raw '{
    "tcp_ports":[
        86
    ]
    "partitions":[        // 應用所屬分割槽
        1
    ],
    "is_default":false,   // 是否預設應用
    "http_ports":[        // 監聽埠
        80
    ],
    "https_ports":[
        443
    ],
    "http2_status":"global",     // 支援 1."global": 使用全域性配置 2."disabled": 禁用 3."enabled": 啟用
    "allow_access_by_ip_list":["11.11.11.11"],  // 使用ip地址載入證書
    "allow_load_by_ip_list":[],  // 使用ip地址載入應用
    "label": "openresty"          // 標籤
}'

響應示例

Status: 200 OK
{
    "status":0,
    "data":{
        "id":42    // app id
    }
}

刪除 HTTP 應用

URI

DELETE /admin-api/applications/http/{app-id}

請求示例

Shell

curl 'http://{admin-site}/admin-api/applications/http/42' -X 'DELETE'

響應示例

Status: 200 OK
{
    "status":0
}

刪除 TLS 應用

URI

DELETE /admin-api/applications/tls/{app-id}

請求示例

Shell

curl 'http://{admin-site}/admin-api/applications/tls/42' -X 'DELETE'

響應示例

Status: 200 OK
{
    "status":0
}

刪除 TCP 應用

簡介

刪除 TCP 應用

URI

DELETE /admin-api/applications/tcp/{app-id}

請求示例

Shell

curl 'http://{admin-site}/admin-api/applications/tcp/42' -X 'DELETE'

響應示例

Status: 200 OK
{
    "status":0
}

獲取 HTTP/TLS/TCP 應用列表

URI

GET /admin-api/applications

URI 引數

  • detail

    type: integer

    is_necessary: no

    description: 傳任意值顯示詳細資訊,不傳顯示簡略資訊

  • partition_id

    type: integer

    required: no

    description: 叢集分割槽id

  • start_time

    type: integer

    required: no

    description: 建立時間起點,時間戳,為 0 表示無限制

  • end_time

    type: integer

    required: no

    description: 建立時間終點,時間戳,為 0 表示無限制

  • page

    type: integer

    required: no

    description: 第幾頁 (default 1)

  • page_size

    type: integer

    required: no

    description: 每頁大小 (default 20)

請求示例

Shell

curl 'http://{admin-site}/admin-api/applications?detail=1&partition_id=1&start_time=0&end_time=0&page=1&page_size=20'

響應示例

Status: 200 OK
{
    "status":0,
    "data":{
        "meta":{
            "count":7
        },
        "data":[
            {
                "partitions":[
                    1
                ],
                "id":4,
                "domains":[
                    "www.openresty.com"
                ],
                "_created_unix":1615442119.4638,
                "creator":1,
                "_modified_unix":1615442119.4638,
                "pending_changes":0,
                "type":"tls"
            },
            {
                "partitions":[
                    1
                ],
                "creator":1,
                "pending_changes":0,
                "label":"openresty",
                "id":3,
                "_created_unix":1615441984.9297,
                "type":"tcp",
                "_modified_unix":1615441984.9297,
                "tcp_ports":[
                    86
                ]
            },
            {
                "partitions":[
                    1
                ],
                "offline":{
                    "enabled":false
                },
                "creator":1,
                "http_ports":[
                    80
                ],
                "pending_changes":3,
                "type":"http",
                "is_default":false,
                "_modified_unix":1615440009.7412,
                "domains":[
                    {
                        "is_wildcard":false,
                        "domain":"www.openresty.com",
                        "id":42
                    }
                ],
                "id":42,
                "allow_access_by_ip_list":[
                    "11.22.33.44"
                ],
                "https_ports":[
                    443
                ],
                "http2_status":"disabled",
                "_created_unix":1615437907.3928
            },
        ]
    },
    "time":1615443068
}

搜尋 HTTP 應用

URI

GET /admin-api/search/http

URI引數

  • partition_id

    type: integer

    required: no

    description: 叢集分割槽id

  • domain

    type: string

    required: no

    description: 待搜尋的域名

  • start_time

    type: integer

    required: no

    description: 建立時間起點,時間戳,為 0 表示無限制

  • end_time

    type: integer

    required: no

    description: 建立時間終點,時間戳,為 0 表示無限制

  • page

    type: integer

    required: no

    description: 第幾頁 (default 1)

  • page_size

    type: integer

    required: no

    description: 每頁大小 (default 20)

請求示例

Shell

curl 'http://{admin-site}/admin-api/search/http?page=1&page_size=20&partition_id=1&start_time=0&end_time=0&domain=openresty'

響應示例

Status: 200 OK
{
    "status":0,
    "data":{
        "meta":{
            "count":4
        },
        "data":[
            {
                "partitions":[
                    1
                ],
                "offline":{
                    "enabled":false
                },
                "creator":1,
                "http_ports":[
                    80
                ],
                "is_default":false,
                "_created_unix":1615286153.3308,
                "_modified_unix":1615286293.5563,
                "domains":[
                    {
                        "is_wildcard":false,
                        "domain":"www.openresty.com",
                        "id":3
                    }
                ],
                "id":3,
                "pending_changes":2,
                "http2_status":"global",
                "type":"http"
            }
        ]
    },
    "time":1615443784
}

獲取未釋出的 HTTP/TLS/TCP 應用列表

URI

GET /admin-api/search/pending-app

URI引數

  • partition_id

    type: integer

    required: no

    description: 叢集分割槽id

  • start_time

    type: integer

    required: no

    description: 建立時間起點,時間戳,為 0 表示無限制

  • end_time

    type: integer

    required: no

    description: 建立時間終點,時間戳,為 0 表示無限制

  • page

    type: integer

    required: no

    description: 第幾頁 (default 1)

  • page_size

    type: integer

    required: no

    description: 每頁大小 (default 20)

請求示例

Shell

curl 'http://{admin-site}/admin-api/search/pending-app?page=1&page_size=20&partition_id=1&start_time=0&end_time=0'

響應示例

Status: 200 OK
{
    "status":0,
    "data":{
        "meta":{
            "count":3
        },
        "data":[
            {
                "partitions":[
                    1
                ],
                "offline":{
                    "enabled":false
                },
                "_modified_unix":1615440009.7412,
                "_created_unix":1615437907.3928,
                "creator":1,
                "http_ports":[
                    80
                ],
                "pending_changes":3,
                "type":"http",
                "id":42,
                "is_default":false,
                "allow_access_by_ip_list":[
                    "11.22.33.44"
                ],
                "domains":[
                    {
                        "is_wildcard":false,
                        "domain":"www.openresty.com",
                        "id":42
                    }
                ],
                "http2_status":"disabled",
                "https_ports":[
                    443
                ]
            }
        ]
    },
    "time":1615443288
}