Skip to content

Commit

Permalink
docs: remove outdated content in grpc-transcode plugin doc (apache#10954
Browse files Browse the repository at this point in the history
)
  • Loading branch information
kayx23 authored Feb 23, 2024
1 parent 1439b13 commit 880bf40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 28 deletions.
19 changes: 3 additions & 16 deletions docs/en/latest/plugins/grpc-transcode.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ The output binary file, `proto.pb` will contain both `helloworld.proto` and `imp

We can now use the content of `proto.pb` in the `content` field of the API request.

As the content of the proto is binary, we encode it in `base64` using this shell command:
As the content of the proto is binary, we encode it in `base64` and configure the content in APISIX:

```shell
curl http://127.0.0.1:9180/apisix/admin/protos/1 \
Expand All @@ -112,23 +112,10 @@ curl http://127.0.0.1:9180/apisix/admin/protos/1 \
}'
```

This script will take in a `.pb` file and the `id` to create, encodes the content of the proto to `base64`, and calls the Admin API with this encoded content.

To run the script:

```bash
chmod +x ./upload_pb.py
```

```
./upload_pb.py proto.pb 1
```

Response:
You should see an `HTTP/1.1 201 Created` response with the following:

```
# 200
# {"node":{"value":{"create_time":1643879753,"update_time":1643883085,"content":"CmgKEnByb3RvL2ltcG9ydC5wcm90bxIDcGtnIhoKBFVzZXISEgoEbmFtZRgBIAEoCVIEbmFtZSIeCghSZXNwb25zZRISCgRib2R5GAEgASgJUgRib2R5QglaBy4vcHJvdG9iBnByb3RvMwq9AQoPcHJvdG8vc3JjLnByb3RvEgpoZWxsb3dvcmxkGhJwcm90by9pbXBvcnQucHJvdG8iPAoHUmVxdWVzdBIdCgR1c2VyGAEgASgLMgkucGtnLlVzZXJSBHVzZXISEgoEYm9keRgCIAEoCVIEYm9keTI5CgpUZXN0SW1wb3J0EisKA1J1bhITLmhlbGxvd29ybGQuUmVxdWVzdBoNLnBrZy5SZXNwb25zZSIAQglaBy4vcHJvdG9iBnByb3RvMw=="},"key":"\/apisix\/proto\/1"}}
{"node":{"value":{"create_time":1643879753,"update_time":1643883085,"content":"CmgKEnByb3RvL2ltcG9ydC5wcm90bxIDcGtnIhoKBFVzZXISEgoEbmFtZRgBIAEoCVIEbmFtZSIeCghSZXNwb25zZRISCgRib2R5GAEgASgJUgRib2R5QglaBy4vcHJvdG9iBnByb3RvMwq9AQoPcHJvdG8vc3JjLnByb3RvEgpoZWxsb3dvcmxkGhJwcm90by9pbXBvcnQucHJvdG8iPAoHUmVxdWVzdBIdCgR1c2VyGAEgASgLMgkucGtnLlVzZXJSBHVzZXISEgoEYm9keRgCIAEoCVIEYm9keTI5CgpUZXN0SW1wb3J0EisKA1J1bhITLmhlbGxvd29ybGQuUmVxdWVzdBoNLnBrZy5SZXNwb25zZSIAQglaBy4vcHJvdG9iBnByb3RvMw=="},"key":"\/apisix\/proto\/1"}}
```

Now, we can enable the `grpc-transcode` Plugin to a specific Route:
Expand Down
14 changes: 2 additions & 12 deletions docs/zh/latest/plugins/grpc-transcode.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,20 +113,10 @@ curl http://127.0.0.1:9180/apisix/admin/protos/1 \
}'
```

该脚本将使用 `.pb` 文件和要创建的 `id`,将 proto 的内容转换成 `base64`,并使用转换后的内容调用 Admin API。

运行脚本:

```shell
chmod +x ./upload_pb.py
./upload_pb.py proto.pb 1
```

返回结果:
返回 `HTTP/1.1 201 Created` 结果如下:

```
# 200
# {"node":{"value":{"create_time":1643879753,"update_time":1643883085,"content":"CmgKEnByb3RvL2ltcG9ydC5wcm90bxIDcGtnIhoKBFVzZXISEgoEbmFtZRgBIAEoCVIEbmFtZSIeCghSZXNwb25zZRISCgRib2R5GAEgASgJUgRib2R5QglaBy4vcHJvdG9iBnByb3RvMwq9AQoPcHJvdG8vc3JjLnByb3RvEgpoZWxsb3dvcmxkGhJwcm90by9pbXBvcnQucHJvdG8iPAoHUmVxdWVzdBIdCgR1c2VyGAEgASgLMgkucGtnLlVzZXJSBHVzZXISEgoEYm9keRgCIAEoCVIEYm9keTI5CgpUZXN0SW1wb3J0EisKA1J1bhITLmhlbGxvd29ybGQuUmVxdWVzdBoNLnBrZy5SZXNwb25zZSIAQglaBy4vcHJvdG9iBnByb3RvMw=="},"key":"\/apisix\/proto\/1"}}
{"node":{"value":{"create_time":1643879753,"update_time":1643883085,"content":"CmgKEnByb3RvL2ltcG9ydC5wcm90bxIDcGtnIhoKBFVzZXISEgoEbmFtZRgBIAEoCVIEbmFtZSIeCghSZXNwb25zZRISCgRib2R5GAEgASgJUgRib2R5QglaBy4vcHJvdG9iBnByb3RvMwq9AQoPcHJvdG8vc3JjLnByb3RvEgpoZWxsb3dvcmxkGhJwcm90by9pbXBvcnQucHJvdG8iPAoHUmVxdWVzdBIdCgR1c2VyGAEgASgLMgkucGtnLlVzZXJSBHVzZXISEgoEYm9keRgCIAEoCVIEYm9keTI5CgpUZXN0SW1wb3J0EisKA1J1bhITLmhlbGxvd29ybGQuUmVxdWVzdBoNLnBrZy5SZXNwb25zZSIAQglaBy4vcHJvdG9iBnByb3RvMw=="},"key":"\/apisix\/proto\/1"}}
```

现在我们可以在指定路由中启用 `grpc-transcode` 插件:
Expand Down

0 comments on commit 880bf40

Please sign in to comment.