Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add public-api related content #6218

Merged
merged 14 commits into from
Feb 8, 2022

Conversation

bzp2010
Copy link
Contributor

@bzp2010 bzp2010 commented Jan 27, 2022

What this PR does / why we need it:

Add public-api related documents, and remove obsolete content regarding plugin interceptors and plugin development.

Pre-submission checklist:

  • Did you explain what problem does this PR solve? Or what new features have been added?
  • Have you added corresponding test cases?
  • Have you modified the corresponding document?
  • Is this PR backward compatible? If it is not backward compatible, please discuss on the mailing list first

@bzp2010 bzp2010 self-assigned this Jan 27, 2022
@bzp2010 bzp2010 marked this pull request as ready for review January 27, 2022 11:54
docs/en/latest/plugins/prometheus.md Outdated Show resolved Hide resolved
docs/en/latest/plugins/public-api.md Show resolved Hide resolved
docs/zh/latest/plugins/batch-requests.md Outdated Show resolved Hide resolved
docs/zh/latest/plugins/jwt-auth.md Outdated Show resolved Hide resolved
docs/zh/latest/plugins/node-status.md Outdated Show resolved Hide resolved
docs/zh/latest/plugins/wolf-rbac.md Outdated Show resolved Hide resolved
@@ -326,8 +326,7 @@ function _M.api()
end
```

注意注册的接口会暴露到外网。
你可能需要使用 [interceptors](plugin-interceptors.md) 来保护它。
注意,注册的接口将不会默认暴露,您需要使用[public-api 插件](plugins/public-api.md)来暴露它。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
注意,注册的接口将不会默认暴露,您需要使用[public-api 插件](plugins/public-api.md)来暴露它。
注意,注册的接口将不会默认暴露,需要使用[public-api 插件](plugins/public-api.md)来暴露它。

the use of honorifics for personal pronouns is not required in documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, Other personal pronouns in the md file of this PR design have also been removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


```
plugin_attr:
prometheus:
enable_export_server: false
```

同时,您还需要使用 [public-api](public-api.md) 插件来暴露它。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
同时,您还需要使用 [public-api](public-api.md) 插件来暴露它。
同时,需要使用 [public-api](public-api.md) 插件来暴露它。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

The `public-api` plugin is used to enhance the plugin public API access control.
When current users develop custom plugins, they can register some public APIs for fixed functionality, such as the `/apisix/plugin/jwt/sign` API in `jwt-auth`. These APIs can only apply limited plugins for access control (currently only `ip-restriction`) by way of plugin interceptors.

With the `public-api` plugin, we put the all public API into general HTTP API router, which is consistent with the normal route registered by the user and can apply any plugin. The public API added in the user plugin is no longer open by default by APISIX, but the user manually configures the route for it, and the user can configure any uri and plugin.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
With the `public-api` plugin, we put the all public API into general HTTP API router, which is consistent with the normal route registered by the user and can apply any plugin. The public API added in the user plugin is no longer open by default by APISIX, but the user manually configures the route for it, and the user can configure any uri and plugin.
With the `public-api` plugin, we put all public API into the general HTTP API router, which is consistent with the normal route registered by the user and can apply any plugin. The public API added in the user plugin is no longer open by default by APISIX, but the user manually configures the route for it, and the user can configure any uri and plugin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -40,7 +40,7 @@ title: node-status

## 插件接口

插件增加接口 `/apisix/status`,可通过 [interceptors](../plugin-interceptors.md) 保护该接口
插件增加接口 `/apisix/status`,需要通过 [public-api](public-api.md) 插件来暴露它
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update the link to point to English version like

| log_format | object | 可选 | {"host": "$host", "@timestamp": "$time_iso8601", "client_ip": "$remote_addr"} | | 以 JSON 格式的键值对来声明日志格式。对于值部分,仅支持字符串。如果是以 `$` 开头,则表明是要获取 [APISIX 变量](../../../en/latest/apisix-variable.md)[Nginx 内置变量](http://nginx.org/en/docs/varindex.html)。特别的,**该设置是全局生效的**,意味着指定 log_format 后,将对所有绑定 http-logger 的 Route 或 Service 生效。 |

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @spacewander.

As currently used, it renders properly on our official website (when no language-specific localization documents are returned to English), and if we modify it directly, it will cause confusion on the official website, i.e. some multilingual documents will be all linked back to the English version.
It seems like we can't have it both ways, but I think it's more important to make sure the content on the official website is always available in the right way than to use the md file to read it directly.

Currently there is no Chinese documentation for the public-api plugin, if you think it is really necessary to change it, I will do so.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using English only in this PR? After it gets merged, @guoqqqi and @Baoyuantop could help to translate 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bzp2010 @juzhiyuan
We already do this in other loggers. Although someone else can translate it later, but we should not invent another way to handle it, and merge a PR which will create known broken links.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@spacewander updated

Copy link
Member

@juzhiyuan juzhiyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@spacewander spacewander merged commit ec0fc2c into apache:master Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants