Compare commits
8 Commits
feature/ag
...
e6e85564e7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6e85564e7 | ||
|
|
c7a090f78a | ||
|
|
8cc2775fe4 | ||
|
|
0b64538754 | ||
|
|
8009ca20ff | ||
|
|
7a5b9471e0 | ||
|
|
bb55e37b49 | ||
| 9a264a61ac |
10
.github/workflows/test.yml
vendored
10
.github/workflows/test.yml
vendored
@@ -83,13 +83,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
cache-dependency-path: apps/frontend/pnpm-lock.yaml
|
cache-dependency-path: pnpm-lock.yaml
|
||||||
|
|
||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
run: |
|
run: |
|
||||||
cd apps/frontend
|
cd apps/frontend
|
||||||
pnpm install
|
pnpm install
|
||||||
|
|
||||||
- name: Run frontend linter
|
- name: Run frontend linter
|
||||||
run: |
|
run: |
|
||||||
cd apps/frontend
|
cd apps/frontend
|
||||||
@@ -114,7 +114,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
cache-dependency-path: apps/frontend/pnpm-lock.yaml
|
cache-dependency-path: pnpm-lock.yaml
|
||||||
|
|
||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
run: |
|
run: |
|
||||||
@@ -142,12 +142,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
cache-dependency-path: apps/frontend/pnpm-lock.yaml
|
cache-dependency-path: pnpm-lock.yaml
|
||||||
|
|
||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
run: |
|
run: |
|
||||||
cd apps/frontend
|
cd apps/frontend
|
||||||
pnpm install
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
- name: Build frontend
|
- name: Build frontend
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
74
.github/workflows/verify.yml
vendored
74
.github/workflows/verify.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Rust, checkout and restore caches
|
- name: Setup Rust, checkout and restore caches
|
||||||
uses: ./.github/actions/setup-rust
|
uses: ./.github/actions/setup-rust
|
||||||
|
|
||||||
@@ -32,14 +32,62 @@ jobs:
|
|||||||
cargo run -- db:migrate_and_generate --output-path ../../public/database/src/generated/entities
|
cargo run -- db:migrate_and_generate --output-path ../../public/database/src/generated/entities
|
||||||
- name: Check for uncommitted changes in /generated/
|
- name: Check for uncommitted changes in /generated/
|
||||||
run: |
|
run: |
|
||||||
if [[ -n $(git status --porcelain | grep '^ M .*\/generated\/') ]]; then
|
if [[ -n $(git status --porcelain --untracked-files=all | grep '/generated/') ]]; then
|
||||||
echo "Generated code is not up to date. Please run the code generation locally and commit the changes."
|
echo "Generated code is not up to date. Please run the code generation locally and commit the changes."
|
||||||
git status --porcelain | grep '^ M .*\/generated\/'
|
git status --porcelain --untracked-files=all | grep '/generated/'
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Generated code is up to date."
|
echo "Generated code is up to date."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
verify-generated-agent-code:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- uses: actions/setup-java@v5
|
||||||
|
with:
|
||||||
|
distribution: 'temurin'
|
||||||
|
java-version: '21'
|
||||||
|
|
||||||
|
- name: Setup Rust, checkout and restore caches
|
||||||
|
uses: ./.github/actions/setup-rust
|
||||||
|
|
||||||
|
- name: Setup PNPM
|
||||||
|
uses: pnpm/action-setup@v4
|
||||||
|
with:
|
||||||
|
version: 10
|
||||||
|
run_install: false
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
cache: 'pnpm'
|
||||||
|
cache-dependency-path: pnpm-lock.yaml
|
||||||
|
|
||||||
|
- name: Install root dependencies
|
||||||
|
run: |
|
||||||
|
pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: generate agent client code
|
||||||
|
run: |
|
||||||
|
pnpm just generate-agent-client
|
||||||
|
|
||||||
|
|
||||||
|
- name: Check for uncommitted changes in agent client code
|
||||||
|
run: |
|
||||||
|
if [[ -n $(git status --porcelain --untracked-files=all | grep 'public/agent-client/') ]]; then
|
||||||
|
echo "Agent client code is not up to date. Please run the agent client code generation locally and commit the changes."
|
||||||
|
git status --porcelain --untracked-files=all | grep 'public/agent-client/'
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
echo "Agent client code is up to date."
|
||||||
|
fi
|
||||||
|
|
||||||
verify-openapi-spec:
|
verify-openapi-spec:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
@@ -83,7 +131,7 @@ jobs:
|
|||||||
- name: Setup Rust, checkout and restore caches
|
- name: Setup Rust, checkout and restore caches
|
||||||
if: steps.check_changes.outputs.changed == 'true'
|
if: steps.check_changes.outputs.changed == 'true'
|
||||||
uses: ./.github/actions/setup-rust
|
uses: ./.github/actions/setup-rust
|
||||||
|
|
||||||
- name: Generate dummy frontend build (to satisfy dependencies)
|
- name: Generate dummy frontend build (to satisfy dependencies)
|
||||||
if: steps.check_changes.outputs.changed == 'true'
|
if: steps.check_changes.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
@@ -95,13 +143,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd apps/api
|
cd apps/api
|
||||||
cargo run -- generate:openapi --output-path ./swagger.json
|
cargo run -- generate:openapi --output-path ./swagger.json
|
||||||
|
|
||||||
- name: Check for uncommitted changes in swagger.json
|
- name: Check for uncommitted changes in swagger.json
|
||||||
if: steps.check_changes.outputs.changed == 'true'
|
if: steps.check_changes.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
if [[ -n $(git status --porcelain | grep '^ M apps/api/swagger.json') ]]; then
|
if [[ -n $(git status --porcelain --untracked-files=all | grep 'apps/api/swagger.json') ]]; then
|
||||||
echo "OpenAPI spec is not up to date. Please run the OpenAPI generation locally and commit the changes."
|
echo "OpenAPI spec is not up to date. Please run the OpenAPI generation locally and commit the changes."
|
||||||
git status --porcelain | grep '^ M apps/api/swagger.json'
|
git status --porcelain --untracked-files=all | grep 'apps/api/swagger.json'
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "OpenAPI spec is up to date."
|
echo "OpenAPI spec is up to date."
|
||||||
@@ -165,14 +213,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 22
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
cache-dependency-path: apps/frontend/pnpm-lock.yaml
|
cache-dependency-path: pnpm-lock.yaml
|
||||||
|
|
||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
if: steps.check_swagger_changes.outputs.changed == 'true'
|
if: steps.check_swagger_changes.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
cd apps/frontend
|
cd apps/frontend
|
||||||
pnpm install
|
pnpm install
|
||||||
|
|
||||||
- name: Generate frontend API client
|
- name: Generate frontend API client
|
||||||
if: steps.check_swagger_changes.outputs.changed == 'true'
|
if: steps.check_swagger_changes.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
@@ -182,14 +230,14 @@ jobs:
|
|||||||
- name: Check for uncommitted changes in frontend API client
|
- name: Check for uncommitted changes in frontend API client
|
||||||
if: steps.check_swagger_changes.outputs.changed == 'true'
|
if: steps.check_swagger_changes.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
if [[ -n $(git status --porcelain | grep '^ M apps/frontend/app/generated/api-client') ]]; then
|
if [[ -n $(git status --porcelain --untracked-files=all | grep 'apps/frontend/app/generated/api-client') ]]; then
|
||||||
echo "Frontend API client is not up to date. Please run the API client generation locally and commit the changes."
|
echo "Frontend API client is not up to date. Please run the API client generation locally and commit the changes."
|
||||||
git status --porcelain | grep '^ M apps/frontend/app/generated/api-client'
|
git status --porcelain --untracked-files=all | grep 'apps/frontend/app/generated/api-client'
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Frontend API client is up to date."
|
echo "Frontend API client is up to date."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Skip frontend API client generation (no relevant changes)
|
- name: Skip frontend API client generation (no relevant changes)
|
||||||
if: steps.check_swagger_changes.outputs.changed == 'false'
|
if: steps.check_swagger_changes.outputs.changed == 'false'
|
||||||
run: echo "No changes in apps/api/swagger.json nor apps/frontend/app/generated/api-client, skipping frontend API client generation verification."
|
run: echo "No changes in apps/api/swagger.json nor apps/frontend/app/generated/api-client, skipping frontend API client generation verification."
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -27,3 +27,5 @@ target
|
|||||||
.env.generated
|
.env.generated
|
||||||
|
|
||||||
generated-config.yaml
|
generated-config.yaml
|
||||||
|
|
||||||
|
node_modules/
|
||||||
|
|||||||
423
Cargo.lock
generated
423
Cargo.lock
generated
@@ -2,6 +2,19 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 4
|
version = 4
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "agent_client"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"async-trait",
|
||||||
|
"mockall",
|
||||||
|
"reqwest",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"serde_repr",
|
||||||
|
"url",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ahash"
|
name = "ahash"
|
||||||
version = "0.7.8"
|
version = "0.7.8"
|
||||||
@@ -158,7 +171,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -169,7 +182,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -276,7 +289,7 @@ checksum = "604fde5e028fea851ce1d8570bbdc034bec850d157f7569d10f347d06808c05c"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -453,7 +466,7 @@ dependencies = [
|
|||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -492,9 +505,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytes"
|
name = "bytes"
|
||||||
version = "1.10.1"
|
version = "1.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a"
|
checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
@@ -573,7 +586,7 @@ dependencies = [
|
|||||||
"heck 0.5.0",
|
"heck 0.5.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -821,7 +834,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -855,7 +868,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"strsim",
|
"strsim",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -869,7 +882,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"strsim",
|
"strsim",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -880,7 +893,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"darling_core 0.20.11",
|
"darling_core 0.20.11",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -891,7 +904,7 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"darling_core 0.21.3",
|
"darling_core 0.21.3",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -947,7 +960,7 @@ dependencies = [
|
|||||||
"darling 0.20.11",
|
"darling 0.20.11",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -957,7 +970,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c"
|
checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"derive_builder_core",
|
"derive_builder_core",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -977,7 +990,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1001,7 +1014,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1030,6 +1043,12 @@ version = "0.15.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
|
checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "downcast"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1435fa1053d8b2fbbe9be7e97eca7f33d37b28409959813daefc1446a14247f1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dyn-clone"
|
name = "dyn-clone"
|
||||||
version = "1.0.20"
|
version = "1.0.20"
|
||||||
@@ -1270,6 +1289,12 @@ dependencies = [
|
|||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fragile"
|
||||||
|
version = "2.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "28dd6caf6059519a65843af8fe2a3ae298b14b80179855aeb4adc2c1934ee619"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "funty"
|
name = "funty"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
@@ -1343,7 +1368,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1394,8 +1419,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
|
checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
"js-sys",
|
||||||
"libc",
|
"libc",
|
||||||
"wasi",
|
"wasi",
|
||||||
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1405,9 +1432,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
|
checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
"js-sys",
|
||||||
"libc",
|
"libc",
|
||||||
"r-efi",
|
"r-efi",
|
||||||
"wasip2",
|
"wasip2",
|
||||||
|
"wasm-bindgen",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1439,7 +1468,7 @@ dependencies = [
|
|||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
"http",
|
"http",
|
||||||
"indexmap 2.12.0",
|
"indexmap 2.12.1",
|
||||||
"slab",
|
"slab",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
@@ -1474,9 +1503,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.16.0"
|
version = "0.16.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
|
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashlink"
|
name = "hashlink"
|
||||||
@@ -1534,12 +1563,11 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http"
|
name = "http"
|
||||||
version = "1.3.1"
|
version = "1.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565"
|
checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
"fnv",
|
|
||||||
"itoa",
|
"itoa",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1630,6 +1658,7 @@ dependencies = [
|
|||||||
"tokio",
|
"tokio",
|
||||||
"tokio-rustls",
|
"tokio-rustls",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
|
"webpki-roots 1.0.4",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -1645,12 +1674,29 @@ dependencies = [
|
|||||||
"tower-service",
|
"tower-service",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hyper-tls"
|
||||||
|
version = "0.6.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"http-body-util",
|
||||||
|
"hyper",
|
||||||
|
"hyper-util",
|
||||||
|
"native-tls",
|
||||||
|
"tokio",
|
||||||
|
"tokio-native-tls",
|
||||||
|
"tower-service",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper-util"
|
name = "hyper-util"
|
||||||
version = "0.1.17"
|
version = "0.1.17"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8"
|
checksum = "3c6995591a8f1380fcb4ba966a252a4b29188d51d2b89e3a252f5305be65aea8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"base64 0.22.1",
|
||||||
"bytes",
|
"bytes",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
@@ -1658,7 +1704,9 @@ dependencies = [
|
|||||||
"http",
|
"http",
|
||||||
"http-body",
|
"http-body",
|
||||||
"hyper",
|
"hyper",
|
||||||
|
"ipnet",
|
||||||
"libc",
|
"libc",
|
||||||
|
"percent-encoding",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"socket2",
|
"socket2",
|
||||||
"tokio",
|
"tokio",
|
||||||
@@ -1845,12 +1893,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.12.0"
|
version = "2.12.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
|
checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown 0.16.0",
|
"hashbrown 0.16.1",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_core",
|
"serde_core",
|
||||||
]
|
]
|
||||||
@@ -1872,7 +1920,23 @@ checksum = "c727f80bfa4a6c6e2508d2f05b6f4bfce242030bd88ed15ae5331c5b5d30fba7"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ipnet"
|
||||||
|
version = "2.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "iri-string"
|
||||||
|
version = "0.7.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397"
|
||||||
|
dependencies = [
|
||||||
|
"memchr",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2010,6 +2074,12 @@ version = "0.4.28"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
|
checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lru-slab"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "matchers"
|
name = "matchers"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
@@ -2078,6 +2148,32 @@ dependencies = [
|
|||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mockall"
|
||||||
|
version = "0.13.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "39a6bfcc6c8c7eed5ee98b9c3e33adc726054389233e201c95dab2d41a3839d2"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"downcast",
|
||||||
|
"fragile",
|
||||||
|
"mockall_derive",
|
||||||
|
"predicates",
|
||||||
|
"predicates-tree",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mockall_derive"
|
||||||
|
version = "0.13.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "25ca3004c2efe9011bd4e461bd8256445052b9615405b4f7ea43fc8ca5c20898"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.111",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "native-tls"
|
name = "native-tls"
|
||||||
version = "0.2.14"
|
version = "0.2.14"
|
||||||
@@ -2179,7 +2275,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2258,7 +2354,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2319,7 +2415,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"proc-macro2-diagnostics",
|
"proc-macro2-diagnostics",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2397,7 +2493,7 @@ dependencies = [
|
|||||||
"regex",
|
"regex",
|
||||||
"regex-syntax",
|
"regex-syntax",
|
||||||
"structmeta",
|
"structmeta",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2478,7 +2574,7 @@ dependencies = [
|
|||||||
"pest_meta",
|
"pest_meta",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2535,7 +2631,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2617,6 +2713,32 @@ dependencies = [
|
|||||||
"zerocopy",
|
"zerocopy",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "predicates"
|
||||||
|
version = "3.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"predicates-core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "predicates-core"
|
||||||
|
version = "1.0.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "predicates-tree"
|
||||||
|
version = "1.0.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c"
|
||||||
|
dependencies = [
|
||||||
|
"predicates-core",
|
||||||
|
"termtree",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "prettyplease"
|
name = "prettyplease"
|
||||||
version = "0.2.37"
|
version = "0.2.37"
|
||||||
@@ -2624,7 +2746,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
|
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2664,7 +2786,7 @@ dependencies = [
|
|||||||
"proc-macro-error-attr2",
|
"proc-macro-error-attr2",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2684,7 +2806,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
"version_check",
|
"version_check",
|
||||||
"yansi",
|
"yansi",
|
||||||
]
|
]
|
||||||
@@ -2709,7 +2831,7 @@ dependencies = [
|
|||||||
"itertools",
|
"itertools",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2741,6 +2863,61 @@ dependencies = [
|
|||||||
"syn 1.0.109",
|
"syn 1.0.109",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quinn"
|
||||||
|
version = "0.11.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"cfg_aliases",
|
||||||
|
"pin-project-lite",
|
||||||
|
"quinn-proto",
|
||||||
|
"quinn-udp",
|
||||||
|
"rustc-hash",
|
||||||
|
"rustls",
|
||||||
|
"socket2",
|
||||||
|
"thiserror",
|
||||||
|
"tokio",
|
||||||
|
"tracing",
|
||||||
|
"web-time",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quinn-proto"
|
||||||
|
version = "0.11.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31"
|
||||||
|
dependencies = [
|
||||||
|
"bytes",
|
||||||
|
"getrandom 0.3.4",
|
||||||
|
"lru-slab",
|
||||||
|
"rand 0.9.2",
|
||||||
|
"ring",
|
||||||
|
"rustc-hash",
|
||||||
|
"rustls",
|
||||||
|
"rustls-pki-types",
|
||||||
|
"slab",
|
||||||
|
"thiserror",
|
||||||
|
"tinyvec",
|
||||||
|
"tracing",
|
||||||
|
"web-time",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quinn-udp"
|
||||||
|
version = "0.5.14"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd"
|
||||||
|
dependencies = [
|
||||||
|
"cfg_aliases",
|
||||||
|
"libc",
|
||||||
|
"once_cell",
|
||||||
|
"socket2",
|
||||||
|
"tracing",
|
||||||
|
"windows-sys 0.60.2",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.42"
|
version = "1.0.42"
|
||||||
@@ -2847,7 +3024,7 @@ checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2888,6 +3065,51 @@ dependencies = [
|
|||||||
"bytecheck",
|
"bytecheck",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "reqwest"
|
||||||
|
version = "0.12.28"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147"
|
||||||
|
dependencies = [
|
||||||
|
"base64 0.22.1",
|
||||||
|
"bytes",
|
||||||
|
"futures-core",
|
||||||
|
"futures-util",
|
||||||
|
"http",
|
||||||
|
"http-body",
|
||||||
|
"http-body-util",
|
||||||
|
"hyper",
|
||||||
|
"hyper-rustls",
|
||||||
|
"hyper-tls",
|
||||||
|
"hyper-util",
|
||||||
|
"js-sys",
|
||||||
|
"log",
|
||||||
|
"mime_guess",
|
||||||
|
"native-tls",
|
||||||
|
"percent-encoding",
|
||||||
|
"pin-project-lite",
|
||||||
|
"quinn",
|
||||||
|
"rustls",
|
||||||
|
"rustls-pki-types",
|
||||||
|
"serde",
|
||||||
|
"serde_json",
|
||||||
|
"serde_urlencoded",
|
||||||
|
"sync_wrapper",
|
||||||
|
"tokio",
|
||||||
|
"tokio-native-tls",
|
||||||
|
"tokio-rustls",
|
||||||
|
"tokio-util",
|
||||||
|
"tower",
|
||||||
|
"tower-http",
|
||||||
|
"tower-service",
|
||||||
|
"url",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"wasm-streams",
|
||||||
|
"web-sys",
|
||||||
|
"webpki-roots 1.0.4",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rfc6979"
|
name = "rfc6979"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
@@ -3071,6 +3293,7 @@ version = "1.13.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a"
|
checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"web-time",
|
||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3146,7 +3369,7 @@ dependencies = [
|
|||||||
"proc-macro-error2",
|
"proc-macro-error2",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3214,7 +3437,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"sea-query",
|
"sea-query",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3228,7 +3451,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"sea-bae",
|
"sea-bae",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3275,7 +3498,7 @@ dependencies = [
|
|||||||
"heck 0.4.1",
|
"heck 0.4.1",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -3317,7 +3540,7 @@ dependencies = [
|
|||||||
"heck 0.4.1",
|
"heck 0.4.1",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3421,7 +3644,7 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3456,7 +3679,7 @@ checksum = "175ee3e80ae9982737ca543e96133087cbd9a485eecc3bc4de9c1a37b47ea59c"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3490,7 +3713,7 @@ dependencies = [
|
|||||||
"chrono",
|
"chrono",
|
||||||
"hex",
|
"hex",
|
||||||
"indexmap 1.9.3",
|
"indexmap 1.9.3",
|
||||||
"indexmap 2.12.0",
|
"indexmap 2.12.1",
|
||||||
"schemars 0.9.0",
|
"schemars 0.9.0",
|
||||||
"schemars 1.1.0",
|
"schemars 1.1.0",
|
||||||
"serde_core",
|
"serde_core",
|
||||||
@@ -3508,7 +3731,7 @@ dependencies = [
|
|||||||
"darling 0.21.3",
|
"darling 0.21.3",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3672,7 +3895,7 @@ dependencies = [
|
|||||||
"futures-util",
|
"futures-util",
|
||||||
"hashbrown 0.15.5",
|
"hashbrown 0.15.5",
|
||||||
"hashlink",
|
"hashlink",
|
||||||
"indexmap 2.12.0",
|
"indexmap 2.12.1",
|
||||||
"log",
|
"log",
|
||||||
"memchr",
|
"memchr",
|
||||||
"native-tls",
|
"native-tls",
|
||||||
@@ -3704,7 +3927,7 @@ dependencies = [
|
|||||||
"quote",
|
"quote",
|
||||||
"sqlx-core",
|
"sqlx-core",
|
||||||
"sqlx-macros-core",
|
"sqlx-macros-core",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3727,7 +3950,7 @@ dependencies = [
|
|||||||
"sqlx-mysql",
|
"sqlx-mysql",
|
||||||
"sqlx-postgres",
|
"sqlx-postgres",
|
||||||
"sqlx-sqlite",
|
"sqlx-sqlite",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
"tokio",
|
"tokio",
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
@@ -3887,7 +4110,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"structmeta-derive",
|
"structmeta-derive",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3898,7 +4121,7 @@ checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3919,7 +4142,7 @@ dependencies = [
|
|||||||
"heck 0.5.0",
|
"heck 0.5.0",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3941,9 +4164,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.110"
|
version = "2.0.111"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea"
|
checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -3955,6 +4178,9 @@ name = "sync_wrapper"
|
|||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
|
checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
|
||||||
|
dependencies = [
|
||||||
|
"futures-core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "synstructure"
|
name = "synstructure"
|
||||||
@@ -3964,7 +4190,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -3986,6 +4212,12 @@ dependencies = [
|
|||||||
"windows-sys 0.61.2",
|
"windows-sys 0.61.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "termtree"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "testcontainers"
|
name = "testcontainers"
|
||||||
version = "0.26.2"
|
version = "0.26.2"
|
||||||
@@ -4033,7 +4265,7 @@ checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4152,7 +4384,17 @@ checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "tokio-native-tls"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
|
||||||
|
dependencies = [
|
||||||
|
"native-tls",
|
||||||
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4217,7 +4459,7 @@ version = "0.23.7"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d"
|
checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap 2.12.0",
|
"indexmap 2.12.1",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
"toml_parser",
|
"toml_parser",
|
||||||
"winnow",
|
"winnow",
|
||||||
@@ -4280,7 +4522,7 @@ checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"indexmap 2.12.0",
|
"indexmap 2.12.1",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"slab",
|
"slab",
|
||||||
"sync_wrapper",
|
"sync_wrapper",
|
||||||
@@ -4299,8 +4541,12 @@ checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"futures-util",
|
||||||
"http",
|
"http",
|
||||||
|
"http-body",
|
||||||
|
"iri-string",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
|
"tower",
|
||||||
"tower-layer",
|
"tower-layer",
|
||||||
"tower-service",
|
"tower-service",
|
||||||
]
|
]
|
||||||
@@ -4337,7 +4583,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4533,7 +4779,7 @@ version = "5.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2fcc29c80c21c31608227e0912b2d7fddba57ad76b606890627ba8ee7964e993"
|
checksum = "2fcc29c80c21c31608227e0912b2d7fddba57ad76b606890627ba8ee7964e993"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap 2.12.0",
|
"indexmap 2.12.1",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"utoipa-gen",
|
"utoipa-gen",
|
||||||
@@ -4548,7 +4794,7 @@ dependencies = [
|
|||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"regex",
|
"regex",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
"uuid",
|
"uuid",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -4626,6 +4872,19 @@ dependencies = [
|
|||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-bindgen-futures"
|
||||||
|
version = "0.4.55"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"js-sys",
|
||||||
|
"once_cell",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wasm-bindgen-macro"
|
name = "wasm-bindgen-macro"
|
||||||
version = "0.2.105"
|
version = "0.2.105"
|
||||||
@@ -4645,7 +4904,7 @@ dependencies = [
|
|||||||
"bumpalo",
|
"bumpalo",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
"wasm-bindgen-shared",
|
"wasm-bindgen-shared",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -4658,6 +4917,29 @@ dependencies = [
|
|||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasm-streams"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65"
|
||||||
|
dependencies = [
|
||||||
|
"futures-util",
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
"wasm-bindgen-futures",
|
||||||
|
"web-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "web-sys"
|
||||||
|
version = "0.3.82"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1"
|
||||||
|
dependencies = [
|
||||||
|
"js-sys",
|
||||||
|
"wasm-bindgen",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "web-time"
|
name = "web-time"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@@ -4739,7 +5021,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -4750,7 +5032,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5072,6 +5354,7 @@ dependencies = [
|
|||||||
"tokio-cron-scheduler",
|
"tokio-cron-scheduler",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
|
"utoipa",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5128,7 +5411,7 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -5149,7 +5432,7 @@ checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5169,7 +5452,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
"synstructure",
|
"synstructure",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -5209,5 +5492,5 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.110",
|
"syn 2.0.111",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ members = [
|
|||||||
"apps/container",
|
"apps/container",
|
||||||
"apps/cli",
|
"apps/cli",
|
||||||
"apps/agent",
|
"apps/agent",
|
||||||
|
"public/agent-client",
|
||||||
"public/shared",
|
"public/shared",
|
||||||
"public/database",
|
"public/database",
|
||||||
"public/migration"
|
"public/migration"
|
||||||
|
|||||||
@@ -13,3 +13,4 @@ serde = { version = "1.0.228", features = ["std", "derive"] }
|
|||||||
tokio-cron-scheduler = { version = "0.15.1", features = ["signal"] }
|
tokio-cron-scheduler = { version = "0.15.1", features = ["signal"] }
|
||||||
clap = { version = "4", features = ["derive", "env"] }
|
clap = { version = "4", features = ["derive", "env"] }
|
||||||
nix = { version = "0.30.1", features = ["user", "fs"] }
|
nix = { version = "0.30.1", features = ["user", "fs"] }
|
||||||
|
utoipa = { version = "5.4.0", features = ["macros", "axum_extras", "chrono", "decimal", "uuid", "time", "openapi_extensions"] }
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
|
|
||||||
mod commands;
|
mod commands;
|
||||||
|
mod openapi;
|
||||||
mod routes;
|
mod routes;
|
||||||
|
|
||||||
use axum::routing::get;
|
use axum::routing::get;
|
||||||
@@ -13,6 +14,7 @@ use tokio::net::UnixListener;
|
|||||||
use tracing::{error, info, warn};
|
use tracing::{error, info, warn};
|
||||||
|
|
||||||
use crate::commands::NginxService;
|
use crate::commands::NginxService;
|
||||||
|
use crate::openapi::{GenerateOpenapiArgs, generate_openapi_doc};
|
||||||
use crate::routes::{status, validate, validate_and_reload, write_config};
|
use crate::routes::{status, validate, validate_and_reload, write_config};
|
||||||
|
|
||||||
const SOCK_ENV: &str = "YANPM_AGENT_SOCK";
|
const SOCK_ENV: &str = "YANPM_AGENT_SOCK";
|
||||||
@@ -43,6 +45,19 @@ struct Args {
|
|||||||
/// GID to set on the unix socket, default: current user's primary group
|
/// GID to set on the unix socket, default: current user's primary group
|
||||||
#[arg(long, default_value_t = String::from(SOCK_GID_DEFAULT), env = SOCK_GID_ENV)]
|
#[arg(long, default_value_t = String::from(SOCK_GID_DEFAULT), env = SOCK_GID_ENV)]
|
||||||
sock_gid: String,
|
sock_gid: String,
|
||||||
|
|
||||||
|
#[command(subcommand)]
|
||||||
|
command: Option<SubCommand>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(clap::Subcommand, Debug)]
|
||||||
|
pub enum SubCommand {
|
||||||
|
/// Generate OpenAPI spec to file or stdout
|
||||||
|
GenerateOpenapi {
|
||||||
|
/// Output file path.
|
||||||
|
#[arg(short = 'o', long)]
|
||||||
|
output: String,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
@@ -59,6 +74,18 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
|||||||
|
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
|
|
||||||
|
if let Some(cmd) = &args.command {
|
||||||
|
match cmd {
|
||||||
|
SubCommand::GenerateOpenapi { output } => {
|
||||||
|
generate_openapi_doc(&GenerateOpenapiArgs {
|
||||||
|
output: output.clone(),
|
||||||
|
})
|
||||||
|
.await?;
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let (sock, nginx_config_dir, sock_perm, sock_gid) = get_args(&args).await?;
|
let (sock, nginx_config_dir, sock_perm, sock_gid) = get_args(&args).await?;
|
||||||
|
|
||||||
let path = PathBuf::from(&sock);
|
let path = PathBuf::from(&sock);
|
||||||
|
|||||||
45
apps/agent/src/openapi.rs
Normal file
45
apps/agent/src/openapi.rs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
use tracing::info;
|
||||||
|
use utoipa::OpenApi;
|
||||||
|
|
||||||
|
pub mod tag {
|
||||||
|
/// nginx
|
||||||
|
pub const NGINX_TAG: &str = "Nginx Agent";
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(utoipa::OpenApi)]
|
||||||
|
#[openapi(
|
||||||
|
paths(
|
||||||
|
crate::routes::status,
|
||||||
|
crate::routes::validate,
|
||||||
|
crate::routes::validate_and_reload,
|
||||||
|
crate::routes::write_config,
|
||||||
|
),
|
||||||
|
components(
|
||||||
|
schemas(crate::routes::StatusResp),
|
||||||
|
schemas(crate::routes::ValidateAndReloadResp),
|
||||||
|
schemas(crate::routes::ValidateBody),
|
||||||
|
schemas(crate::routes::WriteConfigBody),
|
||||||
|
schemas(crate::routes::ValidateAndReloadBody),
|
||||||
|
),
|
||||||
|
tags(
|
||||||
|
(name = tag::NGINX_TAG, description = "Nginx Agent API"),
|
||||||
|
)
|
||||||
|
)]
|
||||||
|
struct ApiDoc;
|
||||||
|
|
||||||
|
pub struct GenerateOpenapiArgs {
|
||||||
|
pub output: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn generate_openapi_doc(
|
||||||
|
args: &GenerateOpenapiArgs,
|
||||||
|
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
|
info!("Generating OpenAPI documentation...");
|
||||||
|
let doc = ApiDoc::openapi();
|
||||||
|
let json = doc
|
||||||
|
.to_pretty_json()
|
||||||
|
.expect("Failed to serialize OpenAPI doc to JSON");
|
||||||
|
std::fs::write(&args.output, json).expect("Failed to write OpenAPI doc to file");
|
||||||
|
info!("OpenAPI documentation generated at {}", args.output);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -9,28 +9,46 @@ use tracing::warn;
|
|||||||
|
|
||||||
use crate::commands::NginxService;
|
use crate::commands::NginxService;
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize, utoipa::ToSchema)]
|
||||||
pub struct StatusResp {
|
pub struct StatusResp {
|
||||||
pub ok: bool,
|
pub ok: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Health check endpoint
|
||||||
|
#[utoipa::path(
|
||||||
|
get,
|
||||||
|
path = "/status",
|
||||||
|
responses(
|
||||||
|
(status = 200, description = "Status response", body = StatusResp)
|
||||||
|
),
|
||||||
|
tag = crate::openapi::tag::NGINX_TAG
|
||||||
|
)]
|
||||||
pub async fn status() -> impl IntoResponse {
|
pub async fn status() -> impl IntoResponse {
|
||||||
let resp = StatusResp { ok: true };
|
let resp = StatusResp { ok: true };
|
||||||
(axum::http::StatusCode::OK, axum::Json(resp))
|
(axum::http::StatusCode::OK, axum::Json(resp))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize, utoipa::ToSchema)]
|
||||||
pub struct ValidateAndReloadResp {
|
pub struct ValidateAndReloadResp {
|
||||||
pub rc: i32,
|
pub rc: i32,
|
||||||
pub ro: String,
|
pub ro: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, utoipa::ToSchema)]
|
||||||
pub struct ValidateBody {
|
pub struct ValidateBody {
|
||||||
config_name: String,
|
config_name: String,
|
||||||
timestamp: u64,
|
timestamp: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[utoipa::path(
|
||||||
|
post,
|
||||||
|
path = "/validate",
|
||||||
|
request_body = ValidateBody,
|
||||||
|
responses(
|
||||||
|
(status = 200, description = "Validation response", body = serde_json::Value)
|
||||||
|
),
|
||||||
|
tag = crate::openapi::tag::NGINX_TAG
|
||||||
|
)]
|
||||||
pub async fn validate(
|
pub async fn validate(
|
||||||
State(nginx_controller): State<Arc<NginxService>>,
|
State(nginx_controller): State<Arc<NginxService>>,
|
||||||
Json(payload): Json<Value>,
|
Json(payload): Json<Value>,
|
||||||
@@ -57,12 +75,21 @@ pub async fn validate(
|
|||||||
(axum::http::StatusCode::OK, axum::Json(resp)).into_response()
|
(axum::http::StatusCode::OK, axum::Json(resp)).into_response()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, utoipa::ToSchema)]
|
||||||
pub struct ValidateAndReloadBody {
|
pub struct ValidateAndReloadBody {
|
||||||
config_name: String,
|
config_name: String,
|
||||||
timestamp: u64,
|
timestamp: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[utoipa::path(
|
||||||
|
post,
|
||||||
|
path = "/validate_and_reload",
|
||||||
|
request_body = ValidateAndReloadBody,
|
||||||
|
responses(
|
||||||
|
(status = 200, description = "Validate and reload response", body = ValidateAndReloadResp)
|
||||||
|
),
|
||||||
|
tag = crate::openapi::tag::NGINX_TAG
|
||||||
|
)]
|
||||||
pub async fn validate_and_reload(
|
pub async fn validate_and_reload(
|
||||||
State(nginx_controller): State<Arc<NginxService>>,
|
State(nginx_controller): State<Arc<NginxService>>,
|
||||||
Json(payload): Json<Value>,
|
Json(payload): Json<Value>,
|
||||||
@@ -96,13 +123,23 @@ pub async fn validate_and_reload(
|
|||||||
(axum::http::StatusCode::OK, axum::Json(resp)).into_response()
|
(axum::http::StatusCode::OK, axum::Json(resp)).into_response()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize, utoipa::ToSchema)]
|
||||||
pub struct WriteConfigBody {
|
pub struct WriteConfigBody {
|
||||||
config_name: String,
|
config_name: String,
|
||||||
timestamp: u64,
|
timestamp: u64,
|
||||||
content: String,
|
content: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[utoipa::path(
|
||||||
|
post,
|
||||||
|
path = "/write_config",
|
||||||
|
request_body = WriteConfigBody,
|
||||||
|
responses(
|
||||||
|
(status = 200, description = "Write config response"),
|
||||||
|
(status = 500, description = "Internal server error", body = serde_json::Value)
|
||||||
|
),
|
||||||
|
tag = crate::openapi::tag::NGINX_TAG
|
||||||
|
)]
|
||||||
pub async fn write_config(
|
pub async fn write_config(
|
||||||
State(nginx_controller): State<Arc<NginxService>>,
|
State(nginx_controller): State<Arc<NginxService>>,
|
||||||
Json(payload): Json<Value>,
|
Json(payload): Json<Value>,
|
||||||
|
|||||||
215
apps/agent/swagger.json
Normal file
215
apps/agent/swagger.json
Normal file
@@ -0,0 +1,215 @@
|
|||||||
|
{
|
||||||
|
"openapi": "3.1.0",
|
||||||
|
"info": {
|
||||||
|
"title": "yanpm-agent",
|
||||||
|
"description": "",
|
||||||
|
"license": {
|
||||||
|
"name": ""
|
||||||
|
},
|
||||||
|
"version": "0.1.0"
|
||||||
|
},
|
||||||
|
"paths": {
|
||||||
|
"/status": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Nginx Agent"
|
||||||
|
],
|
||||||
|
"summary": "Health check endpoint",
|
||||||
|
"operationId": "status",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Status response",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/StatusResp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/validate": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"Nginx Agent"
|
||||||
|
],
|
||||||
|
"operationId": "validate",
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ValidateBody"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Validation response",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/validate_and_reload": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"Nginx Agent"
|
||||||
|
],
|
||||||
|
"operationId": "validate_and_reload",
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ValidateAndReloadBody"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Validate and reload response",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/ValidateAndReloadResp"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/write_config": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"Nginx Agent"
|
||||||
|
],
|
||||||
|
"operationId": "write_config",
|
||||||
|
"requestBody": {
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/WriteConfigBody"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Write config response"
|
||||||
|
},
|
||||||
|
"500": {
|
||||||
|
"description": "Internal server error",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"components": {
|
||||||
|
"schemas": {
|
||||||
|
"StatusResp": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"ok"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"ok": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ValidateAndReloadBody": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"config_name",
|
||||||
|
"timestamp"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"config_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"timestamp": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64",
|
||||||
|
"minimum": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ValidateAndReloadResp": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"rc",
|
||||||
|
"ro"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"rc": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"ro": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ValidateBody": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"config_name",
|
||||||
|
"timestamp"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"config_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"timestamp": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64",
|
||||||
|
"minimum": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"WriteConfigBody": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"config_name",
|
||||||
|
"timestamp",
|
||||||
|
"content"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"config_name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"content": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"timestamp": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64",
|
||||||
|
"minimum": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
{
|
||||||
|
"name": "Nginx Agent",
|
||||||
|
"description": "Nginx Agent API"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
24
justfile
24
justfile
@@ -50,9 +50,31 @@ generate-openapi:
|
|||||||
# Generate API client for frontend
|
# Generate API client for frontend
|
||||||
cd apps/frontend && \
|
cd apps/frontend && \
|
||||||
pnpm generate:openapi
|
pnpm generate:openapi
|
||||||
|
# Generate API client for agent
|
||||||
|
cd apps/agent && \
|
||||||
|
cargo run -- generate-openapi --output swagger.json
|
||||||
|
|
||||||
|
generate-agent-client:
|
||||||
|
# Generate API client for agent
|
||||||
|
pnpm openapi-generator-cli generate \
|
||||||
|
-g rust --skip-validate-spec \
|
||||||
|
-o ./public/agent-client -i ./apps/agent/swagger.json \
|
||||||
|
--additional-properties=library=reqwest-trait \
|
||||||
|
--additional-properties=mockall=true \
|
||||||
|
--additional-properties=packageName=agent_client \
|
||||||
|
--additional-properties=packageVersion=0.1.0 \
|
||||||
|
--additional-properties=supportAsync=true \
|
||||||
|
--additional-properties=supportMultipleResponses=true \
|
||||||
|
--additional-properties=topLevelApiClient=true \
|
||||||
|
--additional-properties=useSingleRequestParameter=true
|
||||||
|
# format generated code
|
||||||
|
cd public/agent-client && \
|
||||||
|
cargo fmt
|
||||||
|
# append lint allows/forbids to the end of Cargo.toml to disable warnings in generated code and forbid unsafe code
|
||||||
|
cd public/agent-client && \
|
||||||
|
echo '\n[lints.clippy]\nall = "allow"\n[lints.rust]\nunsafe_code = "forbid"\n' >> Cargo.toml
|
||||||
|
|
||||||
generate-all: generate-entity generate-openapi
|
generate-all: generate-entity generate-openapi generate-agent-client
|
||||||
|
|
||||||
build-frontend:
|
build-frontend:
|
||||||
# build frontend assets
|
# build frontend assets
|
||||||
|
|||||||
7
openapitools.json
Normal file
7
openapitools.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
|
||||||
|
"spaces": 2,
|
||||||
|
"generator-cli": {
|
||||||
|
"version": "7.18.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
6
package.json
Normal file
6
package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"devDependencies": {
|
||||||
|
"@openapitools/openapi-generator-cli": "^2.26.0",
|
||||||
|
"rust-just": "^1.44.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
3418
apps/frontend/pnpm-lock.yaml → pnpm-lock.yaml
generated
3418
apps/frontend/pnpm-lock.yaml → pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
7
pnpm-workspace.yaml
Normal file
7
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
packages:
|
||||||
|
- apps/frontend
|
||||||
|
|
||||||
|
onlyBuiltDependencies:
|
||||||
|
- '@nestjs/core'
|
||||||
|
- '@openapitools/openapi-generator-cli'
|
||||||
|
- esbuild
|
||||||
3
public/agent-client/.gitignore
vendored
Normal file
3
public/agent-client/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
/target/
|
||||||
|
**/*.rs.bk
|
||||||
|
Cargo.lock
|
||||||
23
public/agent-client/.openapi-generator-ignore
Normal file
23
public/agent-client/.openapi-generator-ignore
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# OpenAPI Generator Ignore
|
||||||
|
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
||||||
|
|
||||||
|
# Use this file to prevent files from being overwritten by the generator.
|
||||||
|
# The patterns follow closely to .gitignore or .dockerignore.
|
||||||
|
|
||||||
|
# As an example, the C# client generator defines ApiClient.cs.
|
||||||
|
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
||||||
|
#ApiClient.cs
|
||||||
|
|
||||||
|
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
||||||
|
#foo/*/qux
|
||||||
|
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
||||||
|
#foo/**/qux
|
||||||
|
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
||||||
|
|
||||||
|
# You can also negate patterns with an exclamation (!).
|
||||||
|
# For example, you can ignore all files in a docs folder with the file extension .md:
|
||||||
|
#docs/*.md
|
||||||
|
# Then explicitly reverse the ignore rule for a single file:
|
||||||
|
#!docs/README.md
|
||||||
21
public/agent-client/.openapi-generator/FILES
Normal file
21
public/agent-client/.openapi-generator/FILES
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
.gitignore
|
||||||
|
.travis.yml
|
||||||
|
Cargo.toml
|
||||||
|
README.md
|
||||||
|
docs/NginxAgentApi.md
|
||||||
|
docs/StatusResp.md
|
||||||
|
docs/ValidateAndReloadBody.md
|
||||||
|
docs/ValidateAndReloadResp.md
|
||||||
|
docs/ValidateBody.md
|
||||||
|
docs/WriteConfigBody.md
|
||||||
|
git_push.sh
|
||||||
|
src/apis/configuration.rs
|
||||||
|
src/apis/mod.rs
|
||||||
|
src/apis/nginx_agent_api.rs
|
||||||
|
src/lib.rs
|
||||||
|
src/models/mod.rs
|
||||||
|
src/models/status_resp.rs
|
||||||
|
src/models/validate_and_reload_body.rs
|
||||||
|
src/models/validate_and_reload_resp.rs
|
||||||
|
src/models/validate_body.rs
|
||||||
|
src/models/write_config_body.rs
|
||||||
1
public/agent-client/.openapi-generator/VERSION
Normal file
1
public/agent-client/.openapi-generator/VERSION
Normal file
@@ -0,0 +1 @@
|
|||||||
|
7.18.0
|
||||||
1
public/agent-client/.travis.yml
Normal file
1
public/agent-client/.travis.yml
Normal file
@@ -0,0 +1 @@
|
|||||||
|
language: rust
|
||||||
27
public/agent-client/Cargo.toml
Normal file
27
public/agent-client/Cargo.toml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
[package]
|
||||||
|
name = "agent_client"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["OpenAPI Generator team and contributors"]
|
||||||
|
description = "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)"
|
||||||
|
license = ""
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
serde = { version = "^1.0", features = ["derive"] }
|
||||||
|
serde_json = "^1.0"
|
||||||
|
serde_repr = "^0.1"
|
||||||
|
url = "^2.5"
|
||||||
|
async-trait = "^0.1"
|
||||||
|
reqwest = { version = "^0.12", default-features = false, features = ["json", "multipart", "stream"] }
|
||||||
|
mockall = { version = "^0.13", optional = true}
|
||||||
|
[features]
|
||||||
|
default = ["native-tls"]
|
||||||
|
native-tls = ["reqwest/native-tls"]
|
||||||
|
rustls-tls = ["reqwest/rustls-tls"]
|
||||||
|
mockall = ["dep:mockall"]
|
||||||
|
|
||||||
|
[lints.clippy]
|
||||||
|
all = "allow"
|
||||||
|
[lints.rust]
|
||||||
|
unsafe_code = "forbid"
|
||||||
|
|
||||||
53
public/agent-client/README.md
Normal file
53
public/agent-client/README.md
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# Rust API client for agent_client
|
||||||
|
|
||||||
|
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
|
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client.
|
||||||
|
|
||||||
|
- API version: 0.1.0
|
||||||
|
- Package version: 0.1.0
|
||||||
|
- Generator version: 7.18.0
|
||||||
|
- Build package: `org.openapitools.codegen.languages.RustClientCodegen`
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Put the package under your project folder in a directory named `agent_client` and add the following to `Cargo.toml` under `[dependencies]`:
|
||||||
|
|
||||||
|
```
|
||||||
|
agent_client = { path = "./agent_client" }
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation for API Endpoints
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost*
|
||||||
|
|
||||||
|
Class | Method | HTTP request | Description
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*NginxAgentApi* | [**status**](docs/NginxAgentApi.md#status) | **GET** /status | Health check endpoint
|
||||||
|
*NginxAgentApi* | [**validate**](docs/NginxAgentApi.md#validate) | **POST** /validate |
|
||||||
|
*NginxAgentApi* | [**validate_and_reload**](docs/NginxAgentApi.md#validate_and_reload) | **POST** /validate_and_reload |
|
||||||
|
*NginxAgentApi* | [**write_config**](docs/NginxAgentApi.md#write_config) | **POST** /write_config |
|
||||||
|
|
||||||
|
|
||||||
|
## Documentation For Models
|
||||||
|
|
||||||
|
- [StatusResp](docs/StatusResp.md)
|
||||||
|
- [ValidateAndReloadBody](docs/ValidateAndReloadBody.md)
|
||||||
|
- [ValidateAndReloadResp](docs/ValidateAndReloadResp.md)
|
||||||
|
- [ValidateBody](docs/ValidateBody.md)
|
||||||
|
- [WriteConfigBody](docs/WriteConfigBody.md)
|
||||||
|
|
||||||
|
|
||||||
|
To get access to the crate's generated documentation, use:
|
||||||
|
|
||||||
|
```
|
||||||
|
cargo doc --open
|
||||||
|
```
|
||||||
|
|
||||||
|
## Author
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
121
public/agent-client/docs/NginxAgentApi.md
Normal file
121
public/agent-client/docs/NginxAgentApi.md
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
# \NginxAgentApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**status**](NginxAgentApi.md#status) | **GET** /status | Health check endpoint
|
||||||
|
[**validate**](NginxAgentApi.md#validate) | **POST** /validate |
|
||||||
|
[**validate_and_reload**](NginxAgentApi.md#validate_and_reload) | **POST** /validate_and_reload |
|
||||||
|
[**write_config**](NginxAgentApi.md#write_config) | **POST** /write_config |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## status
|
||||||
|
|
||||||
|
> models::StatusResp status()
|
||||||
|
Health check endpoint
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**models::StatusResp**](StatusResp.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
||||||
|
## validate
|
||||||
|
|
||||||
|
> serde_json::Value validate(validate_body)
|
||||||
|
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Required | Notes
|
||||||
|
------------- | ------------- | ------------- | ------------- | -------------
|
||||||
|
**validate_body** | [**ValidateBody**](ValidateBody.md) | | [required] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**serde_json::Value**](serde_json::Value.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
||||||
|
## validate_and_reload
|
||||||
|
|
||||||
|
> models::ValidateAndReloadResp validate_and_reload(validate_and_reload_body)
|
||||||
|
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Required | Notes
|
||||||
|
------------- | ------------- | ------------- | ------------- | -------------
|
||||||
|
**validate_and_reload_body** | [**ValidateAndReloadBody**](ValidateAndReloadBody.md) | | [required] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**models::ValidateAndReloadResp**](ValidateAndReloadResp.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
||||||
|
## write_config
|
||||||
|
|
||||||
|
> write_config(write_config_body)
|
||||||
|
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Required | Notes
|
||||||
|
------------- | ------------- | ------------- | ------------- | -------------
|
||||||
|
**write_config_body** | [**WriteConfigBody**](WriteConfigBody.md) | | [required] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
11
public/agent-client/docs/StatusResp.md
Normal file
11
public/agent-client/docs/StatusResp.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# StatusResp
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**ok** | **bool** | |
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
||||||
121
public/agent-client/docs/TagNginxtagApi.md
Normal file
121
public/agent-client/docs/TagNginxtagApi.md
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
# \TagNginxtagApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://localhost*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**status**](TagNginxtagApi.md#status) | **GET** /status | Health check endpoint
|
||||||
|
[**validate**](TagNginxtagApi.md#validate) | **POST** /validate |
|
||||||
|
[**validate_and_reload**](TagNginxtagApi.md#validate_and_reload) | **POST** /validate_and_reload |
|
||||||
|
[**write_config**](TagNginxtagApi.md#write_config) | **POST** /write_config |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## status
|
||||||
|
|
||||||
|
> models::StatusResp status()
|
||||||
|
Health check endpoint
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
This endpoint does not need any parameter.
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**models::StatusResp**](StatusResp.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
||||||
|
## validate
|
||||||
|
|
||||||
|
> serde_json::Value validate(validate_body)
|
||||||
|
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Required | Notes
|
||||||
|
------------- | ------------- | ------------- | ------------- | -------------
|
||||||
|
**validate_body** | [**ValidateBody**](ValidateBody.md) | | [required] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**serde_json::Value**](serde_json::Value.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
||||||
|
## validate_and_reload
|
||||||
|
|
||||||
|
> models::ValidateAndReloadResp validate_and_reload(validate_and_reload_body)
|
||||||
|
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Required | Notes
|
||||||
|
------------- | ------------- | ------------- | ------------- | -------------
|
||||||
|
**validate_and_reload_body** | [**ValidateAndReloadBody**](ValidateAndReloadBody.md) | | [required] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
[**models::ValidateAndReloadResp**](ValidateAndReloadResp.md)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
||||||
|
## write_config
|
||||||
|
|
||||||
|
> write_config(write_config_body)
|
||||||
|
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
|
||||||
|
Name | Type | Description | Required | Notes
|
||||||
|
------------- | ------------- | ------------- | ------------- | -------------
|
||||||
|
**write_config_body** | [**WriteConfigBody**](WriteConfigBody.md) | | [required] |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
(empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
12
public/agent-client/docs/ValidateAndReloadBody.md
Normal file
12
public/agent-client/docs/ValidateAndReloadBody.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# ValidateAndReloadBody
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**config_name** | **String** | |
|
||||||
|
**timestamp** | **i64** | |
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
||||||
12
public/agent-client/docs/ValidateAndReloadResp.md
Normal file
12
public/agent-client/docs/ValidateAndReloadResp.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# ValidateAndReloadResp
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**rc** | **i32** | |
|
||||||
|
**ro** | **String** | |
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
||||||
12
public/agent-client/docs/ValidateBody.md
Normal file
12
public/agent-client/docs/ValidateBody.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# ValidateBody
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**config_name** | **String** | |
|
||||||
|
**timestamp** | **i64** | |
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
||||||
13
public/agent-client/docs/WriteConfigBody.md
Normal file
13
public/agent-client/docs/WriteConfigBody.md
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
# WriteConfigBody
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------ | ------------- | ------------- | -------------
|
||||||
|
**config_name** | **String** | |
|
||||||
|
**content** | **String** | |
|
||||||
|
**timestamp** | **i64** | |
|
||||||
|
|
||||||
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|
||||||
57
public/agent-client/git_push.sh
Normal file
57
public/agent-client/git_push.sh
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
||||||
|
#
|
||||||
|
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
||||||
|
|
||||||
|
git_user_id=$1
|
||||||
|
git_repo_id=$2
|
||||||
|
release_note=$3
|
||||||
|
git_host=$4
|
||||||
|
|
||||||
|
if [ "$git_host" = "" ]; then
|
||||||
|
git_host="github.com"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_user_id" = "" ]; then
|
||||||
|
git_user_id="GIT_USER_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$git_repo_id" = "" ]; then
|
||||||
|
git_repo_id="GIT_REPO_ID"
|
||||||
|
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$release_note" = "" ]; then
|
||||||
|
release_note="Minor update"
|
||||||
|
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Initialize the local directory as a Git repository
|
||||||
|
git init
|
||||||
|
|
||||||
|
# Adds the files in the local repository and stages them for commit.
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
||||||
|
git commit -m "$release_note"
|
||||||
|
|
||||||
|
# Sets the new remote
|
||||||
|
git_remote=$(git remote)
|
||||||
|
if [ "$git_remote" = "" ]; then # git remote not defined
|
||||||
|
|
||||||
|
if [ "$GIT_TOKEN" = "" ]; then
|
||||||
|
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
||||||
|
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
|
else
|
||||||
|
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
git pull origin master
|
||||||
|
|
||||||
|
# Pushes (Forces) the changes in the local repository up to the remote repository
|
||||||
|
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
||||||
|
git push origin master 2>&1 | grep -v 'To https'
|
||||||
48
public/agent-client/src/apis/configuration.rs
Normal file
48
public/agent-client/src/apis/configuration.rs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
* yanpm-agent
|
||||||
|
*
|
||||||
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
*
|
||||||
|
* Generated by: https://openapi-generator.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct Configuration {
|
||||||
|
pub base_path: String,
|
||||||
|
pub user_agent: Option<String>,
|
||||||
|
pub client: reqwest::Client,
|
||||||
|
pub basic_auth: Option<BasicAuth>,
|
||||||
|
pub oauth_access_token: Option<String>,
|
||||||
|
pub bearer_access_token: Option<String>,
|
||||||
|
pub api_key: Option<ApiKey>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type BasicAuth = (String, Option<String>);
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct ApiKey {
|
||||||
|
pub prefix: Option<String>,
|
||||||
|
pub key: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Configuration {
|
||||||
|
pub fn new() -> Configuration {
|
||||||
|
Configuration::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Configuration {
|
||||||
|
fn default() -> Self {
|
||||||
|
Configuration {
|
||||||
|
base_path: "http://localhost".to_owned(),
|
||||||
|
user_agent: Some("OpenAPI-Generator/0.1.0/rust".to_owned()),
|
||||||
|
client: reqwest::Client::new(),
|
||||||
|
basic_auth: None,
|
||||||
|
oauth_access_token: None,
|
||||||
|
bearer_access_token: None,
|
||||||
|
api_key: None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
165
public/agent-client/src/apis/mod.rs
Normal file
165
public/agent-client/src/apis/mod.rs
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
use std::error;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct ResponseContent<T> {
|
||||||
|
pub status: reqwest::StatusCode,
|
||||||
|
pub content: String,
|
||||||
|
pub entity: Option<T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Error<T> {
|
||||||
|
Reqwest(reqwest::Error),
|
||||||
|
Serde(serde_json::Error),
|
||||||
|
Io(std::io::Error),
|
||||||
|
ResponseError(ResponseContent<T>),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> fmt::Display for Error<T> {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
let (module, e) = match self {
|
||||||
|
Error::Reqwest(e) => ("reqwest", e.to_string()),
|
||||||
|
Error::Serde(e) => ("serde", e.to_string()),
|
||||||
|
Error::Io(e) => ("IO", e.to_string()),
|
||||||
|
Error::ResponseError(e) => ("response", format!("status code {}", e.status)),
|
||||||
|
};
|
||||||
|
write!(f, "error in {}: {}", module, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: fmt::Debug> error::Error for Error<T> {
|
||||||
|
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
||||||
|
Some(match self {
|
||||||
|
Error::Reqwest(e) => e,
|
||||||
|
Error::Serde(e) => e,
|
||||||
|
Error::Io(e) => e,
|
||||||
|
Error::ResponseError(_) => return None,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> From<reqwest::Error> for Error<T> {
|
||||||
|
fn from(e: reqwest::Error) -> Self {
|
||||||
|
Error::Reqwest(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> From<serde_json::Error> for Error<T> {
|
||||||
|
fn from(e: serde_json::Error) -> Self {
|
||||||
|
Error::Serde(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> From<std::io::Error> for Error<T> {
|
||||||
|
fn from(e: std::io::Error) -> Self {
|
||||||
|
Error::Io(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn urlencode<T: AsRef<str>>(s: T) -> String {
|
||||||
|
::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String, String)> {
|
||||||
|
if let serde_json::Value::Object(object) = value {
|
||||||
|
let mut params = vec![];
|
||||||
|
|
||||||
|
for (key, value) in object {
|
||||||
|
match value {
|
||||||
|
serde_json::Value::Object(_) => params.append(&mut parse_deep_object(
|
||||||
|
&format!("{}[{}]", prefix, key),
|
||||||
|
value,
|
||||||
|
)),
|
||||||
|
serde_json::Value::Array(array) => {
|
||||||
|
for (i, value) in array.iter().enumerate() {
|
||||||
|
params.append(&mut parse_deep_object(
|
||||||
|
&format!("{}[{}][{}]", prefix, key, i),
|
||||||
|
value,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
serde_json::Value::String(s) => {
|
||||||
|
params.push((format!("{}[{}]", prefix, key), s.clone()))
|
||||||
|
}
|
||||||
|
_ => params.push((format!("{}[{}]", prefix, key), value.to_string())),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
unimplemented!("Only objects are supported with style=deepObject")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Internal use only
|
||||||
|
/// A content type supported by this client.
|
||||||
|
#[allow(dead_code)]
|
||||||
|
enum ContentType {
|
||||||
|
Json,
|
||||||
|
Text,
|
||||||
|
Unsupported(String),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<&str> for ContentType {
|
||||||
|
fn from(content_type: &str) -> Self {
|
||||||
|
if content_type.starts_with("application") && content_type.contains("json") {
|
||||||
|
return Self::Json;
|
||||||
|
} else if content_type.starts_with("text/plain") {
|
||||||
|
return Self::Text;
|
||||||
|
} else {
|
||||||
|
return Self::Unsupported(content_type.to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub mod nginx_agent_api;
|
||||||
|
|
||||||
|
pub mod configuration;
|
||||||
|
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
pub trait Api {
|
||||||
|
fn nginx_agent_api(&self) -> &dyn nginx_agent_api::NginxAgentApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ApiClient {
|
||||||
|
nginx_agent_api: Box<dyn nginx_agent_api::NginxAgentApi>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ApiClient {
|
||||||
|
pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
|
||||||
|
Self {
|
||||||
|
nginx_agent_api: Box::new(nginx_agent_api::NginxAgentApiClient::new(
|
||||||
|
configuration.clone(),
|
||||||
|
)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Api for ApiClient {
|
||||||
|
fn nginx_agent_api(&self) -> &dyn nginx_agent_api::NginxAgentApi {
|
||||||
|
self.nginx_agent_api.as_ref()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "mockall")]
|
||||||
|
pub struct MockApiClient {
|
||||||
|
pub nginx_agent_api_mock: nginx_agent_api::MockNginxAgentApi,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "mockall")]
|
||||||
|
impl MockApiClient {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
nginx_agent_api_mock: nginx_agent_api::MockNginxAgentApi::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "mockall")]
|
||||||
|
impl Api for MockApiClient {
|
||||||
|
fn nginx_agent_api(&self) -> &dyn nginx_agent_api::NginxAgentApi {
|
||||||
|
&self.nginx_agent_api_mock
|
||||||
|
}
|
||||||
|
}
|
||||||
329
public/agent-client/src/apis/nginx_agent_api.rs
Normal file
329
public/agent-client/src/apis/nginx_agent_api.rs
Normal file
@@ -0,0 +1,329 @@
|
|||||||
|
/*
|
||||||
|
* yanpm-agent
|
||||||
|
*
|
||||||
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
*
|
||||||
|
* Generated by: https://openapi-generator.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
use super::{configuration, Error};
|
||||||
|
use crate::apis::ContentType;
|
||||||
|
use crate::{apis::ResponseContent, models};
|
||||||
|
use async_trait::async_trait;
|
||||||
|
#[cfg(feature = "mockall")]
|
||||||
|
use mockall::automock;
|
||||||
|
use reqwest;
|
||||||
|
use serde::{de::Error as _, Deserialize, Serialize};
|
||||||
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "mockall", automock)]
|
||||||
|
#[async_trait]
|
||||||
|
pub trait NginxAgentApi: Send + Sync {
|
||||||
|
/// GET /status
|
||||||
|
///
|
||||||
|
///
|
||||||
|
async fn status(&self) -> Result<ResponseContent<StatusSuccess>, Error<StatusError>>;
|
||||||
|
|
||||||
|
/// POST /validate
|
||||||
|
///
|
||||||
|
///
|
||||||
|
async fn validate(
|
||||||
|
&self,
|
||||||
|
params: ValidateParams,
|
||||||
|
) -> Result<ResponseContent<ValidateSuccess>, Error<ValidateError>>;
|
||||||
|
|
||||||
|
/// POST /validate_and_reload
|
||||||
|
///
|
||||||
|
///
|
||||||
|
async fn validate_and_reload(
|
||||||
|
&self,
|
||||||
|
params: ValidateAndReloadParams,
|
||||||
|
) -> Result<ResponseContent<ValidateAndReloadSuccess>, Error<ValidateAndReloadError>>;
|
||||||
|
|
||||||
|
/// POST /write_config
|
||||||
|
///
|
||||||
|
///
|
||||||
|
async fn write_config(
|
||||||
|
&self,
|
||||||
|
params: WriteConfigParams,
|
||||||
|
) -> Result<ResponseContent<WriteConfigSuccess>, Error<WriteConfigError>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct NginxAgentApiClient {
|
||||||
|
configuration: Arc<configuration::Configuration>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl NginxAgentApiClient {
|
||||||
|
pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
|
||||||
|
Self { configuration }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for passing parameters to the method [`NginxAgentApi::validate`]
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct ValidateParams {
|
||||||
|
pub validate_body: models::ValidateBody,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for passing parameters to the method [`NginxAgentApi::validate_and_reload`]
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct ValidateAndReloadParams {
|
||||||
|
pub validate_and_reload_body: models::ValidateAndReloadBody,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for passing parameters to the method [`NginxAgentApi::write_config`]
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct WriteConfigParams {
|
||||||
|
pub write_config_body: models::WriteConfigBody,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl NginxAgentApi for NginxAgentApiClient {
|
||||||
|
async fn status(&self) -> Result<ResponseContent<StatusSuccess>, Error<StatusError>> {
|
||||||
|
let local_var_configuration = &self.configuration;
|
||||||
|
|
||||||
|
let local_var_client = &local_var_configuration.client;
|
||||||
|
|
||||||
|
let local_var_uri_str = format!("{}/status", local_var_configuration.base_path);
|
||||||
|
let mut local_var_req_builder =
|
||||||
|
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
|
||||||
|
|
||||||
|
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
||||||
|
local_var_req_builder = local_var_req_builder
|
||||||
|
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
let local_var_req = local_var_req_builder.build()?;
|
||||||
|
let local_var_resp = local_var_client.execute(local_var_req).await?;
|
||||||
|
|
||||||
|
let local_var_status = local_var_resp.status();
|
||||||
|
let local_var_content = local_var_resp.text().await?;
|
||||||
|
|
||||||
|
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||||
|
let local_var_entity: Option<StatusSuccess> =
|
||||||
|
serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_result = ResponseContent {
|
||||||
|
status: local_var_status,
|
||||||
|
content: local_var_content,
|
||||||
|
entity: local_var_entity,
|
||||||
|
};
|
||||||
|
Ok(local_var_result)
|
||||||
|
} else {
|
||||||
|
let local_var_entity: Option<StatusError> =
|
||||||
|
serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_error = ResponseContent {
|
||||||
|
status: local_var_status,
|
||||||
|
content: local_var_content,
|
||||||
|
entity: local_var_entity,
|
||||||
|
};
|
||||||
|
Err(Error::ResponseError(local_var_error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn validate(
|
||||||
|
&self,
|
||||||
|
params: ValidateParams,
|
||||||
|
) -> Result<ResponseContent<ValidateSuccess>, Error<ValidateError>> {
|
||||||
|
let ValidateParams { validate_body } = params;
|
||||||
|
|
||||||
|
let local_var_configuration = &self.configuration;
|
||||||
|
|
||||||
|
let local_var_client = &local_var_configuration.client;
|
||||||
|
|
||||||
|
let local_var_uri_str = format!("{}/validate", local_var_configuration.base_path);
|
||||||
|
let mut local_var_req_builder =
|
||||||
|
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
|
||||||
|
|
||||||
|
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
||||||
|
local_var_req_builder = local_var_req_builder
|
||||||
|
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
||||||
|
}
|
||||||
|
local_var_req_builder = local_var_req_builder.json(&validate_body);
|
||||||
|
|
||||||
|
let local_var_req = local_var_req_builder.build()?;
|
||||||
|
let local_var_resp = local_var_client.execute(local_var_req).await?;
|
||||||
|
|
||||||
|
let local_var_status = local_var_resp.status();
|
||||||
|
let local_var_content = local_var_resp.text().await?;
|
||||||
|
|
||||||
|
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||||
|
let local_var_entity: Option<ValidateSuccess> =
|
||||||
|
serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_result = ResponseContent {
|
||||||
|
status: local_var_status,
|
||||||
|
content: local_var_content,
|
||||||
|
entity: local_var_entity,
|
||||||
|
};
|
||||||
|
Ok(local_var_result)
|
||||||
|
} else {
|
||||||
|
let local_var_entity: Option<ValidateError> =
|
||||||
|
serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_error = ResponseContent {
|
||||||
|
status: local_var_status,
|
||||||
|
content: local_var_content,
|
||||||
|
entity: local_var_entity,
|
||||||
|
};
|
||||||
|
Err(Error::ResponseError(local_var_error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn validate_and_reload(
|
||||||
|
&self,
|
||||||
|
params: ValidateAndReloadParams,
|
||||||
|
) -> Result<ResponseContent<ValidateAndReloadSuccess>, Error<ValidateAndReloadError>> {
|
||||||
|
let ValidateAndReloadParams {
|
||||||
|
validate_and_reload_body,
|
||||||
|
} = params;
|
||||||
|
|
||||||
|
let local_var_configuration = &self.configuration;
|
||||||
|
|
||||||
|
let local_var_client = &local_var_configuration.client;
|
||||||
|
|
||||||
|
let local_var_uri_str =
|
||||||
|
format!("{}/validate_and_reload", local_var_configuration.base_path);
|
||||||
|
let mut local_var_req_builder =
|
||||||
|
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
|
||||||
|
|
||||||
|
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
||||||
|
local_var_req_builder = local_var_req_builder
|
||||||
|
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
||||||
|
}
|
||||||
|
local_var_req_builder = local_var_req_builder.json(&validate_and_reload_body);
|
||||||
|
|
||||||
|
let local_var_req = local_var_req_builder.build()?;
|
||||||
|
let local_var_resp = local_var_client.execute(local_var_req).await?;
|
||||||
|
|
||||||
|
let local_var_status = local_var_resp.status();
|
||||||
|
let local_var_content = local_var_resp.text().await?;
|
||||||
|
|
||||||
|
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||||
|
let local_var_entity: Option<ValidateAndReloadSuccess> =
|
||||||
|
serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_result = ResponseContent {
|
||||||
|
status: local_var_status,
|
||||||
|
content: local_var_content,
|
||||||
|
entity: local_var_entity,
|
||||||
|
};
|
||||||
|
Ok(local_var_result)
|
||||||
|
} else {
|
||||||
|
let local_var_entity: Option<ValidateAndReloadError> =
|
||||||
|
serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_error = ResponseContent {
|
||||||
|
status: local_var_status,
|
||||||
|
content: local_var_content,
|
||||||
|
entity: local_var_entity,
|
||||||
|
};
|
||||||
|
Err(Error::ResponseError(local_var_error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn write_config(
|
||||||
|
&self,
|
||||||
|
params: WriteConfigParams,
|
||||||
|
) -> Result<ResponseContent<WriteConfigSuccess>, Error<WriteConfigError>> {
|
||||||
|
let WriteConfigParams { write_config_body } = params;
|
||||||
|
|
||||||
|
let local_var_configuration = &self.configuration;
|
||||||
|
|
||||||
|
let local_var_client = &local_var_configuration.client;
|
||||||
|
|
||||||
|
let local_var_uri_str = format!("{}/write_config", local_var_configuration.base_path);
|
||||||
|
let mut local_var_req_builder =
|
||||||
|
local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
|
||||||
|
|
||||||
|
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
||||||
|
local_var_req_builder = local_var_req_builder
|
||||||
|
.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
||||||
|
}
|
||||||
|
local_var_req_builder = local_var_req_builder.json(&write_config_body);
|
||||||
|
|
||||||
|
let local_var_req = local_var_req_builder.build()?;
|
||||||
|
let local_var_resp = local_var_client.execute(local_var_req).await?;
|
||||||
|
|
||||||
|
let local_var_status = local_var_resp.status();
|
||||||
|
let local_var_content = local_var_resp.text().await?;
|
||||||
|
|
||||||
|
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||||
|
let local_var_entity: Option<WriteConfigSuccess> =
|
||||||
|
serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_result = ResponseContent {
|
||||||
|
status: local_var_status,
|
||||||
|
content: local_var_content,
|
||||||
|
entity: local_var_entity,
|
||||||
|
};
|
||||||
|
Ok(local_var_result)
|
||||||
|
} else {
|
||||||
|
let local_var_entity: Option<WriteConfigError> =
|
||||||
|
serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_error = ResponseContent {
|
||||||
|
status: local_var_status,
|
||||||
|
content: local_var_content,
|
||||||
|
entity: local_var_entity,
|
||||||
|
};
|
||||||
|
Err(Error::ResponseError(local_var_error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed successes of method [`NginxAgentApi::status`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum StatusSuccess {
|
||||||
|
Status200(models::StatusResp),
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed successes of method [`NginxAgentApi::validate`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum ValidateSuccess {
|
||||||
|
Status200(serde_json::Value),
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed successes of method [`NginxAgentApi::validate_and_reload`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum ValidateAndReloadSuccess {
|
||||||
|
Status200(models::ValidateAndReloadResp),
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed successes of method [`NginxAgentApi::write_config`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum WriteConfigSuccess {
|
||||||
|
Status200(),
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed errors of method [`NginxAgentApi::status`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum StatusError {
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed errors of method [`NginxAgentApi::validate`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum ValidateError {
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed errors of method [`NginxAgentApi::validate_and_reload`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum ValidateAndReloadError {
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed errors of method [`NginxAgentApi::write_config`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum WriteConfigError {
|
||||||
|
Status500(serde_json::Value),
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
280
public/agent-client/src/apis/tag_nginxtag_api.rs
Normal file
280
public/agent-client/src/apis/tag_nginxtag_api.rs
Normal file
@@ -0,0 +1,280 @@
|
|||||||
|
/*
|
||||||
|
* yanpm-agent
|
||||||
|
*
|
||||||
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
*
|
||||||
|
* Generated by: https://openapi-generator.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
use async_trait::async_trait;
|
||||||
|
#[cfg(feature = "mockall")]
|
||||||
|
use mockall::automock;
|
||||||
|
use reqwest;
|
||||||
|
use std::sync::Arc;
|
||||||
|
use serde::{Deserialize, Serialize, de::Error as _};
|
||||||
|
use crate::{apis::ResponseContent, models};
|
||||||
|
use super::{Error, configuration};
|
||||||
|
use crate::apis::ContentType;
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "mockall", automock)]
|
||||||
|
#[async_trait]
|
||||||
|
pub trait TagNginxtagApi: Send + Sync {
|
||||||
|
|
||||||
|
/// GET /status
|
||||||
|
///
|
||||||
|
///
|
||||||
|
async fn status(&self, ) -> Result<ResponseContent<StatusSuccess>, Error<StatusError>>;
|
||||||
|
|
||||||
|
/// POST /validate
|
||||||
|
///
|
||||||
|
///
|
||||||
|
async fn validate(&self, params: ValidateParams ) -> Result<ResponseContent<ValidateSuccess>, Error<ValidateError>>;
|
||||||
|
|
||||||
|
/// POST /validate_and_reload
|
||||||
|
///
|
||||||
|
///
|
||||||
|
async fn validate_and_reload(&self, params: ValidateAndReloadParams ) -> Result<ResponseContent<ValidateAndReloadSuccess>, Error<ValidateAndReloadError>>;
|
||||||
|
|
||||||
|
/// POST /write_config
|
||||||
|
///
|
||||||
|
///
|
||||||
|
async fn write_config(&self, params: WriteConfigParams ) -> Result<ResponseContent<WriteConfigSuccess>, Error<WriteConfigError>>;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct TagNginxtagApiClient {
|
||||||
|
configuration: Arc<configuration::Configuration>
|
||||||
|
}
|
||||||
|
|
||||||
|
impl TagNginxtagApiClient {
|
||||||
|
pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
|
||||||
|
Self { configuration }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// struct for passing parameters to the method [`TagNginxtagApi::validate`]
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct ValidateParams {
|
||||||
|
pub validate_body: models::ValidateBody
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for passing parameters to the method [`TagNginxtagApi::validate_and_reload`]
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct ValidateAndReloadParams {
|
||||||
|
pub validate_and_reload_body: models::ValidateAndReloadBody
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for passing parameters to the method [`TagNginxtagApi::write_config`]
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct WriteConfigParams {
|
||||||
|
pub write_config_body: models::WriteConfigBody
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl TagNginxtagApi for TagNginxtagApiClient {
|
||||||
|
async fn status(&self, ) -> Result<ResponseContent<StatusSuccess>, Error<StatusError>> {
|
||||||
|
|
||||||
|
|
||||||
|
let local_var_configuration = &self.configuration;
|
||||||
|
|
||||||
|
let local_var_client = &local_var_configuration.client;
|
||||||
|
|
||||||
|
let local_var_uri_str = format!("{}/status", local_var_configuration.base_path);
|
||||||
|
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
|
||||||
|
|
||||||
|
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
||||||
|
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
||||||
|
}
|
||||||
|
|
||||||
|
let local_var_req = local_var_req_builder.build()?;
|
||||||
|
let local_var_resp = local_var_client.execute(local_var_req).await?;
|
||||||
|
|
||||||
|
let local_var_status = local_var_resp.status();
|
||||||
|
let local_var_content = local_var_resp.text().await?;
|
||||||
|
|
||||||
|
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||||
|
let local_var_entity: Option<StatusSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||||
|
Ok(local_var_result)
|
||||||
|
} else {
|
||||||
|
let local_var_entity: Option<StatusError> = serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||||
|
Err(Error::ResponseError(local_var_error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn validate(&self, params: ValidateParams ) -> Result<ResponseContent<ValidateSuccess>, Error<ValidateError>> {
|
||||||
|
|
||||||
|
let ValidateParams {
|
||||||
|
validate_body,
|
||||||
|
} = params;
|
||||||
|
|
||||||
|
|
||||||
|
let local_var_configuration = &self.configuration;
|
||||||
|
|
||||||
|
let local_var_client = &local_var_configuration.client;
|
||||||
|
|
||||||
|
let local_var_uri_str = format!("{}/validate", local_var_configuration.base_path);
|
||||||
|
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
|
||||||
|
|
||||||
|
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
||||||
|
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
||||||
|
}
|
||||||
|
local_var_req_builder = local_var_req_builder.json(&validate_body);
|
||||||
|
|
||||||
|
let local_var_req = local_var_req_builder.build()?;
|
||||||
|
let local_var_resp = local_var_client.execute(local_var_req).await?;
|
||||||
|
|
||||||
|
let local_var_status = local_var_resp.status();
|
||||||
|
let local_var_content = local_var_resp.text().await?;
|
||||||
|
|
||||||
|
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||||
|
let local_var_entity: Option<ValidateSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||||
|
Ok(local_var_result)
|
||||||
|
} else {
|
||||||
|
let local_var_entity: Option<ValidateError> = serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||||
|
Err(Error::ResponseError(local_var_error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn validate_and_reload(&self, params: ValidateAndReloadParams ) -> Result<ResponseContent<ValidateAndReloadSuccess>, Error<ValidateAndReloadError>> {
|
||||||
|
|
||||||
|
let ValidateAndReloadParams {
|
||||||
|
validate_and_reload_body,
|
||||||
|
} = params;
|
||||||
|
|
||||||
|
|
||||||
|
let local_var_configuration = &self.configuration;
|
||||||
|
|
||||||
|
let local_var_client = &local_var_configuration.client;
|
||||||
|
|
||||||
|
let local_var_uri_str = format!("{}/validate_and_reload", local_var_configuration.base_path);
|
||||||
|
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
|
||||||
|
|
||||||
|
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
||||||
|
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
||||||
|
}
|
||||||
|
local_var_req_builder = local_var_req_builder.json(&validate_and_reload_body);
|
||||||
|
|
||||||
|
let local_var_req = local_var_req_builder.build()?;
|
||||||
|
let local_var_resp = local_var_client.execute(local_var_req).await?;
|
||||||
|
|
||||||
|
let local_var_status = local_var_resp.status();
|
||||||
|
let local_var_content = local_var_resp.text().await?;
|
||||||
|
|
||||||
|
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||||
|
let local_var_entity: Option<ValidateAndReloadSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||||
|
Ok(local_var_result)
|
||||||
|
} else {
|
||||||
|
let local_var_entity: Option<ValidateAndReloadError> = serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||||
|
Err(Error::ResponseError(local_var_error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn write_config(&self, params: WriteConfigParams ) -> Result<ResponseContent<WriteConfigSuccess>, Error<WriteConfigError>> {
|
||||||
|
|
||||||
|
let WriteConfigParams {
|
||||||
|
write_config_body,
|
||||||
|
} = params;
|
||||||
|
|
||||||
|
|
||||||
|
let local_var_configuration = &self.configuration;
|
||||||
|
|
||||||
|
let local_var_client = &local_var_configuration.client;
|
||||||
|
|
||||||
|
let local_var_uri_str = format!("{}/write_config", local_var_configuration.base_path);
|
||||||
|
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
|
||||||
|
|
||||||
|
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
|
||||||
|
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
|
||||||
|
}
|
||||||
|
local_var_req_builder = local_var_req_builder.json(&write_config_body);
|
||||||
|
|
||||||
|
let local_var_req = local_var_req_builder.build()?;
|
||||||
|
let local_var_resp = local_var_client.execute(local_var_req).await?;
|
||||||
|
|
||||||
|
let local_var_status = local_var_resp.status();
|
||||||
|
let local_var_content = local_var_resp.text().await?;
|
||||||
|
|
||||||
|
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
|
||||||
|
let local_var_entity: Option<WriteConfigSuccess> = serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||||
|
Ok(local_var_result)
|
||||||
|
} else {
|
||||||
|
let local_var_entity: Option<WriteConfigError> = serde_json::from_str(&local_var_content).ok();
|
||||||
|
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
|
||||||
|
Err(Error::ResponseError(local_var_error))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed successes of method [`TagNginxtagApi::status`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum StatusSuccess {
|
||||||
|
Status200(models::StatusResp),
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed successes of method [`TagNginxtagApi::validate`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum ValidateSuccess {
|
||||||
|
Status200(serde_json::Value),
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed successes of method [`TagNginxtagApi::validate_and_reload`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum ValidateAndReloadSuccess {
|
||||||
|
Status200(models::ValidateAndReloadResp),
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed successes of method [`TagNginxtagApi::write_config`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum WriteConfigSuccess {
|
||||||
|
Status200(),
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed errors of method [`TagNginxtagApi::status`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum StatusError {
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed errors of method [`TagNginxtagApi::validate`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum ValidateError {
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed errors of method [`TagNginxtagApi::validate_and_reload`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum ValidateAndReloadError {
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
|
/// struct for typed errors of method [`TagNginxtagApi::write_config`]
|
||||||
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
#[serde(untagged)]
|
||||||
|
pub enum WriteConfigError {
|
||||||
|
Status500(serde_json::Value),
|
||||||
|
UnknownValue(serde_json::Value),
|
||||||
|
}
|
||||||
|
|
||||||
10
public/agent-client/src/lib.rs
Normal file
10
public/agent-client/src/lib.rs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#![allow(unused_imports)]
|
||||||
|
#![allow(clippy::too_many_arguments)]
|
||||||
|
|
||||||
|
extern crate serde;
|
||||||
|
extern crate serde_json;
|
||||||
|
extern crate serde_repr;
|
||||||
|
extern crate url;
|
||||||
|
|
||||||
|
pub mod apis;
|
||||||
|
pub mod models;
|
||||||
10
public/agent-client/src/models/mod.rs
Normal file
10
public/agent-client/src/models/mod.rs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
pub mod status_resp;
|
||||||
|
pub use self::status_resp::StatusResp;
|
||||||
|
pub mod validate_and_reload_body;
|
||||||
|
pub use self::validate_and_reload_body::ValidateAndReloadBody;
|
||||||
|
pub mod validate_and_reload_resp;
|
||||||
|
pub use self::validate_and_reload_resp::ValidateAndReloadResp;
|
||||||
|
pub mod validate_body;
|
||||||
|
pub use self::validate_body::ValidateBody;
|
||||||
|
pub mod write_config_body;
|
||||||
|
pub use self::write_config_body::WriteConfigBody;
|
||||||
24
public/agent-client/src/models/status_resp.rs
Normal file
24
public/agent-client/src/models/status_resp.rs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* yanpm-agent
|
||||||
|
*
|
||||||
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
*
|
||||||
|
* Generated by: https://openapi-generator.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
use crate::models;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct StatusResp {
|
||||||
|
#[serde(rename = "ok")]
|
||||||
|
pub ok: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl StatusResp {
|
||||||
|
pub fn new(ok: bool) -> StatusResp {
|
||||||
|
StatusResp { ok }
|
||||||
|
}
|
||||||
|
}
|
||||||
29
public/agent-client/src/models/validate_and_reload_body.rs
Normal file
29
public/agent-client/src/models/validate_and_reload_body.rs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* yanpm-agent
|
||||||
|
*
|
||||||
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
*
|
||||||
|
* Generated by: https://openapi-generator.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
use crate::models;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct ValidateAndReloadBody {
|
||||||
|
#[serde(rename = "config_name")]
|
||||||
|
pub config_name: String,
|
||||||
|
#[serde(rename = "timestamp")]
|
||||||
|
pub timestamp: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ValidateAndReloadBody {
|
||||||
|
pub fn new(config_name: String, timestamp: i64) -> ValidateAndReloadBody {
|
||||||
|
ValidateAndReloadBody {
|
||||||
|
config_name,
|
||||||
|
timestamp,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
26
public/agent-client/src/models/validate_and_reload_resp.rs
Normal file
26
public/agent-client/src/models/validate_and_reload_resp.rs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* yanpm-agent
|
||||||
|
*
|
||||||
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
*
|
||||||
|
* Generated by: https://openapi-generator.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
use crate::models;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct ValidateAndReloadResp {
|
||||||
|
#[serde(rename = "rc")]
|
||||||
|
pub rc: i32,
|
||||||
|
#[serde(rename = "ro")]
|
||||||
|
pub ro: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ValidateAndReloadResp {
|
||||||
|
pub fn new(rc: i32, ro: String) -> ValidateAndReloadResp {
|
||||||
|
ValidateAndReloadResp { rc, ro }
|
||||||
|
}
|
||||||
|
}
|
||||||
29
public/agent-client/src/models/validate_body.rs
Normal file
29
public/agent-client/src/models/validate_body.rs
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* yanpm-agent
|
||||||
|
*
|
||||||
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
*
|
||||||
|
* Generated by: https://openapi-generator.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
use crate::models;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct ValidateBody {
|
||||||
|
#[serde(rename = "config_name")]
|
||||||
|
pub config_name: String,
|
||||||
|
#[serde(rename = "timestamp")]
|
||||||
|
pub timestamp: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ValidateBody {
|
||||||
|
pub fn new(config_name: String, timestamp: i64) -> ValidateBody {
|
||||||
|
ValidateBody {
|
||||||
|
config_name,
|
||||||
|
timestamp,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
32
public/agent-client/src/models/write_config_body.rs
Normal file
32
public/agent-client/src/models/write_config_body.rs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* yanpm-agent
|
||||||
|
*
|
||||||
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||||
|
*
|
||||||
|
* The version of the OpenAPI document: 0.1.0
|
||||||
|
*
|
||||||
|
* Generated by: https://openapi-generator.tech
|
||||||
|
*/
|
||||||
|
|
||||||
|
use crate::models;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct WriteConfigBody {
|
||||||
|
#[serde(rename = "config_name")]
|
||||||
|
pub config_name: String,
|
||||||
|
#[serde(rename = "content")]
|
||||||
|
pub content: String,
|
||||||
|
#[serde(rename = "timestamp")]
|
||||||
|
pub timestamp: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl WriteConfigBody {
|
||||||
|
pub fn new(config_name: String, content: String, timestamp: i64) -> WriteConfigBody {
|
||||||
|
WriteConfigBody {
|
||||||
|
config_name,
|
||||||
|
content,
|
||||||
|
timestamp,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user