搜索

5.14. 创建 ActiveDocs

download PDF

使用 3scale toolbox 在 Developer Portal 中创建、更新、列出或删除 ActiveDocs。

5.14.1. 创建新的 ActiveDocs

要从 API 定义创建一个新的 ActiveDocs,符合 OpenAPI 规格:

  1. 将 API 定义添加到 3scale,选择性地为其指定名称:

    $ 3scale activedocs create <remote> <activedocs-name> <specification>

    ActiveDocs 的 OpenAPI 规格是必需的,且必须是以下值之一:

    • 可用路径中的文件名.
    • toolbox 可以从中下载内容的 URL。支持的方案是 httphttps
    • 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
  2. 在 Developer Portal 中发布该定义。

5.14.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
注意

在 3scale 2.8 中 activedocs apply --skip-swagger-validations 的行为有所变化。您可能需要使用 activedocs apply 更新现有脚本。在以前的版本中,如果您没有在每个 activedocs apply 命令中指定这个选项,则不会跳过验证。现在,--skip-swagger-validations 默认为 true

5.14.3. 列出 ActiveDocs

使用以下命令在 Developer Portal 中获取有关所有 ActiveDocs 的信息,包括:

  • id
  • 名称
  • 系统名称
  • 描述
  • 发布(这意味着可以在开发人员门户中显示)
  • 创建日期
  • 最新更新日期

以下命令列出所有定义的 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

5.14.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
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.