3.12. 创建 ActiveDocs
使用 3scale toolbox 在 Developer Portal 中创建、更新、列出或删除 ActiveDocs。
3.12.1. 创建新的 ActiveDocs 复制链接链接已复制到粘贴板!
要从 API 定义创建一个新的 ActiveDocs,符合 OpenAPI 规格:
将 API 定义添加到 3scale,选择性地为其指定名称:
3scale activedocs create <remote> <activedocs-name> <specification>ActiveDocs 的 OpenAPI 规格是必需的,且必须是以下值之一:
- 可用路径中的文件名.
-
toolbox 可以从中下载内容的 URL。支持的方案是
http和https。 从
stdin标准输入流读取.这通过设置-值来控制。在创建 ActiveDocs 时使用以下选项:
Options -d --description=<value> Specify the description of the ActiveDocs -i --service-id=<value> Specify the Service ID associated to the ActiveDocs -o --output=<value> Output format on stdout: one of json|yaml -p --published Specify to publish the ActiveDocs on the Developer Portal. Otherwise it is hidden. -s --system-name=<value> Specify the system-name of the ActiveDocs --skip-swagger-validations Specify to skip validation of the Swagger specification Options for ActiveDocs -c --config-file=<value> toolbox configuration file. Defaults to $HOME/.3scalerc.yaml -h --help Print help for this command -k --insecure Proceed and operate even for server connections otherwise considered insecure -v --version Print the version of this command --verbose Verbose mode
- 在 Developer Portal 中发布该定义。
3.12.2. 创建或更新 ActiveDocs 复制链接链接已复制到粘贴板!
使用以下命令创建新的 ActiveDocs(如果不存在),或者使用新的 API 定义更新现有 ActiveDocs:
3scale activedocs apply <remote> <activedocs_id_or_system_name>
在更新 ActiveDocs 时使用以下选项:
Options
-d --description=<value> Specify the description of the
ActiveDocs
--hide Specify to hide the ActiveDocs
on the Developer Portal
-i --service-id=<value> Specify the Service ID associated
to the ActiveDocs
-o --output=<value> Output format on stdout:
one of json|yaml
--openapi-spec=<value> Specify the Swagger specification.
Can be a file, a URL or '-' to read
from stdin. This is a mandatory
option when applying the ActiveDoc
for the first time.
-p --publish Specify to publish the ActiveDocs
on the Developer Portal. Otherwise
it is hidden
-s --name=<value> Specify the name of the ActiveDocs
--skip-swagger-validations=<value> Specify whether to skip validation
of the Swagger specification: true
or false. Defaults to true.
Options for ActiveDocs
-c --config-file=<value> 3scale toolbox configuration file:
defaults to $HOME/.3scalerc.yaml
-h --help Print help for this command
-k --insecure Proceed and operate even for server
connections otherwise considered
insecure
-v --version Print the version of this command
--verbose Verbose mode
activedocs 应用 --skip-swagger-validations 的行为在 3scale 2.8 中 更改。您可能需要使用 activedocs apply 更新现有脚本。在以前的版本中,如果您没有在每个 activedocs apply 命令中指定这个选项,则不会跳过验证。现在,--skip-swagger-validations 默认为 true。
3.12.3. 列出 ActiveDocs 复制链接链接已复制到粘贴板!
使用以下命令在 Developer Portal 中获取有关所有 ActiveDocs 的信息,包括:
- id
- name
- 系统名称
- description
- 发布(这意味着可以在开发人员门户中显示)
- 创建日期
- 最新更新日期
以下命令列出所有定义的 ActiveDocs:
3scale activedocs list <remote>
在列出 ActiveDocs 时请使用以下选项:
Options
-o --output=<value> Output format on stdout:
one of json|yaml
-s --service-ref=<value> Filter the ActiveDocs by service
reference
Options for ActiveDocs
-c --config-file=<value> 3scale toolbox configuration file:
defaults to $HOME/.3scalerc.yaml
-h --help Print help for this command
-k --insecure Proceed and operate even for server
connections otherwise considered insecure
-v --version Print the version of this command
--verbose Verbose mode
3.12.4. 删除 ActiveDocs 复制链接链接已复制到粘贴板!
以下命令删除 ActiveDocs:
3scale activedocs delete <remote> <activedocs-id_or-system-name>
在删除 ActiveDocs 时使用以下选项:
Options for ActiveDocs
-c --config-file=<value> 3scale toolbox configuration file:
defaults to $HOME/.3scalerc.yaml
-h --help Print help for this command
-k --insecure Proceed and operate even for server
connections otherwise considered insecure
-v --version Print the version of this command
--verbose Verbose mode