From e8dfd9dddc491ab3f4582059911fdf851fab6286 Mon Sep 17 00:00:00 2001 From: Damonxue Date: Fri, 11 Oct 2024 08:43:33 +0800 Subject: [PATCH] refactor to rust code mode. --- shenyuClientRust/http.md | 30 +++++++++++-------- .../{version-1.0.0 => version-0.2.0}/http.md | 24 +++++++++------ ...ebars.json => version-0.2.0-sidebars.json} | 3 +- 3 files changed, 34 insertions(+), 23 deletions(-) rename shenyuClientRust_versioned_docs/{version-1.0.0 => version-0.2.0}/http.md (91%) rename shenyuClientRust_versioned_sidebars/{version-1.0.0-sidebars.json => version-0.2.0-sidebars.json} (67%) diff --git a/shenyuClientRust/http.md b/shenyuClientRust/http.md index 36967c0f433..62c7084a0ca 100644 --- a/shenyuClientRust/http.md +++ b/shenyuClientRust/http.md @@ -30,14 +30,17 @@ shenyu: password: "123456" ``` -```markdown -//init config. -let config = ShenYuConfig::from_yaml_file("config.yml").unwrap(); -// init shenyu client. -let client = ShenyuClient::new(config, app.app_name(), app.uri_infos(), 3000).unwrap(); +```rust +fn register_test() { + //init config. + let config = ShenYuConfig::from_yaml_file("config.yml").unwrap(); + // init shenyu client. + let client = ShenyuClient::new(config, app.app_name(), app.uri_infos(), 3000).unwrap(); + /// other steps. +} ``` -```log +``` The adminToken like this : { "code":200, @@ -49,19 +52,22 @@ The adminToken like this : "enabled":true, "dateCreated":"2018-06-23 15:12:22", "dateUpdated":"2024-10-03 02:29:39", - "token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjUwNjc5OTQ2fQ.K92Il2kmJ0X3FgjY4igW35-pw9nsf5VKdUyqBoyIaF4" + "token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNzI4NTQ3NjQ3fQ.93LAuDP_MrJZeQB5A6gX-3-Vyxy9egw41QhnNHlUWEE" } } When you success get toekn, you will see this : -this is ShenYu Admin client token -> eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNjUwNjc5OTQ2fQ.K92Il2kmJ0X3FgjY4igW35-pw9nsf5VKdUyqBoyIaF4 +2024-10-09T08:07:27.721483Z INFO shenyu_client_rust::core: [SUCCESS], get register token success, register token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNzI4NTQ3NjQ3fQ.93LAuDP_MrJZeQB5A6gX-3-Vyxy9egw41QhnNHlUWEE" ``` -**3.Step 2 Register MetaData to ShenYu GateWay.** +**3.Step 2 Register to ShenYu admin. (maybe add the admin sync data to gateway doc url).** -```markdown -// register to shenyu admin. -client.register().expect("TODO: panic message"); +```rust +fn register_test() { + /// Step1. + // register to shenyu admin. + client.register().expect("TODO: panic message"); +} ``` ```log diff --git a/shenyuClientRust_versioned_docs/version-1.0.0/http.md b/shenyuClientRust_versioned_docs/version-0.2.0/http.md similarity index 91% rename from shenyuClientRust_versioned_docs/version-1.0.0/http.md rename to shenyuClientRust_versioned_docs/version-0.2.0/http.md index 169236baa69..62c7084a0ca 100644 --- a/shenyuClientRust_versioned_docs/version-1.0.0/http.md +++ b/shenyuClientRust_versioned_docs/version-0.2.0/http.md @@ -30,11 +30,14 @@ shenyu: password: "123456" ``` -```markdown -//init config. -let config = ShenYuConfig::from_yaml_file("config.yml").unwrap(); -// init shenyu client. -let client = ShenyuClient::new(config, app.app_name(), app.uri_infos(), 3000).unwrap(); +```rust +fn register_test() { + //init config. + let config = ShenYuConfig::from_yaml_file("config.yml").unwrap(); + // init shenyu client. + let client = ShenyuClient::new(config, app.app_name(), app.uri_infos(), 3000).unwrap(); + /// other steps. +} ``` ``` @@ -57,11 +60,14 @@ When you success get toekn, you will see this : 2024-10-09T08:07:27.721483Z INFO shenyu_client_rust::core: [SUCCESS], get register token success, register token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTmFtZSI6ImFkbWluIiwiZXhwIjoxNzI4NTQ3NjQ3fQ.93LAuDP_MrJZeQB5A6gX-3-Vyxy9egw41QhnNHlUWEE" ``` -**3.Step 2 Register MetaData to ShenYu GateWay.** +**3.Step 2 Register to ShenYu admin. (maybe add the admin sync data to gateway doc url).** -```markdown -// register to shenyu admin. -client.register().expect("TODO: panic message"); +```rust +fn register_test() { + /// Step1. + // register to shenyu admin. + client.register().expect("TODO: panic message"); +} ``` ```log diff --git a/shenyuClientRust_versioned_sidebars/version-1.0.0-sidebars.json b/shenyuClientRust_versioned_sidebars/version-0.2.0-sidebars.json similarity index 67% rename from shenyuClientRust_versioned_sidebars/version-1.0.0-sidebars.json rename to shenyuClientRust_versioned_sidebars/version-0.2.0-sidebars.json index f37ad319f0b..d94d4e7513e 100644 --- a/shenyuClientRust_versioned_sidebars/version-1.0.0-sidebars.json +++ b/shenyuClientRust_versioned_sidebars/version-0.2.0-sidebars.json @@ -1,9 +1,8 @@ { - "version-1.0.0/tutorialSidebar": [ + "version-0.2.0/tutorialSidebar": [ { "type": "autogenerated", "dirName": "." } ] } - \ No newline at end of file