APISIX Dashboard中文文档(一)

2023-11-06

2022年7月6日13:24:56

APISIX Dashboard中文文档(一)APISIX Dashboard中文文档(二)APISIX Dashboard中文文档(三)

官方文档:https://apisix.apache.org/zh/docs/dashboard/USER_GUIDE/

用户指南

以下是模块快照的一部分。

仪表板#
我们通过在 iframe 中引用来支持监控页面。 在访问 Grafana 之前,请启用 allow_embedding=true,默认为 false。 由于安全策略,这会导致浏览器无法正确呈现 Grafana 页面。

image

路由#
Route 模块旨在通过 UI 控制路由,而不是调用 API。

列表#image

创建#image

image

image

image

image

设置#image

导入 OpenAPI 指南

概述#
OpenAPI 规范 (OAS) 为 RESTful API 定义了一个与语言无关的标准接口,它允许人类和计算机在不访问源代码、文档或通过网络流量检查的情况下发现和理解服务的功能。

Apache APISIX Dashboard 支持导入OpenApi3.0(我们将简称为 OAS3.0)文件,json并且yaml都支持,以创建一个或多个路由。目前我们支持大部分的 OpenApi 规范,但还是有一些区别,比如兼容性和扩展字段。

扩展字段#
APISIX Route 中有些字段是必填的,但 OAS3.0 的属性中没有包含,为了方便基于 OAS3.0 扩展自定义路由实体,我们增加了一些扩展字段,如上游、插件、主机等上。所有扩展都以 x-apisix 开头。

Extended fields APISIX Route Properties
x-apisix-plugins plugins
x-apisix-script script
x-apisix-upstream upstream
x-apisix-host host
x-apisix-hosts hosts
x-apisix-remote_addr remote_addr
x-apisix-priority priority
x-apisix-vars vars
x-apisix-filter_func filter_func
x-apisix-labels labels
x-apisix-enable_websocket enable_websocket
x-apisix-status status
x-apisix-service_id service_id
x-apisix-upstream_id upstream_id

请注意,我们只扩展了第一级字段,子级字段仍然保持不变。 以 x-apisix-upstream 为例。

...
# 我们在 OAS3.0 中添加 x-apisix-upstream 作为扩展字段代表上游
x-apisix-upstream:
  # x-apisix-upstream 的子字段仍然与上游的子字段保持一致
  type: roundrobin
  nodes:
    - host: 172.16.238.20
      port: 1980
      weight: 1
...

有关 APISIX 路由属性的更多详细信息,请参阅

OAS3.0 兼容性

当我们从 OAS3.0 导入路由时,会因为 APISIX 的 Route 中没有对应的字段而遗漏 OAS3.0 中的一些字段:

  1. API General Info:用于描述你的API的一般信息,有时,一个OAS3.0文件包含一系列 属于应用程序的 api,因此此信息不同于 api 的名称和额外的基本信息。

例子:

# this part of information will be missed
openapi: 3.0.0
info:
  version: 1.0.0-oas3
  description: test desc
  license:
    name: Apache License 2.0
    url: 'http://www.apache.org/licenses/LICENSE-2.0'
  title: test title
...
  1. API 服务器和基本路径:上游 url + url 前缀(选项)

例子:

# this part of information will be missed
...
servers:
  - url: https://api.example.com/v1
...
  1. Path params: 路径中描述的 api 参数.

例子:

# 不管 uri 中有多少路径参数
# 从 OAS3.0 文件导入路由后,我们将得到带有 uri 的路由,如 `/get/*`
...
paths:
  /get/{id}/{name}:
    delete:
      operationId: api1DELETE
...
  1. Query params: 查询中描述的 api 参数.

Example:

...
paths:
  /users:
    get:
      summary: Get a user by ID
      # this part of information will be missed
      parameters:
        - in: path
          name: userId
          schema:
            type: integer
          required: true
          description: Numeric ID of the user to get
...
  1. Responses description and links: 定义 API 操作的响应.

Example:

...
paths:
  /hello:
    get:
      description: hello world.
      operationId: hello
      x-apisix-service_id: service1
      # this part of information will be missed
      responses:
        '200':
          description: list response
        default:
          description: unexpected error
...

不同用户场景下OAS3.0配置示例

配置基本发布路由

提示:导入的路由默认的status为unpublished,表示该路由不能访问,如果要导入一个published的路由,需要在里面加上x-apisix-status: 1 你的OAS3.0文件

openapi: 3.0.0
info:
  version: 1.0.0-oas3
  description: test desc
  license:
    name: Apache License 2.0
    url: 'http://www.apache.org/licenses/LICENSE-2.0'
  title: test title
paths:
  /hello: # route uri
    get: # route method
      description: hello world. # route desc
      operationId: hello # route name
      x-apisix-upstream: # route upstream
        type: roundrobin
        nodes:
          - host: 172.16.238.20
            port: 1980
            weight: 1
      x-apisix-status: 1 # the route will be published after imported
      responses:
        '200':
          description: list response
        default:
          description: unexpected error

使用插件配置路由

提示:扩展字段支持的大多数插件 x-apisix-plugins

openapi: 3.0.0
info:
  version: 1.0.0-oas3
  description: test desc
  license:
    name: Apache License 2.0
    url: 'http://www.apache.org/licenses/LICENSE-2.0'
  title: test title
paths:
  /hello:
    get:
      description: hello world.
      operationId: hello
      x-apisix-upstream:
        type: roundrobin
        nodes:
          - host: 172.16.238.20
            port: 1980
            weight: 1
      x-apisix-plugins:
        limit-count:
          count: 2
          time_window: 60
          rejected_code: 503
          key: remote_addr
          policy: local
      responses:
        '200':
          description: list response
        default:
          description: unexpected error

配置带有参数验证的路由

提示:对于插件 request-validation,我们将使用 参数序列化 用于标头参数验证和 描述请求正文 用于 OAS3.0 中的正文参数验证

openapi: 3.0.0
info:
  version: "1"
  description: |-
    test desc
  license:
    name: Apache License 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0
  title: |-
    test title
paths:
  /hello:
    post:
      description: |-
        hello world.
      operationId: hello
      x-apisix-upstream:
        type: roundrobin
        nodes:
          - host: "172.16.238.20"
            port: 1980
            weight: 1
      parameters:
        - name: id
          in: header
          description: ID of pet to use
          required: true
          schema:
            type: string
          style: simple

      requestBody:
        content:
          'application/x-www-form-urlencoded':
            schema:
              properties:
                name:
                  description: Update pet's name
                  type: string
                status:
                  description: Updated status of the pet
                  type: string
              required:
                - status
      responses:
        200:
          description: list response
        default:
          description: unexpected error

使用身份验证插件配置路由

注意: 对于插件 basic-auth jwt-authkey-auth 我们将使用 Authentication 在 OAS3.0

components:
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
openapi: 3.0.0
info:
  version: "1"
  description: |-
    test desc
  license:
    name: Apache License 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0
  title: |-
    test title
paths:
  /hello:
    post:
      description: |-
        hello world.
      operationId: hello
      x-apisix-upstream:
        type: roundrobin
        nodes:
          - host: "172.16.238.20"
            port: 1980
            weight: 1
      security:
        - basicAuth: []
        - ApiKeyAuth: []
        - BearerAuth: []
      responses:
        200:
          description: list response
        default:
          description: unexpected error

配置现有服务或上游的路由

提示: 如果 APISIX 中不存在 service_idupstream_id,从配置文件导入路由会报错

openapi: 3.0.0
info:
  version: 1.0.0-oas3
  description: test desc
  license:
    name: Apache License 2.0
    url: 'http://www.apache.org/licenses/LICENSE-2.0'
  title: test title
paths:
  /hello:
    get:
      description: hello world.
      operationId: hello
      x-apisix-service_id: service1
      responses:
        '200':
          description: list response
        default:
          description: unexpected error

配置多个路由

info:
  title: RoutesExport
  version: 3.0.0
openapi: 3.0.0
paths:
  /get:
    delete:
      operationId: api1Delete
      requestBody: {}
      responses:
        default:
          description: ''
      x-apisix-enableWebsocket: false
      x-apisix-labels:
        API_VERSION: v2
        dev: test
      x-apisix-plugins:
        proxy-rewrite:
          disable: false
          scheme: https
      x-apisix-priority: 0
      x-apisix-status: 1
      x-apisix-upstream:
        nodes:
          - host: httpbin.org
            port: 443
            weight: 1
        type: roundrobin
        pass_host: node
      x-apisix-vars: []
    get:
      operationId: api1Get
      requestBody: {}
      responses:
        default:
          description: ''
      x-apisix-enableWebsocket: false
      x-apisix-labels:
        API_VERSION: v2
        dev: test
      x-apisix-plugins:
        proxy-rewrite:
          disable: false
          scheme: https
      x-apisix-priority: 0
      x-apisix-status: 1
      x-apisix-upstream:
        nodes:
          - host: httpbin.org
            port: 443
            weight: 1
        type: roundrobin
        pass_host: node
      x-apisix-vars: []
  /post:
    post:
      operationId: test_post
      requestBody: {}
      responses:
        default:
          description: ''
      security: []
      x-apisix-enableWebsocket: false
      x-apisix-labels:
        API_VERSION: v1
        version: v1
      x-apisix-plugins:
        proxy-rewrite:
          disable: false
          scheme: https
      x-apisix-priority: 0
      x-apisix-status: 1
      x-apisix-upstream:
        nodes:
          - host: httpbin.org
            port: 443
            weight: 1
        type: roundrobin
        pass_host: node
      x-apisix-vars: []

管理API 的 API 文档

Manager API 直接操作 ETCD 并为 Apache APISIX 提供数据管理,为前端或其他客户端提供 API.

License: Apache License 2.0

/apisix/admin/migrate/export

GET

简介

导出配置文件以进行迁移

参数

None.

返回

A file for download.

/apisix/admin/migrate/import

简介

导入配置文件以恢复配置

POST

参数 (FORM)
Name Located in Description Required Schema
mode body(form) import mode (return, skip or overwrite) Yes string
file body(form) file to upload Yes string
返回
Code Description Schema
0 import success ApiError
20001 Config conflict ApiError

/apisix/admin/check_ssl_cert

POST

简介

验证 SSL 证书和密钥

参数
Name Located in Description Required Schema
cert body cert of SSL Yes string
key body key of SSL Yes string
返回
Code Description Schema
0 SSL verify passed ApiError
default unexpected error ApiError

/apisix/admin/check_ssl_exists

POST

简介

检查 SSL 是否存在

参数
Name Located in Description Required Schema
cert body cert of SSL Yes string
key body key of SSL Yes string
返回
Code Description Schema
0 SSL exists ApiError
default unexpected error ApiError

/apisix/admin/consumers

GET

简介

根据指定的页码和页面大小返回消费者列表,可以通过用户名搜索消费者。

参数
Name Located in Description Required Schema
page query page number No integer
page_size query page size No integer
username query username of consumer No string
返回
Code Description Schema
0 list response [ consumer ]
default unexpected error ApiError

/apisix/admin/notexist/routes

GET

简介

路由的返回结果通过名称和排除ID检查是否存在

参数
Name Located in Description Required Schema
name query name of route No string
exclude query id of route that exclude checking No string
返回
Code Description Schema
0 route not exists ApiError
default unexpected error ApiError

/apisix/admin/routes

GET

简介

根据指定的页码和页面大小返回路由列表,可以按名称和uri搜索路由

参数
Name Located in Description Required Schema
page query page number No integer
page_size query page size No integer
name query name of route No string
uri query uri of route No string
label query label of route No string
返回
Code Description Schema
0 list response [ route ]
default unexpected error ApiError

/apisix/admin/services

GET

简介

根据指定的页码和页面大小返回服务列表,并可按名称搜索服务

参数
Name Located in Description Required Schema
page query page number No integer
page_size query page size No integer
name query name of service No string
返回
Code Description Schema
0 list response [ service ]
default unexpected error ApiError

/apisix/admin/ssl

GET

简介

根据指定的页码和页面大小返回 SSL 列表,可以通过 sni 进行 SSL 搜索。

参数
Name Located in Description Required Schema
page query page number No integer
page_size query page size No integer
sni query sni of SSL No string
返回
Code Description Schema
0 list response [ ssl ]
default unexpected error ApiError

/apisix/admin/upstreams

GET

简介

根据指定的页码和页面大小返回上游列表,可以按名称搜索上游

参数
Name Located in Description Required Schema
page query page number No integer
page_size query page size No integer
name query name of upstream No string
返回
Code Description Schema
0 list response [ upstream ]
default unexpected error ApiError

/apisix/admin/user/login

POST

简介

用户登录.

参数
Name Located in Description Required Schema
username body user name Yes string
password body password Yes string
返回
Code Description Schema
0 login success ApiError
default unexpected error ApiError

Models

ApiError

Name Type Description Required
code long response code No
message string response message No

BaseInfo

Name Type Description Required
create_time long No
id object No
update_time long No

Consumer

Name Type Description Required
create_time long No
desc string No
id object No
labels object No
plugins object No
update_time long No
username string No

LoginInput

Name Type Description Required
password string password No
username string user name No

Route

Name Type Description Required
create_time long No
desc string No
enable_websocket boolean No
filter_func string No
host string No
hosts [ string ] No
id object No
labels object No
methods [ string ] No
name string No
plugins object No
priority long No
remote_addr string No
remote_addrs [ string ] No
script object No
service_id object No
service_protocol string No
update_time long No
upstream UpstreamDef No
upstream_id object No
uri string No
uris [ string ] No
vars object No

SSL

Name Type Description Required
cert string No
certs [ string ] No
create_time long No
exptime long No
id object No
key string No
keys [ string ] No
labels object No
sni string No
snis [ string ] No
status long No
update_time long No
validity_end long No
validity_start long No

Service

Name Type Description Required
create_time long No
desc string No
enable_websocket boolean No
id object No
labels object No
name string No
plugins object No
script string No
update_time long No
upstream UpstreamDef No
upstream_id object No

Upstream

Name Type Description Required
checks object No
create_time long No
desc string No
hash_on string No
id object No
k8s_deployment_info object No
key string No
labels object No
name string No
nodes object No
pass_host string No
retries long No
service_name string No
timeout object No
type string No
update_time long No
upstream_host string No

UpstreamDef

Name Type Description Required
checks object No
desc string No
hash_on string No
k8s_deployment_info object No
key string No
labels object No
name string No
nodes object No
pass_host string No
retries long No
service_name string No
timeout object No
type string No
upstream_host string No
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

APISIX Dashboard中文文档(一) 的相关文章

  • WPS授权过期问题解决方案——编程方法

    在使用WPS时 有时会遇到授权已到期的提示 这意味着您的WPS软件无法再正常使用 然而 通过编程 我们可以采取一些方法来解决这个问题 本文将介绍一种通过编程来解决WPS授权过期问题的方法 解决WPS授权过期问题的一种常见方法是修改系统的ho
  • python中mean的用法_Python Pandas dataframe.mean()用法及代码示例

    Python是进行数据分析的一种出色语言 主要是因为以数据为中心的python软件包具有奇妙的生态系统 Pandas是其中的一种 使导入和分析数据更加容易 Pandas dataframe mean 函数返回所请求轴的平均值 如果将方法应用
  • C语言实现二叉树(链式存储结构)+ 遍历

    C语言实现链式存储结构二叉树遍历 结构体定义及三种遍历方法 1 结构体定义 2 先序遍历 先序遍历的递归实现 先序遍历的非递归实现 3 中序遍历 中序遍历的递归实现 中序遍历的非递归实现 4 后续遍历 后序遍历的递归实现 5 二叉树的递归建
  • 九款实用的在线画图工具(那些可以替代Visio的应用)

    Visio是付费软件 通常会遇到下载 安装以及 授权 等各种问题 今天介绍的几款在线作图工具 帮你抛开下载 安装 授权等各种烦恼 1 LucidChart LucidChart是一个基于HTML5的在线流程图绘制和协作应用平台 用户可以方便
  • 冒号等于(:=)在Python语言中是什么意思?

    Python 3 8中提供了此语法 在Python语言中支持 运算符 以允许在表达式中进行变量赋值 此符号 是Python语言中的赋值运算符 主要称为海象运算符 简而言之 海象操作符压缩了我们的代码以使其更短 下面是一个非常简单的例子 wi
  • WSL编译linux-5.16.9 时出现 fatal error: libelf.h: No such file or directory

    make时出现两个错误 第一个是
  • Mac安装Android Studio并配置环境变量

    Mac安装Android Studio并配置环境变量 文章目录 Mac安装Android Studio并配置环境变量 安装JDK 下载并安装Android Studio 配置环境变量 安装JDK 检查 JDK 版本 在终端输入 java v
  • echarts地图自定义tooltip样式

    效果图 自定义tooltip样式 tooltip position 50 50 trigger item backgroundColor rgba 0 0 0 0 borderColor rgba 0 0 0 0 extraCssText
  • SQL学习笔记——REGEXP运算符

    REGEXP运算符 是正则表达式 regular expression 的缩写 正则表达式在搜索字符串时非常强大 下面是关于它的应用 1 查找名字中包含field的顾客 select from customers where last na
  • pytorch从0开始安装

    文章目录 一 安装anaconda 1 安装pytorch前需要先安装anaonda 首先进入官网 Anaconda The World s Most Popular Data Science Platform 进行安装相应的版本 2 接着
  • java编辑文件FileUtils

    FileUtiles 进行获取文件 把每行添加到字符串数组里 然后对每行进行替换 最后写回文件里 import org apache commons io FileUtils try str FileUtils readFileToStri
  • Python 学习资源 ( 整理日期2010-02-24 )

    Python 简明教程 入门必看 在线 浏览 http www woodpecker org cn 9081 doc abyteofpython cn chinese index html PDF http bbs chinaunix ne
  • 小酌Django4——博客文章展示

    小酌Django4 博客文章展示 文章列表页 已发布的文章列表展示页面 展示文章标题 交互模式下的数据读取 blog models py中创建数据模型后 Django会自动提供数据库抽象的API ORM 进行增删改查操作 使用命令pytho
  • TCP/IP 通信

    学习资料来源 正点原子STM32 目录 TCP IP TCP连接 TCP终止连接 MAC LAN8720 DMA LWIP内存分配 内存池 内存堆 数据包管理 pbuf介绍 数据包申请与释放 网络接口管理 ARP协议 TCP IP TCP是
  • input 去除边框/设置placeholder样式--SCSS

    input 去除边框 设置placeholder样式 SCSS el input edit v deep input webkit input placeholder font size 22px el input inner border
  • scrapy爬虫框架实例二 当当图书信息

    spider py import scrapy from DD items import DdItem class DdSpider scrapy Spider name dd allowed domains http search dan
  • 如何用crontab每隔1分钟执行一个命令行脚本

    我在 home 下面写了一个a sh bin sh echo hello gt home hello txt 然后在crontab e中设置了 1 home a sh 为何等了好几分钟 home下面还是没有hello txt呢 指定一下用什
  • python制造童年回忆【猫和老鼠小游戏】(附源码+详细分析)

    周末好吖 铁汁们 到了看动画片 打游戏 敲代码 的美好宅时光了 大家小时候有没有看过一部 猫和老鼠 的动画片80 90 00 应该都知道吧 10后可能就没听过了 接下来 让我隆重介绍本期游戏的主角们 他们就是 汤姆和杰瑞 相信不用我多介绍吧
  • window11系统基于 wsl2 安装Linux发行版ubuntu,并安装docker及vscode

    前景介绍 WSL是 Windows Subsystem for Linux 的缩写 顾名思义 WSL就是Windows系统的Linux子系统 其作为Windows组件搭载在Windows10周年更新 1607 后的Windows系统中 既然
  • 字符串和数学方法

    字符串 用单引号或双引号包起来 字符串也像数组一样 有数字索引 可以通过响应的索引可以通过响应索引对应字符 获取字符串的长度str length 获取第一个字符 0 获取最后一个字符 str str length 1 字符串常用方法 1 c

随机推荐